Skip to content

Refactor distro.info() method to return an InfoDict#360

Merged
HorlogeSkynet merged 1 commit intopython-distro:masterfrom
scc-tw:master
Jun 4, 2023
Merged

Refactor distro.info() method to return an InfoDict#360
HorlogeSkynet merged 1 commit intopython-distro:masterfrom
scc-tw:master

Conversation

@scc-tw
Copy link
Contributor

@scc-tw scc-tw commented Jun 1, 2023

This commit modifies the distro.info() method in the distro.py file. The method now returns an InfoDict object instead of a regular dictionary. This change improves the consistency and readability of the codebase. The InfoDict object contains the distribution ID, version, and version parts. The change does not affect the functionality of the method.

@scc-tw
Copy link
Contributor Author

scc-tw commented Jun 1, 2023

This commit improves pylint from:

************* Module distro.distro
src/distro/distro.py:1:0: C0302: Too many lines in module (1403/1000) (too-many-lines)
src/distro/distro.py:203:0: W0622: Redefining built-in 'id' (redefined-builtin)
src/distro/distro.py:61:0: C0115: Missing class docstring (missing-class-docstring)
src/distro/distro.py:67:0: C0115: Missing class docstring (missing-class-docstring)
src/distro/distro.py:203:0: C0103: Function name "id" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:633:4: C0103: Class name "cached_property" doesn't conform to PascalCase naming style (invalid-name)
src/distro/distro.py:639:27: C0103: Argument name "f" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:633:4: R0903: Too few public methods (1/2) (too-few-public-methods)
src/distro/distro.py:649:0: R0902: Too many instance attributes (8/7) (too-many-instance-attributes)
src/distro/distro.py:667:4: R0913: Too many arguments (7/5) (too-many-arguments)
src/distro/distro.py:833:4: C0103: Method name "id" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:867:8: W0621: Redefining name 'name' from outer scope (line 287) (redefined-outer-name)
src/distro/distro.py:879:16: W0621: Redefining name 'version' from outer scope (line 326) (redefined-outer-name)
src/distro/distro.py:908:8: W0621: Redefining name 'version' from outer scope (line 326) (redefined-outer-name)
src/distro/distro.py:914:16: C0103: Variable name "v" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:918:16: C0103: Variable name "v" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:938:30: W0621: Redefining name 'build_number' from outer scope (line 417) (redefined-outer-name)
src/distro/distro.py:998:15: R1735: Consider using '{"id": self.id(), "version": self.version(pretty, best), "version_parts": dict(major=self.major_version(best), minor=self.minor_version(best), build_number=self.build_number(best)), ... }' instead of a call to 'dict'. (use-dict-literal)
src/distro/distro.py:1001:26: R1735: Consider using '{"major": self.major_version(best), "minor": self.minor_version(best), ... }' instead of a call to 'dict'. (use-dict-literal)
src/distro/distro.py:1131:19: C0103: Variable name "v" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:1188:12: C0103: Variable name "kv" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:1192:15: C0103: Variable name "v" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:1223:17: C0103: Variable name "fp" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:1235:12: W0621: Redefining name 'name' from outer scope (line 287) (redefined-outer-name)
src/distro/distro.py:1235:18: W0621: Redefining name 'version' from outer scope (line 326) (redefined-outer-name)
src/distro/distro.py:1323:53: C0103: Variable name "fp" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:1362:0: C0116: Missing function or method docstring (missing-function-docstring)


Your code has been rated at 9.21/10

To:

************* Module distro.distro
src/distro/distro.py:1:0: C0302: Too many lines in module (1403/1000) (too-many-lines)
src/distro/distro.py:203:0: W0622: Redefining built-in 'id' (redefined-builtin)
src/distro/distro.py:61:0: C0115: Missing class docstring (missing-class-docstring)
src/distro/distro.py:67:0: C0115: Missing class docstring (missing-class-docstring)
src/distro/distro.py:203:0: C0103: Function name "id" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:633:4: C0103: Class name "cached_property" doesn't conform to PascalCase naming style (invalid-name)
src/distro/distro.py:639:27: C0103: Argument name "f" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:633:4: R0903: Too few public methods (1/2) (too-few-public-methods)
src/distro/distro.py:649:0: R0902: Too many instance attributes (8/7) (too-many-instance-attributes)
src/distro/distro.py:667:4: R0913: Too many arguments (7/5) (too-many-arguments)
src/distro/distro.py:833:4: C0103: Method name "id" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:867:8: W0621: Redefining name 'name' from outer scope (line 287) (redefined-outer-name)
src/distro/distro.py:879:16: W0621: Redefining name 'version' from outer scope (line 326) (redefined-outer-name)
src/distro/distro.py:908:8: W0621: Redefining name 'version' from outer scope (line 326) (redefined-outer-name)
src/distro/distro.py:914:16: C0103: Variable name "v" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:918:16: C0103: Variable name "v" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:938:30: W0621: Redefining name 'build_number' from outer scope (line 417) (redefined-outer-name)
src/distro/distro.py:1001:26: R1735: Consider using '{"major": self.major_version(best), "minor": self.minor_version(best), ... }' instead of a call to 'dict'. (use-dict-literal)
src/distro/distro.py:1131:19: C0103: Variable name "v" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:1188:12: C0103: Variable name "kv" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:1192:15: C0103: Variable name "v" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:1223:17: C0103: Variable name "fp" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:1235:12: W0621: Redefining name 'name' from outer scope (line 287) (redefined-outer-name)
src/distro/distro.py:1235:18: W0621: Redefining name 'version' from outer scope (line 326) (redefined-outer-name)
src/distro/distro.py:1323:53: C0103: Variable name "fp" doesn't conform to snake_case naming style (invalid-name)
src/distro/distro.py:1362:0: C0116: Missing function or method docstring (missing-function-docstring)


Your code has been rated at 9.24/10

This commit modifies the `distro.info()` method in the `distro.py`
file. The method now returns an `InfoDict` object instead of a regular
dictionary. This change improves the consistency and readability of
the codebase. The `InfoDict` object contains the distribution ID,
version, and version parts. The change does not affect the
functionality of the method.
@HorlogeSkynet HorlogeSkynet merged commit 2804e55 into python-distro:master Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants