Skip to content

Commit

Permalink
Format with black
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier committed Jun 4, 2024
1 parent a49c7e2 commit 661e839
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions data_tests/test_packaging/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A pure Python module containing a few functions"""

import numpy as np


Expand Down
6 changes: 3 additions & 3 deletions src/transonic/analyses/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,9 @@ def analyse_aot(code, pathfile):
annotations["__locals__"][name_func] = annotations_locals

if fdef.returns:
annotations["__returns__"][
name_func
] = extract_returns_annotation(fdef.returns, namespace)
annotations["__returns__"][name_func] = (
extract_returns_annotation(fdef.returns, namespace)
)

for signatures in annotations["__in_comments__"].values():
replace_strings_by_objects(signatures, module, ancestors, udc, duc)
Expand Down
1 change: 1 addition & 0 deletions src/transonic/analyses/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
=============================
"""

import re
from pathlib import Path
from textwrap import dedent
Expand Down
1 change: 1 addition & 0 deletions src/transonic/backends/cython.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
:private-members:
"""

import copy
import inspect

Expand Down
3 changes: 2 additions & 1 deletion src/transonic/backends/jax.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def add_jax_comments(code):
# Replace `import numpy as np` -> `import jax.numpy as np`
if isinstance(node, gast.Import):
if (alias := node.names[0]).name == "numpy":
node = gast.Import([gast.alias(name="jax.numpy", asname=alias.asname or alias.name)])
g_alias = gast.alias(name="jax.numpy", asname=alias.asname or alias.name)
node = gast.Import([g_alias])

# Replace `from numpy import eye` -> `from jax.numpy import eye`
elif isinstance(node, gast.ImportFrom):
Expand Down
1 change: 1 addition & 0 deletions src/transonic/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
path_root = Path(os.environ.get("TRANSONIC_DIR", Path.home() / ".transonic"))
SUPPORTED_BACKENDS = frozenset(("pythran", "cython", "jax", "numba", "python"))


def strtobool(value):
"""Convert a string representation of truth to true (1) or false (0).
Expand Down
1 change: 1 addition & 0 deletions src/transonic/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
logging messages.
"""

from transonic.log import logger


Expand Down
1 change: 1 addition & 0 deletions src/transonic/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
:private-members:
"""

import re
from enum import Enum, auto
import itertools
Expand Down
5 changes: 2 additions & 3 deletions src/transonic_cl/init_meson.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def process_directory(path_dir, path_pack=None):
if path_pack is None:
path_pack = path_dir
print(f"Process {path_dir}")
subdir=path_pack.name
subdir = path_pack.name
else:
subdir=PurePosixPath(path_dir.relative_to(path_pack.parent))
subdir = PurePosixPath(path_dir.relative_to(path_pack.parent))
print(f"Process subdir {subdir}")

names_py = sorted(path.name for path in path_dir.glob("*.py"))
Expand Down Expand Up @@ -77,4 +77,3 @@ def main():
sys.exit(1)

process_directory(path_pack)

0 comments on commit 661e839

Please sign in to comment.