Skip to content

Commit

Permalink
Merge pull request #1331 from JohnVillalovos/jlvillal/mypy_config
Browse files Browse the repository at this point in the history
chore: add type-hints to gitlab/config.py
  • Loading branch information
max-wittig committed Feb 25, 2021
2 parents 665c0c3 + 213e563 commit d207074
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions gitlab/config.py
Expand Up @@ -17,17 +17,18 @@

import os
import configparser
from typing import List, Optional, Union

from gitlab.const import USER_AGENT


def _env_config():
def _env_config() -> List[str]:
if "PYTHON_GITLAB_CFG" in os.environ:
return [os.environ["PYTHON_GITLAB_CFG"]]
return []


_DEFAULT_FILES = _env_config() + [
_DEFAULT_FILES: List[str] = _env_config() + [
"/etc/python-gitlab.cfg",
os.path.expanduser("~/.python-gitlab.cfg"),
]
Expand All @@ -50,7 +51,9 @@ class GitlabConfigMissingError(ConfigError):


class GitlabConfigParser(object):
def __init__(self, gitlab_id=None, config_files=None):
def __init__(
self, gitlab_id: Optional[str] = None, config_files: Optional[List[str]] = None
) -> None:
self.gitlab_id = gitlab_id
_files = config_files or _DEFAULT_FILES
file_exist = False
Expand Down Expand Up @@ -85,7 +88,7 @@ def __init__(self, gitlab_id=None, config_files=None):
"configuration (%s)" % self.gitlab_id
) from e

self.ssl_verify = True
self.ssl_verify: Union[bool, str] = True
try:
self.ssl_verify = self._config.getboolean("global", "ssl_verify")
except ValueError:
Expand Down

0 comments on commit d207074

Please sign in to comment.