Skip to content
This repository has been archived by the owner on Jun 7, 2018. It is now read-only.

Commit

Permalink
Bug fixed in Helper.output(), some docstrings added
Browse files Browse the repository at this point in the history
  • Loading branch information
rc0r committed Jan 6, 2015
1 parent b7783de commit 288050d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions AvivoreXT/Compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@


def is_python3():
"""
Check if interpreter is Python 3.
:return: True if interpreter is Python 3, False otherwise.
"""
return sys.version_info[0] == 3
15 changes: 13 additions & 2 deletions AvivoreXT/Helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ def is_string(arg):


def is_sequence(arg):
# check if arg is list, tuple, ...
"""
Checks if an object is sequential type (like list, tuple, ...), but not a string.
:param arg: Object under test.
:return: True if object is sequential type (and not string), False otherwise.
"""
return (not is_string(arg) and
(hasattr(arg, "__getitem__") or
hasattr(arg, "__iter__")))
Expand Down Expand Up @@ -61,7 +66,13 @@ def filepath_exists(filename):


def output(string):
"""
Prints a unix timestamp followed by a provided message.
:param string: The message to print
:return: None
"""
# Default text output for the console.
if isinstance(string, str):
if is_string(string):
# This is sort of lame but whatever:
print("[" + str(round(time.time(), 0))[:-2] + "] " + string)
Binary file modified testdata/empty_typedefs.db
Binary file not shown.

0 comments on commit 288050d

Please sign in to comment.