rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
assert have_pyrex | assert have_pyrex == cython_needed | def ext_modules(): for pyx_file in glob.glob(os.path.join('djvu', '*.pyx')): module, _ = os.path.splitext(os.path.basename(pyx_file)) yield module |
for n in -100, 0, 1 << 32: | for n in -100, 0, (1 + sys.maxint) * 2: | def set_cache_size(n): context.cache_size = n |
for n in 1, 100, 1 << 10, 1 << 20, (1 << 32) -1: | n = 1 while n < 3 * sys.maxint: | def set_cache_size(n): context.cache_size = n |
>>> page_job.render(RENDER_COLOR, (0, 0, 100000, 100000), (0, 0, 100000, 100000), PixelFormatRgb(), 8) | >>> x = int((sys.maxint//2) ** 0.5) >>> page_job.render(RENDER_COLOR, (0, 0, x, x), (0, 0, x, x), PixelFormatRgb(), 8) | def test_decode(): r''' >>> context = Context() >>> document = context.new_document(FileUri(images + 'test1.djvu')) >>> message = document.get_message() >>> type(message) == DocInfoMessage True >>> page_job = document.pages[0].decode() >>> page_job.is_done True >>> type(page_job) == PageJob True >>> page_job.is_done Tr... |
changelog = file(os.path.join('doc', 'changelog')) | changelog = open(os.path.join('doc', 'changelog')) | def get_version(): changelog = file(os.path.join('doc', 'changelog')) try: return changelog.readline().split()[1].strip('()') finally: changelog.close() |
from setuptools.extension import Extension | from setuptools.extension import Extension, have_pyrex assert have_pyrex del have_pyrex | def ext_modules(): for pyx_file in glob.glob(os.path.join('djvu', '*.pyx')): module, _ = os.path.splitext(os.path.basename(pyx_file)) yield module |
from distutils.extension import Extension, have_pyrex assert have_pyrex del have_pyrex | from distutils.extension import Extension | def ext_modules(): for pyx_file in glob.glob(os.path.join('djvu', '*.pyx')): module, _ = os.path.splitext(os.path.basename(pyx_file)) yield module |
"Returns True to carry on or erase and False to maintain" if path.startswith(self.deposit): debug('Deposit path: ' + path,DEBUG_MEDIUM) return False if os.path.ismount(path): | "Returns True to carry on or erase and False to maintain" if path.startswith(self.deposit): debug('Deposit path: ' + path,DEBUG_MEDIUM) return False if os.path.ismount(path) and path != self.homedir: | def __restore_or_erase(self,path): "Returns True to carry on or erase and False to maintain" #Do nothing with the deposit if it's inside a home directory if path.startswith(self.deposit): debug('Deposit path: ' + path,DEBUG_MEDIUM) return False |
print "Debug L: "+ str(text.encode('utf-8')) | print "Debug L: "+ text | def debug(text, level=DEBUG_LOW): "Prints a text in the terminal if the debug level is higher than the requested" try: if level <= debug_level: if level == DEBUG_LOW: print "Debug L: "+ str(text.encode('utf-8')) if level == DEBUG_MEDIUM: print "Debug M: "+ str(text.encode('utf-8')) if level == DEBUG_HIGH: print "Debug ... |
print "Debug M: "+ str(text.encode('utf-8')) | print "Debug M: "+ text | def debug(text, level=DEBUG_LOW): "Prints a text in the terminal if the debug level is higher than the requested" try: if level <= debug_level: if level == DEBUG_LOW: print "Debug L: "+ str(text.encode('utf-8')) if level == DEBUG_MEDIUM: print "Debug M: "+ str(text.encode('utf-8')) if level == DEBUG_HIGH: print "Debug ... |
print "Debug H: "+ str(text.encode('utf-8')) | print "Debug H: "+ text | def debug(text, level=DEBUG_LOW): "Prints a text in the terminal if the debug level is higher than the requested" try: if level <= debug_level: if level == DEBUG_LOW: print "Debug L: "+ str(text.encode('utf-8')) if level == DEBUG_MEDIUM: print "Debug M: "+ str(text.encode('utf-8')) if level == DEBUG_HIGH: print "Debug ... |
print "Warning: "+ str(text.encode('utf-8')) | print "Warning: "+ text | def print_error(text,level=ERROR): "Prints a error or warning message in the terminal" try: if level == WARNING: print "Warning: "+ str(text.encode('utf-8')) return print "Error : "+ str(text.encode('utf-8')) except: print "Error : Can't print error message" |
print "Error : "+ str(text.encode('utf-8')) | print "Error : "+ text | def print_error(text,level=ERROR): "Prints a error or warning message in the terminal" try: if level == WARNING: print "Warning: "+ str(text.encode('utf-8')) return print "Error : "+ str(text.encode('utf-8')) except: print "Error : Can't print error message" |
raise LexerError(errline, ((line, pos), (line, len(errline)))) | raise LexerError(errline, ((line, pos + 1), (line, len(errline)))) | def match_specs(specs, str, i, (line, pos)): for spec in specs: m = spec.re.match(str, i) if m is not None: value = m.group() nls = value.count(u'\n') n_line = line + nls if nls == 0: n_pos = pos + len(value) else: n_pos = len(value) - value.rfind(u'\n') - 1 return Token(spec.type, value, ((line, pos), (n_line, n_pos))... |
CC_FLAGS = "-g -Wall -Wfatal-errors -Werror" | CC_FLAGS = "-g -Wall -Werror" | def ExecProcess(cmd): try: pipe = os.popen4(cmd)[1] except AttributeError: pipe = os.popen(cmd) result = "" for line in pipe.readlines(): result = result + line[:-1] pipe.close() return result |
DEFINES += ['IMAGES_USE_LIBPNG'] | DEFINES += ['IMAGES_USE_LIBPNG', 'NO_CAIRO'] | def ExecProcess(cmd): try: pipe = os.popen4(cmd)[1] except AttributeError: pipe = os.popen(cmd) result = "" for line in pipe.readlines(): result = result + line[:-1] pipe.close() return result |
'ole32', 'msvcp60', 'Msimg32', 'png', 'z', 'opengl32', 'glu32', 'cairo' | 'ole32', 'msvcp60', 'Msimg32', 'opengl32', 'glu32', 'png', 'z' | def ExecProcess(cmd): try: pipe = os.popen4(cmd)[1] except AttributeError: pipe = os.popen(cmd) result = "" for line in pipe.readlines(): result = result + line[:-1] pipe.close() return result |
ccflags += " -fPIC" linkflags += " -shared -fPIC" | if getHost() == "windows": linkflags += " -shared" else: ccflags += " -fPIC" linkflags += " -shared -fPIC" | def Compile(outputfile, files, ccflags="", linkflags="", target="exe", cc=CC): if target == "dll": ccflags += " -fPIC" linkflags += " -shared -fPIC" ofile = DllExt(outputfile) elif target == "exe": ofile = ExeExt(outputfile) else: Error("unknown target " + type) linkCmd = "" for f in files: Exec(Subs("$# -c $# -o $# $#... |
Exec(Subs("$ | c = Changed(f, f) if c.check() or force: Exec(Subs("$ c.success() | def Compile(outputfile, files, ccflags="", linkflags="", target="exe", cc=CC): if target == "dll": ccflags += " -fPIC" linkflags += " -shared -fPIC" ofile = DllExt(outputfile) elif target == "exe": ofile = ExeExt(outputfile) else: Error("unknown target " + type) linkCmd = "" for f in files: Exec(Subs("$# -c $# -o $# $#... |
ccflags += ccflags + " -Iclaro" | ccflags += ccflags + " -Iinclude" | def cmd_examples(ccflags): ccflags += ccflags + " -Iclaro" Compile("build/hello", ["examples/helloworld/hello.c"], ccflags) Compile("build/radio", ["examples/radio/radio.c"], ccflags) Compile("build/combo", ["examples/combo/combo.c"], ccflags) Compile("build/layout_test", ["examples/layout/layout_test.c"], ccflags) Com... |
raise self.ConnectionError(*exc.args) | raise ConnectionError(*exc.args) | def connect(self): """ Connects to the STOMP server if not already connected. """ if self._sock: return try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.host, self.port)) except socket.error, exc: raise self.ConnectionError(*exc.args) except socket.timeout, exc: raise self.ConnectionTime... |
raise self.ConnectionTimeoutError(*exc.args) | raise ConnectionTimeoutError(*exc.args) | def connect(self): """ Connects to the STOMP server if not already connected. """ if self._sock: return try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.host, self.port)) except socket.error, exc: raise self.ConnectionError(*exc.args) except socket.timeout, exc: raise self.ConnectionTime... |
print "Trying to disconnect." | def disconnect(self, conf=None): """ Disconnect from the server, if connected. """ print "Trying to disconnect." if self._sock is None: return try: self._sock.close() except socket.error: pass self._sock = None self._buffer.clear() | |
print repr(self.connection.connected) | def disconnect(self, conf=None, extra_headers=None): """Disconnect from the server.""" print repr(self.connection.connected) if self.connection.connected: disconnect = frame.DisconnectFrame(extra_headers=extra_headers) result = self.send_frame(disconnect) self.connection.disconnect() return result | |
subscribe clients, since the message messages are received by a separate thread. | subscribe clients, since a listener thread needs to be able to share the *same* socket with other publisher thread(s). | def get_all_connections(self): "Return a list of all connection objects the manager knows about" return self.connections.values() |
This class is notably not thread-safe. You need to use external mechanisms to guard access to connections. This is typically accomplished by using a thread-safe connection pool implementation (e.g. L{stompclient.connection.ThreadLocalConnectionPool}). | This class provides some basic synchronization to avoid threads stepping on eachother. Specifically the following activities are each protected by [their own] C{threading.RLock} instances: - connect() and disconnect() methods (share a lock). - read() - send() It is assumed that send() and recv() should be allowed to h... | def get_all_connections(self): "Return a list of all connection objects the manager knows about" return self.connections.values() |
self._connect_lock = threading.RLock() self._send_lock = threading.RLock() self._read_lock = threading.RLock() | def __init__(self, host, port=61613, socket_timeout=None): self.host = host self.port = port self.socket_timeout = socket_timeout self._sock = None self._buffer = FrameBuffer() self._connected = threading.Event() | |
if self._sock: return try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.host, self.port)) except socket.timeout as exc: raise ConnectionTimeoutError(*exc.args) except socket.error as exc: raise ConnectionError(*exc.args) sock.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) sock.settime... | with self._connect_lock: if self._sock: return try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.host, self.port)) except socket.timeout as exc: raise ConnectionTimeoutError(*exc.args) except socket.error as exc: raise ConnectionError(*exc.args) sock.setsockopt(socket.SOL_TCP, socket.TCP... | def connect(self): """ Connects to the STOMP server if not already connected. """ if self._sock: return try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.host, self.port)) except socket.timeout as exc: raise ConnectionTimeoutError(*exc.args) except socket.error as exc: raise ConnectionErr... |
if self._sock is None: raise NotConnectedError() try: self._sock.close() except socket.error: pass self._sock = None self._buffer.clear() self._connected.clear() | with self._connect_lock: if self._sock is None: raise NotConnectedError() try: self._sock.close() except socket.error: pass self._sock = None self._buffer.clear() self._connected.clear() | def disconnect(self, conf=None): """ Disconnect from the server, if connected. @raise NotConnectedError: If the connection is not currently connected. """ if self._sock is None: raise NotConnectedError() try: self._sock.close() except socket.error: pass self._sock = None self._buffer.clear() self._connected.clear() |
self.connect() try: self._sock.sendall(str(frame)) except socket.error, e: if e.args[0] == errno.EPIPE: self.disconnect() raise ConnectionError("Error %s while writing to socket. %s." % e.args) | with self._send_lock: self.connect() try: self._sock.sendall(str(frame)) except socket.error, e: if e.args[0] == errno.EPIPE: self.disconnect() raise ConnectionError("Error %s while writing to socket. %s." % e.args) | def send(self, frame): """ Sends the specified frame to STOMP server. @param frame: The frame to send to server. @type frame: L{stompclient.frame.Frame} """ self.connect() try: self._sock.sendall(str(frame)) except socket.error, e: if e.args[0] == errno.EPIPE: self.disconnect() raise ConnectionError("Error %s while wr... |
begdata = 900 + (nchannels * 75) enddata = self.info["eventtablepos"] nsamples = ((enddata - begdata)/self.info["nchannels"])/2 self.info["nsamples"] = nsamples | def load_setup(self): """Loads CNT metadata from header.""" self.info = {} self.file.seek(0) self.info["rev"] = self.get('12s') self.info["nextfile"] = self.get('l') self.info["prevfile"] = self.get('L') self.info["type"] = self.get('b') self.info["id"] = se... | |
shape = (2, len(self.events)) | shape = (len(self.events), 2) | def save_events(self): self.get_event_table() self.load_events() shape = (2, len(self.events)) atom = tables.Int16Atom() filters = tables.Filters(complevel=5, complib='zlib') ca = self.h5.createCArray(self.h5.root, 'triggers', atom, shape, title="Trigger Data", filters=filters) for event in self.events: ca[:, even... |
for event in self.events: ca[:, event.event_id] = [event.stimtype, event.offset] | for i, event in enumerate(self.events): ca[i, :] = [event.stimtype, event.offset] | def save_events(self): self.get_event_table() self.load_events() shape = (2, len(self.events)) atom = tables.Int16Atom() filters = tables.Filters(complevel=5, complib='zlib') ca = self.h5.createCArray(self.h5.root, 'triggers', atom, shape, title="Trigger Data", filters=filters) for event in self.events: ca[:, even... |
sys.exit() CNTData(cnt_filename) | sys.exit(0) else: print cnt_filename CNTData(cnt_filename) | def convert_bytes_to_points(self, byte): data_offset = 900 + (75 * self.info["nchannels"]) point = (byte - data_offset) / (2 * self.info["nchannels"]) return point |
begdata = 900 + (nchannels * 75) | begdata = 900 + (self.info["nchannels"] * 75) | def load_setup(self): """Loads CNT metadata from header.""" self.info = {} self.file.seek(0) self.info["rev"] = self.get('12s') self.info["nextfile"] = self.get('l') self.info["prevfile"] = self.get('L') self.info["type"] = self.get('b') self.info["id"] = se... |
needs = p._str.split()[1:] | needs = p._str.split() | def check(self, *args, **kwds): _rpmts.check(self, *args, **kwds) |
self.ndiffAssertEqual(f(s), '\n'.join(['case when foo = 1 then 2', ' when foo = 3 then 4', ' else 5', | self.ndiffAssertEqual(f(s), '\n'.join(['case', ' when foo = 1 then 2', ' when foo = 3 then 4', ' else 5', | def test_case(self): f = lambda sql: sqlparse.format(sql, reindent=True) s = 'case when foo = 1 then 2 when foo = 3 then 4 else 5 end' self.ndiffAssertEqual(f(s), '\n'.join(['case when foo = 1 then 2', ' when foo = 3 then 4', ' else 5', 'end'])) |
if x.next()(t): | if next(x)(t): | def _consume_cycle(tl, i): x = itertools.cycle(( lambda y: (y.match(T.Punctuation, '.') or y.ttype is T.Operator), lambda y: (y.ttype in (T.String.Symbol, T.Name, T.Wildcard)))) for t in tl.tokens[i:]: if x.next()(t): yield t else: raise StopIteration |
return unicode(self).encode('utf-8') | return self.value or '' | def __str__(self): return unicode(self).encode('utf-8') |
def __unicode__(self): return self.value or '' | def __repr__(self): short = self._get_repr_value() return '<%s \'%s\' at 0x%07x>' % (self._get_repr_name(), short, id(self)) | |
def __unicode__(self): return ''.join(unicode(x) for x in self.flatten()) | def __unicode__(self): return ''.join(unicode(x) for x in self.flatten()) | |
return unicode(self).encode('utf-8') | return ''.join('%s' % x for x in self.flatten()) | def __str__(self): return unicode(self).encode('utf-8') |
data['proc_time'] = '%.3f' % proc_time or 0.0 | data['proc_time'] = '%.3f' % (proc_time or 0.0) | def index(request): output = None data = {} proc_time = None if request.method == 'POST': logging.debug(request.POST) form = FormOptions(request.POST, request.FILES) if form.is_valid(): start = time.time() output = format_sql(form, format=request.POST.get('format', 'html')) proc_time = time.time()-start else: form = Fo... |
unittest.TextTestRunner(verbosity=2).run(suite) | return unittest.TextTestRunner(verbosity=2).run(suite) | def main(args): """Create a TestSuite and run it.""" loader = unittest.TestLoader() suite = unittest.TestSuite() fnames = [os.path.split(f)[-1] for f in args] for fname in os.listdir(os.path.dirname(__file__)): if (not fname.startswith('test_') or not fname.endswith('.py') or (fnames and fname not in fnames)): continue... |
main(args) | result = main(args) if not result.wasSuccessful(): return_code = 1 else: return_code = 0 sys.exit(return_code) | def main(args): """Create a TestSuite and run it.""" loader = unittest.TestLoader() suite = unittest.TestSuite() fnames = [os.path.split(f)[-1] for f in args] for fname in os.listdir(os.path.dirname(__file__)): if (not fname.startswith('test_') or not fname.endswith('.py') or (fnames and fname not in fnames)): continue... |
usage() | __usage() | def build_tree(search_path, outdir): """Build a directory tree under outdir containing symlinks to all LV2 extensions found in search_path, such that the symlink paths correspond to the extension URIs.""" for bundle in __bundles(search_path): # Load manifest into model manifest = RDF.Model() parser = RDF.Parser(name="g... |
print_usage() | usage() | def usage(): print """Usage: lv2compatgen.py DATA |
path = os.path.join(release_dir, 'lv2-%s-%s.0.tar.gz' % (b, rev)) subprocess.call(['tar', '-czf', path, os.path.join(outdir, '%s.lv2' % b)]) | path = os.path.join(os.path.abspath(release_dir), 'lv2-%s-%s.0.tar.gz' % (b, rev)) subprocess.call(['tar', '--exclude-vcs', '-czf', path, bundle[bundle.find('/') + 1:]], cwd=dir) | def gendoc(specgen_dir, bundle_dir, ttl_filename, html_filename): subprocess.call([os.path.join(specgen_dir, 'lv2specgen.py'), os.path.join(bundle_dir, ttl_filename), os.path.join(specgen_dir, 'template.html'), os.path.join(specgen_dir, 'style.css'), os.path.join(out_base, html_filename), os.path.join('..', 'doc'), '-i... |
for name, old_kind_details in cwd: | for name, old_kind_details in cwd.iteritems(): | def _gather_deleted_dir(self, path, dirdict): # List what the tree thought it had as deletes. pending = [(path, dirdict)] while pending: dirname, cwd = pending.pop(-1) for name, old_kind_details in cwd: path = dirname and ('%s/%s' % (dirname, name)) or name if type(old_kind_details) is dict: pending.append((path, old_k... |
cwd[name][1]) | old_kind_details) | def finished(self): """Return the journal obtained by scanning the disk.""" pending = [''] while pending: dirname = pending.pop(-1) names = self.transport.list_dir(dirname) # NB: quadratic in lookup here due to presence in inner loop: # consider tuning. segments = dirname.split('/') cwd = self.tree for segment in segme... |
self.journal.add(path, 'replace', (cwd[name][1], new_kind_details)) | old_kind_details = cwd[name] if type(old_kind_details) is dict: old_kind_details = ('dir',) if old_kind_details != new_kind_details: self.journal.add(path, 'replace', (old_kind_details, new_kind_details)) | def finished(self): """Return the journal obtained by scanning the disk.""" pending = [''] while pending: dirname = pending.pop(-1) names = self.transport.list_dir(dirname) # NB: quadratic in lookup here due to presence in inner loop: # consider tuning. segments = dirname.split('/') cwd = self.tree for segment in segme... |
if content[0] != dir: | if content[0] != 'dir': | def replay(self): """Replay the journal.""" adds = [] deletes = [] replaces = [] for path, (action, content) in self.journal.paths.iteritems(): if action == 'new': adds.append((path, content)) elif action == 'del': deletes.append((path, content)) elif action == 'replace': replaces.append((path, content[0], content[1]))... |
realpath = self.sourcedir.local_abspath(path) | realpath = self.contentdir.local_abspath(path) | def put_with_check(self, path, content): """Put a_file at path checking that as received it matches content. |
temppath = self.contentdir.local_abspath(tempname) | def put_with_check(self, path, content): """Put a_file at path checking that as received it matches content. | |
os.utime(tempname, (content.mtime, content.mtime)) | os.utime(temppath, (content.mtime, content.mtime)) | def put_with_check(self, path, content): """Put a_file at path checking that as received it matches content. |
temppath = self.contentdir.local_abspath(tempname) | def put_with_check(self, path, content): """Put a_file at path checking that as received it matches content. | |
except OSError, e: if e.errno != errno.ENOENT: raise self.ui.output_log(4, __name__, 'Failed to set mtime for %r' % (temppath,)) | def put_with_check(self, path, content): """Put a_file at path checking that as received it matches content. | |
requires = ['webit', 'gtk', 'gobject', 'keybinder', 'pynotify'], | requires = ['webkit', 'gtk', 'gobject', 'keybinder', 'pynotify'], | def get_data_files(root, data_dir): return [ (root + parent[len(data_dir):], [ os.path.join(parent, fn) for fn in files ]) for parent, dirs, files in os.walk(data_dir) if files ] |
print raw_json | def crack_request(params): raw_json = urllib.unquote(params[1]) print raw_json request_info = dict([(k.encode('utf8'), v) for k, v in json.loads(raw_json).items()]) args = ( request_info['uuid'] , request_info['method'] , request_info['url'] , request_info['params'] , request_info['headers']) th = threading.Thread(targ... | |
libwebkit = ctypes.CDLL('libwebkit-1.0.so.2') | try: libwebkit = ctypes.CDLL('libwebkit-1.0.so.2') pass except: libwebkit = ctypes.CDLL('libwebkitgtk-1.0.so.0.2.0') pass | def webkit_set_proxy_uri(uri): if uri and '://' not in uri: uri = 'https://' + uri pass try: if os.name == 'nt': libgobject = ctypes.CDLL('libgobject-2.0-0.dll') libsoup = ctypes.CDLL('libsoup-2.4-1.dll') libwebkit = ctypes.CDLL('libwebkit-1.0-2.dll') pass else: libgobject = ctypes.CDLL('libgobject-2.0.so.0') libsoup =... |
print 'error: webkit_set_proxy_uri' | exctype, value = sys.exc_info()[:2] print 'error: webkit_set_proxy_uri: (%s, %s)' % (exctype,value) | def webkit_set_proxy_uri(uri): if uri and '://' not in uri: uri = 'https://' + uri pass try: if os.name == 'nt': libgobject = ctypes.CDLL('libgobject-2.0-0.dll') libsoup = ctypes.CDLL('libsoup-2.4-1.dll') libwebkit = ctypes.CDLL('libwebkit-1.0-2.dll') pass else: libgobject = ctypes.CDLL('libgobject-2.0.so.0') libsoup =... |
gobject.idle_add(os.system, 'aplay -q "%s"' % utils.get_sound('notify')) | subprocess.Popen(['aplay', '-q', '-N', utils.get_sound('notify')]) | def crack_system(params): if params[1] == 'notify' or params[1] == 'notify_with_sound': if not get_prefs('use_native_notify'): return summary = urllib.unquote(params[2]) body = urllib.unquote(params[3]) notify.update(summary, body) notify.show() if params[1] == 'notify_with_sound': gobject.idle_add(os.system, 'aplay -q... |
$(' | $('.version').text('%s'); | def apply_config(): version = 'ver %s (%s)'% (hotot.__version__, hotot.__codename__) exts_enabled = json.dumps(get_prefs('exts_enabled')) webv.execute_script(''' $('#version').text('%s'); ext.exts_enabled = %s; ''' % (version , exts_enabled)) apply_prefs() pass |
msg = 'Unknow Errors ... ' | msg = 'Unknown Errors ... ' | def request(uuid, method, url, params={}, headers={},files=[],additions=''): scripts = '' try: if (method == 'POST'): result = _post(url, params, headers, files, additions) else: result = _get(url, params, headers) pass except urllib2.HTTPError, e: msg = 'Unknow Errors ... ' if http_code_msg_table.has_key(e.getcode()):... |
settings.set_property('enable-universal-access-from-file-uris', True) settings.set_property('enable-file-access-from-file-uris', True) settings.set_property('enable-page-cache', True) settings.set_property('tab-key-cycles-through-elements', True) settings.set_property('enable-default-context-menu', False) | try: settings.set_property('enable-universal-access-from-file-uris', True) settings.set_property('enable-default-context-menu', False) settings.set_property('enable-page-cache', True) settings.set_property('tab-key-cycles-through-elements', True) settings.set_property('enable-file-access-from-file-uris', True) except: ... | def __init__(self): WebView.__init__(self) self.load_finish_flag = False self.set_property('can-focus', True) self.set_property('can-default', True) self.set_full_content_zoom(1) self.clipbord = gtk.Clipboard() |
mitem_resume.connect('activate', self.on_trayicon_activate); | mitem_resume.connect('activate', self.on_trayicon_activate) | def build_gui(self): self.window = gtk.Window() gtk.window_set_default_icon_from_file( utils.get_ui_object('imgs/ic64_hotot_classics.png')) self.window.set_icon_from_file( utils.get_ui_object('imgs/ic64_hotot_classics.png')) |
mitem_prefs.connect('activate', self.on_mitem_prefs_activate); | mitem_prefs.connect('activate', self.on_mitem_prefs_activate) | def build_gui(self): self.window = gtk.Window() gtk.window_set_default_icon_from_file( utils.get_ui_object('imgs/ic64_hotot_classics.png')) self.window.set_icon_from_file( utils.get_ui_object('imgs/ic64_hotot_classics.png')) |
mitem_about.connect('activate', self.on_mitem_about_activate); | mitem_about.connect('activate', self.on_mitem_about_activate) | def build_gui(self): self.window = gtk.Window() gtk.window_set_default_icon_from_file( utils.get_ui_object('imgs/ic64_hotot_classics.png')) self.window.set_icon_from_file( utils.get_ui_object('imgs/ic64_hotot_classics.png')) |
mitem_quit.connect('activate', self.on_mitem_quit_activate); | mitem_quit.connect('activate', self.on_mitem_quit_activate) | def build_gui(self): self.window = gtk.Window() gtk.window_set_default_icon_from_file( utils.get_ui_object('imgs/ic64_hotot_classics.png')) self.window.set_icon_from_file( utils.get_ui_object('imgs/ic64_hotot_classics.png')) |
mitem_resume.connect('activate', self.on_mitem_resume_activate); | mitem_resume.connect('activate', self.on_mitem_resume_activate) | def build_gui(self): self.window = gtk.Window() gtk.window_set_default_icon_from_file( utils.get_ui_object('imgs/ic64_hotot_classics.png')) self.window.set_icon_from_file( utils.get_ui_object('imgs/ic64_hotot_classics.png')) |
pass | def _on_hotkey_compose(self): if config.get(self.active_profile, 'use_native_input'): if not self.tbox_status.is_focus(): self.inputw.hide() pass self.inputw.present() self.tbox_status.grab_focus() else: if not self.webv.is_focus(): self.window.hide() pass self.window.present() self.webv.grab_focus() | |
config.loads(); | config.loads() | def main(): global HAS_INDICATOR gtk.gdk.threads_init() config.loads(); config.load_sys_conf() if not config.sys_get('use_ubuntu_indicator'): HAS_INDICATOR = False try: import dl libc = dl.open('/lib/libc.so.6') libc.call('prctl', 15, 'hotot', 0, 0, 0) except: pass agent.init_notify() app = Hotot() agent.app = app if H... |
settings.set_property('tab-key-cycles-through-elements', False) | settings.set_property('tab-key-cycles-through-elements', True) | def __init__(self): webkit.WebView.__init__(self) self.load_finish_flag = False self.set_property('can-focus', True) self.set_property('can-default', True) self.set_full_content_zoom(1) self.clipbord = gtk.Clipboard() |
gtk.window_set_default_icon_name("gtk-dnd") self.window.set_icon_name("gtk-dnd") | gtk.window_set_default_icon_from_file( config.abspath + '/imgs/ic64_hotot.png') self.window.set_icon_from_file( config.abspath + '/imgs/ic64_hotot.png') | def build_gui(self): self.window = gtk.Window() gtk.window_set_default_icon_name("gtk-dnd") self.window.set_icon_name("gtk-dnd") self.window.set_default_size(750, 550) self.window.set_title("Hotot") self.window.set_position(gtk.WIN_POS_CENTER) |
self.window.set_title("Hotot") | self.window.set_title('Hotot') | def build_gui(self): self.window = gtk.Window() gtk.window_set_default_icon_name("gtk-dnd") self.window.set_icon_name("gtk-dnd") self.window.set_default_size(750, 550) self.window.set_title("Hotot") self.window.set_position(gtk.WIN_POS_CENTER) |
libwebkit = ctypes.CDLL('libwebkitgtk-1.0.so.0.2.0') | libwebkit = ctypes.CDLL('libwebkitgtk-1.0.so.0') | def webkit_set_proxy_uri(uri): if uri and '://' not in uri: uri = 'https://' + uri pass try: if os.name == 'nt': libgobject = ctypes.CDLL('libgobject-2.0-0.dll') libsoup = ctypes.CDLL('libsoup-2.4-1.dll') libwebkit = ctypes.CDLL('libwebkit-1.0-2.dll') pass else: libgobject = ctypes.CDLL('libgobject-2.0.so.0') libsoup =... |
gobject.idle_add(webv.execute_script, "new Image().src='http://mobile.twitter.com/';") | gobject.idle_add(webv.execute_script, "new Image().src='http://google.com/';") | def apply_proxy_setting(): if get_prefs('use_http_proxy'): proxy_uri = "https://%s:%s" % ( get_prefs('http_proxy_host') , get_prefs('http_proxy_port')) webkit_set_proxy_uri(proxy_uri) pass else: webkit_set_proxy_uri("") pass gobject.idle_add(webv.execute_script, "new Image().src='http://mobile.twitter.com/';") pass |
, font_family_list, font_family_used, font_size | , json.dumps(font_family_list), font_family_used, font_size | def push_prefs(): # account settings remember_password = 'true' if config.remember_password else 'false' consumer_key = config.consumer_key consumer_secret = config.consumer_secret # system settings shortcut_summon_hotot = config.shortcut_summon_hotot # display settings font_family_list = [ff.get_name() for ff in gtk... |
config.set(app.active_profile, 'api_base', 'https://identi.ca/api/') | set_prefs('api_base', 'https://identi.ca/api/') | def select_config(protocol): if protocol == 'identica': config.set(app.active_profile, 'api_base', 'https://identi.ca/api/') execute_script("lib.twitterapi.api_base='https://identi.ca/api/'") pass |
return DEFAULT_SCREEN_NAME | return json.dumps(DEFAULT_SCREEN_NAME) | def get_screen_name(webv): if CAN_EVAL_SCRIPT: return webv.ctx().EvaluateScript(''' utility.DB.json(utility.DB.auto_complete_list) ''') else: return DEFAULT_SCREEN_NAME |
ui.Header.update_status('%s'); | ui.StatusBox.update_status('%s'); | def update_status(text): view.execute_script(''' ui.Header.update_status('%s'); ''' % text); pass |
if (method == 'POST'): result = _post(url, params, headers) | scripts = '' try: if (method == 'POST'): result = _post(url, params, headers) else: result = _get(url, params, headers) except urllib2.HTTPError, e: content = '<p><label>HTTP Code:</label> %s <br/><label>URL:</label> %s<br/><label>Details:</label> %s<br/></p>' % (e.getcode(), e.geturl(), str(e)) scripts = ''' ui.Messag... | def request(uuid, method, url, params={}, headers={}): if (method == 'POST'): result = _post(url, params, headers) else: result = _get(url, params, headers) scripts = '' if result[0] != '{' and result[0] != '[': scripts = '''lib.twitterapi.success_task_table['%s']('%s'); ''' % (uuid, result) else: scripts = '''lib.twi... |
result = _get(url, params, headers) scripts = '' if result[0] != '{' and result[0] != '[': scripts = '''lib.twitterapi.success_task_table['%s']('%s'); ''' % (uuid, result) else: scripts = '''lib.twitterapi.success_task_table['%s'](%s); ''' % (uuid, result) | if result[0] != '{' and result[0] != '[': scripts = '''lib.twitterapi.success_task_table['%s']('%s'); ''' % (uuid, result) else: scripts = '''lib.twitterapi.success_task_table['%s'](%s); ''' % (uuid, result) pass scripts += '''delete lib.twitterapi.error_task_table['%s']; delete lib.twitterapi.error_task_table['%s']; '... | def request(uuid, method, url, params={}, headers={}): if (method == 'POST'): result = _post(url, params, headers) else: result = _get(url, params, headers) scripts = '' if result[0] != '{' and result[0] != '[': scripts = '''lib.twitterapi.success_task_table['%s']('%s'); ''' % (uuid, result) else: scripts = '''lib.twi... |
mitem_resume.connect('activate', self.on_mitem_resume_activate); | mitem_resume.connect('activate', self.on_trayicon_activate); | def build_gui(self): self.window = gtk.Window() gtk.window_set_default_icon_from_file( config.get_ui_object('imgs/ic64_hotot.png')) self.window.set_icon_from_file( config.get_ui_object('imgs/ic64_hotot.png')) |
builder.set_field_text('donors', _('Donors'), "Separate multiple entries using comments.") | builder.set_field_text('donors', _('Donors'), "Separate multiple entries using commas.") | def build_package_iati_form(is_admin=False): builder = package.build_package_form() # IATI specifics #Publishing Entity: builder.add_field(AtLeastOneGroupSelectField('groups', allow_empty=False)) #builder.add_field(common.TextExtraField('publisher')) #builder.set_field_text('publisher', _('Publishing entity')) #P... |
builder.set_field_text('donors_type', _('Donor type'), "Separate multiple entries using comments.") | builder.set_field_text('donors_type', _('Donor type'), "Separate multiple entries using commas.") | def build_package_iati_form(is_admin=False): builder = package.build_package_form() # IATI specifics #Publishing Entity: builder.add_field(AtLeastOneGroupSelectField('groups', allow_empty=False)) #builder.add_field(common.TextExtraField('publisher')) #builder.set_field_text('publisher', _('Publishing entity')) #P... |
builder.set_field_text('donors_country', _('Donor country'), "Separate multiple entries using comments.") | builder.set_field_text('donors_country', _('Donor country'), "Separate multiple entries using commas.") | def build_package_iati_form(is_admin=False): builder = package.build_package_form() # IATI specifics #Publishing Entity: builder.add_field(AtLeastOneGroupSelectField('groups', allow_empty=False)) #builder.add_field(common.TextExtraField('publisher')) #builder.set_field_text('publisher', _('Publishing entity')) #P... |
label = NomGene+AjouteZero(i)+"-" | label = NomGene+"-"+AjouteZero(i) | def AjouteZero(n): N = str(n) a = [] for i in range(len(N),4): a.append("0") a.append(N) return "".join(a) |
print f.filename, | print f.basename, | def AjouteZero(n): N = str(n) a = [] for i in range(len(N),4): a.append("0") a.append(N) return "".join(a) |
self.raw_data = None | def __init__(self, label=u'', validators=None, parse_kwargs=None, display_format='%Y-%m-%d %H:%M', **kwargs): super(DateTimeField, self).__init__(label, validators, **kwargs) if parse_kwargs is None: parse_kwargs = {} self.parse_kwargs = parse_kwargs self.display_format = display_format self.raw_data = None | |
if self.raw_data is not None: return self.raw_data | if self.raw_data: return u' '.join(self.raw_data) | def _value(self): if self.raw_data is not None: return self.raw_data else: return self.data and self.data.strftime(self.display_format) or u'' |
self.raw_data = str.join(' ', valuelist) | date_str = u' '.join(valuelist) | def process_formdata(self, valuelist): if valuelist: self.raw_data = str.join(' ', valuelist) parse_kwargs = self.parse_kwargs.copy() if 'default' not in parse_kwargs: try: parse_kwargs['default'] = self.default() except TypeError: parse_kwargs['default'] = self.default try: self.data = parser.parse(self.raw_data, **pa... |
self.data = parser.parse(self.raw_data, **parse_kwargs) | self.data = parser.parse(date_str, **parse_kwargs) | def process_formdata(self, valuelist): if valuelist: self.raw_data = str.join(' ', valuelist) parse_kwargs = self.parse_kwargs.copy() if 'default' not in parse_kwargs: try: parse_kwargs['default'] = self.default() except TypeError: parse_kwargs['default'] = self.default try: self.data = parser.parse(self.raw_data, **pa... |
if field.raw_data is not None and (not field.raw_data or not field.raw_data[0].strip()): | if field.raw_data is None or not field.raw_data or not field.raw_data[0].strip(): | def __call__(self, form, field): if field.raw_data is not None and (not field.raw_data or not field.raw_data[0].strip()): field.errors[:] = [] raise StopValidation() |
raise ValueError('Missing reference_class attribute in ' | raise TypeError('Missing reference_class attribute in ' | def __init__(self, label=u'', validators=None, reference_class=None, label_attr=None, allow_blank=False, blank_text=u'', **kwargs): super(ReferencePropertyField, self).__init__(label, validators, **kwargs) self.label_attr = label_attr self.allow_blank = allow_blank self.blank_text = blank_text self._set_data(None) if r... |
raise ValidationError('Not a valid choice') | raise ValueError(self.gettext(u'Not a valid choice')) | def pre_validate(self, form): if not self.allow_blank or self.data is not None: for obj in self.queryset: if self.data == str(obj.key()): break else: raise ValidationError('Not a valid choice') |
self.assert_("does not match format" in form.a.errors[0]) | self.assert_("not match format" in form.a.errors[0]) | def test(self): d = datetime(2008, 5, 5, 4, 30, 0, 0) form = self.F(DummyPostData(a=['2008-05-05', '04:30:00'], b=['2008-05-05 04:30'])) self.assertEqual(form.a.data, d) self.assertEqual(form.a(), u"""<input id="a" name="a" type="text" value="2008-05-05 04:30:00" />""") self.assertEqual(form.b.data, d) self.assertEqual... |
self.assertEqual(form.name._default, None) self.assertEqual(form.city._default, None) self.assertEqual(form.age._default, None) self.assertEqual(form.is_admin._default, False) | self.assertEqual(form.name.default, None) self.assertEqual(form.city.default, None) self.assertEqual(form.age.default, None) self.assertEqual(form.is_admin.default, False) | def test_default_value(self): form_class = model_form(Author) |
for obj in self.queryset: | for obj in self.query: | def pre_validate(self, form): if not self.allow_blank or self.data is not None: for obj in self.queryset: if self.data == str(obj.key()): break else: raise ValueError(self.gettext(u'Not a valid choice')) |
return f.DateTimeField(format='%Y-%m-%d', **kwargs) | return f.DateField(format='%Y-%m-%d', **kwargs) | def convert_DateProperty(model, prop, kwargs): """Returns a form field for a ``db.DateProperty``.""" if prop.auto_now or prop.auto_now_add: return None return f.DateTimeField(format='%Y-%m-%d', **kwargs) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.