Skip to content

Commit

Permalink
Merge pull request #316 from NREL-Sienna/jd/add_infos
Browse files Browse the repository at this point in the history
Jd/add infos
  • Loading branch information
jd-lara authored Dec 22, 2023
2 parents 43d40cc + deebdbc commit 2f8a2dc
Show file tree
Hide file tree
Showing 54 changed files with 2,408 additions and 1,562 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v2
- name: Install JuliaFormatter and format
run: |
julia -e 'include(".github/workflows/formatter/formatter_code.jl")'
julia -e 'include("scripts/formatter/formatter_code.jl")'
- uses: reviewdog/action-suggester@v1
if: github.event_name == 'pull_request'
with:
Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/formatter/formatter_code.jl

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/formatter/formatter_docs.jl

This file was deleted.

10 changes: 8 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TimeSeries = "9e3dc215-6440-5c97-bce1-76c03772f85e"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
Expand All @@ -38,6 +37,13 @@ Mustache = "1"
PrettyTables = "^1.3, 2"
StructTypes = "^1.9"
TerminalLoggers = "~0.1"
TimeSeries = "~0.22, 0.23"
TimeSeries = "0.23, 0.24"
YAML = "~0.4"
julia = "^1.6"
Dates = "1"
InteractiveUtils = "1"
Logging = "1"
Pkg = "1"
Random = "1"
TOML = "1"
UUIDs = "1"
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[compat]
JuliaFormatter = "v0.22.7"
julia = "^1.2"
JuliaFormatter = "1.0"
julia = "^1.7"
28 changes: 28 additions & 0 deletions scripts/formatter/formatter_code.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Pkg
Pkg.activate(@__DIR__)
Pkg.instantiate()
Pkg.update()

using JuliaFormatter

main_paths = ["./src", "./test"]
for main_path in main_paths
for (root, dir, files) in walkdir(main_path)
for f in files
@show file_path = abspath(root, f)
!occursin(".jl", f) && continue
format(file_path;
whitespace_ops_in_indices = true,
remove_extra_newlines = true,
verbose = true,
always_for_in = true,
whitespace_typedefs = true,
conditional_to_if = true,
join_lines_based_on_source = true,
separate_kwargs_with_semicolon = true,

# always_use_return = true. # Disabled since it throws a lot of false positives
)
end
end
end
27 changes: 26 additions & 1 deletion src/InfrastructureSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Required interface functions for subtypes:
Optional interface functions:
- get_time_series_container()
- get_supplemental_attributes_container()
Subtypes may contain time series.
"""
Expand All @@ -53,6 +54,25 @@ Base type for auxillary structs. These should not be stored in a system.
"""
abstract type DeviceParameter <: InfrastructureSystemsType end

"""
Base type for structs that store supplemental attributes
Required interface functions for subtypes:
- get_internal()
Optional interface functions:
- get_time_series_container()
- get_component_uuids()
- get_uuid()
Subtypes may contain time series. Which requires
- get_time_series_container()
"""
abstract type InfrastructureSystemsSupplementalAttribute <: InfrastructureSystemsType end

"""
Return the internal time_series storage container or nothing, if the type doesn't store
time series.
Expand All @@ -63,7 +83,7 @@ function get_time_series_container(value::InfrastructureSystemsComponent)
return nothing
end

set_time_series_container!(value::InfrastructureSystemsComponent) = nothing
set_time_series_container!(value::InfrastructureSystemsComponent, _) = nothing

get_name(value::InfrastructureSystemsComponent) = value.name

Expand Down Expand Up @@ -92,7 +112,11 @@ include("forecasts.jl")
include("static_time_series.jl")
include("time_series_container.jl")
include("time_series_parser.jl")
include("containers.jl")
include("supplemental_attribute.jl")
include("supplemental_attributes.jl")
include("components.jl")
include("geographic_supplemental_attribute.jl")
include("generated/includes.jl")
include("single_time_series.jl")
include("deterministic_single_time_series.jl")
Expand All @@ -110,6 +134,7 @@ include("component.jl")
include("results.jl")
include("serialization.jl")
include("system_data.jl")
include("time_series_interface.jl")
include("validation.jl")
include("utils/print.jl")
include("utils/test.jl")
Expand Down
Loading

0 comments on commit 2f8a2dc

Please sign in to comment.