rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
candidate_trail = self.filter_trail_list(trail) for drs in candidate_trail: | for drs in self.filter_trail(trail): | def accommodation(drs): condition_index = self._get_condition_index(drs, trail) return Reading([(drs, PresuppositionDRS.Accommodation(self, condition_index))]) |
if self.is_unary_predicate(cond) and self.has_same_features(cond, self.features): | if is_unary_predicate(cond) and self.has_same_features(cond, self.features): | def _binding_check(self, drs): # Iterate over unary predicates from the conditions of the drs possible_antecedents = [] for cond in drs.conds: if self.is_unary_predicate(cond) and self.has_same_features(cond, self.features): for funcname in self.function_name: |
new_second = DRS(self.second.refs,self.second.conds) first_refs = self.first.get_refs() for ref in (r for r in self.second.get_refs() if r in first_refs): | new_second = self.second for ref in set(self.first.get_refs(True)) & set(self.second.get_refs(True)): | def simplify(self): """When dealing with DRSs, it is good to have unique names for the referents bound by each DRS.""" if isinstance(self.first, DRS) and isinstance(self.second, DRS): new_second = DRS(self.second.refs,self.second.conds) first_refs = self.first.get_refs() for ref in (r for r in self.second.get_refs() ... |
new_second = new_second.replace(ref,newref,True) return drt.DrtBooleanExpression.simplify(self.__class__(self.first,new_second)) | new_second = self.second.replace(ref,newref,True) return drt.DrtBooleanExpression.simplify(self.__class__(self.first, new_second)) | def simplify(self): """When dealing with DRSs, it is good to have unique names for the referents bound by each DRS.""" if isinstance(self.first, DRS) and isinstance(self.second, DRS): new_second = DRS(self.second.refs,self.second.conds) first_refs = self.first.get_refs() for ref in (r for r in self.second.get_refs() ... |
if not utter_time_search and isinstance(refex, DrtTimeVariableExpression) and \ | if isinstance(refex, DrtUtterVariableExpression): """In case there is no location time referent that has not yet been used to relate some eventuality to utterance time, use utter time as loc time.""" return [Reading([(trail[-1], DrtFindUtterTimeExpression.VariableReplacer(self.argument.variable, refex))])], True elif ... | def _readings(self, trail=[]): utter_time_search = False |
elif isinstance(refex, DrtUtterVariableExpression): """In case there is no location time referent that has not yet been used to relate some eventuality to utterance time, use utter time as loc time.""" return [Reading([(trail[-1], DrtFindUtterTimeExpression.VariableReplacer(self.argument.variable, refex))])], True | def _readings(self, trail=[]): utter_time_search = False | |
raise Exception("%s is not found on the list of conditions of % s" % (self, superordinate_drs)) | return None | def _get_condition_index(self, superordinate_drs, trail): """Use a for loop and 'is' to find the condition. Do not use index(), because it calls a time-consuming equals method.""" for ind, trailee in enumerate(trail): if trailee is superordinate_drs: # The condition might be not in superordinate_drs, but inside one of ... |
if not isinstance(drs, PresuppositionDRS): | if not isinstance(drs, PresuppositionDRS) and not isinstance(drs, DrtBooleanExpression): | def accommodation(drs): condition_index = self._get_condition_index(drs, trail) return Reading([(drs, NonPronPresuppositionDRS.Accommodation(self, condition_index))]) |
drs = tester.parse( "The boy owns a car.", utter=True) print drs drs.draw() readings = drs.readings() for reading in readings: for cond in reading.conds: print type(cond), cond, try: print type(cond.argument), cond.argument.variable, except: pass try: print type(cond.function.argument) except: pass reading.draw() | sentences = [ "If Mia died the girl walked", "The boy kissed his room", "John kissed a hammer. He kissed a flower. John liked the tool" ] for sentence in sentences: drs = tester.parse(sentence, utter=True) print drs drs.draw() readings = drs.readings() print 'number of readings', len(readings) for reading in readings... | def anaphora_main(tester): #drs = tester.parse( "a boy kissed a girl. She bit he.", utter=True) #drs = tester.parse( "John owns a letter of Mary", utter=True) #A married boy that is dead is away #drs = tester.parse( "John owns a car. John kissed Mary", utter=True) #A married boy that is dead is away drs = tester.parse(... |
DocTestSuite(setUp=setUp, tearDown=tearDown), DocTestSuite('zc.resourcelibrary.publication', | doctest.DocTestSuite(setUp=setUp, tearDown=tearDown), doctest.DocTestSuite('zc.resourcelibrary.publication', | def test_suite(): return unittest.TestSuite( ( DocTestSuite(setUp=setUp, tearDown=tearDown), DocTestSuite('zc.resourcelibrary.publication', optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS, ), )) |
usage = """A simple tool for basic configuration of Speech Dispatcher and problem diagnostics usage: %prog [options]""" | usage = """%prog [options] A simple dialog based tool for basic configuration of Speech Dispatcher and problem diagnostics.""" | def __init__(self): usage = """A simple tool for basic configuration of Speech Dispatcher |
else value == DataMode.TEXT: | elif value == DataMode.TEXT: | def set_data_mode(self, value): """Set the data mode for further speech commands. |
socket_connect_args = (socket_path,) | socket_connect_args = socket_path | def __init__(self, method, socket_path, host, port): """Init connection: open the socket to server, initialize buffers, launch a communication handling thread. """ |
self._socket.connect(*socket_connect_args) | self._socket.connect(socket_connect_args) | def __init__(self, method, socket_path, host, port): """Init connection: open the socket to server, initialize buffers, launch a communication handling thread. """ |
def __init__(self, name, component='default', user='unknown', host=None, port=None, method=ConnectionMethod.UNIX_SOCKET, socket_path=None, autospawn=None): | def __init__(self, name, component='default', user='unknown', address=None, autospawn=None, host=None, port=None, method=None, socket_path=None): | def __init__(self, name, component='default', user='unknown', host=None, port=None, method=ConnectionMethod.UNIX_SOCKET, socket_path=None, autospawn=None): """Initialize the instance and connect to the server. |
autospawn -- a flag to specify whether the library should try to start the server if it determines its not already running or not | def __init__(self, name, component='default', user='unknown', host=None, port=None, method=ConnectionMethod.UNIX_SOCKET, socket_path=None, autospawn=None): """Initialize the instance and connect to the server. | |
if socket_path is None: socket_path = os.environ.get('SPEECHD_SOCKET', os.path.expanduser(self.DEFAULT_SOCKET_PATH)) if host is None: host = os.environ.get('SPEECHD_HOST', self.DEFAULT_HOST) if port is None: | connection_args = {'method': ConnectionMethod.UNIX_SOCKET, 'socket_path': os.path.expanduser(self.DEFAULT_SOCKET_PATH), 'host': self.DEFAULT_HOST, 'port': self.DEFAULT_PORT, } _address = address or os.environ.get("SPEECHD_ADDRESS") if _address: address_params = _address.split(":") | def __init__(self, name, component='default', user='unknown', host=None, port=None, method=ConnectionMethod.UNIX_SOCKET, socket_path=None, autospawn=None): """Initialize the instance and connect to the server. |
port = int(os.environ.get('SPEECHD_PORT')) except (ValueError, TypeError): port = self.DEFAULT_PORT connection_args = {'method': method, 'socket_path': socket_path, 'host': host, 'port': port} | _method = address_params[0] except: raise SSIPCommunicationErrror("Wrong format of server address") connection_args['method'] = _method if _method == ConnectionMethod.UNIX_SOCKET: try: connection_args['socket_path'] = address_params[1] except IndexError: pass elif _method == ConnectionMethod.INET_SOCKET: try: connectio... | def __init__(self, name, component='default', user='unknown', host=None, port=None, method=ConnectionMethod.UNIX_SOCKET, socket_path=None, autospawn=None): """Initialize the instance and connect to the server. |
except socket.error: raise SSIPCommunicationError("Can't open socket using method " + communication_method) | except socket.error, ex: raise SSIPCommunicationError("Can't open socket using method " + communication_method, original_exception = ex) | def __init__(self, communication_method, socket_path, host, port): """Init connection: open the socket to server, initialize buffers, launch a communication handling thread. """ |
except SSIPCommunicationError: | except SSIPCommunicationError, ce: | def _connect_with_autospawn(self, connection_args, autospawn): """Establish new connection (and/or autospawn server)""" try: self._conn = _SSIP_Connection(**connection_args) except SSIPCommunicationError: # Suppose server might not be running, try the autospawn mechanism if autospawn != False: # Autospawn is however no... |
self._server_spawn(connection_args) | try: self._server_spawn(connection_args) except SpawnError, se: ce.set_additional_exception(se) raise ce | def _connect_with_autospawn(self, connection_args, autospawn): """Establish new connection (and/or autospawn server)""" try: self._conn = _SSIP_Connection(**connection_args) except SSIPCommunicationError: # Suppose server might not be running, try the autospawn mechanism if autospawn != False: # Autospawn is however no... |
raise SpawnError("Server refused to autospawn, reason:\n %s" % (stderr_reply,)) | raise SpawnError("Server refused to autospawn, stating this reason: %s" % (stderr_reply,)) | def _server_spawn(self, connection_args): """Attempts to spawn the speech-dispatcher server.""" if os.path.exists(paths.SPD_SPAWN_CMD): connection_params = [] for param, value in connection_args.items(): if param not in ["host",]: connection_params += ["--"+param.replace("_","-"), str(value)] server = subprocess.Popen(... |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def cancel(self, scope=Scope.SELF): """Immediately stop speaking and discard messages in queues. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def stop(self, scope=Scope.SELF): """Immediately stop speaking the currently spoken message. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def pause(self, scope=Scope.SELF): """Pause speaking and postpone other messages until resume. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def resume(self, scope=Scope.SELF): """Resume speaking of the currently paused messages. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def set_language(self, language, scope=Scope.SELF): """Switch to a particular language for further speech commands. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def set_output_module(self, name, scope=Scope.SELF): """Switch to a particular output module. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def set_pitch(self, value, scope=Scope.SELF): """Set the pitch for further speech commands. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def set_rate(self, value, scope=Scope.SELF): """Set the speech rate (speed) for further speech commands. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def set_volume(self, value, scope=Scope.SELF): """Set the speech volume for further speech commands. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def set_punctuation(self, value, scope=Scope.SELF): """Set the punctuation pronounciation level. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def set_spelling(self, value, scope=Scope.SELF): """Toogle the spelling mode or on off. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def set_cap_let_recogn(self, value, scope=Scope.SELF): """Set capital letter recognition mode. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def set_voice(self, value, scope=Scope.SELF): """Set voice by a symbolic name. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def set_synthesis_voice(self, value, scope=Scope.SELF): """Set voice by its real name. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def set_pause_context(self, value, scope=Scope.SELF): """Set the amount of context when resuming a paused message. |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def set_debug(self, val): """Switch debugging on and off. When switched on, debugging files will be created in the chosen destination (see set_debug_destination()) for Speech Dispatcher and all its running modules. All logging information will then be written into these files with maximal verbosity until switched off. ... |
scope -- see the documentaion of this class. | scope -- see the documentation of this class. | def set_debug_destination(self, path): """Set debug destination. |
if spawn: speechd_server_pid = '' | def data(self): """Return the data which resulted in this error.""" return self._data | |
self.speechd_server_pid = self.speechd_server_spawn() | self.speechd_server_spawn() | def __init__(self, method, socket_name, host, port, autospawn): """Init connection: open the socket to server, initialize buffers, launch a communication handling thread. |
if os.path.exists(spawn.SPD_SPAWN_CMD): speechd_server = subprocess.Popen([spawn.SPD_SPAWN_CMD], stdin=None, stdout=subprocess.PIPE, stderr=None) | if os.path.exists(paths.SPD_SPAWN_CMD): speechd_server = subprocess.Popen([paths.SPD_SPAWN_CMD], stdin=None, stdout=subprocess.PIPE, stderr=None) | def speechd_server_spawn(self): """Attempts to spawn the speech-dispatcher server.""" if os.path.exists(spawn.SPD_SPAWN_CMD): speechd_server = subprocess.Popen([spawn.SPD_SPAWN_CMD], stdin=None, stdout=subprocess.PIPE, stderr=None) return speechd_server.communicate()[0].rstrip('\n') |
port=None, method='unix_socket', socket_name=None, autospawn=True): | port=None, method='unix_socket', socket_name=None, autospawn=None): | def __init__(self, name, component='default', user='unknown', host=None, port=None, method='unix_socket', socket_name=None, autospawn=True): """Initialize the instance and connect to the server. |
server if it determines its not already running | server if it determines its not already running or no | def __init__(self, name, component='default', user='unknown', host=None, port=None, method='unix_socket', socket_name=None, autospawn=True): """Initialize the instance and connect to the server. |
else: main() | def main(): report("Speech Dispatcher configuration tool") if options.create_user_configuration: # Check for and/or create basic user configuration configure.create_user_configuration() reply = question("Do you want to continue with basic settings?", True) if reply: configure.configure_basic_settings(type='user') eli... | |
["pulse", "alsa", "oss", "pulse,alsa"]) | ["pulse", "libao", "alsa", "oss", "pulse,alsa"]) | def configure_basic_settings(self, type='user'): """Ask for basic settings and rewrite them in the configuration file""" |
self.minlen = [360.0, 360.0, 360.0] self.maxlen = [0.0, 0.0, 0.0] | self.minlen = [None, None, None] self.maxlen = [None, None, None] | def __init__(self): self.constants = {"cfac": 1.7, "fadd":20, "space": 0.50, "gmemfac": 200, "gmemceil": 400, "ofrac":0.1, "redfac": 0.25 } self.minlen = [360.0, 360.0, 360.0] self.maxlen = [0.0, 0.0, 0.0] self.q = 0.0 self.gotatom = 0 self.gothet = 0 self.olen = [0.0, 0.0, 0.0] self.cen = [0.0, 0.0, 0.0] self.clen = [... |
self.minlen[i] = min(center[i]-rad, self.minlen[i]) self.maxlen[i] = max(center[i]+rad, self.maxlen[i]) | if self.minlen[i] == None or center[i]-rad < self.minlen[i]: self.minlen[i] = center[i]-rad if self.maxlen[i] == None or center[i]+rad > self.maxlen[i]: self.maxlen[i] = center[i]+rad | def parseLines(self, lines): """ Parse the lines """ for line in lines: if string.find(line,"ATOM") == 0: subline = string.replace(line[30:], "-", " -") words = string.split(subline) if len(words) < 4: continue self.gotatom = self.gotatom + 1 self.q = self.q + float(words[3]) rad = float(words[4]) center = [] for word ... |
url=cgi.escape(ll[0]) | url=ll[0] | def create_net_menu(self): mm = gtk.Menu() links=self.__m.get_current().get('links',u'').split(u'\n') for l in links: ll=l.split(u'\t',1) url=cgi.escape(ll[0]) if len(ll)>1: t=cgi.escape(ll[1]) else: t=url i= gtk.MenuItem(t) i.connect("activate", self.net_menu_cb,url) i.show() mm.add(i) self.net_menu.set_submenu(mm) |
else: t=url | else: t=cgi.escape(url) | def create_net_menu(self): mm = gtk.Menu() links=self.__m.get_current().get('links',u'').split(u'\n') for l in links: ll=l.split(u'\t',1) url=cgi.escape(ll[0]) if len(ll)>1: t=cgi.escape(ll[1]) else: t=url i= gtk.MenuItem(t) i.connect("activate", self.net_menu_cb,url) i.show() mm.add(i) self.net_menu.set_submenu(mm) |
if block.stopTime > aTime: | if block.stopTime is None or block.stopTime > aTime: | def getNextBoundary(self, aTime): for block in self: if block.startTime > aTime: return block.startTime if block.stopTime > aTime: return block.stopTime return None |
if block.stopTime and block.stopTime < aTime: | if block.stopTime is not None and block.stopTime < aTime: | def getPrevBoundary(self, aTime): for block in reversed(self): if block.stopTime and block.stopTime < aTime: return block.stopTime if block.startTime < aTime: return block.startTime return timedelta(0) |
if block.stopTime < aTime: | if block.stopTime and block.stopTime < aTime: | def getPrevBoundary(self, aTime): for block in reversed(self): if block.stopTime < aTime: return block.stopTime if block.startTime < aTime: return block.startTime return timedelta(0) |
self.edl.normalize(timedelta(seconds=self.ui.player.totalTime()//1000)) | self.edl.normalize(timedelta(milliseconds=self.ui.player.totalTime())) | def saveEDL(self): assert self.edlFileName assert self.edl is not None self.edl.normalize(timedelta(seconds=self.ui.player.totalTime()//1000)) self.edlModel.emitChanged() pyedl.dump(self.edl, open(self.edlFileName, "w")) |
self.__edl = [] | self.__edl = None | def __init__(self, *args, **kwargs): QtGui.QWidget.__init__(self, *args, **kwargs) self.__edl = [] self.__totalTime = None # ms self.__currentTime = None # ms |
for block in self.reverse(): | for block in reversed(self): | def getPrevBoundary(self, aTime): for block in self.reverse(): if block.stopTime < aTime: return block.stopTime if block.startTime < aTime: return block.startTime return timedelta(0) |
status = bool(apport.packaging.get_version(dbg)) | status = apport.packaging.get_version(dbg) | def add_info(report): logs = [ '/var/log/mythtv/mythbackend.log', '/var/log/mythtv/mythfrontend.log', ] for log in logs: apport.hookutils.attach_file_if_exists(report, log) report['MythTVDirectoryPermissions'] = apport.hookutils.command_output(['ls', '-l', '/var/lib/mythtv']) dbg_packages = [ 'mythtv-dbg', 'mythplugi... |
status = False | status = '0.0' | def add_info(report): logs = [ '/var/log/mythtv/mythbackend.log', '/var/log/mythtv/mythfrontend.log', ] for log in logs: apport.hookutils.attach_file_if_exists(report, log) report['MythTVDirectoryPermissions'] = apport.hookutils.command_output(['ls', '-l', '/var/lib/mythtv']) dbg_packages = [ 'mythtv-dbg', 'mythplugi... |
c = cred.Client(identifier, urlFactory) v = {"old": c._url, "actual": None} d = c.getCallbackURL() | c = cred.Client(identifier, redirectURIFactory) v = {"old": c._redirectURI, "actual": None} d = c.getRedirectURI() | def _genericMemoizationTest(self, identifier, expectedURL): c = cred.Client(identifier, urlFactory) v = {"old": c._url, "actual": None} # please backport nonlocal d = c.getCallbackURL() |
def testMemoization(url): self.assertNotEqual(v["old"], url) v["actual"] = url return c.getCallbackURL() | def testMemoization(uri): self.assertNotEqual(v["old"], uri) v["actual"] = uri return c.getRedirectURI() | def testMemoization(url): self.assertNotEqual(v["old"], url) v["actual"] = url # please, please backport nonlocal return c.getCallbackURL() |
def testMemoized(url): self.assertNotEqual(v["old"], url) self.assertEqual(v["actual"], url) | def testMemoized(uri): self.assertNotEqual(v["old"], uri) self.assertEqual(v["actual"], uri) | def testMemoized(url): self.assertNotEqual(v["old"], url) self.assertEqual(v["actual"], url) |
r = cred.ClientRealm(urlFactory) | r = cred.ClientRealm(redirectURIFactory) | def _genericTest(self, identifier=IDENTIFIER, mind=None, requestedInterfaces=(interfaces.IClient,), expectedURL=URL): r = cred.ClientRealm(urlFactory) |
r = cred.ClientRealm(urlFactory) | r = cred.ClientRealm(redirectURIFactory) | def test_badInterface(self): r = cred.ClientRealm(urlFactory) self.assertRaises(NotImplementedError, r.requestAvatar, IDENTIFIER, None, object()) |
def getCallbackURL(): | def getRedirectURI(): | def getCallbackURL(): """ Gets the registered callback URL for this client. |
Gets the registered callback URL for this client. | Gets the registered redirection URI for this client. | def getCallbackURL(): """ Gets the registered callback URL for this client. |
@return: A C{Deferred} which will fire with the URL, or C{None} if no URL has been registered. | @return: A C{Deferred} which will fire with the URI, or C{None} if no URI has been registered. | def getCallbackURL(): """ Gets the registered callback URL for this client. |
self._genericTest(identifier="parrot", expectedURL=None) | self._genericTest(identifier=BOGUS_IDENTIFIER, expectedURL=None) | def test_missingURL(self): self._genericTest(identifier="parrot", expectedURL=None) |
r.requestAvatar, "spam", None, object()) | r.requestAvatar, IDENTIFIER, None, object()) | def test_badInterface(self): r = cred.ClientRealm(urlFactory) self.assertRaises(NotImplementedError, r.requestAvatar, "spam", None, object()) |
.implementedBy(SimpleRedirectURIFactory)) | .implementedBy(simple.SimpleRedirectURIFactory)) | def test_interface(self): self.assertTrue(interfaces.IRedirectURIFactory .implementedBy(SimpleRedirectURIFactory)) |
def __init__(self, identifier, callbackURLFactory): | def __init__(self, identifier, redirectURIFactory): | def __init__(self, identifier, callbackURLFactory): self._identifier = identifier self._urlFactory = callbackURLFactory self._url = _UNSET |
self._urlFactory = callbackURLFactory self._url = _UNSET | self._redirectURIFactory = redirectURIFactory self._redirectURI = _UNSET | def __init__(self, identifier, callbackURLFactory): self._identifier = identifier self._urlFactory = callbackURLFactory self._url = _UNSET |
def getCallbackURL(self): if self._url is _UNSET: d = self._urlFactory.get(self._identifier) | def getRedirectURI(self): if self._redirectURI is _UNSET: d = self._redirectURIFactory.get(self._identifier) | def getCallbackURL(self): if self._url is _UNSET: d = self._urlFactory.get(self._identifier) |
def memoize(url): self._url = url return url | def memoize(uri): self._redirectURI = uri return uri | def memoize(url): self._url = url return url # Caller expects deferred to fire with URL |
return defer.succeed(self._url) | return defer.succeed(self._redirectURI) | def memoize(url): self._url = url return url # Caller expects deferred to fire with URL |
def test_simple_missingURL(self): | def test_missingURL(self): | def test_simple_missingURL(self): d = self.empty.get("blah") def cb(url): self.assertEquals(url, None) d.addCallback(cb) return d |
def test_simple_registeredURL(self): | def test_registeredURL(self): | def test_simple_registeredURL(self): d = self.withURLs.get("spam") def cb(url): self.assertEquals(url, "eggs") d.addCallback(cb) return d |
self._test_missing(self.store) | return self._test_missing(self.store) | def test_missing(self): self._test_missing(self.store) |
self._test_missing(self.store2) | return self._test_missing(self.store2) | def test_missing_noForceInvalidation(self): self._test_missing(self.store2) |
self._test_missing(self.store, invalidate=False) | return self._test_missing(self.store, invalidate=False) | def test_missing_noInvalidation(self): self._test_missing(self.store, invalidate=False) |
self._test_missing(self.store2, invalidate=False) | return self._test_missing(self.store2, invalidate=False) | def test_missing_noForceInvalidation_noInvalidation(self): self._test_missing(self.store2, invalidate=False) |
super(RefreshToken, self).__init__(clientCredentials) | super(EndUserCredentials, self).__init__(clientCredentials) | def __init__(self, clientCredentials, endUserCredentials): super(RefreshToken, self).__init__(clientCredentials) self._endUserCredentials = endUserCredentials |
TYPE, ASSERTION = "", "" BOGUS_TYPE, BOGUS_ASSERTION = "", "" | TYPE, ASSERTION = "IReactorFDSet", "awesome" BOGUS_TYPE, BOGUS_ASSERTION = "Thread", "not blowing up" | def test_clientCredentialsImmutability_different(self): self._test_immutability("clientCredentials", self.bogusCredentials) |
args = REFRESH_TOKEN | args = REFRESH_TOKEN, | def test_authorizationCodeImmutability_different(self): self._test_immutability("authorizationCode", BOGUS_CODE) |
self.assertEquals(url, None) | self.assertEquals(url, "eggs") | def callbackURLCheck(url): self.assertEquals(url, None) |
self._genericFactoryTest(self.wtihURLs, IDENTIFIER, URL) | self._genericFactoryTest(self.withURLs, IDENTIFIER, URL) | def test_registeredURL(self): self._genericFactoryTest(self.wtihURLs, IDENTIFIER, URL) |
return self._test_missing(self.store, invalidate=False) def test_missing_noForceInvalidation_noInvalidation(self): | def test_missing_noInvalidation(self): return self._test_missing(self.store, invalidate=False) | |
def test_enforcedInvalidation(self): | def _test_enforcedInvalidation(self, assertion): | def test_enforcedInvalidation(self): d = self.store.checkAssertion(self.assertion, invalidate=False) |
opt.add_option('--debug', action='store_true', default=False, dest='debug', | opt.add_option('--debug', action='store_true', default=True, dest='debug', | def set_options(opt): "Add standard autowaf options if they havn't been added yet" global g_step if g_step > 0: return opt.tool_options('compiler_cc') opt.tool_options('compiler_cxx') opt.add_option('--debug', action='store_true', default=False, dest='debug', help="Build debuggable binaries [Default: False]") opt.add_o... |
help="Build debuggable binaries [Default: False]") | help="Build debuggable binaries [Default: True]") opt.add_option('--optimize', action='store_false', default=False, dest='debug', help="Build optimized binaries [Default: False]") | def set_options(opt): "Add standard autowaf options if they havn't been added yet" global g_step if g_step > 0: return opt.tool_options('compiler_cc') opt.tool_options('compiler_cxx') opt.add_option('--debug', action='store_true', default=True, dest='debug', help="Build debuggable binaries [Default: False]") opt.add_op... |
'\[(.*?)\]\s+?signature\s*=\s*(.*?)ep_only\s*=\s*(\w+)(?:\s*section_start_only\s*=\s*(\w+)|)', re.S) | '\[(.*?)\]\s+?signature\s*=\s*(.*?)(\s+\?\?)*\s*ep_only\s*=\s*(\w+)(?:\s*section_start_only\s*=\s*(\w+)|)', re.S) | def __init__(self, filename=None, data=None): # RegExp to match a signature block # self.parse_sig = re.compile( '\[(.*?)\]\s+?signature\s*=\s*(.*?)ep_only\s*=\s*(\w+)(?:\s*section_start_only\s*=\s*(\w+)|)', re.S) # Signature information # # Signatures are stored as trees using dictionaries # The keys are the byte va... |
for packer_name, signature, ep_only, section_start_only in matches: | for packer_name, signature, superfluous_wildcards, ep_only, section_start_only in matches: | def to_byte(value) : if value == '??' or value == '?0' : return value return int (value, 16) |
offset = self.PointerToRawData | offset = PointerToRawData_adj | def get_data(self, start=None, length=None): """Get data chunk from a section. Allows to query data from the section by passing the addresses where the PE file would be loaded by default. It is then possible to retrieve code and data by its real addresses as it would be if loaded. """ if start is None: offset = self.... |
offset = ( start - self.VirtualAddress) + self.PointerToRawData | offset = ( start - VirtualAddress_adj ) + PointerToRawData_adj | def get_data(self, start=None, length=None): """Get data chunk from a section. Allows to query data from the section by passing the addresses where the PE file would be loaded by default. It is then possible to retrieve code and data by its real addresses as it would be if loaded. """ if start is None: offset = self.... |
return offset - self.PointerToRawData + self.VirtualAddress | return offset - adjust_PointerToRawData( self.PointerToRawData ) + adjust_VirtualAddress( self.VirtualAddress, self.pe.OPTIONAL_HEADER.SectionAlignment ) | def get_rva_from_offset(self, offset): return offset - self.PointerToRawData + self.VirtualAddress |
return (rva - self.VirtualAddress) + self.PointerToRawData | return (rva - adjust_VirtualAddress( self.VirtualAddress, self.pe.OPTIONAL_HEADER.SectionAlignment )) + adjust_PointerToRawData( self.PointerToRawData ) | def get_offset_from_rva(self, rva): return (rva - self.VirtualAddress) + self.PointerToRawData |
return self.PointerToRawData <= offset < self.PointerToRawData + self.SizeOfRawData | return ( adjust_PointerToRawData( self.PointerToRawData ) <= offset < adjust_PointerToRawData( self.PointerToRawData ) + self.SizeOfRawData ) | def contains_offset(self, offset): """Check whether the section contains the file offset provided.""" if self.PointerToRawData is None: # bss and other sections containing only uninitialized data must have 0 # and do not take space in the file return False return self.PointerToRawData <= offset < self.PointerToRawData... |
if len(self.pe.__data__) - self.PointerToRawData < self.SizeOfRawData: | if len(self.pe.__data__) - adjust_PointerToRawData( self.PointerToRawData ) < self.SizeOfRawData: | def contains_rva(self, rva): """Check whether the section contains the address provided.""" # PECOFF documentation v8 says: # The total size of the section when loaded into memory. # If this value is greater than SizeOfRawData, the section is zero-padded. # This field is valid only for executable images and should be ... |
return self.VirtualAddress <= rva < self.VirtualAddress + size | VirtualAddress_adj = adjust_VirtualAddress( self.VirtualAddress, self.pe.OPTIONAL_HEADER.SectionAlignment ) return VirtualAddress_adj <= rva < VirtualAddress_adj + size | def contains_rva(self, rva): """Check whether the section contains the address provided.""" # PECOFF documentation v8 says: # The total size of the section when loaded into memory. # If this value is greater than SizeOfRawData, the section is zero-padded. # This field is valid only for executable images and should be ... |
s.PointerToRawData for s in self.sections if s.PointerToRawData>0] | adjust_PointerToRawData( s.PointerToRawData ) for s in self.sections if s.PointerToRawData>0] | def __parse__(self, fname, data, fast_load): """Parse a Portable Executable file. Loads a PE file, parsing all its structures and making them available through the instance's attributes. """ if fname: fd = file(fname, 'rb') self.fileno = fd.fileno() self.__data__ = mmap.mmap( self.fileno, 0, access = mmap.ACCESS_READ... |
if section.PointerToRawData > len(self.__data__): | if adjust_PointerToRawData( section.PointerToRawData ) > len(self.__data__): | def parse_sections(self, offset): """Fetch the PE file sections. The sections will be readily available in the "sections" attribute. Its attributes will contain all the section information plus "data" a buffer containing the section's data. The "Characteristics" member will be processed and attributes representing th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.