Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
rkishony committed May 22, 2024
1 parent 332f88d commit 1e27ba2
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 deletions.
1 change: 0 additions & 1 deletion install.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import contextlib
import subprocess
import sys
import os
import traceback
from pathlib import Path

Expand Down
6 changes: 4 additions & 2 deletions pyquibbler-documentations/convert_doc_notebooks_to_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def reformat_file(file: str):
os.system(r"sed -i '' -E 's/parsed-literal::/code:: none/g' " + file)

# [[CNN\|\http...]] -> `CNN <http...>`_
os.system(r"sed -i '' -E 's/\[\[([A-Z,a-z][-._ [:alnum:]]{1,100})\\\|\\ ([-.:<>/_ [:alnum:]]{1,100})\]\]/`\1 <\2>`_/g' " + file)
os.system(r"sed -i '' -E 's/\[\[([A-Z,a-z][-._ [:alnum:]]{1,100})\\\|\\ ([-.:<>/_ [:alnum:]]{1,100})\]\]"
r"/`\1 <\2>`_/g' " + file)

# [[Quib]] -> `~pyquibbler.Quib`
os.system(r"sed -i '' -E 's/\[\[Quib\]\]/:py:class:`~pyquibbler.Quib`/g' " + file)
Expand All @@ -31,7 +32,8 @@ def reformat_file(file: str):
os.system(r"sed -i '' -E 's/\[\[quibdemo([-_[:alnum:]]{1,100}\]\])/\[\[examples\/quibdemo\1/g' " + file)

# [[see this reference|reference]] -> :doc:`see this reference<reference>`
os.system(r"sed -i '' -E 's/\[\[([A-Z,a-z][-._ [:alnum:]]{1,100})\|([-.:<>/_ [:alnum:]]{1,100})\]\]/:doc:`\1<\2>`/g' " + file)
os.system(r"sed -i '' -E 's/\[\[([A-Z,a-z][-._ [:alnum:]]{1,100})\|([-.:<>/_ [:alnum:]]{1,100})\]\]"
r"/:doc:`\1<\2>`/g' " + file)

# [[reference]] -> :doc:`reference`
os.system(r"sed -i '' -E 's/\[\[([A-Z,a-z][-/_ [:alnum:]]{1,100})\]\]/:doc:`\1`/g' " + file)
Expand Down
1 change: 1 addition & 0 deletions pyquibbler-documentations/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@

# html_style = 'custom.css'


def setup(app):
app.add_css_file('custom.css')
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ def _jupyter_labextension_paths():
"src": "labextension",
"dest": data["name"]
}]

7 changes: 4 additions & 3 deletions pyquibbler-labextension/pyquibbler_labextension/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from pathlib import Path

__all__ = ["__version__"]
HERE = Path(__file__).parent.resolve()

def _fetchVersion():
HERE = Path(__file__).parent.resolve()

for settings in HERE.rglob("package.json"):
def _fetchVersion():
for settings in HERE.rglob("package.json"):
try:
with settings.open() as f:
version = json.load(f)["version"]
Expand All @@ -20,4 +20,5 @@ def _fetchVersion():

raise FileNotFoundError(f"Could not find package.json under dir {HERE!s}")


__version__ = _fetchVersion()
2 changes: 1 addition & 1 deletion pyquibbler-labextension/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
.replace("-alpha.", "a")
.replace("-beta.", "b")
.replace("-rc.", "rc")
)
)

setup_args = dict(
name=name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def create_or_reuse_func_definition(base_func_definition: Optional[FuncDefinitio
"""
raw_data_source_arguments = raw_data_source_arguments or []
data_argument_designations = convert_raw_data_arguments_to_data_argument_designations(raw_data_source_arguments)
if base_func_definition and (func_definition_cls is None or type(base_func_definition) == func_definition_cls):
if base_func_definition and (func_definition_cls is None or type(base_func_definition) is func_definition_cls):
# use base_func_definition as the default upon which to make changes:
bfd = base_func_definition
func_definition = type(bfd)(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class ArrayPathTranslator:

def _convert_an_arg_to_array_of_source_index_codes(self, arg: Any, path_to_source: Optional[Path] = None,
) -> IndexCodeArray:
arg_index_array, remaining_path_to_source, path_in_source_array, path_in_source_element,\
arg_index_array, remaining_path_to_source, path_in_source_array, path_in_source_element, \
is_extracting_element_out_of_source_array = \
convert_an_arg_to_array_of_source_index_codes(arg, self.focal_source, path_to_source, self.path_in_source)
if path_to_source is not None:
Expand Down

0 comments on commit 1e27ba2

Please sign in to comment.