Skip to content

Commit

Permalink
lot of pep 8 and others
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco-Sulla committed Dec 31, 2023
1 parent 117fecd commit cbf9506
Show file tree
Hide file tree
Showing 17 changed files with 485 additions and 525 deletions.
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ assignees: ""
Welcome! Before you write your Feature Request, please read below:

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
A clear and concise description of what the problem is. Ex. I'm always
frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
A clear and concise description of any alternative solutions or
features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
24 changes: 18 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@
bug_url = "https://github.com/Marco-Sulla/python-frozendict/issues"
author = "Marco Sulla"
author_email = "[email protected]"
license = "LGPL v3"
license = "LGPL v3"
license_files = "LICENSE.txt"
description = "A simple immutable dictionary"
keywords = "immutable hashable picklable frozendict dict dictionary map Mapping MappingProxyType developers stable utility"

keywords = (
"immutable hashable picklable frozendict dict dictionary " +
"map Mapping MappingProxyType developers stable utility"
)

python_requires = ">=3.6"

classifiers = [
Expand Down Expand Up @@ -61,7 +66,10 @@
package_path_str = str(package_path)
packages = setuptools.find_packages(where = package_path_str)
package_data_filenames = (py_typed_filename, mypy_filename)
package_data = {package_name: package_data_filenames for package_name in packages}
package_data = {
package_name: package_data_filenames
for package_name in packages
}

# C extension - START

Expand Down Expand Up @@ -118,6 +126,7 @@
if argv_1_exists and argv[1] == "c_debug":
undef_macros = ["NDEBUG"]


def get_ext_module(
fullname,
sources,
Expand All @@ -137,6 +146,7 @@ def get_ext_module(

return ext_module


def get_ext_module_1(optional):
return get_ext_module(
fullname = ext1_fullname,
Expand All @@ -149,13 +159,14 @@ def get_ext_module_1(optional):

# C extension - END


common_setup_args = dict(
name = name,
author = author,
author_email = author_email,
version = version,
python_requires = python_requires,
license = license,
license = license,
license_files = (license_files, ),
url = main_url,

Expand Down Expand Up @@ -197,10 +208,11 @@ def get_ext_module_1(optional):
pure_py = pure_py_env == '1'

mix_c_py_error = ValueError(
"You can't specify the pure py implementation *and* C extension togheter"
"You can't specify the pure py implementation *and* C " +
"extension togheter"
)

if custom_arg == None:
if custom_arg is None:
if impl == "PyPy" or not c_src_path.exists():
custom_arg = "py"
else:
Expand Down
10 changes: 3 additions & 7 deletions src/frozendict/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,20 @@


def _getFrozendictJsonEncoder(BaseJsonEncoder = None):
if BaseJsonEncoder == None:
if BaseJsonEncoder is None:
from json.encoder import JSONEncoder


BaseJsonEncoder = JSONEncoder


class FrozendictJsonEncoder(BaseJsonEncoder):
class FrozendictJsonEncoderInternal(BaseJsonEncoder):
def default(self, obj):
if isinstance(obj, frozendict):
# TODO create a C serializer
return dict(obj)


return BaseJsonEncoder.default(self, obj)


return FrozendictJsonEncoder
return FrozendictJsonEncoderInternal


FrozendictJsonEncoder = _getFrozendictJsonEncoder()
Expand Down
2 changes: 1 addition & 1 deletion src/frozendict/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import TypeVar, overload, Optional
from typing import TypeVar, overload, Optional, Union

try:
from typing import Mapping, Iterable, Iterator, Tuple, Type
Expand Down
Loading

0 comments on commit cbf9506

Please sign in to comment.