rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
ts = message_filters.TimeSynchronizer([lsub, rsub], 4) | if 1: ts = message_filters.TimeSynchronizer([lsub, rsub], 4) else: ts = message_filters.TimeSynchronizer([Resizer(lsub), Resizer(rsub)], 4) | def __init__(self, chess_size, dim, service_check): |
msub.registerCallback(self.queue_monocular) | if 1: msub.registerCallback(self.queue_monocular) else: Resizer(msub).registerCallback(self.queue_monocular) | def __init__(self, chess_size, dim, service_check): |
Return the square edge length, in meters, or -1 if not possible. | :param li: source left image containing chessboard :type li: :class:`cvMat` :param ri: source left image containing chessboard :type ri: :class:`cvMat` Post calibration, return the square edge length, in meters, or -1 if not possible. | def chessboard_size(self, li, ri): """ Return the square edge length, in meters, or -1 if not possible. """ (ok, corners) = get_corners(li) if not ok: return -1 src = cv.Reshape(mk_image_points([corners]), 2) L = list(cvmat_iterator(self.lundistort_points(src))) (ok, corners) = get_corners(ri) if not ok: return -1 src ... |
image_topic = rospy.resolve_name("monocular") + "/" + rospy.resolve_name("image") | image_topic = rospy.resolve_name("monocular") + rospy.resolve_name("image") | def __init__(self, chess_size, dim): self.chess_size = chess_size self.dim = dim |
left_topic = rospy.resolve_name("stereo") + "/left/" + rospy.resolve_name("image") | left_topic = rospy.resolve_name("stereo") + "/left" + rospy.resolve_name("image") | def __init__(self, chess_size, dim): self.chess_size = chess_size self.dim = dim |
right_topic = rospy.resolve_name("stereo") + "/right/" + rospy.resolve_name("image") | right_topic = rospy.resolve_name("stereo") + "/right" + rospy.resolve_name("image") | def __init__(self, chess_size, dim): self.chess_size = chess_size self.dim = dim |
alts = list(self.alts(word)) | alts = [] for i in range(1, self.maxalt[word] + 1): if (word,i) in self: alts.append(dict.__getitem__(self, (word, i))) del self[word, i] | def del_alt_phones(self, word, alt): """ Delete alternate pronunciation alt for word. |
raise HtkScanningError, ("Scanning error. Illegal character '%s' at line %s " % (lexdata[lexpos], t.lexer.lineno), lexdata[lexpos:]) | raise HtkScanningError, ("Scanning error. Illegal character '%s' at line %s " % (t.lexer.lexdata[t.lexpos], t.lexer.lineno), t.lexer.lexdata[t.lexpos:]) | def t_error(t): raise HtkScanningError, ("Scanning error. Illegal character '%s' at line %s " % (lexdata[lexpos], t.lexer.lineno), lexdata[lexpos:]) |
fn = 'release/Mumble-%s.dmg' % ver title = 'Mumble %s' % ver | if options.universal: fn = 'release/Mumble-Universal-%s.dmg' % ver title = 'Mumble %s (Universal) ' %ver else: fn = 'release/Mumble-%s.dmg' % ver title = 'Mumble %s ' % ver | def create(self): ''' Create the disk image itself. ''' print ' * Creating diskimage. Please wait...' if os.path.exists(self.filename): shutil.rmtree(self.filename) p = Popen(['hdiutil', 'create', '-srcfolder', self.tmp, '-format', 'UDBZ', '-volname', self.volname, self.filename]) retval = p.wait() print ' * Removing t... |
fn = 'release/Mumble-Snapshot-%s-%s.dmg' % (d, ver) title = 'Mumble Snapshot %s (%s)' % (ver, d) | if options.universal: fn = 'release/Mumble-Universal-Snapshot-%s-%s.dmg' % (d, ver) title = 'Mumble Snapshot %s (Universal, %s)' % (ver, d) else: fn = 'release/Mumble-Snapshot-%s-%s.dmg' % (d, ver) title = 'Mumble Snapshot %s (%s)' % (ver, d) | def create(self): ''' Create the disk image itself. ''' print ' * Creating diskimage. Please wait...' if os.path.exists(self.filename): shutil.rmtree(self.filename) p = Popen(['hdiutil', 'create', '-srcfolder', self.tmp, '-format', 'UDBZ', '-volname', self.volname, self.filename]) retval = p.wait() print ' * Removing t... |
pid = server.registerUser(username) reg = server.getRegistration(pid) reg.pw = password server.updateregistration(reg) | info = {Murmur.UserInfo.UserName:username, Murmur.UserInfo.UserPassword:password} server.registerUser(info) | def doregister(self, id = None, username = None, password = None, cpassword = None): title = "Mumble Auth - Register"; sema_ids.acquire() try: # Check if all parameters are ok if not id in ids: body = self.err_id # Invalid id elif not username or " " in username: # Invalid username body = self.err_username + \ self.sni... |
bn = os.path.basename(path) if not bn in lib: | if lib != bn: | def get_binary_libs(self, path): ''' Get a list of libraries that we depend on. ''' m = re.compile('^\t(.*)\ \(.*$') libs = Popen(['otool', '-L', path], stdout=PIPE).communicate()[0] libs = string.split(libs, '\n') ret = [] for line in libs: g = m.match(line) if g is not None: lib = g.groups()[0] bn = os.path.basename(... |
shutil.copy('release/libcelt.0.7.0.dylib', dst) | shutil.copy('release/libcelt0.0.7.0.dylib', dst) | def copy_codecs(self): ''' Copy over dynamic CELT libraries. ''' print ' * Copying CELT libraries.' dst = os.path.join(self.bundle, 'Contents', 'Codecs') os.makedirs(dst) shutil.copy('release/libcelt.0.7.0.dylib', dst) |
walkDir(menutv(sender=""), 1, 1, recurse=True) | walkDir(myhulu(sender=""), 1, 1, recurse=True) walkDir(channels(sender=""), 1, 1, recurse=True) walkDir(feeds(sender=""), 1, 1, recurse=True) | def UpdateCache(): #cacheLevel = Prefs.Get("cacheLevel") #if cacheLevel = "Low": # cacheLevel = 2 #else: # cacheLevel = 5 #walkDir(MainMenu(), cacheLevel, 0) walkDir(menutv(sender=""), 1, 1, recurse=True) walkDir(menumovies(sender=""), 1, 1, recurse=True) walkDir(menupopular(sender=""), 1, 1, recurse=True) walkDir(me... |
return result[0][len('user-'):] | if result[0].startswith('user-'): return result[0][len('user-'):] return None | def get_user_from_openid(self, openid_url): """Returns the username for the given openid_url, or None. """ result = config.storage_class.find_slates_with('user', 'auth_openid', openid_url) if len(result) == 0: return None elif len(result) == 1: return result[0][len('user-'):] else: raise ValueError('More than one user ... |
pickled = pickle.dumps(value).encode('utf-8') | pickled = self.binary(pickle.dumps(value)) | def set(self, key, value): if key in self.section.lgauth_conf_indexed: pickled = value else: pickled = pickle.dumps(value).encode('utf-8') |
result = pickle.loads(str(result.decode('utf-8'))) | result = pickle.loads(result) | def _get(self, key, value): """Translates the given value for the specified key into python objects (from pickle). """ result = value if key not in self.section.lgauth_conf_indexed: result = pickle.loads(str(result.decode('utf-8'))) return result |
config.auth.login(user, forgotpass=True) | config.auth.login(user, admin=True) | def forgot_password_response(self, user, code, redirect): error = 'Unknown error' try: u = config.auth.user_get_record(user) ucode = u.get('email_forgot_code') if ucode is None: raise AuthError('Unknown request') if (datetime.datetime.utcnow() - ucode[0]).days >= 1: raise AuthError('Unknown request') if code != ucode[1... |
version = "0.6.0", | version = "0.7.0", | def main(): setup( name = "bx-python", version = "0.6.0", py_modules = [ 'psyco_full' ], packages = find_packages( 'lib' ), package_dir = { '': 'lib' }, package_data = { '': ['*.ps'] }, scripts = glob( "scripts/*.py" ), ext_modules = get_extension_modules(), test_suite = 'nose.collector', setup_requires = ['nose>=0.10... |
author = "James Taylor, Bob Harris, David King, Brent Pedersen, and others", | author = "James Taylor, Bob Harris, David King, Brent Pedersen, Kanwei Li, and others", | def main(): setup( name = "bx-python", version = "0.6.0", py_modules = [ 'psyco_full' ], packages = find_packages( 'lib' ), package_dir = { '': 'lib' }, package_data = { '': ['*.ps'] }, scripts = glob( "scripts/*.py" ), ext_modules = get_extension_modules(), test_suite = 'nose.collector', setup_requires = ['nose>=0.10... |
url = "http://bx-python.trac.bx.psu.edu", | url = "http://bitbucket.org/james_taylor/bx-python/wiki/Home", | def main(): setup( name = "bx-python", version = "0.6.0", py_modules = [ 'psyco_full' ], packages = find_packages( 'lib' ), package_dir = { '': 'lib' }, package_data = { '': ['*.ps'] }, scripts = glob( "scripts/*.py" ), ext_modules = get_extension_modules(), test_suite = 'nose.collector', setup_requires = ['nose>=0.10... |
if(ourYoungest < theirYoungest): | if(ourYoungest <= theirYoungest): | def check_sync(self, log, db, repos): ourYoungest = self.youngest_rev(db) theirYoungest = repos.get_youngest_rev() #log.info("TKT: check_sync %d/%d" % (ourYoungest,theirYoungest)) if(ourYoungest < theirYoungest): self.resync(log, db, repos, ourYoungest, theirYoungest) |
if number.startswith("747") or number.startswith("1747"): | if number.startswith("747") or number.startswith("1747") or number.startswith("+1747"): | def guess_phone_type(number): if number.startswith("747") or number.startswith("1747"): return GVoiceBackend.PHONE_TYPE_GIZMO else: return GVoiceBackend.PHONE_TYPE_MOBILE |
def main(): | def print_contacts(): | def main(): logging.basicConfig(level=logging.DEBUG) args = sys.argv username = args[1] password = args[2] b = backend.GVoiceBackend() b.login(username, password) assert b.is_authed() book = abook.Addressbook(b) book.update() for number in book.get_numbers(): print number, book.get_contact_name(number), book.get_pho... |
print number, book.get_contact_name(number), book.get_phone_type(number) | pprint.pprint(book._numbers[number]) def print_blank_names(): logging.basicConfig(level=logging.DEBUG) args = sys.argv username = args[1] password = args[2] b = backend.GVoiceBackend() b.login(username, password) assert b.is_authed() book = abook.Addressbook(b) book.update() for number in book.get_numbers(): if no... | def main(): logging.basicConfig(level=logging.DEBUG) args = sys.argv username = args[1] password = args[2] b = backend.GVoiceBackend() b.login(username, password) assert b.is_authed() book = abook.Addressbook(b) book.update() for number in book.get_numbers(): print number, book.get_contact_name(number), book.get_pho... |
main() | if True: print_contacts() else: print_blank_names() | def main(): logging.basicConfig(level=logging.DEBUG) args = sys.argv username = args[1] password = args[2] b = backend.GVoiceBackend() b.login(username, password) assert b.is_authed() book = abook.Addressbook(b) book.update() for number in book.get_numbers(): print number, book.get_contact_name(number), book.get_pho... |
("+1747", None), | ("\+1747", None), | def get_sane_callback(backend): """ Try to set a sane default callback number on these preferences 1) 1747 numbers ( Gizmo ) 2) anything with gizmo in the name 3) anything with computer in the name 4) the first value """ numbers = backend.get_callback_numbers() priorityOrderedCriteria = [ ("+1747", None), ("1747", Non... |
if numberCriteria is not None and re.compile(numberCriteria).match(number) is None: | if numberMatcher is not None and numberMatcher.match(number) is None: | def get_sane_callback(backend): """ Try to set a sane default callback number on these preferences 1) 1747 numbers ( Gizmo ) 2) anything with gizmo in the name 3) anything with computer in the name 4) the first value """ numbers = backend.get_callback_numbers() priorityOrderedCriteria = [ ("+1747", None), ("1747", Non... |
if descriptionCriteria is not None and re.compile(descriptionCriteria).match(description) is None: | if descriptionMatcher is not None and descriptionMatcher.match(description) is None: | def get_sane_callback(backend): """ Try to set a sane default callback number on these preferences 1) 1747 numbers ( Gizmo ) 2) anything with gizmo in the name 3) anything with computer in the name 4) the first value """ numbers = backend.get_callback_numbers() priorityOrderedCriteria = [ ("+1747", None), ("1747", Non... |
def handle(self, handleType, handleId): | def get_handle_by_id(self, handleType, handleId): | def handle(self, handleType, handleId): """ @abstract """ raise NotImplementedError("Abstract function called") |
'contacts-poll-period': 'i', 'voicemail-poll-period': 'i', 'texts-poll-period': 'i', | 'contacts-poll-period-in-hours': 'i', 'voicemail-poll-period-in-minutes': 'i', 'texts-poll-period-in-minutes': 'i', | def __init__(self, parameters = None): if parameters is None: return self.useGVContacts = parameters["use-gv-contacts"] self.contactsPollPeriodInHours = parameters['contacts-poll-period-in-hours'] self.voicemailPollPeriodInMinutes = parameters['voicemail-poll-period-in-minutes'] self.textsPollPeriodInMinutes = paramete... |
if len(args) != 1: | if not args: | def do_call(self, args): if len(args) != 1: self._report_new_message("Must specify the phone number and only the phone nunber") return |
number = args[0] | number = args | def do_call(self, args): if len(args) != 1: self._report_new_message("Must specify the phone number and only the phone nunber") return |
publishProps = self._conn._generate_props(telepathy.CHANNEL_TYPE_FILE_TRANSFER, self.__otherHandle, False) self._conn._channel_manager.channel_for_props(publishProps, signal=True) | try: publishProps = self._conn._generate_props(telepathy.CHANNEL_TYPE_FILE_TRANSFER, self.__otherHandle, False) self._conn._channel_manager.channel_for_props(publishProps, signal=True) except Exception, e: self._report_new_message(str(e)) | def do_grab_log(self, args): if args: self._report_new_message("No arguments supported") return publishProps = self._conn._generate_props(telepathy.CHANNEL_TYPE_FILE_TRANSFER, self.__otherHandle, False) self._conn._channel_manager.channel_for_props(publishProps, signal=True) |
p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=theonering" | p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=The%20One%20Ring" | def build_package(distribution): try: os.chdir(os.path.dirname(sys.argv[0])) except: pass py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution] p = py2deb.Py2deb(__appname__) if distribution == "debian": p.prettyName = constants.__pretty_app_name__ else: p.prettyName = "Google Voice plugin for Conversations... |
print "is_inbound", self._targetHandle, self._initiatorHandle print "is_inbound", self._targetID, self._initiatorID | def is_inbound(self): isInbound = self._targetHandle == self._initiatorHandle print "is_inbound", self._targetHandle, self._initiatorHandle print "is_inbound", self._targetID, self._initiatorID return isInbound | |
self.manager.disconnect_completed(self) | self.manager.disconnect_completed() | def disconnect(self, reason): _moduleLogger.info("Disconnecting") |
for conv in self._conversations.itervalues(): conv.compress(self.OLDEST_MESSAGE_WINDOW) | for key, mergedConv in self._conversations.iteritems(): _moduleLogger.debug("%s \tSaving %s" % (self._name, key)) for conv in mergedConv.conversations: _moduleLogger.debug("%s \t\tSaving %s (%r) %r %r %r" % (self._name, conv.id, conv.time, conv.isRead, conv.isArchived, len(conv.messages))) | def save(self, path): try: _moduleLogger.info("%s Saving cache" % (self._name, )) for conv in self._conversations.itervalues(): conv.compress(self.OLDEST_MESSAGE_WINDOW) dataToDump = (constants.__version__, constants.__build__, self._conversations) with open(path, "wb") as f: pickle.dump(dataToDump, f, pickle.HIGHEST_P... |
_moduleLogger.debug("%s \t\tLoaded %s (%r) %r %r %r" % (self._name, conv.id, conv.time, conv.isRead, conv.isArchived, len(conv.messages))) | message = "%s \t\tLoaded %s (%r) %r %r %r" % ( self._name, conv.id, conv.time, conv.isRead, conv.isArchived, len(conv.messages) ) _moduleLogger.debug(message) | def load(self, path): _moduleLogger.debug("%s Loading cache" % (self._name, )) assert not self._conversations try: with open(path, "rb") as f: fileVersion, fileBuild, convs = pickle.load(f) except (pickle.PickleError, IOError, EOFError, ValueError): _moduleLogger.exception("While loading for %s" % self._name) return |
_moduleLogger.info("%s Saving cache" % (self._name, )) for key, mergedConv in self._conversations.iteritems(): _moduleLogger.debug("%s \tSaving %s" % (self._name, key)) for conv in mergedConv.conversations: _moduleLogger.debug("%s \t\tSaving %s (%r) %r %r %r" % (self._name, conv.id, conv.time, conv.isRead, conv.isAr... | def save(self, path): try: _moduleLogger.info("%s Saving cache" % (self._name, )) #for conv in self._conversations.itervalues(): # conv.compress(self.OLDEST_MESSAGE_WINDOW) | |
_moduleLogger.debug("%s \t\tUpdated %s (%r) %r %r %r" % (self._name, conv.id, conv.time, conv.isRead, conv.isArchived, len(conv.messages))) | message = "%s \t\tUpdated %s (%r) %r %r %r" % ( self._name, conv.id, conv.time, conv.isRead, conv.isArchived, len(conv.messages) ) _moduleLogger.debug(message) | def _update(self): conversationResult = yield ( self._get_raw_conversations, (), {}, ) |
def compress(self, timedelta): now = datetime.datetime.now() oldNumConvs = len(self._conversations) oldConvs = self._conversations self._conversations = [ conv for conv in self._conversations if (now - conv.time) < timedelta ] newNumConvs = len(self._conversations) if oldNumConvs != newNumConvs: _moduleLogger.debug("Co... | def compress(self, timedelta): now = datetime.datetime.now() oldNumConvs = len(self._conversations) oldConvs = self._conversations self._conversations = [ conv for conv in self._conversations if (now - conv.time) < timedelta ] newNumConvs = len(self._conversations) if oldNumConvs != newNumConvs: _moduleLogger.debug("Co... | |
message.when = conv.time.strftime("%I:%M %p") | try: message.when = conv.time.strftime("%I:%M %p") except ValueError: _moduleLogger.exception("Confusing time provided: %r" % conv.time) message.when = "Unknown" | def _parse_voicemail(self, voicemailHtml): splitVoicemail = self._seperateVoicemailsRegex.split(voicemailHtml) for messageId, messageHtml in itergroup(splitVoicemail[1:], 2): conv = Conversation() conv.type = Conversation.TYPE_VOICEMAIL conv.id = messageId.strip() |
validate_response(json) | self._validate_response(json) | def _parse_with_validation(self, page): json = parse_json(page) validate_response(json) return json |
def validate_response(response): """ Validates that the JSON response is A-OK """ try: assert response is not None assert 'ok' in response assert response['ok'] except AssertionError: raise RuntimeError('There was a problem with GV: %s' % response) | def validate_response(response): """ Validates that the JSON response is A-OK """ try: assert response is not None assert 'ok' in response assert response['ok'] except AssertionError: raise RuntimeError('There was a problem with GV: %s' % response) | |
self._report_new_message(currentStdout.getvalue()) | stdoutData = currentStdout.getvalue().strip() if stdoutData: self._report_new_message(stdoutData) | def Send(self, messageType, text): if messageType != telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL: raise telepathy.errors.NotImplemented("Unhandled message type: %r" % messageType) |
p.prettyName = constants.__pretty_app_name__ | if distribution == "debian": p.prettyName = constants.__pretty_app_name__ else: p.prettyName = "Google Voice protocol plugin for Conversations and Contacts" | def build_package(distribution): try: os.chdir(os.path.dirname(sys.argv[0])) except: pass py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution] p = py2deb.Py2deb(__appname__) p.prettyName = constants.__pretty_app_name__ p.description = __description__ p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?pro... |
finally: return False | except Exception: pass return False | def _on_once(self): self.cancel() try: self.__func() finally: return False |
finally: return False | except Exception: pass return False __QUEUE_EMPTY = object() class AsyncPool(object): def __init__(self): self.__workQueue = Queue.Queue() self.__thread = threading.Thread( name = type(self).__name__, target = self.__consume_queue, ) self.__isRunning = True def start(self): self.__thread.start() def stop(self): ... | def _on_once(self): self.cancel() try: self.__func() finally: return False |
if handle in self._channels[type]: self._channels[type].setdefault(handle, []).append(channel) | self._channels[type].setdefault(handle, []).append(channel) | def create_channel_for_props(self, props, signal=True, **args): """Create a new channel with theses properties""" type, _, handle = self._get_type_requested_handle(props) |
if interface not in self.ATTRIBUTES: raise telepathy.errors.InvalidArgument( 'Interface %s is not supported by GetContactAttributes' % (interface) ) | if interface in self.ATTRIBUTES: supportedInterfaces.add(interface) else: _moduleLogger.debug("Ignoring unsupported interface %s" % interface) | def GetContactAttributes(self, handles, interfaces, hold, sender): #InspectHandle already checks we're connected, the handles and handle type. for interface in interfaces: if interface not in self.ATTRIBUTES: raise telepathy.errors.InvalidArgument( 'Interface %s is not supported by GetContactAttributes' % (interface) ) |
interfaces = set(interfaces + [telepathy.CONNECTION]) for interface in interfaces: | supportedInterfaces.add(telepathy.CONNECTION) for interface in supportedInterfaces: | def GetContactAttributes(self, handles, interfaces, hold, sender): #InspectHandle already checks we're connected, the handles and handle type. for interface in interfaces: if interface not in self.ATTRIBUTES: raise telepathy.errors.InvalidArgument( 'Interface %s is not supported by GetContactAttributes' % (interface) ) |
__QUEUE_EMPTY = object() | _QUEUE_EMPTY = object() | def _on_once(self): self.cancel() try: self.__func() except Exception: pass return False |
self.__workQueue.put(__QUEUE_EMPTY) | self.__workQueue.put(_QUEUE_EMPTY) | def stop(self): self.__isRunning = False for _ in algorithms.itr_available(self.__workQueue): pass # eat up queue to cut down dumb work self.__workQueue.put(__QUEUE_EMPTY) |
if task is __QUEUE_EMPTY: | if task is _QUEUE_EMPTY: | def __consume_queue(self): while True: task = self.__workQueue.get() if task is __QUEUE_EMPTY: break func, args, kwds, on_success, on_error = task |
timeout_add_seconds(timeoutInSeconds, self._on_once) | self.__timeoutId = timeout_add_seconds(timeoutInSeconds, self._on_once) | def start(self, **kwds): assert self.__timeoutId is None |
except AttributeError: | except KeyError: | def _get_avatar(self, imageName): try: return self._avatarCache[imageName] except AttributeError: image = self._load_avatar(imageName) self._avatarCache[imageName] = image return image |
if not isinstance(value, (bool, dbus.types.Boolean)): | if not isinstance(value, (bool, dbus.Boolean)): | def check_parameters(self, parameters): """ Uses the values of self._mandatory_parameters and self._optional_parameters to validate and type check all of the provided parameters, and check all mandatory parameters are present. Sets defaults according to the defaults if the client has not provided any. """ for (parm, va... |
todel = [] for prop in props: iface, name = prop.rsplit('.', 1) if name in channel._immutable_properties: if channel._immutable_properties[name] != iface: todel.append(prop) else: todel.append(prop) for p in todel: del props[p] _success(channel._object_path, props) | returnedProps = channel.get_props() _success(channel._object_path, returnedProps) | def CreateChannel(self, request, _success, _error): type, handle_type, handle = self._check_basic_properties(request) self._validate_handle(request) props = self._alter_properties(request) |
_success(yours, channel._object_path, props) | returnedProps = channel.get_props() _success(yours, channel._object_path, returnedProps) | def EnsureChannel(self, request, _success, _error): type, handle_type, handle = self._check_basic_properties(request) self._validate_handle(request) props = self._alter_properties(request) |
_moduleLogger.info('%r %r' % (accountNumber, h.phoneNumber)) | def _get_text_channel(self, props): _, surpress_handler, h = self._get_type_requested_handle(props) | |
"name": name, | "name": unescape(name), | def _parse_history(self, historyHtml): splitVoicemail = self._seperateVoicemailsRegex.split(historyHtml) for messageId, messageHtml in itergroup(splitVoicemail[1:], 2): exactTimeGroup = self._exactVoicemailTimeRegex.search(messageHtml) exactTime = exactTimeGroup.group(1).strip() if exactTimeGroup else "" exactTime = go... |
"location": location, | "location": unescape(location), | def _parse_history(self, historyHtml): splitVoicemail = self._seperateVoicemailsRegex.split(historyHtml) for messageId, messageHtml in itergroup(splitVoicemail[1:], 2): exactTimeGroup = self._exactVoicemailTimeRegex.search(messageHtml) exactTime = exactTimeGroup.group(1).strip() if exactTimeGroup else "" exactTime = go... |
conv.location = locationGroup.group(1).strip() if locationGroup else "" | conv.location = unescape(locationGroup.group(1).strip() if locationGroup else "") | def _parse_voicemail(self, voicemailHtml): splitVoicemail = self._seperateVoicemailsRegex.split(voicemailHtml) for messageId, messageHtml in itergroup(splitVoicemail[1:], 2): conv = Conversation() conv.type = Conversation.TYPE_VOICEMAIL conv.id = messageId.strip() |
conv.name = nameGroup.group(1).strip() if nameGroup else "" | conv.name = unescape(nameGroup.group(1).strip() if nameGroup else "") | def _parse_voicemail(self, voicemailHtml): splitVoicemail = self._seperateVoicemailsRegex.split(voicemailHtml) for messageId, messageHtml in itergroup(splitVoicemail[1:], 2): conv = Conversation() conv.type = Conversation.TYPE_VOICEMAIL conv.id = messageId.strip() |
conv.name = nameGroup.group(1).strip() if nameGroup else "" | conv.name = unescape(nameGroup.group(1).strip() if nameGroup else "") | def _parse_sms(self, smsHtml): splitSms = self._seperateVoicemailsRegex.split(smsHtml) for messageId, messageHtml in itergroup(splitSms[1:], 2): conv = Conversation() conv.type = Conversation.TYPE_SMS conv.id = messageId.strip() |
return eval(s, {}, {}) | s = _COMMENT_REGEX.sub(" try: results = eval(s, {}, {}) except SyntaxError: _moduleLogger.exception("Oops") results = None return results | def safe_eval(s): _TRUE_REGEX = re.compile("true") _FALSE_REGEX = re.compile("false") s = _TRUE_REGEX.sub("True", s) s = _FALSE_REGEX.sub("False", s) return eval(s, {}, {}) |
assert 'ok' in response and response['ok'] | assert response is not None assert 'ok' in response assert response['ok'] | def validate_response(response): """ Validates that the JSON response is A-OK """ try: assert 'ok' in response and response['ok'] except AssertionError: raise RuntimeError('There was a problem with GV: %s' % response) |
self.InitialOffsetDefined(0) | assert not self.__socketName, self.__socketName self.__socketName = os.tempnam() assert self.__socket is None, self.__socket self.__socket = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) self.__socket.bind(self.__socketName) | def AcceptFile(self, addressType, accessControl, accessControlParam, offset): _moduleLogger.info("%r %r %r %r" % (addressType, accessControl, accessControlParam, offset)) self.InitialOffsetDefined(0) self._state = telepathy.constants.FILE_TRANSFER_STATE_ACCEPTED self.FileTransferStateChanged( self._state, telepathy.con... |
self._state = telepathy.constants.FILE_TRANSFER_STATE_OPEN self.FileTransferStateChanged( self._state, telepathy.constants.FILE_TRANSFER_STATE_CHANGE_REASON_NONE, ) | self.__delayWrite.start(seconds=0) | def AcceptFile(self, addressType, accessControl, accessControlParam, offset): _moduleLogger.info("%r %r %r %r" % (addressType, accessControl, accessControlParam, offset)) self.InitialOffsetDefined(0) self._state = telepathy.constants.FILE_TRANSFER_STATE_ACCEPTED self.FileTransferStateChanged( self._state, telepathy.con... |
sockittome = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sockittome.connect(accessControlParam) try: sockittome.send(self._log) finally: sockittome.close() self._transferredBytes = len(self._log) self.TransferredBytesChanged(self._transferredBytes) self._state = telepathy.constants.FILE_TRANSFER_STATE_COMPLETED... | return self.__socketName | def AcceptFile(self, addressType, accessControl, accessControlParam, offset): _moduleLogger.info("%r %r %r %r" % (addressType, accessControl, accessControlParam, offset)) self.InitialOffsetDefined(0) self._state = telepathy.constants.FILE_TRANSFER_STATE_ACCEPTED self.FileTransferStateChanged( self._state, telepathy.con... |
defaults[key] = state_machine.INFINITE_PERIOD | defaults[key] = state_machine.UpdateStateMachine.INFINITE_PERIOD | def __init__(self, cookiePath = None, defaults = None): if defaults is None: defaults = self._DEFAULTS else: for key, (quant, unit) in defaults.iteritems(): if quant == 0: defaults[key] = self._DEFAULTS[key] elif quant < 0: defaults[key] = state_machine.INFINITE_PERIOD self._username = None self._password = None |
contactsPeriodInSeconds = state_machine.to_seconds( **{defaults["contacts"][1]: defaults["contacts"][0],} ) | if defaults["contacts"][0] == state_machine.UpdateStateMachine.INFINITE_PERIOD: contactsPeriodInSeconds = state_machine.UpdateStateMachine.INFINITE_PERIOD else: contactsPeriodInSeconds = state_machine.to_seconds( **{defaults["contacts"][1]: defaults["contacts"][0],} ) | def __init__(self, cookiePath = None, defaults = None): if defaults is None: defaults = self._DEFAULTS else: for key, (quant, unit) in defaults.iteritems(): if quant == 0: defaults[key] = self._DEFAULTS[key] elif quant < 0: defaults[key] = state_machine.INFINITE_PERIOD self._username = None self._password = None |
voicemailPeriodInSeconds = state_machine.to_seconds( **{defaults["voicemail"][1]: defaults["voicemail"][0],} ) | if defaults["voicemail"][0] == state_machine.UpdateStateMachine.INFINITE_PERIOD: voicemailPeriodInSeconds = state_machine.UpdateStateMachine.INFINITE_PERIOD else: voicemailPeriodInSeconds = state_machine.to_seconds( **{defaults["voicemail"][1]: defaults["voicemail"][0],} ) | def __init__(self, cookiePath = None, defaults = None): if defaults is None: defaults = self._DEFAULTS else: for key, (quant, unit) in defaults.iteritems(): if quant == 0: defaults[key] = self._DEFAULTS[key] elif quant < 0: defaults[key] = state_machine.INFINITE_PERIOD self._username = None self._password = None |
textsPeriodInSeconds = state_machine.to_seconds( **{defaults["texts"][1]: defaults["texts"][0],} ) | if defaults["texts"][0] == state_machine.UpdateStateMachine.INFINITE_PERIOD: textsPeriodInSeconds = state_machine.UpdateStateMachine.INFINITE_PERIOD else: textsPeriodInSeconds = state_machine.to_seconds( **{defaults["texts"][1]: defaults["texts"][0],} ) | def __init__(self, cookiePath = None, defaults = None): if defaults is None: defaults = self._DEFAULTS else: for key, (quant, unit) in defaults.iteritems(): if quant == 0: defaults[key] = self._DEFAULTS[key] elif quant < 0: defaults[key] = state_machine.INFINITE_PERIOD self._username = None self._password = None |
target_id, target_handle_type) | (target_id, target_handle_type)) | def _alter_properties(self, props): target_handle_type = props.get(telepathy.interfaces.CHANNEL_INTERFACE + '.TargetHandleType', telepathy.constants.HANDLE_TYPE_NONE) target_handle = props.get(telepathy.interfaces.CHANNEL_INTERFACE + '.TargetHandle', None) target_id = props.get(telepathy.interfaces.CHANNEL_INTERFACE + ... |
self._current = self._min / 2 | self._current = self._min | def initialize_state(self): self._current = self._min / 2 |
return self._init + self._current | timeout = self._init + self._current return timeout | def timeout(self): return self._init + self._current |
_moduleLogger.info("%s Next update in %s ms" % (self._name, nextTimeout, )) | _moduleLogger.info("%s Next update in %s seconds" % (self._name, nextTimeout, )) | def _schedule_update(self): assert self._timeoutId is None self._strategy.increment_state() nextTimeout = self._strategy.timeout if nextTimeout != self.INFINITE_PERIOD: self._timeoutId = gobject_utils.timeout_add_seconds(nextTimeout, self._on_timeout) _moduleLogger.info("%s Next update in %s ms" % (self._name, nextTime... |
logging.debug("telepathy-theonering %s-%s" % (constants.__version__, constants.__build__)) | logging.info("telepathy-theonering %s-%s" % (constants.__version__, constants.__build__)) | def main(logToFile): try: os.makedirs(constants._data_path_) except OSError, e: if e.errno != 17: raise telepathy_utils.debug_divert_messages(os.getenv('THEONERING_LOGFILE')) if logToFile: logging.basicConfig( level=logging.DEBUG, filename=constants._user_logpath_, format='(%(asctime)s) %(levelname)s:%(name)s:%(messag... |
self.StatusChanged( telepathy.CONNECTION_STATUS_DISCONNECTED, telepathy.CONNECTION_STATUS_REASON_NETWORK_ERROR ) | self.disconnect(telepathy.CONNECTION_STATUS_REASON_NETWORK_ERROR) | def Connect(self): """ For org.freedesktop.telepathy.Connection """ _moduleLogger.info("Connecting...") self.StatusChanged( telepathy.CONNECTION_STATUS_CONNECTING, telepathy.CONNECTION_STATUS_REASON_REQUESTED ) try: self.__session.load(self.__cachePath) |
self.StatusChanged( telepathy.CONNECTION_STATUS_DISCONNECTED, telepathy.CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED ) | self.disconnect(telepathy.CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED) | def Connect(self): """ For org.freedesktop.telepathy.Connection """ _moduleLogger.info("Connecting...") self.StatusChanged( telepathy.CONNECTION_STATUS_CONNECTING, telepathy.CONNECTION_STATUS_REASON_REQUESTED ) try: self.__session.load(self.__cachePath) |
def _on_login(self): | def _on_login(self, *args): | def _on_login(self): _moduleLogger.info("Connected, setting up...") try: self.__session.load(self.__cachePath) |
_moduleLogger.warning('InitiatorID or InitiatorHandle not set on new channel') self._initiator = None | _moduleLogger.warning('InitiatorID or InitiatorHandle not set on new channel, assuming locally initiated') self._initiator = connection.GetSelfHandle() | def __init__(self, connection, manager, props, contactHandle): self.__manager = manager self.__props = props self.__cancelId = None |
'username': self._username, | 'account': self._username, | def queue_action(self): self._cm[telepathy.server.CONNECTION_MANAGER].RequestConnection( 'sip', { 'username': self._username, 'password': self._password, 'forward': self._forward, }, reply_handler = self._on_done, error_handler = self._on_error, ) |
p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=The%20One%20Ring" | p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=The%%20One%%20Ring" | def build_package(distribution): try: os.chdir(os.path.dirname(sys.argv[0])) except: pass py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution] p = py2deb.Py2deb(__appname__) if distribution == "debian": p.prettyName = constants.__pretty_app_name__ else: p.prettyName = "Google Voice plugin for Conversations... |
"chinook": "", | def build_package(distribution): try: os.chdir(os.path.dirname(sys.argv[0])) except: pass py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution] p = py2deb.Py2deb(__appname__) if distribution == "debian": p.prettyName = constants.__pretty_app_name__ else: p.prettyName = "Google Voice plugin for Conversations... | |
state_machine.ConstantStateStrategy( max(voicemailPeriodInSeconds * 4, self._MINIMUM_MESSAGE_PERIOD) ) | state_machine.ConstantStateStrategy(idleVoicemailPeriodInSeconds) | def __init__(self, cookiePath = None, defaults = None): if defaults is None: defaults = self._DEFAULTS else: for key, (quant, unit) in defaults.iteritems(): if quant == 0: defaults[key] = (self._DEFAULTS[key], unit) elif quant < 0: defaults[key] = (state_machine.UpdateStateMachine.INFINITE_PERIOD, unit) self._username ... |
else: | idleTextsPeriodInSeconds = state_machine.UpdateStateMachine.INFINITE_PERIOD else: initTextsPeriodInSeconds = state_machine.to_seconds(seconds=20) minTextsPeriodInSeconds = state_machine.to_seconds(seconds=1) | def __init__(self, cookiePath = None, defaults = None): if defaults is None: defaults = self._DEFAULTS else: for key, (quant, unit) in defaults.iteritems(): if quant == 0: defaults[key] = (self._DEFAULTS[key], unit) elif quant < 0: defaults[key] = (state_machine.UpdateStateMachine.INFINITE_PERIOD, unit) self._username ... |
state_machine.ConstantStateStrategy( max(textsPeriodInSeconds * 4, self._MINIMUM_MESSAGE_PERIOD) ) | state_machine.ConstantStateStrategy(idleTextsPeriodInSeconds) | def __init__(self, cookiePath = None, defaults = None): if defaults is None: defaults = self._DEFAULTS else: for key, (quant, unit) in defaults.iteritems(): if quant == 0: defaults[key] = (self._DEFAULTS[key], unit) elif quant < 0: defaults[key] = (state_machine.UpdateStateMachine.INFINITE_PERIOD, unit) self._username ... |
state_machine.to_seconds(seconds=20), state_machine.to_seconds(seconds=1), | initTextsPeriodInSeconds, minTextsPeriodInSeconds, | def __init__(self, cookiePath = None, defaults = None): if defaults is None: defaults = self._DEFAULTS else: for key, (quant, unit) in defaults.iteritems(): if quant == 0: defaults[key] = (self._DEFAULTS[key], unit) elif quant < 0: defaults[key] = (state_machine.UpdateStateMachine.INFINITE_PERIOD, unit) self._username ... |
if postReadLen < postReportedLen: self._conn.log_to_user(__name__, "Dropped %s messages due to already being read" % (postReportedLen - postReadLen)) | if postReadLen < postSelfLen: self._conn.log_to_user(__name__, "Dropped %s messages due to already being read" % (postSelfLen- postReadLen)) | def _report_conversation(self, mergedConversations): newConversations = mergedConversations.conversations if not newConversations: _moduleLogger.info( "No messages ended up existing for %r" % (self._contactKey, ) ) return |
return self._numbers[strippedNumber][1]["response"] == self._RESPONSE_BLOCKED | return self._numbers[strippedNumber][2]["response"] == self._RESPONSE_BLOCKED | def is_blocked(self, strippedNumber): try: return self._numbers[strippedNumber][1]["response"] == self._RESPONSE_BLOCKED except KeyError: return False |
if phonenumber is None or phonenumber is "": | if phonenumber is None or phonenumber == "": | def make_pretty(phonenumber): """ Function to take a phone number and return the pretty version pretty numbers: if phonenumber begins with 0: ...-(...)-...-.... if phonenumber begins with 1: ( for gizmo callback numbers ) 1 (...)-...-.... if phonenumber is 13 digits: (...)-...-.... if phonenumber is 10 digits: ...-....... |
if phonenumber[0] == "+": | if phonenumber == "": return "" elif phonenumber[0] == "+": | def make_pretty(phonenumber): """ Function to take a phone number and return the pretty version pretty numbers: if phonenumber begins with 0: ...-(...)-...-.... if phonenumber begins with 1: ( for gizmo callback numbers ) 1 (...)-...-.... if phonenumber is 13 digits: (...)-...-.... if phonenumber is 10 digits: ...-....... |
if uglynumber.startswith("1") and len(uglynumber) == 11: | if uglynumber.startswith("+"): pass elif uglynumber.startswith("1") and len(uglynumber) == 11: | def normalize_number(prettynumber): """ function to take a phone number and strip out all non-numeric characters >>> normalize_number("+012-(345)-678-90") '+01234567890' >>> normalize_number("1-(345)-678-9000") '+13456789000' >>> normalize_number("+1-(345)-678-9000") '+13456789000' """ uglynumber = re.sub('[^0-9+]', '... |
@gobject_utils.async @gtk_toolbox.log_exception(_moduleLogger) | def close(self): self._callback = None | |
_moduleLogger.info("Starting State Machine") for item in self._initItems: try: item.update() except Exception: _moduleLogger.exception("Initial update failed for %r" % item) self._schedule_update() return False | assert self._startId is None self._startId = gobject.idle_add(self._start) | def start(self): _moduleLogger.info("Starting State Machine") for item in self._initItems: try: item.update() except Exception: _moduleLogger.exception("Initial update failed for %r" % item) self._schedule_update() return False # do not continue |
_moduleLogger.info("Stopping an already stopped state machine") | if self._startId is not None: _moduleLogger.info("Stopping state machine before it even had a chance to start") gobject.source_remove(self._startId) self._startId = None | def stop(self): _moduleLogger.info("Stopping an already stopped state machine") self._stop_update() |
min(voicemailPeriodInSeconds * 4, self._MINIMUM_MESSAGE_PERIOD) | max(voicemailPeriodInSeconds * 4, self._MINIMUM_MESSAGE_PERIOD) | def __init__(self, cookiePath = None, defaults = None): if defaults is None: defaults = self._DEFAULTS else: for key, (quant, unit) in defaults.iteritems(): if quant == 0: defaults[key] = self._DEFAULTS[key] elif quant < 0: defaults[key] = state_machine.INFINITE_PERIOD self._username = None self._password = None |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.