Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2 from avelino/master

Implementation PEP8 and Encode UTF-8
  • Loading branch information...
commit 84925114542a04342547d1aba92d304f261b77a7 2 parents 248966c + eab6626
@vic authored
View
4 examples/builtins.py
@@ -1,4 +1,6 @@
-"wat"
+# -*- coding: utf-8 -*-
+
+"""wat"""
print __name__
print __doc__
print object
View
12 examples/classes.py
@@ -1,12 +1,24 @@
+# -*- coding: utf-8 -*-
+
class BankAccount(object):
+
def __init__(self, initial_balance=0):
+
self.balance = initial_balance
+
def deposit(self, amount):
+
self.balance = self.balance + amount
+
def withdraw(self, amount):
+
self.balance = self.balance - amount
+
def overdrawn(self):
+
return self.balance < 0
+
+
print BankAccount
my_account = BankAccount(15)
print my_account
View
22 examples/decorators.py
@@ -1,14 +1,20 @@
+# -*- coding: utf-8 -*-
+
class test(object):
- @staticmethod
- def static(a,b,c):
- print a, b, c
-
- @classmethod
- def clsm(cls, a, b, c):
- print cls, a, b, c
+
+ @staticmethod
+ def static(a,b,c):
+
+ print a, b, c
+
+ @classmethod
+ def clsm(cls, a, b, c):
+
+ print cls, a, b, c
+
test.static(1,2,3) # => "1 2 3"
test.clsm(1,2,3) # => "<type 'test'> 1 2 3"
test().static(1,2,3) # => "1 2 3"
-test().clsm(1,2,3) # => "<type 'test'> 1 2 3"
+test().clsm(1,2,3) # => "<type 'test'> 1 2 3"
View
28 examples/descriptors.py
@@ -1,16 +1,28 @@
+# -*- coding: utf-8 -*-
+
class DataDesc(object):
- def __get__(self, obj, type):
- print "datadesc", self, obj, type
- def __set__(self, obj, val):
- print "datadesc", self, obj, val
+
+ def __get__(self, obj, type):
+
+ print "datadesc", self, obj, type
+
+ def __set__(self, obj, val):
+
+ print "datadesc", self, obj, val
+
class Desc(object):
- def __get__(self, obj, type):
- print "desc", self, obj, type
+
+ def __get__(self, obj, type):
+
+ print "desc", self, obj, type
+
class test(object):
- dd = DataDesc()
- d = Desc()
+
+ dd = DataDesc()
+ d = Desc()
+
#__debugger__()
test.dd
View
29 examples/embed_func.py
@@ -1,18 +1,21 @@
+# -*- coding: utf-8 -*-
+
z = 'watevah'
def blah(a,k='b'):
- def blorp(b):
- print(b) #3
- print(a) #4
- print(z) #5
- print(__name__) #6
-
- l = lambda x: x
- #def l(x): return x
-
- print(l("zoom!")) #1
-
- print(a,k) #2
- blorp("boom")
+
+ def blorp(b):
+
+ print(b) #3
+ print(a) #4
+ print(z) #5
+ print(__name__) #6
+
+ l = lambda x: x
+ #def l(x): return x
+ print(l("zoom!")) #1
+ print(a,k) #2
+ blorp("boom")
+
blah("floom")
View
2  examples/eval.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
a = 22
b = eval("a * 33")
print b
View
9 examples/foo/bar.py
@@ -1,4 +1,9 @@
-"The Foo::Bar module"
+# -*- coding: utf-8 -*-
+
def bar():
- print "BAR"
+ """The Foo::Bar module"""
+
+ print "BAR"
+
+
bar()
View
4 examples/from_import.py
@@ -1,2 +1,6 @@
+# -*- coding: utf-8 -*-
+
from imported import foo
+
+
print foo()
View
4 examples/from_import_as.py
@@ -1,2 +1,6 @@
+# -*- coding: utf-8 -*-
+
from imported import foo as bar
+
+
print bar()
View
5 examples/func.py
@@ -1,9 +1,14 @@
+# -*- coding: utf-8 -*-
+
def greet(name, wat, blorp = 'woop', zoop = 'noop'):
+
print '---'
print 'hello', name
print 'wat:', wat
print 'blorp:', blorp
print 'zoop:', zoop
+
+
greet('Jack', 'stuff')
greet('Jill', 'cffuf', 'tuff')
greet('Bob', 'wat')
View
2  examples/hello.py
@@ -1 +1,3 @@
+# -*- coding: utf-8 -*-
+
print("hello world")
View
7 examples/import.py
@@ -1,6 +1,7 @@
-import imported
-
-print(imported.__doc__)
+# -*- coding: utf-8 -*-
+import imported
import foo.bar
+
+print(imported.__doc__)
View
6 examples/import_as.py
@@ -1,2 +1,6 @@
+# -*- coding: utf-8 -*-
+
import imported as foo
-print(foo.__name__) # => "imported"
+
+# => "imported"
+print(foo.__name__)
View
4 examples/imported.py
@@ -1,6 +1,8 @@
-"imported module"
+# -*- coding: utf-8 -*-
def foo():
+ """imported module"""
return "FOO"
+
print __name__
View
2  examples/literals.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
1
2.3
"a b c"
View
5 examples/numbers.py
@@ -1,7 +1,10 @@
+# -*- coding: utf-8 -*-
+
print "boom"
x = 1
-y = 100000*100000 # current parser blows up on long numbers.
+# current parser blows up on long numbers.
+y = 100000*100000
z = 10000
#__debugger__()
View
4 examples/pass.py
@@ -1,3 +1,7 @@
+# -*- coding: utf-8 -*-
+
def foo():
pass
+
+
print foo()
View
6 examples/ruby.py
@@ -1,6 +1,8 @@
-from __ruby__ import require
+# -*- coding: utf-8 -*-
-require('rbconfig')
+from __ruby__ import require
from __ruby__.Config.CONFIG import fetch as rb
+
+require('rbconfig')
print rb("RUBY_INSTALL_NAME") # => rbx
View
4 examples/singletons.py
@@ -1,4 +1,6 @@
+# -*- coding: utf-8 -*-
+
print None
print None.__class__
print NotImplemented
-print NotImplemented.__class__
+print NotImplemented.__class__

0 comments on commit 8492511

Please sign in to comment.
Something went wrong with that request. Please try again.