From 4ca9419c8469c980593d167644dc9aee159119d2 Mon Sep 17 00:00:00 2001 From: Tamer Sherif Date: Fri, 1 Nov 2019 14:08:17 -0400 Subject: [PATCH 1/2] added additional methods --- .idea/inspectionProfiles/profiles_settings.xml | 6 ++++++ .idea/misc.xml | 4 ++++ .idea/modules.xml | 8 ++++++++ .idea/shopify_python.iml | 11 +++++++++++ .idea/vcs.xml | 6 ++++++ .idea/workspace.xml | 10 ++++++++++ shopify_python/git_utils.py | 15 ++++++++++++++- 7 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/shopify_python.iml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..a2e120d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..86b4a4f --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/shopify_python.iml b/.idea/shopify_python.iml new file mode 100644 index 0000000..6711606 --- /dev/null +++ b/.idea/shopify_python.iml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..5a3031e --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/shopify_python/git_utils.py b/shopify_python/git_utils.py index ce4b122..586df04 100644 --- a/shopify_python/git_utils.py +++ b/shopify_python/git_utils.py @@ -51,7 +51,6 @@ def _file_is_python(path): def changed_python_files_in_tree(root_path): # type: (str) -> typing.List[str] - git_repo = repo.Repo(root_path) remote_master = _remote_origin_master(git_repo) modified = _modified_in_branch(git_repo, remote_master) @@ -60,6 +59,20 @@ def changed_python_files_in_tree(root_path): if os.path.exists(abs_mod) and os.path.isfile(abs_mod) and _file_is_python(abs_mod)] +def uncommitted_python_files(root_path): + # type: (str) -> typing.FrozenSet[str] + git_repo = repo.Repo(root_path) + unstaged_files = [file.a_path for file in git_repo.index.diff(None) if _file_is_python(file.a_path)] + staged_files = [file.a_path for file in git_repo.index.diff('HEAD') if _file_is_python(file.a_path)] + return frozenset(unstaged_files + staged_files) + + +def untracked_python_files(root_path): + # type: (str) -> typing.List[str] + git_repo = repo.Repo(root_path) + return [item for item in git_repo.untracked_files if _file_is_python(item)] + + # Options are defined here: https://pypi.python.org/pypi/autopep8#usage _AutopepOptions = typing.NamedTuple('_AutopepOptions', [ # pylint: disable=global-variable,invalid-name ('aggressive', int), From 92618d7bcc05218e6490bfcab4def4584047c647 Mon Sep 17 00:00:00 2001 From: Tamer Sherif Date: Fri, 1 Nov 2019 14:09:49 -0400 Subject: [PATCH 2/2] added additional methods --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index d52e479..57f3397 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ *.py[cod] *.egg-info .DS_Store +# ignore pycharm config files +.idea .cache build/ dist/