Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

black #1073

Merged
merged 4 commits into from
Jul 4, 2024
Merged

black #1073

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
master_doc = "index"

# General information about the project.
project = u"regolith"
copyright = u"2015, Anthony Scopatz"
project = "regolith"
copyright = "2015, Anthony Scopatz"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -209,8 +209,8 @@
(
"index",
"regolith.tex",
u"Regolith Documentation",
u"Anthony Scopatz",
"Regolith Documentation",
"Anthony Scopatz",
"manual",
)
]
Expand Down Expand Up @@ -240,7 +240,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [("index", "regolith", u"regolith docs", [u"Anthony Scopatz"], 1)]
man_pages = [("index", "regolith", "regolith docs", ["Anthony Scopatz"], 1)]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand All @@ -255,8 +255,8 @@
(
"index",
"regolith",
u"regolith documentation",
u"Anthony Scopatz",
"regolith documentation",
"Anthony Scopatz",
"regolith",
"Research group managment software.",
"Miscellaneous",
Expand Down Expand Up @@ -307,9 +307,7 @@ def format_key(schema, key, indent_str=""):
if schema.get("schema", False):
s += "\n"
for inner_key in schema.get("schema", ()):
s += format_key(
schema["schema"], inner_key, indent_str=indent_str + "\t"
)
s += format_key(schema["schema"], inner_key, indent_str=indent_str + "\t")

return s

Expand Down Expand Up @@ -339,10 +337,7 @@ def build_schema_doc(key):
documents = {doc["_id"]: doc for doc in documents}
dump_json(temp.name, documents)
docs = sorted(documents.values(), key=_id_key)
lines = [
json.dumps(doc, sort_keys=True, indent=4, separators=(",", ": "))
for doc in docs
]
lines = [json.dumps(doc, sort_keys=True, indent=4, separators=(",", ": ")) for doc in docs]
jd = "\n".join(lines)
json_to_yaml(temp.name, temp2.name)
with open(temp2.name, "r") as ff:
Expand Down Expand Up @@ -404,9 +399,7 @@ def build_cli_doc(cli):


# build CLI docs
clis = sorted(
set(CONNECTED_COMMANDS.keys()) | set(DISCONNECTED_COMMANDS.keys())
)
clis = sorted(set(CONNECTED_COMMANDS.keys()) | set(DISCONNECTED_COMMANDS.keys()))
for cli in clis:
build_cli_doc(cli)

Expand Down
23 changes: 23 additions & 0 deletions news/black.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* all py files linted with black

**Security:**

* <news item>
2 changes: 1 addition & 1 deletion regolith/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
execer = XSH.execer
xonsh.imphooks.install_import_hooks(execer=execer)

__version__ = '0.8.2'
__version__ = "0.8.2"

del xonsh
19 changes: 7 additions & 12 deletions regolith/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Flask app for looking at information in regolith."""

import json
import traceback
import tempfile
Expand Down Expand Up @@ -57,19 +58,16 @@ def collection_page(dbname, collname):
except Exception:
td = tempfile.TemporaryDirectory()
n = os.path.join(td.name, "regolith.txt")
print(
"Error in json parsing writing text file to {}. "
"Please try again.".format(n)
)
with open(n, "w", encoding='utf-8') as f:
print("Error in json parsing writing text file to {}. " "Please try again.".format(n))
with open(n, "w", encoding="utf-8") as f:
f.write(form["body"])
traceback.print_exc()
raise
tv, errors = validate(dbname, body, rc.schemas)
if not tv:
td = tempfile.TemporaryDirectory()
n = os.path.join(td.name, "regolith.txt")
with open(n, "w", encoding='utf-8') as f:
with open(n, "w", encoding="utf-8") as f:
f.write(form["body"])
raise ValueError(
"Error while validating the record,"
Expand All @@ -90,19 +88,16 @@ def collection_page(dbname, collname):
except Exception:
td = tempfile.TemporaryDirectory()
n = os.path.join(td.name, "regolith.txt")
print(
"Error in json parsing writing text file to {}. "
"Please try again.".format(n)
)
with open(n, encoding='utf-8') as f:
print("Error in json parsing writing text file to {}. " "Please try again.".format(n))
with open(n, encoding="utf-8") as f:
f.write(form["body"])
traceback.print_exc()
raise
tv, errors = validate(dbname, body, rc.schemas)
if not tv:
td = tempfile.TemporaryDirectory()
n = os.path.join(td.name, "regolith.txt")
with open(n, encoding='utf-8') as f:
with open(n, encoding="utf-8") as f:
f.write(form["body"])
raise ValueError(
"Error while validating the record,"
Expand Down
3 changes: 2 additions & 1 deletion regolith/broker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API for accessing the metadata and file storage"""

import copy

from regolith.database import dump_database, open_dbs
Expand Down Expand Up @@ -66,7 +67,7 @@ def from_rc(cls, rc_file="regolithrc.json"):
return load_db(rc_file)

def get_file_path(self, document, name):
""" Get a file from the file storage associated with the document and
"""Get a file from the file storage associated with the document and
name

Parameters
Expand Down
2 changes: 1 addition & 1 deletion regolith/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"recent-collabs": RecentCollaboratorsBuilder,
"resume": ResumeBuilder,
"review-man": ManRevBuilder,
"review-prop": PropRevBuilder
"review-prop": PropRevBuilder,
}


Expand Down
Loading
Loading