Skip to content

Commit

Permalink
Improve code quality, fix potential bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
dpetrovs committed Dec 1, 2019
1 parent 1f22674 commit fcd1faa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pypgn/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def event(self) -> str:
:return: Event name
"""
return self.tag('Event' if 'Event' in self.tags else '')
return self.tag('Event' if self.tags is not None and 'Event' in self.tags else '')

def result(self) -> str:
"""Gets and returns the game result
Expand All @@ -120,7 +120,7 @@ def date(self) -> str:
:return: Date of the game in format YYYY.MM.DD
"""
return self.tag('Date' if 'Date' in self.tags else 'UTCDate')
return self.tag('Date' if self.tags is not None and 'Date' in self.tags else 'UTCDate')

def move_range(self, start: int = 1, end: int = None) -> List[Move]:
"""Gets and returns a range of moves
Expand Down
5 changes: 2 additions & 3 deletions pypgn/game_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import re
import http.client
from typing import List, NewType, Union
from http.client import HTTPException
from http.client import HTTPException, HTTPSConnection

Move = NewType('Move', Union[str, List])

Expand Down Expand Up @@ -48,7 +47,7 @@ def _get_moves(pgn: list) -> List[Move]:


def _get_lichess_pgn_lines(src: str) -> list:
conn = http.client.HTTPSConnection("lichess.org")
conn = HTTPSConnection("lichess.org")

payload = ""
endpoint = "/game/export/"
Expand Down

0 comments on commit fcd1faa

Please sign in to comment.