Skip to content

Commit

Permalink
Apply black formatter (#590)
Browse files Browse the repository at this point in the history
* Apply black formatter

* Add pre-commit install commands

* Revert "Add pre-commit install commands"

This reverts commit b260beb.

* Revert part of "Apply black formatter"

This reverts commit 724932f.

* Update README.rst

* ignore cge folders

* exclude cge folders

* update according to formatter

* Revert "update according to formatter"

This reverts commit 75ccc13.

* update formatter after team discussion

* reformatted according to the formatter

* I cannot removee e203, black keeps adding it back (#599)

* removed the error codes (#600)

Co-authored-by: Chen Wang <[email protected]>

* exclude docs; manual changes (#601)

Co-authored-by: Chen Wang <[email protected]>

* fix e731, e741, f401 and f403 (#598)

---------

Co-authored-by: Chen Wang <[email protected]>
Co-authored-by: Rashmil Panchani <[email protected]>
  • Loading branch information
3 people authored Jul 3, 2024
1 parent 4f91a29 commit 319b756
Show file tree
Hide file tree
Showing 259 changed files with 14,588 additions and 8,727 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 180
extend-ignore = E203
exclude = __init__.py
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
exclude: 'pyincore/analyses/(joplincge|saltlakecge|seasidecge|galvestoncge)/.*|docs/*'
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added
- Apply Black formatter [#589](https://github.com/IN-CORE/pyincore/issues/589)


## [1.19.0] - 2024-06-12

### Changed
Expand Down
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ Please use pip for installing pyincore at your discretion.
**Prerequisite**

* GDAL C library must be installed to install pyincore. (for Ubuntu, **gdal-bin** and **libgdal-dev**)
* ipopt executable must be installed to run some analyses such as seaside CGE, joplin CGE, etc.
* ipopt executable must be installed to run some analyses such as seaside CGE, joplin CGE, etc.
* For developers, pre-install must be installed. If not, run `brew install pre-commit` or `pip install pre-commit`.

To install **pyincore** package, run

Expand Down
98 changes: 49 additions & 49 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
import os
import sys

sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../..'))
sys.path.insert(0, os.path.abspath('../../pyincore'))
sys.path.insert(0, os.path.abspath('../../pyincore/analyses'))
sys.path.insert(0, os.path.abspath('../../tests'))
sys.path.insert(0, os.path.abspath('../../docs'))
sys.path.insert(0, os.path.abspath("."))
sys.path.insert(0, os.path.abspath("../.."))
sys.path.insert(0, os.path.abspath("../../pyincore"))
sys.path.insert(0, os.path.abspath("../../pyincore/analyses"))
sys.path.insert(0, os.path.abspath("../../tests"))
sys.path.insert(0, os.path.abspath("../../docs"))

# -- Project information -----------------------------------------------------

project = 'pyIncore'
author = ''
project = "pyIncore"
author = ""

# The short X.Y version
version = '1.19'
version = "1.19"
# The full version, including alpha/beta/rc tags
release = '1.19.0'
release = "1.19.0"

# -- General configuration ---------------------------------------------------

Expand All @@ -46,25 +46,26 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
# 'sphinx.ext.viewcode',
'sphinx_rtd_theme',
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon',
'sphinx.ext.todo'
]
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
# 'sphinx.ext.viewcode',
"sphinx_rtd_theme",
"sphinx.ext.ifconfig",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = '.rst'
source_suffix = ['.rst', '.md']
source_suffix = [".rst", ".md"]

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

# The language for content autogenerated by Sphinx. Refer to documentation.rst
# for a list of supported languages.
Expand All @@ -79,7 +80,7 @@
exclude_patterns = []

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

# -- Custom configuration ---------------------------------------------------

Expand All @@ -89,7 +90,7 @@
# See also:
# http://www.sphinx-doc.org/en/stable/ext/autodoc.html#confval-autodoc_mock_importshttps://github.com/sphinx-doc/sphinx/issues/4182

autodoc_mock_imports = ['pytest', 'rasterstats']
autodoc_mock_imports = ["pytest", "rasterstats"]

# This value selects what content will be inserted into the main body of an autoclass directive.
# The possible values are:
Expand All @@ -99,7 +100,7 @@
# “both”: Both the class ’ and the init method’s docstring are concatenated and inserted.
# “init”: Only the init method’s docstring is inserted.

autoclass_content = 'both'
autoclass_content = "both"

# -- Options for HTML output -------------------------------------------------

Expand All @@ -116,19 +117,19 @@
#
# html_theme_options = {}
html_theme_options = {
'canonical_url': '',
'analytics_id': '',
'logo_only': False,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,
'vcs_pageview_mode': '',
"canonical_url": "",
"analytics_id": "",
"logo_only": False,
"display_version": True,
"prev_next_buttons_location": "bottom",
"style_external_links": False,
"vcs_pageview_mode": "",
# Toc options
'collapse_navigation': True,
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False
"collapse_navigation": True,
"sticky_navigation": True,
"navigation_depth": 4,
"includehidden": True,
"titles_only": False,
}

# Add any paths that contain custom static files (such as style sheets) here,
Expand All @@ -150,7 +151,7 @@
# -- Options for HTMLHelp output ---------------------------------------------

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


# -- Options for LaTeX output ------------------------------------------------
Expand All @@ -159,15 +160,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

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

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -177,19 +175,15 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'pyincore.tex', 'pyincore Documentation',
'ISDA NCSA', 'manual'),
(master_doc, "pyincore.tex", "pyincore Documentation", "ISDA NCSA", "manual"),
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'pyincore', 'pyincore Documentation',
[author], 1)
]
man_pages = [(master_doc, "pyincore", "pyincore Documentation", [author], 1)]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand All @@ -201,9 +195,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'pyincore', 'pyincore Documentation',
author, 'pyincore', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"pyincore",
"pyincore Documentation",
author,
"pyincore",
"One line description of project.",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
Expand Down
10 changes: 8 additions & 2 deletions pyincore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@
from pyincore.models.mappingset import MappingSet
from pyincore.models.mapping import Mapping
from pyincore.models.networkdataset import NetworkDataset
from pyincore.models.hazard.hazarddataset import HazardDataset, HurricaneDataset, EarthquakeDataset, TsunamiDataset, \
TornadoDataset, FloodDataset
from pyincore.models.hazard.hazarddataset import (
HazardDataset,
HurricaneDataset,
EarthquakeDataset,
TsunamiDataset,
TornadoDataset,
FloodDataset,
)
from pyincore.models.hazard.hazard import Hazard
from pyincore.models.hazard.hurricane import Hurricane
from pyincore.models.hazard.flood import Flood
Expand Down
Loading

0 comments on commit 319b756

Please sign in to comment.