From 0267d41e4fa964e3fd1c4a5531b58d3d7a18de43 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Wed, 11 Mar 2015 10:37:15 +0100 Subject: [PATCH] pep8 --- src/EMSL_dump.py | 2 +- src/EMSL_local.py | 18 ++++++++++-------- src/docopt.py | 26 +++++++++++++++++--------- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/EMSL_dump.py b/src/EMSL_dump.py index 080f6ab..4e45635 100644 --- a/src/EMSL_dump.py +++ b/src/EMSL_dump.py @@ -29,6 +29,7 @@ def install_with_pip(name): class EMSL_dump: + """ This call implement all you need for download the EMSL and save it localy """ @@ -260,7 +261,6 @@ class EMSL_dump: else: q_in.task_done() - def enqueue(): for [name, path_xml, des, elts] in list_basis_array: q_in.put([name, path_xml, des, elts]) diff --git a/src/EMSL_local.py b/src/EMSL_local.py index 9ebf8e0..b0ed4e0 100755 --- a/src/EMSL_local.py +++ b/src/EMSL_local.py @@ -91,6 +91,7 @@ def string_to_nb_mo(str_l): class EMSL_local: + """ All the method for using the EMSL db localy """ @@ -113,13 +114,13 @@ class EMSL_local: l = [] for i, line in enumerate(atom_basis): - m = re.search(self.p, line) - if m: - l.append([m.group(1), i]) - try: - l[-2].append(i) - except IndexError: - pass + m = re.search(self.p, line) + if m: + l.append([m.group(1), i]) + try: + l[-2].append(i) + except IndexError: + pass l[-1].append(i + 1) return l @@ -305,7 +306,8 @@ class EMSL_local: tail_s = common + "{:>23.7f}".format(float(a[2])) body_s.append(tail_s) - # Is only a whan only 3 elements, coef for p == coef for s + # Is only a whan only 3 elements, coef for p == coef + # for s try: tail_p = common + "{:>23.7f}".format(float(a[3])) except IndexError: diff --git a/src/docopt.py b/src/docopt.py index 78f7f77..59830d5 100644 --- a/src/docopt.py +++ b/src/docopt.py @@ -59,12 +59,20 @@ class Pattern(object): either = [list(child.children) for child in transform(self).children] for case in either: for e in [child for child in case if case.count(child) > 1]: - if type(e) is Argument or type(e) is Option and e.argcount: + if isinstance( + e, + Argument) or isinstance( + e, + Option) and e.argcount: if e.value is None: e.value = [] - elif type(e.value) is not list: + elif not isinstance(e.value, list): e.value = e.value.split() - if type(e) is Command or type(e) is Option and e.argcount == 0: + if isinstance( + e, + Command) or isinstance( + e, + Option) and e.argcount == 0: e.value = 0 return self @@ -84,10 +92,10 @@ def transform(pattern): if any(t in map(type, children) for t in parents): child = [c for c in children if type(c) in parents][0] children.remove(child) - if type(child) is Either: + if isinstance(child, Either): for c in child.children: groups.append([c] + children) - elif type(child) is OneOrMore: + elif isinstance(child, OneOrMore): groups.append(child.children * 2 + children) else: groups.append(child.children + children) @@ -117,10 +125,10 @@ class LeafPattern(Pattern): left_ = left[:pos] + left[pos + 1:] same_name = [a for a in collected if a.name == self.name] if type(self.value) in (int, list): - if type(self.value) is int: + if isinstance(self.value, int): increment = 1 else: - increment = ([match.value] if type(match.value) is str + increment = ([match.value] if isinstance(match.value, str) else match.value) if not same_name: match.value = increment @@ -151,7 +159,7 @@ class Argument(LeafPattern): def single_match(self, left): for n, pattern in enumerate(left): - if type(pattern) is Argument: + if isinstance(pattern, Argument): return n, Argument(self.name, pattern.value) return None, None @@ -169,7 +177,7 @@ class Command(Argument): def single_match(self, left): for n, pattern in enumerate(left): - if type(pattern) is Argument: + if isinstance(pattern, Argument): if pattern.value == self.name: return n, Command(self.name, True) else: