Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
Use inspect instead of dir for listing methods (#24)
Browse files Browse the repository at this point in the history
* Use inspect instead of dir for listing method
  • Loading branch information
mpcusack-color authored Jun 15, 2021
1 parent 8f8aae9 commit 70506d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions clr/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def _load_namespace(key):
# Prefer doc string, otherwise explicit .longdescr, otherwise .descr
longdescr = inspect.getdoc(instance) or getattr(instance, "longdescr", descr)
command_callables = {
attribute_name[4:]: getattr(instance, attribute_name)
for attribute_name in dir(instance)
if attribute_name.startswith("cmd_")
method_name[4:]: method
for method_name, method in inspect.getmembers(self, inspect.ismethod)
if method_name.startswith("cmd_")
}
# Build CommandSpecs for each command. These contain metadata about the
# command and its args. These are kept in a seperate dataclass from the
Expand Down
10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@

setup(
name="clr",
version="0.3.4",
version="0.3.5",
description="A command line tool for executing custom python scripts.",
author="Color",
author_email="dev@getcolor.com",
url="/~https://github.com/color/clr",
packages=["clr"],
entry_points={"console_scripts": ["clr = clr:main"],},
entry_points={
"console_scripts": ["clr = clr:main"],
},
install_requires=requirements,
setup_requires=["pytest-runner"],
tests_require=requirements + ["pytest==6.2.4"],
license="MIT",
include_package_data=True,
package_data={"": ["completion.*"],},
package_data={
"": ["completion.*"],
},
)

0 comments on commit 70506d7

Please sign in to comment.