This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Null(object): | |
def __repr__(self): | |
return "<Null>" | |
def __str__(self): | |
return '' | |
def __nonzero__(self): | |
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pyt@worker3:~/ab-buildout$ git diff temp | |
diff --git a/ab/apps/advert/forms.py b/ab/apps/advert/forms.py | |
index 608237e..e80f156 100755 | |
--- a/ab/apps/advert/forms.py | |
+++ b/ab/apps/advert/forms.py | |
@@ -885,11 +885,6 @@ class Search_form(forms.Form): | |
regions.append(self.cleaned_data["%s%i"%( 'country', i)]) | |
elif self.cleaned_data["%s%i"%( 'region', i)]: | |
regions.append(self.cleaned_data["%s%i"%( 'region', i)]) | |
- try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pyt@worker2:~/ab-buildout$ git diff HEAD | |
diff --git a/ab/apps/advert/forms.py b/ab/apps/advert/forms.py | |
index 608237e..e80f156 100755 | |
--- a/ab/apps/advert/forms.py | |
+++ b/ab/apps/advert/forms.py | |
@@ -885,11 +885,6 @@ class Search_form(forms.Form): | |
regions.append(self.cleaned_data["%s%i"%( 'country', i)]) | |
elif self.cleaned_data["%s%i"%( 'region', i)]: | |
regions.append(self.cleaned_data["%s%i"%( 'region', i)]) | |
- try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/Users/t0ster/Documents/workspace/ab-buildout/bin/nosetests", line 63, in <module> | |
nose.run_exit() | |
File "/Users/t0ster/.buildout/eggs/nose-0.11.4-py2.7.egg/nose/core.py", line 117, in __init__ | |
**extra_args) | |
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 94, in __init__ | |
self.parseArgs(argv) | |
File "/Users/t0ster/.buildout/eggs/nose-0.11.4-py2.7.egg/nose/core.py", line 134, in parseArgs | |
self.config.configure(argv, doc=self.usage()) | |
File "/Users/t0ster/.buildout/eggs/nose-0.11.4-py2.7.egg/nose/config.py", line 324, in configure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'dm-core' | |
require 'dm-migrations' | |
# An in-memory Sqlite3 connection: | |
DataMapper.setup(:default, 'sqlite::memory:') | |
# Defining models | |
class Post | |
include DataMapper::Resource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_attr(obj, attr_name): | |
""" | |
*Example*: | |
if `obj` has 'one__two__three' attribute and | |
`attr_name` is 'one' this will return 'one', | |
if `attr_name` is 'one__two__three__four' will return | |
'one__two__three' | |
>>> class C(object): pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def raskolbas(iterable, r): | |
""" | |
>>> raskolbas(['one', 'two', 'three', 'four', 'five'], 2) | |
[['one', 'two'], ['two', 'three'], ['three', 'four'], ['four', 'five']] | |
""" | |
l = list(iterable) | |
return reduce(lambda x, y: (x.append(x[-1][-r+1:] + [y]), x)[-1], l[r:], [l[:r]]) | |
def zakolbas(iterable): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ResultAttr(object): | |
""" | |
Proxy class, grabbed from | |
http://code.activestate.com/recipes/496741-object-proxying/ | |
""" | |
__slots__ = ["_obj", "__weakref__"] | |
def __init__(self, name, obj, result): | |
object.__setattr__(self, "_name", name) | |
object.__setattr__(self, "_obj", obj) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ResultAttr: | |
attr_names = set(( | |
'_ResultAttr__value', '_ResultAttr__result', 'name')) | |
def __init__(self, name, value, result): | |
""" | |
Proxy class for `Result` attributes | |
Arguments: | |
- `name`: attribute name, for example 'user' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ti.API.debug "In tango.init" | |
IMPORTED = [] | |
# Setting sys.path | |
sys = {} | |
sys.path = ['site-packages', '.'] | |
class ImportError extends Error | |
constructor: (@message, @fileName, @lineNumber) -> |
OlderNewer