Skip to content

Commit

Permalink
Format with black
Browse files Browse the repository at this point in the history
  • Loading branch information
ethho committed Mar 21, 2024
1 parent a9470b5 commit 1cbfa45
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions datajoint/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def declare(self, context=None):
raise DataJointError(
"Table with class name `{name}` contains an underscore. ".format(
name=self.class_name
) +
"Classes defining tables should be formatted in strict CamelCase."
)
+ "Classes defining tables should be formatted in strict CamelCase."
)
sql, external_stores = declare(self.full_table_name, self.definition, context)
sql = sql.format(database=self.database)
Expand Down
4 changes: 3 additions & 1 deletion datajoint/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def is_camel_case(s):
>>> is_camel_case("table_name") # returns False
"""
# return re.match(r"^[A-Z][a-z0-9]+(?:[A-Z][a-z0-9]+)*$", s) is not None
return re.match(r"[A-Z][a-zA-Z0-9]*", s) is not None and not contains_non_ascii_char(s)
return re.match(
r"[A-Z][a-zA-Z0-9]*", s
) is not None and not contains_non_ascii_char(s)


def to_camel_case(s):
Expand Down
1 change: 0 additions & 1 deletion tests/test_declare.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,3 @@ class Table_With_Underscores(dj.Manual):
schema_any(TableNoUnderscores)
with pytest.raises(dj.DataJointError, match="strict CamelCase") as e:
schema_any(Table_With_Underscores)

7 changes: 6 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
"""

from datajoint import DataJointError
from datajoint.utils import from_camel_case, to_camel_case, is_camel_case, contains_non_ascii_char
from datajoint.utils import (
from_camel_case,
to_camel_case,
is_camel_case,
contains_non_ascii_char,
)
import pytest


Expand Down

0 comments on commit 1cbfa45

Please sign in to comment.