- Notifications
You must be signed in to change notification settings - Fork673
chore: convert to using relative imports#1728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Draft
JohnVillalovos wants to merge2 commits intomainChoose a base branch fromjlvillal/relative_imports
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Draft
Changes fromall commits
Commits
Show all changes
2 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
27 changes: 14 additions & 13 deletionsgitlab/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletionsgitlab/__main__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from .importcli | ||
nejch marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
if__name__=="__main__": | ||
cli.main() | ||
nejch marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. |
11 changes: 5 additions & 6 deletionsgitlab/base.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
22 changes: 13 additions & 9 deletionsgitlab/cli.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -27,8 +27,10 @@ | ||
from requests.structures import CaseInsensitiveDict | ||
from . import __version__ | ||
from . import config as gl_config | ||
from .base import RESTObject | ||
from .client import Gitlab | ||
# This regex is based on: | ||
# https://github.com/jpvanhal/inflection/blob/master/inflection/__init__.py | ||
@@ -246,10 +248,10 @@ def _get_base_parser(add_help: bool = True) -> argparse.ArgumentParser: | ||
def _get_parser() -> argparse.ArgumentParser: | ||
# NOTE: We must delay import of gitlab.v4.cli until now or | ||
# otherwise it will cause circular import errors | ||
from.v4 importcli | ||
parser = _get_base_parser() | ||
return cli.extend_parser(parser) | ||
JohnVillalovos marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
def _parse_value(v: Any) -> Any: | ||
@@ -279,7 +281,7 @@ def docs() -> argparse.ArgumentParser: # pragma: no cover | ||
def main() -> None: | ||
if "--version" in sys.argv: | ||
print(__version__) | ||
sys.exit(0) | ||
parser = _get_base_parser(add_help=False) | ||
@@ -289,8 +291,8 @@ def main() -> None: | ||
# any subparser setup | ||
(options, _) = parser.parse_known_args(sys.argv) | ||
try: | ||
config =gl_config.GitlabConfigParser(options.gitlab, options.config_file) | ||
exceptgl_config.ConfigError as e: | ||
if "--help" in sys.argv or "-h" in sys.argv: | ||
parser.print_help() | ||
sys.exit(0) | ||
@@ -346,7 +348,7 @@ def main() -> None: | ||
args_dict = {k: _parse_value(v) for k, v in args_dict.items() if v is not None} | ||
try: | ||
gl = Gitlab.merge_config(vars(options), gitlab_id, config_files) | ||
if gl.private_token or gl.oauth_token: | ||
gl.auth() | ||
except Exception as e: | ||
@@ -355,4 +357,6 @@ def main() -> None: | ||
if debug: | ||
gl.enable_debug() | ||
from .v4 import cli | ||
cli.run(gl, what, action, args_dict, verbose, output, fields) |
50 changes: 24 additions & 26 deletionsgitlab/client.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletiongitlab/config.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletiongitlab/const.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.