Skip to content

Commit

Permalink
adds vscode workspace settings
Browse files Browse the repository at this point in the history
  • Loading branch information
xharris committed Oct 30, 2021
1 parent bb74a30 commit 14d71ae
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 26 deletions.
5 changes: 4 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"recommendations": ["mikestead.dotenv"]
"recommendations": [
"mikestead.dotenv",
"ms-python.python"
]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python.formatting.provider": "black",
"editor.tabSize": 4
}
2 changes: 1 addition & 1 deletion PokeCord.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ async def _spawn(self, channel=None, message=None):
else:
t0 = datetime.now()
self.wild_pokemon = requests.post(url).json()
print(f"Obtained Pokemon - {datetime.now() - t0}")
log.info(f"Obtained Pokemon in {datetime.now() - t0}")
with open(f"IO Files/Pokemon/Pokemon#{self.wild_pokemon['id']}", 'w') as file:
json.dump(self.wild_pokemon, file)

Expand Down
57 changes: 33 additions & 24 deletions log.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,46 @@
from datetime import datetime
from enum import Enum


class LEVEL(Enum):
INFO = 1
ERROR = 2
WARN = 3
DEBUG = 4
def __ge__(self, other):
if self.__class__ is other.__class__:
return self.value >= other.value
return NotImplemented
def __gt__(self, other):
if self.__class__ is other.__class__:
return self.value > other.value
return NotImplemented
def __le__(self, other):
if self.__class__ is other.__class__:
return self.value <= other.value
return NotImplemented
def __lt__(self, other):
if self.__class__ is other.__class__:
return self.value < other.value
return NotImplemented
INFO = 1
ERROR = 2
WARN = 3
DEBUG = 4

def __ge__(self, other):
if self.__class__ is other.__class__:
return self.value >= other.value
return NotImplemented

def __gt__(self, other):
if self.__class__ is other.__class__:
return self.value > other.value
return NotImplemented

def __le__(self, other):
if self.__class__ is other.__class__:
return self.value <= other.value
return NotImplemented

def __lt__(self, other):
if self.__class__ is other.__class__:
return self.value < other.value
return NotImplemented


level = LEVEL.DEBUG


def separator():
print('~~~~~~~~~~~~')
print("~~~~~~~~~~~~")


def info(*args, **kwargs):
if level >= LEVEL.INFO:
print(f"[{datetime.now().strftime('%b-%d %H:%M')}] INFO",*args,**kwargs)
if level >= LEVEL.INFO:
print(f"[{datetime.now().strftime('%b-%d %H:%M')}] INFO", *args, **kwargs)


# def error()
# def warn()
# def debug()
# def debug()

0 comments on commit 14d71ae

Please sign in to comment.