-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding python type hint support in class and methods
- Loading branch information
lpmatos
committed
Jul 28, 2020
1 parent
4e07f70
commit 8a6e7f7
Showing
8 changed files
with
70 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GitLabRC | ||
================================================ |
This file contains 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,3 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
__version__ = ".".join(map(str, (0, 0, 6))) | ||
VERSION = (0, 0, 9) | ||
|
||
__version__ = ".".join(map(str, VERSION)) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from enum import Enum | ||
from typing import Text, Type | ||
|
||
""" | ||
https://stackoverflow.com/questions/36932/how-can-i-represent-an-enum-in-python | ||
""" | ||
|
||
class CloneMethod(Enum): | ||
HTTP = 1 | ||
SSH = 2 | ||
|
||
@staticmethod | ||
def parse(method: Type[Text]) -> Enum: | ||
return CloneMethod[method.upper()] |
This file contains 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,14 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from os import environ | ||
from typing import Text | ||
from typing import Text, Type, Optional | ||
|
||
class Config: | ||
|
||
@staticmethod | ||
def get_env(env: Text) -> Text: | ||
try: | ||
return environ.get(env) | ||
except KeyError as error: | ||
print(f"Key Error: {error}") | ||
def get_env(env: Type[Text], default: Optional[Type[Text]] = None) -> Text: | ||
return environ.get(env, default) | ||
|
This file contains 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