Skip to content

Commit

Permalink
Merge pull request #219 from Open-Telecoms-Data/2022-12-07-fix-precommit
Browse files Browse the repository at this point in the history
2022 12 07 fix precommit
  • Loading branch information
odscjames authored Dec 7, 2022
2 parents 28fe876 + e759015 commit 35fe65d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/csv/contracts.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
id,contracts/0/id,contracts/0/title,contracts/0/description,contracts/0/type,contracts/0/value/amount,contracts/0/value/currency,contracts/0/dateSigned
a096d627-72e1-4f9b-b129-951b1737bff4,1,NextGen Phase 1 Construction Contract,Contract for the construction of phase 1 of the NextGen network.,private,1537459500.0,GHS,2016-06-30
a096d627-72e1-4f9b-b129-951b1737bff4,1,NextGen Phase 1 Construction Contract,Contract for the construction of phase 1 of the NextGen network.,private,1537459500.00,GHS,2016-06-30
2 changes: 1 addition & 1 deletion examples/csv/spans.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
id,spans/0/id,spans/0/name,spans/0/phase/id,spans/0/phase/name,spans/0/status,spans/0/readyForServiceDate,spans/0/start,spans/0/end,spans/0/directed,spans/0/route/type,spans/0/route/coordinates,spans/0/physicalInfrastructureProvider/id,spans/0/physicalInfrastructureProvider/name,spans/0/networkProvider/id,spans/0/networkProvider/name,spans/0/supplier/id,spans/0/supplier/name,spans/0/transmissionMedium,spans/0/deployment,spans/0/deploymentDetails/description,spans/0/darkFibre,spans/0/fibreType,spans/0/fibreTypeDetails/fibreSubtype,spans/0/fibreTypeDetails/description,spans/0/fibreCount,spans/0/fibreLength,spans/0/technologies,spans/0/capacity,spans/0/capacityDetails/description,spans/0/countries
a096d627-72e1-4f9b-b129-951b1737bff4,1,Accra to Kumasi,1,NextGen Phase 1,operational,2018-01-01,1,2,False,LineString,"-0.173,5.626;-0.178,5.807;-0.112,5.971;-0.211,5.963;-0.321,6.17;-0.488,6.29;-0.56,6.421;-0.752,6.533;-0.867,6.607;-1.101,6.585;-1.304,6.623;-1.461,6.727;-1.628,6.713",GH-RGD-CS111111111,FibreCo,GH-RGD-CS222222222,FastWeb,GH-RGD-CS333333333,ProjectCo,fibre,belowGround,Buried in ducts,True,G.652,G.652.D,"CABLED STANDARD ENHANCED SINGLEMODE FIBRE ESMF, LOW WATER PEAK SINGLE MODE FIBRE G.652.D, OS2",24,276000,sdh,4.976,2xSTM-16,GH
a096d627-72e1-4f9b-b129-951b1737bff4,1,Accra to Kumasi,1,NextGen Phase 1,operational,2018-01-01,1,2,False,LineString,"-0.173,5.626;-0.178,5.807;-0.112,5.971;-0.211,5.963;-0.321,6.170;-0.488,6.290;-0.560,6.421;-0.752,6.533;-0.867,6.607;-1.101,6.585;-1.304,6.623;-1.461,6.727;-1.628,6.713",GH-RGD-CS111111111,FibreCo,GH-RGD-CS222222222,FastWeb,GH-RGD-CS333333333,ProjectCo,fibre,belowGround,Buried in ducts,True,G.652,G.652.D,"CABLED STANDARD ENHANCED SINGLEMODE FIBRE ESMF, LOW WATER PEAK SINGLE MODE FIBRE G.652.D, OS2",24,276000,sdh,4.976,2xSTM-16,GH
20 changes: 11 additions & 9 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def get_codelist_references(schema, codelist, parents=None, network_schema=None)
def generate_codelist_markdown(codelist, type, references, definitions):
"""Generate reference markdown for codelist"""

markdown = ["This codelist is referenced by the following properties:\n"]
markdown = ["This codelist is referenced by the following properties:\n\n"]

for ref in references:
# Remove array indices because they do not appear in the HTML anchors generated by the json schema directive
Expand All @@ -343,7 +343,7 @@ def generate_codelist_markdown(codelist, type, references, definitions):
continue

url += ','.join(ref)
markdown.append(f"* [`{'/'.join(ref)}`]({url})\n")
markdown.append(f"- [`{'/'.join(ref)}`]({url})\n")

markdown.extend([
"\nThis codelist has the following codes:\n\n"
Expand Down Expand Up @@ -480,7 +480,7 @@ def update_schema_docs(schema):

# Add a list of properties that reference this definition
definition["references"] = get_definition_references(schema, defn)
definition["content"].append("This component is referenced by the following properties:\n")
definition["content"].append("This component is referenced by the following properties:\n\n")

for ref in definition["references"]:
# Remove array indices because they do not appear in the HTML anchors generated by the json schema directive
Expand All @@ -498,7 +498,7 @@ def update_schema_docs(schema):
continue

url += ','.join(ref)
definition["content"].append(f"* [`{'/'.join(ref)}`]({url})\n")
definition["content"].append(f"- [`{'/'.join(ref)}`]({url})\n")

# Add schema table
definition["content"].extend([
Expand Down Expand Up @@ -699,7 +699,7 @@ def update_from_airtable():
subdir = "open"

with open(codelistdir / subdir / filename, 'w', newline='') as f:
fieldnames = ['code', 'title', 'description']
fieldnames = ['Code', 'Title', 'Description']
writer = csv.DictWriter(f, fieldnames=fieldnames)
writer.writeheader()

Expand Down Expand Up @@ -738,8 +738,8 @@ def pre_commit():
# Generate network-schema.csv
schema_table = mapping_sheet(schema, include_codelist=True, include_definitions=True)

with (schemadir / 'network-schema.csv').open('w') as f:
writer = csv.DictWriter(f, fieldnames=schema_table[0])
with (schemadir / 'network-schema.csv').open('w', newline='') as f:
writer = csv.DictWriter(f, fieldnames=schema_table[0], lineterminator='\n')

writer.writeheader()
for row in schema_table[1]:
Expand All @@ -754,7 +754,8 @@ def pre_commit():
output_format='csv',
main_sheet_name="networks",
truncation_length=9,
root_list_path='networks'
root_list_path='networks',
line_terminator='LF',
)

# Update examples/csv/template
Expand All @@ -764,7 +765,8 @@ def pre_commit():
output_format="csv",
main_sheet_name="networks",
truncation_length=9,
no_deprecated_fields=True
no_deprecated_fields=True,
line_terminator='LF',
)

# Update docs/reference/publication_formats/csv.md
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ PyGithub
ocdskit
sphinx-design
libcoveofds
flattentool
flattentool>=0.20
pytest
jscc
mdformat
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ exceptiongroup==1.0.0rc9
# via
# cattrs
# pytest
flattentool==0.19.0
flattentool==0.20.0
# via -r requirements.in
gitdb==4.0.9
# via gitpython
Expand Down

0 comments on commit 35fe65d

Please sign in to comment.