From e178797ad24a3b96a4e6109b6b0182ab6e67b067 Mon Sep 17 00:00:00 2001 From: psadi Date: Fri, 19 Apr 2024 17:43:48 +0530 Subject: [PATCH] fix(pr,repo): positional args no's corrected --- README.md | 11 ++--------- bb/__version__.py | 9 +++++---- bb/pr/copy.py | 4 +--- bb/repo/__init__.py | 8 ++++---- bb/repo/archive.py | 2 +- bb/repo/create.py | 2 +- bb/utils/request.py | 2 +- pdm.lock | 48 ++++++++++++++++++++++----------------------- 8 files changed, 39 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 5cb2bb1..ac380e2 100755 --- a/README.md +++ b/README.md @@ -1,16 +1,9 @@ -
- -

Bitbucket-CLI (bb)

-

Work seamlessly with Bitbucket from the command line

-
-
+## Bitbucket CLI (bb) +Work seamlessly with Bitbucket from the command line ![](https://img.shields.io/badge/license-MIT-green.svg?style=flat) [![Continuous Integration](https://github.com/psadi/bbcli/actions/workflows/ci.yml/badge.svg)](https://github.com/psadi/bbcli/actions/workflows/ci.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=psadi_bbcli&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=psadi_bbcli) - - - Buy Me A Coffee --- diff --git a/bb/__version__.py b/bb/__version__.py index 6f4f262..bfa7374 100755 --- a/bb/__version__.py +++ b/bb/__version__.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- """ - bb.__version__ - Sets the packge version, picked dynamically by - the utility and pyproject +bb.__version__ + Sets the packge version, picked dynamically by + the utility and pyproject """ -__version__ = "0.5.7" + +__version__ = "0.5.8" diff --git a/bb/pr/copy.py b/bb/pr/copy.py index 2ec7438..eb894a4 100755 --- a/bb/pr/copy.py +++ b/bb/pr/copy.py @@ -22,9 +22,7 @@ def copy_pull_request(_id: str) -> None: username, token, bitbucket_host = ini.parse() project, repository = cmnd.base_repo() url: str = request.get( - bitbucket_api.pull_request_info(bitbucket_host, project, repository, _id), - username, - token, + bitbucket_api.pull_request_info(project, repository, _id), )[1]["links"]["self"][0]["href"] cmnd.cp_to_clipboard(url) live.update(richprint.console.print("COPIED", style="bold green")) diff --git a/bb/repo/__init__.py b/bb/repo/__init__.py index cac133d..963f700 100755 --- a/bb/repo/__init__.py +++ b/bb/repo/__init__.py @@ -46,7 +46,7 @@ def delete( @error_handler def _delete(project, repo): project = validate_input(project, vars.project_name, vars.project_cant_be_none) - repo = validate_input(repo, vars.repoitory_name, vars.repo_cant_be_none) + repo = validate_input(repo, vars.repository_name, vars.repo_cant_be_none) delete_repository(project, repo) @@ -63,7 +63,7 @@ def archive( @error_handler def _archive(project, repo): project = validate_input(project, vars.project_name, vars.project_cant_be_none) - repo = validate_input(repo, vars.repoitory_name, vars.repo_cant_be_none) + repo = validate_input(repo, vars.repository_name, vars.repo_cant_be_none) archive_repository(project, repo, True) @@ -80,7 +80,7 @@ def unarchive( @error_handler def _unarchive(project, repo): project = validate_input(project, vars.project_name, vars.project_cant_be_none) - repo = validate_input(repo, vars.repoitory_name, vars.repo_cant_be_none) + repo = validate_input(repo, vars.repository_name, vars.repo_cant_be_none) archive_repository(project, repo, False) @@ -99,7 +99,7 @@ def create( @error_handler def _create(project, repo, forkable, default_branch): project = validate_input(project, vars.project_name, vars.project_cant_be_none) - repo = validate_input(repo, vars.repoitory_name, vars.repo_cant_be_none) + repo = validate_input(repo, vars.repository_name, vars.repo_cant_be_none) create_repository(project, repo, forkable, default_branch) diff --git a/bb/repo/archive.py b/bb/repo/archive.py index 83eb6cc..b78e60b 100755 --- a/bb/repo/archive.py +++ b/bb/repo/archive.py @@ -29,7 +29,7 @@ def archive_repository(project: str, repo: str, archive: bool) -> None: if request[0] == 200: live.update(console.print("DONE", style="bold green")) - if request[0] == 409: + if request[0] in (403, 409): live.update(console.print("CONFLICT", style="bold yellow")) console.print( f"Message: {request[1]['errors'][0]['message']}", diff --git a/bb/repo/create.py b/bb/repo/create.py index 7926e0e..9497c31 100755 --- a/bb/repo/create.py +++ b/bb/repo/create.py @@ -12,7 +12,7 @@ def create_repository( ) -> None: with live_progress(f"Creating '{project}/{repo}' Repository ... ") as live: request = post( - bitbucket_api.create_repo(project, repo), + bitbucket_api.create_repo(project), json.dumps( { "name": repo, diff --git a/bb/utils/request.py b/bb/utils/request.py index 00bfa14..739b9de 100755 --- a/bb/utils/request.py +++ b/bb/utils/request.py @@ -92,7 +92,7 @@ def put(url: str, body: dict) -> list[int, dict]: timeout=10.0, ) - if request.status_code not in (200, 409): + if request.status_code not in (200, 403, 409): raise ValueError( f"\n[{request.status_code}] {http_response_definitions(request.status_code)}" ) diff --git a/pdm.lock b/pdm.lock index 2b8c91e..31dc39a 100644 --- a/pdm.lock +++ b/pdm.lock @@ -238,14 +238,14 @@ files = [ [[package]] name = "exceptiongroup" -version = "1.2.0" +version = "1.2.1" requires_python = ">=3.7" summary = "Backport of PEP 654 (exception groups)" groups = ["default", "dev"] marker = "python_version < \"3.11\"" files = [ - {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, - {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, + {file = "exceptiongroup-1.2.1-py3-none-any.whl", hash = "sha256:5258b9ed329c5bbdd31a309f53cbfb0b155341807f6ff7606a1e801a891b29ad"}, + {file = "exceptiongroup-1.2.1.tar.gz", hash = "sha256:a4785e48b045528f5bfe627b6ad554ff32def154f42372786903b7abcfe1aa16"}, ] [[package]] @@ -520,28 +520,28 @@ files = [ [[package]] name = "ruff" -version = "0.3.7" +version = "0.4.0" requires_python = ">=3.7" summary = "An extremely fast Python linter and code formatter, written in Rust." groups = ["dev"] files = [ - {file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:0e8377cccb2f07abd25e84fc5b2cbe48eeb0fea9f1719cad7caedb061d70e5ce"}, - {file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:15a4d1cc1e64e556fa0d67bfd388fed416b7f3b26d5d1c3e7d192c897e39ba4b"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d28bdf3d7dc71dd46929fafeec98ba89b7c3550c3f0978e36389b5631b793663"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:379b67d4f49774ba679593b232dcd90d9e10f04d96e3c8ce4a28037ae473f7bb"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c060aea8ad5ef21cdfbbe05475ab5104ce7827b639a78dd55383a6e9895b7c51"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:ebf8f615dde968272d70502c083ebf963b6781aacd3079081e03b32adfe4d58a"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d48098bd8f5c38897b03604f5428901b65e3c97d40b3952e38637b5404b739a2"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:da8a4fda219bf9024692b1bc68c9cff4b80507879ada8769dc7e985755d662ea"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c44e0149f1d8b48c4d5c33d88c677a4aa22fd09b1683d6a7ff55b816b5d074f"}, - {file = "ruff-0.3.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3050ec0af72b709a62ecc2aca941b9cd479a7bf2b36cc4562f0033d688e44fa1"}, - {file = "ruff-0.3.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a29cc38e4c1ab00da18a3f6777f8b50099d73326981bb7d182e54a9a21bb4ff7"}, - {file = "ruff-0.3.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:5b15cc59c19edca917f51b1956637db47e200b0fc5e6e1878233d3a938384b0b"}, - {file = "ruff-0.3.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e491045781b1e38b72c91247cf4634f040f8d0cb3e6d3d64d38dcf43616650b4"}, - {file = "ruff-0.3.7-py3-none-win32.whl", hash = "sha256:bc931de87593d64fad3a22e201e55ad76271f1d5bfc44e1a1887edd0903c7d9f"}, - {file = "ruff-0.3.7-py3-none-win_amd64.whl", hash = "sha256:5ef0e501e1e39f35e03c2acb1d1238c595b8bb36cf7a170e7c1df1b73da00e74"}, - {file = "ruff-0.3.7-py3-none-win_arm64.whl", hash = "sha256:789e144f6dc7019d1f92a812891c645274ed08af6037d11fc65fcbc183b7d59f"}, - {file = "ruff-0.3.7.tar.gz", hash = "sha256:d5c1aebee5162c2226784800ae031f660c350e7a3402c4d1f8ea4e97e232e3ba"}, + {file = "ruff-0.4.0-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:70b8c620cf2212744eabd6d69c4f839f2be0d8880d27beaeb0adb6aa0b316aa8"}, + {file = "ruff-0.4.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:cfa3e3ff53be05a8c5570c1585ea1e089f6b399ca99fcb78598d4a8234f248db"}, + {file = "ruff-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5616cca501d1d16b932b7e607d7e1fd1b8c8c51d6ee484b7940fc1adc5bea541"}, + {file = "ruff-0.4.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:46eff08dd480b5d9b540846159fe134d70e3c45a3c913c600047cbf7f0e4e308"}, + {file = "ruff-0.4.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2d546f511431fff2b17adcf7110f3b2c2c0c8d33b0e10e5fd27fd340bc617efc"}, + {file = "ruff-0.4.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:c7b6b6b38e216036284c5779b6aa14acbf5664e3b5872533219cf93daf40ddfb"}, + {file = "ruff-0.4.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5e1cf8b064bb2a6b4922af7274fe2dffcb552d96ba716b2fbe5e2c970ed7de18"}, + {file = "ruff-0.4.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9911c9046b94253e1fa844c0192bb764b86866a881502dee324686474d498c17"}, + {file = "ruff-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4ca7a971c8f1a0b6f5ff4a819c0d1c2619536530bbd5a289af725d8b2ef1013d"}, + {file = "ruff-0.4.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:752e0f77f421141dd470a0b1bed4fd8f763aebabe32c80ed3580f740ef4ba807"}, + {file = "ruff-0.4.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:84f2a5dd8f33964d826c5377e094f7ce11e55e432cd42d3bf64efe4384224a03"}, + {file = "ruff-0.4.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:0b20e7db4a672495320a8a18149b7febf4e4f97509a4657367144569ce0915fd"}, + {file = "ruff-0.4.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:0b0eddd339e24dc4f7719b1cde4967f6b6bc0ad948cc183711ba8910f14aeafe"}, + {file = "ruff-0.4.0-py3-none-win32.whl", hash = "sha256:e70befd488271a2c28c80bd427f73d8855dd222fc549fa1e9967d287c5cfe781"}, + {file = "ruff-0.4.0-py3-none-win_amd64.whl", hash = "sha256:8584b9361900997ccf8d7aaa4dc4ab43e258a853ca7189d98ac929dc9ee50875"}, + {file = "ruff-0.4.0-py3-none-win_arm64.whl", hash = "sha256:fea4ec813c965e40af29ee627a1579ee1d827d77e81d54b85bdd7b42d1540cdd"}, + {file = "ruff-0.4.0.tar.gz", hash = "sha256:7457308d9ebf00d6a1c9a26aa755e477787a636c90b823f91cd7d4bea9e89260"}, ] [[package]] @@ -675,7 +675,7 @@ files = [ [[package]] name = "virtualenv" -version = "20.25.1" +version = "20.25.3" requires_python = ">=3.7" summary = "Virtual Python Environment builder" groups = ["dev"] @@ -685,6 +685,6 @@ dependencies = [ "platformdirs<5,>=3.9.1", ] files = [ - {file = "virtualenv-20.25.1-py3-none-any.whl", hash = "sha256:961c026ac520bac5f69acb8ea063e8a4f071bcc9457b9c1f28f6b085c511583a"}, - {file = "virtualenv-20.25.1.tar.gz", hash = "sha256:e08e13ecdca7a0bd53798f356d5831434afa5b07b93f0abdf0797b7a06ffe197"}, + {file = "virtualenv-20.25.3-py3-none-any.whl", hash = "sha256:8aac4332f2ea6ef519c648d0bc48a5b1d324994753519919bddbb1aff25a104e"}, + {file = "virtualenv-20.25.3.tar.gz", hash = "sha256:7bb554bbdfeaacc3349fa614ea5bff6ac300fc7c335e9facf3a3bcfc703f45be"}, ]