Quellcode durchsuchen

Your code is too weak for PEP8. You lack DISCIPLINE

Arnold Schwarzenegger vor 12 Jahren
Ursprung
Commit
5d794ceecb
27 geänderte Dateien mit 83 neuen und 15 gelöschten Zeilen
  1. 1 1
      3-tier.py
  2. 5 0
      abstract_factory.py
  3. 6 0
      adapter.py
  4. 3 0
      bridge.py
  5. 6 1
      builder.py
  6. 1 0
      catalog.py
  7. 5 0
      chain.py
  8. 1 0
      command.py
  9. 2 0
      composite.py
  10. 3 0
      decorator.py
  11. 4 0
      facade.py
  12. 4 0
      factory_method.py
  13. 1 0
      flyweight.py
  14. 3 2
      graph_search.py
  15. 2 2
      iterator.py
  16. 5 1
      mediator.py
  17. 5 1
      memento.py
  18. 4 4
      mvc.py
  19. 1 0
      null.py
  20. 4 0
      observer.py
  21. 1 0
      pool.py
  22. 1 0
      prototype.py
  23. 2 0
      proxy.py
  24. 3 0
      publish_subscribe.py
  25. 5 0
      state.py
  26. 1 0
      strategy.py
  27. 4 3
      visitor.py

+ 1 - 1
3-tier.py

@@ -62,7 +62,7 @@ if __name__ == '__main__':
 # eggs
 # eggs
 # milk
 # milk
 # cheese
 # cheese
-# 
+#
 # PRODUCT INFORMATION:
 # PRODUCT INFORMATION:
 # Name: Cheese, Price: 2.00, Quantity: 10
 # Name: Cheese, Price: 2.00, Quantity: 10
 # PRODUCT INFORMATION:
 # PRODUCT INFORMATION:

+ 5 - 0
abstract_factory.py

@@ -9,6 +9,7 @@ import random
 
 
 
 
 class PetShop:
 class PetShop:
+
     """A pet shop"""
     """A pet shop"""
 
 
     def __init__(self, animal_factory=None):
     def __init__(self, animal_factory=None):
@@ -30,6 +31,7 @@ class PetShop:
 # Stuff that our factory makes
 # Stuff that our factory makes
 
 
 class Dog:
 class Dog:
+
     def speak(self):
     def speak(self):
         return "woof"
         return "woof"
 
 
@@ -38,6 +40,7 @@ class Dog:
 
 
 
 
 class Cat:
 class Cat:
+
     def speak(self):
     def speak(self):
         return "meow"
         return "meow"
 
 
@@ -48,6 +51,7 @@ class Cat:
 # Factory classes
 # Factory classes
 
 
 class DogFactory:
 class DogFactory:
+
     def get_pet(self):
     def get_pet(self):
         return Dog()
         return Dog()
 
 
@@ -56,6 +60,7 @@ class DogFactory:
 
 
 
 
 class CatFactory:
 class CatFactory:
+
     def get_pet(self):
     def get_pet(self):
         return Cat()
         return Cat()
 
 

+ 6 - 0
adapter.py

@@ -7,6 +7,7 @@ import os
 
 
 
 
 class Dog(object):
 class Dog(object):
+
     def __init__(self):
     def __init__(self):
         self.name = "Dog"
         self.name = "Dog"
 
 
@@ -15,6 +16,7 @@ class Dog(object):
 
 
 
 
 class Cat(object):
 class Cat(object):
+
     def __init__(self):
     def __init__(self):
         self.name = "Cat"
         self.name = "Cat"
 
 
@@ -23,6 +25,7 @@ class Cat(object):
 
 
 
 
 class Human(object):
 class Human(object):
+
     def __init__(self):
     def __init__(self):
         self.name = "Human"
         self.name = "Human"
 
 
@@ -31,6 +34,7 @@ class Human(object):
 
 
 
 
 class Car(object):
 class Car(object):
+
     def __init__(self):
     def __init__(self):
         self.name = "Car"
         self.name = "Car"
 
 
@@ -39,6 +43,7 @@ class Car(object):
 
 
 
 
 class Adapter(object):
 class Adapter(object):
+
     """
     """
     Adapts an object by replacing methods.
     Adapts an object by replacing methods.
     Usage:
     Usage:
@@ -63,6 +68,7 @@ class Adapter(object):
     A Human goes 'hello'
     A Human goes 'hello'
     A Car goes vroom!!!
     A Car goes vroom!!!
     """
     """
+
     def __init__(self, obj, adapted_methods):
     def __init__(self, obj, adapted_methods):
         """We set the adapted methods in the object's dict"""
         """We set the adapted methods in the object's dict"""
         self.obj = obj
         self.obj = obj

+ 3 - 0
bridge.py

@@ -6,18 +6,21 @@
 
 
 # ConcreteImplementor 1/2
 # ConcreteImplementor 1/2
 class DrawingAPI1(object):
 class DrawingAPI1(object):
+
     def draw_circle(self, x, y, radius):
     def draw_circle(self, x, y, radius):
         print('API1.circle at {}:{} radius {}'.format(x, y, radius))
         print('API1.circle at {}:{} radius {}'.format(x, y, radius))
 
 
 
 
 # ConcreteImplementor 2/2
 # ConcreteImplementor 2/2
 class DrawingAPI2(object):
 class DrawingAPI2(object):
+
     def draw_circle(self, x, y, radius):
     def draw_circle(self, x, y, radius):
         print('API2.circle at {}:{} radius {}'.format(x, y, radius))
         print('API2.circle at {}:{} radius {}'.format(x, y, radius))
 
 
 
 
 # Refined Abstraction
 # Refined Abstraction
 class CircleShape(object):
 class CircleShape(object):
+
     def __init__(self, x, y, radius, drawing_api):
     def __init__(self, x, y, radius, drawing_api):
         self._x = x
         self._x = x
         self._y = y
         self._y = y

+ 6 - 1
builder.py

@@ -9,6 +9,7 @@ https://gist.github.com/420905#file_builder_python.py
 
 
 # Director
 # Director
 class Director(object):
 class Director(object):
+
     def __init__(self):
     def __init__(self):
         self.builder = None
         self.builder = None
 
 
@@ -23,6 +24,7 @@ class Director(object):
 
 
 # Abstract Builder
 # Abstract Builder
 class Builder(object):
 class Builder(object):
+
     def __init__(self):
     def __init__(self):
         self.building = None
         self.building = None
 
 
@@ -32,6 +34,7 @@ class Builder(object):
 
 
 # Concrete Builder
 # Concrete Builder
 class BuilderHouse(Builder):
 class BuilderHouse(Builder):
+
     def build_floor(self):
     def build_floor(self):
         self.building.floor = 'One'
         self.building.floor = 'One'
 
 
@@ -40,15 +43,17 @@ class BuilderHouse(Builder):
 
 
 
 
 class BuilderFlat(Builder):
 class BuilderFlat(Builder):
+
     def build_floor(self):
     def build_floor(self):
         self.building.floor = 'More than One'
         self.building.floor = 'More than One'
-        
+
     def build_size(self):
     def build_size(self):
         self.building.size = 'Small'
         self.building.size = 'Small'
 
 
 
 
 # Product
 # Product
 class Building(object):
 class Building(object):
+
     def __init__(self):
     def __init__(self):
         self.floor = None
         self.floor = None
         self.size = None
         self.size = None

+ 1 - 0
catalog.py

@@ -10,6 +10,7 @@ __gist__ = "<https://gist.github.com/diopib/7679559>"
 
 
 
 
 class Catalog():
 class Catalog():
+
     """
     """
     catalog of multiple static methods that are executed depending on an init
     catalog of multiple static methods that are executed depending on an init
     parameter
     parameter

+ 5 - 0
chain.py

@@ -5,11 +5,13 @@
 
 
 
 
 class Handler:
 class Handler:
+
     def successor(self, successor):
     def successor(self, successor):
         self.successor = successor
         self.successor = successor
 
 
 
 
 class ConcreteHandler1(Handler):
 class ConcreteHandler1(Handler):
+
     def handle(self, request):
     def handle(self, request):
         if 0 < request <= 10:
         if 0 < request <= 10:
             print('request {} handled in handler 1'.format(request))
             print('request {} handled in handler 1'.format(request))
@@ -18,6 +20,7 @@ class ConcreteHandler1(Handler):
 
 
 
 
 class ConcreteHandler2(Handler):
 class ConcreteHandler2(Handler):
+
     def handle(self, request):
     def handle(self, request):
         if 10 < request <= 20:
         if 10 < request <= 20:
             print('request {} handled in handler 2'.format(request))
             print('request {} handled in handler 2'.format(request))
@@ -26,6 +29,7 @@ class ConcreteHandler2(Handler):
 
 
 
 
 class ConcreteHandler3(Handler):
 class ConcreteHandler3(Handler):
+
     def handle(self, request):
     def handle(self, request):
         if 20 < request <= 30:
         if 20 < request <= 30:
             print('request {} handled in handler 3'.format(request))
             print('request {} handled in handler 3'.format(request))
@@ -34,6 +38,7 @@ class ConcreteHandler3(Handler):
 
 
 
 
 class Client:
 class Client:
+
     def __init__(self):
     def __init__(self):
         h1 = ConcreteHandler1()
         h1 = ConcreteHandler1()
         h2 = ConcreteHandler2()
         h2 = ConcreteHandler2()

+ 1 - 0
command.py

@@ -5,6 +5,7 @@ import os
 
 
 
 
 class MoveFileCommand(object):
 class MoveFileCommand(object):
+
     def __init__(self, src, dest):
     def __init__(self, src, dest):
         self.src = src
         self.src = src
         self.dest = dest
         self.dest = dest

+ 2 - 0
composite.py

@@ -37,6 +37,7 @@ def denormalize(val):
 
 
 
 
 class SpecialDict(dict):
 class SpecialDict(dict):
+
     """ A dictionary type which allows direct attribute
     """ A dictionary type which allows direct attribute
     access to its keys """
     access to its keys """
 
 
@@ -71,6 +72,7 @@ class SpecialDict(dict):
 
 
 
 
 class CompositeDict(SpecialDict):
 class CompositeDict(SpecialDict):
+
     """ A class which works like a hierarchical dictionary.
     """ A class which works like a hierarchical dictionary.
     This class is based on the Composite design-pattern """
     This class is based on the Composite design-pattern """
 
 

+ 3 - 0
decorator.py

@@ -5,6 +5,7 @@
 
 
 
 
 class foo_decorator(object):
 class foo_decorator(object):
+
     def __init__(self, decoratee):
     def __init__(self, decoratee):
         self._decoratee = decoratee
         self._decoratee = decoratee
 
 
@@ -17,6 +18,7 @@ class foo_decorator(object):
 
 
 
 
 class undecorated_foo(object):
 class undecorated_foo(object):
+
     def f1(self):
     def f1(self):
         print("original f1")
         print("original f1")
 
 
@@ -26,6 +28,7 @@ class undecorated_foo(object):
 
 
 @foo_decorator
 @foo_decorator
 class decorated_foo(object):
 class decorated_foo(object):
+
     def f1(self):
     def f1(self):
         print("original f1")
         print("original f1")
 
 

+ 4 - 0
facade.py

@@ -8,6 +8,7 @@ SLEEP = 0.5
 
 
 # Complex Parts
 # Complex Parts
 class TC1:
 class TC1:
+
     def run(self):
     def run(self):
         print("###### In Test 1 ######")
         print("###### In Test 1 ######")
         time.sleep(SLEEP)
         time.sleep(SLEEP)
@@ -21,6 +22,7 @@ class TC1:
 
 
 
 
 class TC2:
 class TC2:
+
     def run(self):
     def run(self):
         print("###### In Test 2 ######")
         print("###### In Test 2 ######")
         time.sleep(SLEEP)
         time.sleep(SLEEP)
@@ -34,6 +36,7 @@ class TC2:
 
 
 
 
 class TC3:
 class TC3:
+
     def run(self):
     def run(self):
         print("###### In Test 3 ######")
         print("###### In Test 3 ######")
         time.sleep(SLEEP)
         time.sleep(SLEEP)
@@ -48,6 +51,7 @@ class TC3:
 
 
 # Facade
 # Facade
 class TestRunner:
 class TestRunner:
+
     def __init__(self):
     def __init__(self):
         self.tc1 = TC1()
         self.tc1 = TC1()
         self.tc2 = TC2()
         self.tc2 = TC2()

+ 4 - 0
factory_method.py

@@ -5,7 +5,9 @@
 
 
 
 
 class GreekGetter:
 class GreekGetter:
+
     """A simple localizer a la gettext"""
     """A simple localizer a la gettext"""
+
     def __init__(self):
     def __init__(self):
         self.trans = dict(dog="σκύλος", cat="γάτα")
         self.trans = dict(dog="σκύλος", cat="γάτα")
 
 
@@ -18,7 +20,9 @@ class GreekGetter:
 
 
 
 
 class EnglishGetter:
 class EnglishGetter:
+
     """Simply echoes the msg ids"""
     """Simply echoes the msg ids"""
+
     def get(self, msgid):
     def get(self, msgid):
         return str(msgid)
         return str(msgid)
 
 

+ 1 - 0
flyweight.py

@@ -7,6 +7,7 @@ import weakref
 
 
 
 
 class Card(object):
 class Card(object):
+
     """The object pool. Has builtin reference counting"""
     """The object pool. Has builtin reference counting"""
     _CardPool = weakref.WeakValueDictionary()
     _CardPool = weakref.WeakValueDictionary()
 
 

+ 3 - 2
graph_search.py

@@ -3,6 +3,7 @@
 
 
 
 
 class GraphSearch:
 class GraphSearch:
+
     """Graph search emulation in python, from source
     """Graph search emulation in python, from source
     http://www.python.org/doc/essays/graphs/"""
     http://www.python.org/doc/essays/graphs/"""
 
 
@@ -62,7 +63,7 @@ class GraphSearch:
                         shortest = newpath
                         shortest = newpath
         return shortest
         return shortest
 
 
-#example of graph usage
+# example of graph usage
 graph = {'A': ['B', 'C'],
 graph = {'A': ['B', 'C'],
          'B': ['C', 'D'],
          'B': ['C', 'D'],
          'C': ['D'],
          'C': ['D'],
@@ -71,7 +72,7 @@ graph = {'A': ['B', 'C'],
          'F': ['C']
          'F': ['C']
          }
          }
 
 
-#initialization of new graph search object
+# initialization of new graph search object
 graph1 = GraphSearch(graph)
 graph1 = GraphSearch(graph)
 
 
 
 

+ 2 - 2
iterator.py

@@ -32,6 +32,6 @@ print()
 
 
 ### OUTPUT ###
 ### OUTPUT ###
 # Counting to two...
 # Counting to two...
-# one two 
+# one two
 # Counting to five...
 # Counting to five...
-# one two three four five 
+# one two three four five

+ 5 - 1
mediator.py

@@ -8,6 +8,7 @@ import time
 
 
 
 
 class TC:
 class TC:
+
     def __init__(self):
     def __init__(self):
         self._tm = None
         self._tm = None
         self._bProblem = 0
         self._bProblem = 0
@@ -40,6 +41,7 @@ class TC:
 
 
 
 
 class Reporter:
 class Reporter:
+
     def __init__(self):
     def __init__(self):
         self._tm = None
         self._tm = None
 
 
@@ -56,13 +58,14 @@ class Reporter:
 
 
 
 
 class DB:
 class DB:
+
     def __init__(self):
     def __init__(self):
         self._tm = None
         self._tm = None
 
 
     def insert(self):
     def insert(self):
         print("Inserting the execution begin status in the Database")
         print("Inserting the execution begin status in the Database")
         time.sleep(0.1)
         time.sleep(0.1)
-        #Following code is to simulate a communication from DB to TC
+        # Following code is to simulate a communication from DB to TC
         if random.randrange(1, 4) == 3:
         if random.randrange(1, 4) == 3:
             return -1
             return -1
 
 
@@ -75,6 +78,7 @@ class DB:
 
 
 
 
 class TestManager:
 class TestManager:
+
     def __init__(self):
     def __init__(self):
         self._reporter = None
         self._reporter = None
         self._db = None
         self._db = None

+ 5 - 1
memento.py

@@ -16,6 +16,7 @@ def Memento(obj, deep=False):
 
 
 
 
 class Transaction:
 class Transaction:
+
     """A transaction guard. This is really just
     """A transaction guard. This is really just
       syntactic suggar arount a memento closure.
       syntactic suggar arount a memento closure.
       """
       """
@@ -34,9 +35,11 @@ class Transaction:
 
 
 
 
 class transactional(object):
 class transactional(object):
+
     """Adds transactional semantics to methods. Methods decorated  with
     """Adds transactional semantics to methods. Methods decorated  with
     @transactional will rollback to entry state upon exceptions.
     @transactional will rollback to entry state upon exceptions.
     """
     """
+
     def __init__(self, method):
     def __init__(self, method):
         self.method = method
         self.method = method
 
 
@@ -52,6 +55,7 @@ class transactional(object):
 
 
 
 
 class NumObj(object):
 class NumObj(object):
+
     def __init__(self, value):
     def __init__(self, value):
         self.value = value
         self.value = value
 
 
@@ -116,7 +120,7 @@ if __name__ == '__main__':
 #   File "memento.py", line 47, in transaction
 #   File "memento.py", line 47, in transaction
 #     return self.method(obj, *args, **kwargs)
 #     return self.method(obj, *args, **kwargs)
 #   File "memento.py", line 67, in DoStuff
 #   File "memento.py", line 67, in DoStuff
-#     self.Increment()     # <- will fail and rollback
+# self.Increment()     # <- will fail and rollback
 #   File "memento.py", line 62, in Increment
 #   File "memento.py", line 62, in Increment
 #     self.value += 1
 #     self.value += 1
 # TypeError: Can't convert 'int' object to str implicitly
 # TypeError: Can't convert 'int' object to str implicitly

+ 4 - 4
mvc.py

@@ -61,14 +61,14 @@ if __name__ == '__main__':
 # cheese
 # cheese
 # eggs
 # eggs
 # milk
 # milk
-# 
+#
 # PRODUCT INFORMATION:
 # PRODUCT INFORMATION:
 # Name: Cheese, Price: 2.00, Quantity: 10
 # Name: Cheese, Price: 2.00, Quantity: 10
-# 
+#
 # PRODUCT INFORMATION:
 # PRODUCT INFORMATION:
 # Name: Eggs, Price: 0.20, Quantity: 100
 # Name: Eggs, Price: 0.20, Quantity: 100
-# 
+#
 # PRODUCT INFORMATION:
 # PRODUCT INFORMATION:
 # Name: Milk, Price: 1.50, Quantity: 10
 # Name: Milk, Price: 1.50, Quantity: 10
-# 
+#
 # That product "arepas" does not exist in the records
 # That product "arepas" does not exist in the records

+ 1 - 0
null.py

@@ -5,6 +5,7 @@
 
 
 
 
 class Null:
 class Null:
+
     def __init__(self, *args, **kwargs):
     def __init__(self, *args, **kwargs):
         """Ignore parameters."""
         """Ignore parameters."""
         return None
         return None

+ 4 - 0
observer.py

@@ -5,6 +5,7 @@
 
 
 
 
 class Subject(object):
 class Subject(object):
+
     def __init__(self):
     def __init__(self):
         self._observers = []
         self._observers = []
 
 
@@ -26,6 +27,7 @@ class Subject(object):
 
 
 # Example usage
 # Example usage
 class Data(Subject):
 class Data(Subject):
+
     def __init__(self, name=''):
     def __init__(self, name=''):
         Subject.__init__(self)
         Subject.__init__(self)
         self.name = name
         self.name = name
@@ -42,12 +44,14 @@ class Data(Subject):
 
 
 
 
 class HexViewer:
 class HexViewer:
+
     def update(self, subject):
     def update(self, subject):
         print('HexViewer: Subject %s has data 0x%x' %
         print('HexViewer: Subject %s has data 0x%x' %
               (subject.name, subject.data))
               (subject.name, subject.data))
 
 
 
 
 class DecimalViewer:
 class DecimalViewer:
+
     def update(self, subject):
     def update(self, subject):
         print('DecimalViewer: Subject %s has data %d' %
         print('DecimalViewer: Subject %s has data %d' %
               (subject.name, subject.data))
               (subject.name, subject.data))

+ 1 - 0
pool.py

@@ -5,6 +5,7 @@
 
 
 
 
 class QueueObject():
 class QueueObject():
+
     def __init__(self, queue, auto_get=False):
     def __init__(self, queue, auto_get=False):
         self._queue = queue
         self._queue = queue
         self.object = self._queue.get() if auto_get else None
         self.object = self._queue.get() if auto_get else None

+ 1 - 0
prototype.py

@@ -5,6 +5,7 @@ import copy
 
 
 
 
 class Prototype:
 class Prototype:
+
     def __init__(self):
     def __init__(self):
         self._objects = {}
         self._objects = {}
 
 

+ 2 - 0
proxy.py

@@ -5,6 +5,7 @@ import time
 
 
 
 
 class SalesManager:
 class SalesManager:
+
     def work(self):
     def work(self):
         print("Sales Manager working...")
         print("Sales Manager working...")
 
 
@@ -13,6 +14,7 @@ class SalesManager:
 
 
 
 
 class Proxy:
 class Proxy:
+
     def __init__(self):
     def __init__(self):
         self.busy = 'No'
         self.busy = 'No'
         self.sales = None
         self.sales = None

+ 3 - 0
publish_subscribe.py

@@ -8,6 +8,7 @@ Author: https://github.com/HanWenfang
 
 
 
 
 class Provider:
 class Provider:
+
     def __init__(self):
     def __init__(self):
         self.msg_queue = []
         self.msg_queue = []
         self.subscribers = {}
         self.subscribers = {}
@@ -34,6 +35,7 @@ class Provider:
 
 
 
 
 class Publisher:
 class Publisher:
+
     def __init__(self, msg_center):
     def __init__(self, msg_center):
         self.provider = msg_center
         self.provider = msg_center
 
 
@@ -42,6 +44,7 @@ class Publisher:
 
 
 
 
 class Subscriber:
 class Subscriber:
+
     def __init__(self, name, msg_center):
     def __init__(self, name, msg_center):
         self.name = name
         self.name = name
         self.provider = msg_center
         self.provider = msg_center

+ 5 - 0
state.py

@@ -4,6 +4,7 @@
 
 
 
 
 class State(object):
 class State(object):
+
     """Base state. This is to share functionality"""
     """Base state. This is to share functionality"""
 
 
     def scan(self):
     def scan(self):
@@ -15,6 +16,7 @@ class State(object):
 
 
 
 
 class AmState(State):
 class AmState(State):
+
     def __init__(self, radio):
     def __init__(self, radio):
         self.radio = radio
         self.radio = radio
         self.stations = ["1250", "1380", "1510"]
         self.stations = ["1250", "1380", "1510"]
@@ -27,6 +29,7 @@ class AmState(State):
 
 
 
 
 class FmState(State):
 class FmState(State):
+
     def __init__(self, radio):
     def __init__(self, radio):
         self.radio = radio
         self.radio = radio
         self.stations = ["81.3", "89.1", "103.9"]
         self.stations = ["81.3", "89.1", "103.9"]
@@ -39,7 +42,9 @@ class FmState(State):
 
 
 
 
 class Radio(object):
 class Radio(object):
+
     """A radio.     It has a scan button, and an AM/FM toggle switch."""
     """A radio.     It has a scan button, and an AM/FM toggle switch."""
+
     def __init__(self):
     def __init__(self):
         """We have an AM state and an FM state"""
         """We have an AM state and an FM state"""
         self.amstate = AmState(self)
         self.amstate = AmState(self)

+ 1 - 0
strategy.py

@@ -12,6 +12,7 @@ import types
 
 
 
 
 class StrategyExample:
 class StrategyExample:
+
     def __init__(self, func=None):
     def __init__(self, func=None):
         self.name = 'Strategy Example 0'
         self.name = 'Strategy Example 0'
         if func is not None:
         if func is not None:

+ 4 - 3
visitor.py

@@ -18,10 +18,11 @@ class C(A, B):
 
 
 
 
 class Visitor(object):
 class Visitor(object):
+
     def visit(self, node, *args, **kwargs):
     def visit(self, node, *args, **kwargs):
         meth = None
         meth = None
         for cls in node.__class__.__mro__:
         for cls in node.__class__.__mro__:
-            meth_name = 'visit_'+cls.__name__
+            meth_name = 'visit_' + cls.__name__
             meth = getattr(self, meth_name, None)
             meth = getattr(self, meth_name, None)
             if meth:
             if meth:
                 break
                 break
@@ -31,10 +32,10 @@ class Visitor(object):
         return meth(node, *args, **kwargs)
         return meth(node, *args, **kwargs)
 
 
     def generic_visit(self, node, *args, **kwargs):
     def generic_visit(self, node, *args, **kwargs):
-        print('generic_visit '+node.__class__.__name__)
+        print('generic_visit ' + node.__class__.__name__)
 
 
     def visit_B(self, node, *args, **kwargs):
     def visit_B(self, node, *args, **kwargs):
-        print('visit_B '+node.__class__.__name__)
+        print('visit_B ' + node.__class__.__name__)
 
 
 
 
 a = A()
 a = A()