summaryrefslogtreecommitdiff
path: root/git/objects/util.py
diff options
context:
space:
mode:
authorAntoine Musso <hashar@free.fr>2014-11-16 20:51:04 +0100
committerAntoine Musso <hashar@free.fr>2014-11-16 20:51:21 +0100
commitbe34ec23c48d6d5d8fd2ef4491981f6fb4bab8e6 (patch)
tree7d0124054760421d95a6f675d8e843e42a72ad82 /git/objects/util.py
parentf5d11b750ecc982541d1f936488248f0b42d75d3 (diff)
downloadgitpython-be34ec23c48d6d5d8fd2ef4491981f6fb4bab8e6.tar.gz
pep8 linting (blank lines expectations)
E301 expected 1 blank line, found 0 E302 expected 2 blank lines, found 1 E303 too many blank lines (n)
Diffstat (limited to 'git/objects/util.py')
-rw-r--r--git/objects/util.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/git/objects/util.py b/git/objects/util.py
index f9dffd81..9f947fcc 100644
--- a/git/objects/util.py
+++ b/git/objects/util.py
@@ -22,6 +22,7 @@ __all__ = ('get_object_type_by_name', 'parse_date', 'parse_actor_and_date',
#{ Functions
+
def mode_str_to_int(modestr):
"""
:param modestr: string like 755 or 644 or 100644 - only the last 6 chars will be used
@@ -36,6 +37,7 @@ def mode_str_to_int(modestr):
# END for each char
return mode
+
def get_object_type_by_name(object_type_name):
"""
:return: type suitable to handle the given object type name.
@@ -59,6 +61,7 @@ def get_object_type_by_name(object_type_name):
else:
raise ValueError("Cannot handle unknown object type: %s" % object_type_name)
+
def utctz_to_altz(utctz):
"""we convert utctz to the timezone in seconds, it is the format time.altzone
returns. Git stores it as UTC timezone which has the opposite sign as well,
@@ -66,6 +69,7 @@ def utctz_to_altz(utctz):
:param utctz: git utc timezone string, i.e. +0200"""
return -1 * int(float(utctz)/100*3600)
+
def altz_to_utctz_str(altz):
"""As above, but inverses the operation, returning a string that can be used
in commit objects"""
@@ -92,6 +96,7 @@ def verify_utctz(offset):
# END for each char
return offset
+
def parse_date(string_date):
"""
Parse the given date as one of the following
@@ -169,6 +174,7 @@ def parse_date(string_date):
_re_actor_epoch = re.compile(r'^.+? (.*) (\d+) ([+-]\d+).*$')
_re_only_actor = re.compile(r'^.+? (.*)$')
+
def parse_actor_and_date(line):
"""Parse out the actor (author or committer) info from a line like::
@@ -190,12 +196,14 @@ def parse_actor_and_date(line):
#{ Classes
class ProcessStreamAdapter(object):
+
"""Class wireing all calls to the contained Process instance.
Use this type to hide the underlying process to provide access only to a specified
stream. The process is usually wrapped into an AutoInterrupt class to kill
it if the instance goes out of scope."""
__slots__ = ("_proc", "_stream")
+
def __init__(self, process, stream_name):
self._proc = process
self._stream = getattr(process, stream_name)
@@ -205,6 +213,7 @@ class ProcessStreamAdapter(object):
class Traversable(object):
+
"""Simple interface to perforam depth-first or breadth-first traversals
into one direction.
Subclasses only need to implement one function.
@@ -303,6 +312,7 @@ class Traversable(object):
class Serializable(object):
+
"""Defines methods to serialize and deserialize objects from and into a data stream"""
__slots__ = tuple()