Skip to content

Commit

Permalink
tidy some other scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
fgregg committed Sep 26, 2024
1 parent 105d339 commit bea210c
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 100 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
Expand All @@ -9,7 +9,7 @@ repos:
- id: isort
name: isort (python)
- repo: https://github.com/pycqa/flake8
rev: "7.1.0"
rev: "7.1.1"
hooks:
- id: flake8
args: [--config=.flake8]
51 changes: 29 additions & 22 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,29 @@
extensions = []

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'usaddress'
copyright = u'2014, Cathy Deng, Forest Gregg'
project = "usaddress"
copyright = "2014, Cathy Deng, Forest Gregg"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.5.4'
version = "0.5.4"
# The full version, including alpha/beta/rc tags.
release = '0.5.4'
release = "0.5.4"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -64,7 +64,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
exclude_patterns = ["_build"]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand All @@ -82,7 +82,7 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
Expand All @@ -95,7 +95,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = "default"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -124,7 +124,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down Expand Up @@ -173,18 +173,16 @@
# html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'usaddressdoc'
htmlhelp_basename = "usaddressdoc"


# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
# 'preamble': '',
}
Expand All @@ -193,8 +191,13 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'usaddress.tex', u'usaddress Documentation',
u'Cathy Deng, Forest Gregg', 'manual'),
(
"index",
"usaddress.tex",
"usaddress Documentation",
"Cathy Deng, Forest Gregg",
"manual",
),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -223,8 +226,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'usaddress', u'usaddress Documentation',
[u'Cathy Deng, Forest Gregg'], 1)
("index", "usaddress", "usaddress Documentation", ["Cathy Deng, Forest Gregg"], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -237,10 +239,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'usaddress', u'usaddress Documentation',
u'Cathy Deng, Forest Gregg', 'usaddress',
'One line description of project.',
'Miscellaneous'),
(
"index",
"usaddress",
"usaddress Documentation",
"Cathy Deng, Forest Gregg",
"usaddress",
"One line description of project.",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
Expand Down
28 changes: 17 additions & 11 deletions parse_scripts/import_osm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import requests
import codecs

import requests

query1 = """<union>
<query type="way">
<has-kv k="addr:housenumber"/>
Expand Down Expand Up @@ -46,11 +47,13 @@
</query>
</union>
<print/>""" % ((-70.000000, 50.000000, 25.000000, -125.000000) * 6)
r1 = requests.post('http://overpass-api.de/api/interpreter/', data=query1)
r1.encoding = 'utf-8'
<print/>""" % (
(-70.000000, 50.000000, 25.000000, -125.000000) * 6
)
r1 = requests.post("http://overpass-api.de/api/interpreter/", data=query1)
r1.encoding = "utf-8"

f = codecs.open('data/osm_data.xml', encoding='utf-8', mode='w+')
f = codecs.open("data/osm_data.xml", encoding="utf-8", mode="w+")
f.write(r1.text)


Expand All @@ -71,8 +74,9 @@
</query>
</union>
<print/>""" % ((-87.61309146881104, 41.890042371392965, 41.87234107841773,
-87.64235973358154) * 2)
<print/>""" % (
(-87.61309146881104, 41.890042371392965, 41.87234107841773, -87.64235973358154) * 2
)
# r2 = requests.post('http://overpass-api.de/api/interpreter/', data=query2)

# f = codecs.open("data/osm_data_street.xml", "wb", "utf-8")
Expand All @@ -92,11 +96,13 @@
</union>
<print/>
""" % ((-70.000000, 50.000000, 25.000000, -125.000000) * 2)
""" % (
(-70.000000, 50.000000, 25.000000, -125.000000) * 2
)

if __name__ == '__main__':
r3 = requests.post('http://overpass-api.de/api/interpreter/', data=query3)
if __name__ == "__main__":
r3 = requests.post("http://overpass-api.de/api/interpreter/", data=query3)

f = codecs.open("data/osm_data_full_addr.xml", "wb", "utf-8")
r3.encoding = 'utf-8'
r3.encoding = "utf-8"
f.write(r3.text)
Loading

0 comments on commit bea210c

Please sign in to comment.