Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#35)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sorin Sbarnea <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and ssbarnea committed Jan 21, 2022
1 parent 339d328 commit 3531b7d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
23 changes: 13 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ repos:
rev: v0.11.0
hooks:
- id: markdownlint
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.4.2
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/python/black.git
rev: 20.8b1
- repo: https://github.com/psf/black
rev: 21.12b0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v3.2.0
rev: v4.1.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -23,8 +23,8 @@ repos:
- id: check-merge-conflict
- id: debug-statements
language_version: python3
- repo: https://gitlab.com/pycqa/flake8.git
rev: 3.8.3
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies:
Expand All @@ -34,14 +34,14 @@ repos:
- flake8-docstrings>=1.5.0
language_version: python3
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.24.2
rev: v1.26.3
hooks:
- id: yamllint
files: \.(yaml|yml)$
types: [file, yaml]
entry: yamllint --strict
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.782
rev: v0.931
hooks:
- id: mypy
# empty args needed in order to match mypy cli behavior
Expand All @@ -54,8 +54,11 @@ repos:
- enrich
- packaging
- pygithub
- types-requests
- types-PyYAML
- types-dataclasses
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.6.0
rev: v3.0.0a4
hooks:
- id: pylint
additional_dependencies:
Expand Down
22 changes: 11 additions & 11 deletions lib/gri/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@
from typing import List, Optional, Type, Union

import click
import yaml
from click_help_colors import HelpColorsGroup
from requests.exceptions import HTTPError
from rich import box
from rich.markdown import Markdown
from rich.table import Table

from gri.abc import Query, Review, Server
from gri.console import TERMINAL_THEME, bootstrap, get_logging_level
from gri.constants import RC_CONFIG_ERROR, RC_PARTIAL_RUN
from gri.gerrit import GerritServer
from gri.github import GithubServer
from requests.exceptions import HTTPError
from rich import box
from rich.markdown import Markdown
from rich.table import Table
from yaml import YAMLError, dump, safe_load

try:
from urllib.parse import urlparse
Expand Down Expand Up @@ -81,8 +80,8 @@ def load_config(self, config_file: str) -> dict:
config_file_full = config_file_full = os.path.expanduser(GERTTY_CFG_FILE)
try:
with open(config_file_full, "r") as stream:
return dict(yaml.safe_load(stream))
except (FileNotFoundError, yaml.YAMLError) as exc:
return dict(safe_load(stream))
except (FileNotFoundError, YAMLError) as exc:
LOG.error(exc)
sys.exit(RC_CONFIG_ERROR)

Expand Down Expand Up @@ -191,9 +190,10 @@ def report(
term.print(f"[dim]-- {cnt} changes listed {self.query_details}[/]")

def display_config(self) -> None:
msg = yaml.dump(
msg = dump(
dict(self.cfg), default_flow_style=False, tags=False, sort_keys=False
)
) # type: ignore

term.print(Markdown("```yaml\n# %s\n%s\n```" % (self.cfg.config_file, msg)))


Expand Down Expand Up @@ -266,7 +266,7 @@ def get_command(self, ctx: click.Context, cmd_name: str) -> Optional[click.Comma
"i": incoming,
}
try:
cmd_name = aliases[cmd_name].name
cmd_name = aliases[cmd_name].name or "undefined"
except KeyError:
pass
return super().get_command(ctx, cmd_name)
Expand Down
3 changes: 1 addition & 2 deletions lib/gri/gerrit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
from typing import Dict, List

import requests
from requests.auth import HTTPBasicAuth, HTTPDigestAuth

from gri.abc import Query, Review, Server
from gri.label import Label
from requests.auth import HTTPBasicAuth, HTTPDigestAuth

try:
from urllib.parse import urlencode, urlparse
Expand Down
3 changes: 1 addition & 2 deletions lib/gri/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import Dict, List

import github

from gri.abc import Query, Review, Server
from gri.label import Label

Expand Down Expand Up @@ -40,7 +39,7 @@ def query(self, query: Query, kind="review") -> List:
def mk_query(
self, query: Query, kind: str = "review"
) -> str: # pylint: disable=no-self-use
"""Return query string based on """
"""Return query string based on"""
# https://docs.github.com/en/free-pro-team@latest/github/searching-for-information-on-github/searching-issues-and-pull-requests
kind = "is:pr" if kind == "review" else "is:issue"

Expand Down

0 comments on commit 3531b7d

Please sign in to comment.