body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def test_spam(self, name, staking_utxo_list, fRandomHeight=False, randomRange=0, randomRange2=0, fDoubleSpend=False, fMustPass=False, fZPoS=False, spending_utxo_list=[]): ' General method to create, send and test the spam blocks\n :param name: (string) chain branch (usually either "Main" or ...
-3,516,039,327,091,069,400
General method to create, send and test the spam blocks :param name: (string) chain branch (usually either "Main" or "Forked") staking_utxo_list: (string list) utxos to use for staking fRandomHeight: (bool) send blocks at random height randomRange: (int) if fR...
test/functional/fake_stake/base_test.py
test_spam
tdpsdevextreme/TradePlusCoin
python
def test_spam(self, name, staking_utxo_list, fRandomHeight=False, randomRange=0, randomRange2=0, fDoubleSpend=False, fMustPass=False, fZPoS=False, spending_utxo_list=[]): ' General method to create, send and test the spam blocks\n :param name: (string) chain branch (usually either "Main" or ...
def crossmul(**kwds): 'A factory for Crossmul' from .Crossmul import Crossmul return Crossmul(**kwds)
-7,984,824,203,532,728,000
A factory for Crossmul
python/packages/isce3/signal/__init__.py
crossmul
piyushrpt/isce3
python
def crossmul(**kwds): from .Crossmul import Crossmul return Crossmul(**kwds)
@pytest.mark.parametrize(('acquire', 'use', 'release', 'final_result', 'log'), [(_acquire_success, _use_success, _ReleaseSuccess, IOSuccess('use success'), [('acquire success', Success('use success'))]), (_acquire_success, _use_success, _ReleaseFailure, IOFailure('release failure'), []), (_acquire_success, _use_failure...
5,979,508,904,576,942,000
Ensures that managed works as intended.
tests/test_pipeline/test_managed/test_managed_ioresult.py
test_all_success
CucumisSativus/returns
python
@pytest.mark.parametrize(('acquire', 'use', 'release', 'final_result', 'log'), [(_acquire_success, _use_success, _ReleaseSuccess, IOSuccess('use success'), [('acquire success', Success('use success'))]), (_acquire_success, _use_success, _ReleaseFailure, IOFailure('release failure'), []), (_acquire_success, _use_failure...
def test_full_typing(): 'This test is here to be a case for typing.' logs: List[Tuple[(str, Result[(str, str)])]] = [] pipeline_result = managed(_use_success, _ReleaseSuccess(logs))(_acquire_success) assert (pipeline_result == IOSuccess('use success')) assert (logs == [('acquire success', Success('u...
2,958,457,838,396,522,000
This test is here to be a case for typing.
tests/test_pipeline/test_managed/test_managed_ioresult.py
test_full_typing
CucumisSativus/returns
python
def test_full_typing(): logs: List[Tuple[(str, Result[(str, str)])]] = [] pipeline_result = managed(_use_success, _ReleaseSuccess(logs))(_acquire_success) assert (pipeline_result == IOSuccess('use success')) assert (logs == [('acquire success', Success('use success'))])
def getDivisionFailure(*args, **kwargs): "\n Make a C{Failure} of a divide-by-zero error.\n\n @param args: Any C{*args} are passed to Failure's constructor.\n @param kwargs: Any C{**kwargs} are passed to Failure's constructor.\n " try: (1 / 0) except: f = failure.Failure(*args, *...
-8,652,234,052,711,301,000
Make a C{Failure} of a divide-by-zero error. @param args: Any C{*args} are passed to Failure's constructor. @param kwargs: Any C{**kwargs} are passed to Failure's constructor.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
getDivisionFailure
XZH950926/meizitu
python
def getDivisionFailure(*args, **kwargs): "\n Make a C{Failure} of a divide-by-zero error.\n\n @param args: Any C{*args} are passed to Failure's constructor.\n @param kwargs: Any C{**kwargs} are passed to Failure's constructor.\n " try: (1 / 0) except: f = failure.Failure(*args, *...
def test_failAndTrap(self): '\n Trapping a L{Failure}.\n ' try: raise NotImplementedError('test') except: f = failure.Failure() error = f.trap(SystemExit, RuntimeError) self.assertEqual(error, RuntimeError) self.assertEqual(f.type, NotImplementedError)
-6,052,471,848,568,529,000
Trapping a L{Failure}.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_failAndTrap
XZH950926/meizitu
python
def test_failAndTrap(self): '\n \n ' try: raise NotImplementedError('test') except: f = failure.Failure() error = f.trap(SystemExit, RuntimeError) self.assertEqual(error, RuntimeError) self.assertEqual(f.type, NotImplementedError)
def test_trapRaisesWrappedException(self): '\n If the wrapped C{Exception} is not a subclass of one of the\n expected types, L{failure.Failure.trap} raises the wrapped\n C{Exception}.\n ' if (not _PY3): raise SkipTest('\n Only expected behaviour on Python 3.\n ...
-1,991,415,557,886,170,600
If the wrapped C{Exception} is not a subclass of one of the expected types, L{failure.Failure.trap} raises the wrapped C{Exception}.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_trapRaisesWrappedException
XZH950926/meizitu
python
def test_trapRaisesWrappedException(self): '\n If the wrapped C{Exception} is not a subclass of one of the\n expected types, L{failure.Failure.trap} raises the wrapped\n C{Exception}.\n ' if (not _PY3): raise SkipTest('\n Only expected behaviour on Python 3.\n ...
def test_trapRaisesSelf(self): '\n If the wrapped C{Exception} is not a subclass of one of the\n expected types, L{failure.Failure.trap} raises itself.\n ' if _PY3: raise SkipTest('\n Only expected behaviour on Python 2.\n @see U{http://twisted.readthed...
6,533,851,203,345,425,000
If the wrapped C{Exception} is not a subclass of one of the expected types, L{failure.Failure.trap} raises itself.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_trapRaisesSelf
XZH950926/meizitu
python
def test_trapRaisesSelf(self): '\n If the wrapped C{Exception} is not a subclass of one of the\n expected types, L{failure.Failure.trap} raises itself.\n ' if _PY3: raise SkipTest('\n Only expected behaviour on Python 2.\n @see U{http://twisted.readthed...
def test_failureValueFromFailure(self): '\n A L{failure.Failure} constructed from another\n L{failure.Failure} instance, has its C{value} property set to\n the value of that L{failure.Failure} instance.\n ' exception = ValueError() f1 = failure.Failure(exception) f2 = failure...
-3,928,023,598,779,263,500
A L{failure.Failure} constructed from another L{failure.Failure} instance, has its C{value} property set to the value of that L{failure.Failure} instance.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_failureValueFromFailure
XZH950926/meizitu
python
def test_failureValueFromFailure(self): '\n A L{failure.Failure} constructed from another\n L{failure.Failure} instance, has its C{value} property set to\n the value of that L{failure.Failure} instance.\n ' exception = ValueError() f1 = failure.Failure(exception) f2 = failure...
def test_failureValueFromFoundFailure(self): '\n A L{failure.Failure} constructed without a C{exc_value}\n argument, will search for an "original" C{Failure}, and if\n found, its value will be used as the value for the new\n C{Failure}.\n ' exception = ValueError() f1 = fa...
-6,646,359,321,119,548,000
A L{failure.Failure} constructed without a C{exc_value} argument, will search for an "original" C{Failure}, and if found, its value will be used as the value for the new C{Failure}.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_failureValueFromFoundFailure
XZH950926/meizitu
python
def test_failureValueFromFoundFailure(self): '\n A L{failure.Failure} constructed without a C{exc_value}\n argument, will search for an "original" C{Failure}, and if\n found, its value will be used as the value for the new\n C{Failure}.\n ' exception = ValueError() f1 = fa...
def assertStartsWith(self, s, prefix): '\n Assert that C{s} starts with a particular C{prefix}.\n\n @param s: The input string.\n @type s: C{str}\n @param prefix: The string that C{s} should start with.\n @type prefix: C{str}\n ' self.assertTrue(s.startswith(prefix), ('...
-6,953,724,664,444,620,000
Assert that C{s} starts with a particular C{prefix}. @param s: The input string. @type s: C{str} @param prefix: The string that C{s} should start with. @type prefix: C{str}
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
assertStartsWith
XZH950926/meizitu
python
def assertStartsWith(self, s, prefix): '\n Assert that C{s} starts with a particular C{prefix}.\n\n @param s: The input string.\n @type s: C{str}\n @param prefix: The string that C{s} should start with.\n @type prefix: C{str}\n ' self.assertTrue(s.startswith(prefix), ('...
def assertEndsWith(self, s, suffix): '\n Assert that C{s} end with a particular C{suffix}.\n\n @param s: The input string.\n @type s: C{str}\n @param suffix: The string that C{s} should end with.\n @type suffix: C{str}\n ' self.assertTrue(s.endswith(suffix), ('%r is not...
-6,076,212,063,322,656,000
Assert that C{s} end with a particular C{suffix}. @param s: The input string. @type s: C{str} @param suffix: The string that C{s} should end with. @type suffix: C{str}
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
assertEndsWith
XZH950926/meizitu
python
def assertEndsWith(self, s, suffix): '\n Assert that C{s} end with a particular C{suffix}.\n\n @param s: The input string.\n @type s: C{str}\n @param suffix: The string that C{s} should end with.\n @type suffix: C{str}\n ' self.assertTrue(s.endswith(suffix), ('%r is not...
def assertTracebackFormat(self, tb, prefix, suffix): '\n Assert that the C{tb} traceback contains a particular C{prefix} and\n C{suffix}.\n\n @param tb: The traceback string.\n @type tb: C{str}\n @param prefix: The string that C{tb} should start with.\n @type prefix: C{str}...
3,913,969,195,792,636,000
Assert that the C{tb} traceback contains a particular C{prefix} and C{suffix}. @param tb: The traceback string. @type tb: C{str} @param prefix: The string that C{tb} should start with. @type prefix: C{str} @param suffix: The string that C{tb} should end with. @type suffix: C{str}
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
assertTracebackFormat
XZH950926/meizitu
python
def assertTracebackFormat(self, tb, prefix, suffix): '\n Assert that the C{tb} traceback contains a particular C{prefix} and\n C{suffix}.\n\n @param tb: The traceback string.\n @type tb: C{str}\n @param prefix: The string that C{tb} should start with.\n @type prefix: C{str}...
def assertDetailedTraceback(self, captureVars=False, cleanFailure=False): "\n Assert that L{printDetailedTraceback} produces and prints a detailed\n traceback.\n\n The detailed traceback consists of a header::\n\n *--- Failure #20 ---\n\n The body contains the stacktrace::\n\n ...
-5,696,409,047,367,107,000
Assert that L{printDetailedTraceback} produces and prints a detailed traceback. The detailed traceback consists of a header:: *--- Failure #20 --- The body contains the stacktrace:: /twisted/trial/_synctest.py:1180: _run(...) /twisted/python/util.py:1076: runWithWarningsSuppressed(...) --- <exception caught...
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
assertDetailedTraceback
XZH950926/meizitu
python
def assertDetailedTraceback(self, captureVars=False, cleanFailure=False): "\n Assert that L{printDetailedTraceback} produces and prints a detailed\n traceback.\n\n The detailed traceback consists of a header::\n\n *--- Failure #20 ---\n\n The body contains the stacktrace::\n\n ...
def assertBriefTraceback(self, captureVars=False): "\n Assert that L{printBriefTraceback} produces and prints a brief\n traceback.\n\n The brief traceback consists of a header::\n\n Traceback: <type 'exceptions.ZeroDivisionError'>: float division\n\n The body with the stacktrace...
4,406,321,726,828,651,500
Assert that L{printBriefTraceback} produces and prints a brief traceback. The brief traceback consists of a header:: Traceback: <type 'exceptions.ZeroDivisionError'>: float division The body with the stacktrace:: /twisted/trial/_synctest.py:1180:_run /twisted/python/util.py:1076:runWithWarningsSuppressed And...
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
assertBriefTraceback
XZH950926/meizitu
python
def assertBriefTraceback(self, captureVars=False): "\n Assert that L{printBriefTraceback} produces and prints a brief\n traceback.\n\n The brief traceback consists of a header::\n\n Traceback: <type 'exceptions.ZeroDivisionError'>: float division\n\n The body with the stacktrace...
def assertDefaultTraceback(self, captureVars=False): '\n Assert that L{printTraceback} produces and prints a default traceback.\n\n The default traceback consists of a header::\n\n Traceback (most recent call last):\n\n The body with traceback::\n\n File "/twisted/trial/_synct...
-281,057,180,494,909,540
Assert that L{printTraceback} produces and prints a default traceback. The default traceback consists of a header:: Traceback (most recent call last): The body with traceback:: File "/twisted/trial/_synctest.py", line 1180, in _run runWithWarningsSuppressed(suppress, method) And the footer:: --- <excep...
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
assertDefaultTraceback
XZH950926/meizitu
python
def assertDefaultTraceback(self, captureVars=False): '\n Assert that L{printTraceback} produces and prints a default traceback.\n\n The default traceback consists of a header::\n\n Traceback (most recent call last):\n\n The body with traceback::\n\n File "/twisted/trial/_synct...
def test_printDetailedTraceback(self): "\n L{printDetailedTraceback} returns a detailed traceback including the\n L{Failure}'s count.\n " self.assertDetailedTraceback()
4,912,148,342,093,289,000
L{printDetailedTraceback} returns a detailed traceback including the L{Failure}'s count.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_printDetailedTraceback
XZH950926/meizitu
python
def test_printDetailedTraceback(self): "\n L{printDetailedTraceback} returns a detailed traceback including the\n L{Failure}'s count.\n " self.assertDetailedTraceback()
def test_printBriefTraceback(self): '\n L{printBriefTraceback} returns a brief traceback.\n ' self.assertBriefTraceback()
3,682,398,796,826,470,400
L{printBriefTraceback} returns a brief traceback.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_printBriefTraceback
XZH950926/meizitu
python
def test_printBriefTraceback(self): '\n \n ' self.assertBriefTraceback()
def test_printTraceback(self): '\n L{printTraceback} returns a traceback.\n ' self.assertDefaultTraceback()
4,268,356,974,114,568,000
L{printTraceback} returns a traceback.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_printTraceback
XZH950926/meizitu
python
def test_printTraceback(self): '\n \n ' self.assertDefaultTraceback()
def test_printDetailedTracebackCapturedVars(self): '\n L{printDetailedTraceback} captures the locals and globals for its\n stack frames and adds them to the traceback, when called on a\n L{Failure} constructed with C{captureVars=True}.\n ' self.assertDetailedTraceback(captureVars=Tru...
-1,798,578,512,415,068,000
L{printDetailedTraceback} captures the locals and globals for its stack frames and adds them to the traceback, when called on a L{Failure} constructed with C{captureVars=True}.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_printDetailedTracebackCapturedVars
XZH950926/meizitu
python
def test_printDetailedTracebackCapturedVars(self): '\n L{printDetailedTraceback} captures the locals and globals for its\n stack frames and adds them to the traceback, when called on a\n L{Failure} constructed with C{captureVars=True}.\n ' self.assertDetailedTraceback(captureVars=Tru...
def test_printBriefTracebackCapturedVars(self): '\n L{printBriefTraceback} returns a brief traceback when called on a\n L{Failure} constructed with C{captureVars=True}.\n\n Local variables on the stack can not be seen in the resulting\n traceback.\n ' self.assertBriefTraceback...
7,831,598,147,435,002,000
L{printBriefTraceback} returns a brief traceback when called on a L{Failure} constructed with C{captureVars=True}. Local variables on the stack can not be seen in the resulting traceback.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_printBriefTracebackCapturedVars
XZH950926/meizitu
python
def test_printBriefTracebackCapturedVars(self): '\n L{printBriefTraceback} returns a brief traceback when called on a\n L{Failure} constructed with C{captureVars=True}.\n\n Local variables on the stack can not be seen in the resulting\n traceback.\n ' self.assertBriefTraceback...
def test_printTracebackCapturedVars(self): '\n L{printTraceback} returns a traceback when called on a L{Failure}\n constructed with C{captureVars=True}.\n\n Local variables on the stack can not be seen in the resulting\n traceback.\n ' self.assertDefaultTraceback(captureVars=T...
-5,146,097,845,496,934,000
L{printTraceback} returns a traceback when called on a L{Failure} constructed with C{captureVars=True}. Local variables on the stack can not be seen in the resulting traceback.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_printTracebackCapturedVars
XZH950926/meizitu
python
def test_printTracebackCapturedVars(self): '\n L{printTraceback} returns a traceback when called on a L{Failure}\n constructed with C{captureVars=True}.\n\n Local variables on the stack can not be seen in the resulting\n traceback.\n ' self.assertDefaultTraceback(captureVars=T...
def test_printDetailedTracebackCapturedVarsCleaned(self): '\n C{printDetailedTraceback} includes information about local variables on\n the stack after C{cleanFailure} has been called.\n ' self.assertDetailedTraceback(captureVars=True, cleanFailure=True)
142,082,274,718,069,710
C{printDetailedTraceback} includes information about local variables on the stack after C{cleanFailure} has been called.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_printDetailedTracebackCapturedVarsCleaned
XZH950926/meizitu
python
def test_printDetailedTracebackCapturedVarsCleaned(self): '\n C{printDetailedTraceback} includes information about local variables on\n the stack after C{cleanFailure} has been called.\n ' self.assertDetailedTraceback(captureVars=True, cleanFailure=True)
def test_invalidFormatFramesDetail(self): '\n L{failure.format_frames} raises a L{ValueError} if the supplied\n C{detail} level is unknown.\n ' self.assertRaises(ValueError, failure.format_frames, None, None, detail='noisia')
264,949,235,067,547,040
L{failure.format_frames} raises a L{ValueError} if the supplied C{detail} level is unknown.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_invalidFormatFramesDetail
XZH950926/meizitu
python
def test_invalidFormatFramesDetail(self): '\n L{failure.format_frames} raises a L{ValueError} if the supplied\n C{detail} level is unknown.\n ' self.assertRaises(ValueError, failure.format_frames, None, None, detail='noisia')
def test_stringExceptionConstruction(self): '\n Constructing a C{Failure} with a string as its exception value raises\n a C{TypeError}, as this is no longer supported as of Python 2.6.\n ' exc = self.assertRaises(TypeError, failure.Failure, 'ono!') self.assertIn('Strings are not support...
7,303,733,056,566,425,000
Constructing a C{Failure} with a string as its exception value raises a C{TypeError}, as this is no longer supported as of Python 2.6.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_stringExceptionConstruction
XZH950926/meizitu
python
def test_stringExceptionConstruction(self): '\n Constructing a C{Failure} with a string as its exception value raises\n a C{TypeError}, as this is no longer supported as of Python 2.6.\n ' exc = self.assertRaises(TypeError, failure.Failure, 'ono!') self.assertIn('Strings are not support...
def test_ConstructionFails(self): '\n Creating a Failure with no arguments causes it to try to discover the\n current interpreter exception state. If no such state exists, creating\n the Failure should raise a synchronous exception.\n ' if (sys.version_info < (3, 0)): sys.ex...
5,796,733,913,821,718,000
Creating a Failure with no arguments causes it to try to discover the current interpreter exception state. If no such state exists, creating the Failure should raise a synchronous exception.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_ConstructionFails
XZH950926/meizitu
python
def test_ConstructionFails(self): '\n Creating a Failure with no arguments causes it to try to discover the\n current interpreter exception state. If no such state exists, creating\n the Failure should raise a synchronous exception.\n ' if (sys.version_info < (3, 0)): sys.ex...
def test_getTracebackObject(self): '\n If the C{Failure} has not been cleaned, then C{getTracebackObject}\n returns the traceback object that captured in its constructor.\n ' f = getDivisionFailure() self.assertEqual(f.getTracebackObject(), f.tb)
2,543,048,896,884,482,000
If the C{Failure} has not been cleaned, then C{getTracebackObject} returns the traceback object that captured in its constructor.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_getTracebackObject
XZH950926/meizitu
python
def test_getTracebackObject(self): '\n If the C{Failure} has not been cleaned, then C{getTracebackObject}\n returns the traceback object that captured in its constructor.\n ' f = getDivisionFailure() self.assertEqual(f.getTracebackObject(), f.tb)
def test_getTracebackObjectFromCaptureVars(self): '\n C{captureVars=True} has no effect on the result of\n C{getTracebackObject}.\n ' try: (1 / 0) except ZeroDivisionError: noVarsFailure = failure.Failure() varsFailure = failure.Failure(captureVars=True) self...
-2,149,188,538,576,567,600
C{captureVars=True} has no effect on the result of C{getTracebackObject}.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_getTracebackObjectFromCaptureVars
XZH950926/meizitu
python
def test_getTracebackObjectFromCaptureVars(self): '\n C{captureVars=True} has no effect on the result of\n C{getTracebackObject}.\n ' try: (1 / 0) except ZeroDivisionError: noVarsFailure = failure.Failure() varsFailure = failure.Failure(captureVars=True) self...
def test_getTracebackObjectFromClean(self): '\n If the Failure has been cleaned, then C{getTracebackObject} returns an\n object that looks the same to L{traceback.extract_tb}.\n ' f = getDivisionFailure() expected = traceback.extract_tb(f.getTracebackObject()) f.cleanFailure() o...
-7,771,214,461,307,343,000
If the Failure has been cleaned, then C{getTracebackObject} returns an object that looks the same to L{traceback.extract_tb}.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_getTracebackObjectFromClean
XZH950926/meizitu
python
def test_getTracebackObjectFromClean(self): '\n If the Failure has been cleaned, then C{getTracebackObject} returns an\n object that looks the same to L{traceback.extract_tb}.\n ' f = getDivisionFailure() expected = traceback.extract_tb(f.getTracebackObject()) f.cleanFailure() o...
def test_getTracebackObjectFromCaptureVarsAndClean(self): '\n If the Failure was created with captureVars, then C{getTracebackObject}\n returns an object that looks the same to L{traceback.extract_tb}.\n ' f = getDivisionFailure(captureVars=True) expected = traceback.extract_tb(f.getTra...
-3,117,233,068,195,542,000
If the Failure was created with captureVars, then C{getTracebackObject} returns an object that looks the same to L{traceback.extract_tb}.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_getTracebackObjectFromCaptureVarsAndClean
XZH950926/meizitu
python
def test_getTracebackObjectFromCaptureVarsAndClean(self): '\n If the Failure was created with captureVars, then C{getTracebackObject}\n returns an object that looks the same to L{traceback.extract_tb}.\n ' f = getDivisionFailure(captureVars=True) expected = traceback.extract_tb(f.getTra...
def test_getTracebackObjectWithoutTraceback(self): '\n L{failure.Failure}s need not be constructed with traceback objects. If\n a C{Failure} has no traceback information at all, C{getTracebackObject}\n just returns None.\n\n None is a good value, because traceback.extract_tb(None) -> []....
4,546,643,067,208,967,000
L{failure.Failure}s need not be constructed with traceback objects. If a C{Failure} has no traceback information at all, C{getTracebackObject} just returns None. None is a good value, because traceback.extract_tb(None) -> [].
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_getTracebackObjectWithoutTraceback
XZH950926/meizitu
python
def test_getTracebackObjectWithoutTraceback(self): '\n L{failure.Failure}s need not be constructed with traceback objects. If\n a C{Failure} has no traceback information at all, C{getTracebackObject}\n just returns None.\n\n None is a good value, because traceback.extract_tb(None) -> []....
def test_tracebackFromExceptionInPython3(self): "\n If a L{failure.Failure} is constructed with an exception but no\n traceback in Python 3, the traceback will be extracted from the\n exception's C{__traceback__} attribute.\n " try: (1 / 0) except: (klass, excepti...
-6,128,524,984,914,566,000
If a L{failure.Failure} is constructed with an exception but no traceback in Python 3, the traceback will be extracted from the exception's C{__traceback__} attribute.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_tracebackFromExceptionInPython3
XZH950926/meizitu
python
def test_tracebackFromExceptionInPython3(self): "\n If a L{failure.Failure} is constructed with an exception but no\n traceback in Python 3, the traceback will be extracted from the\n exception's C{__traceback__} attribute.\n " try: (1 / 0) except: (klass, excepti...
def test_cleanFailureRemovesTracebackInPython3(self): '\n L{failure.Failure.cleanFailure} sets the C{__traceback__} attribute of\n the exception to L{None} in Python 3.\n ' f = getDivisionFailure() self.assertIsNotNone(f.tb) self.assertIs(f.value.__traceback__, f.tb) f.cleanFail...
5,851,350,304,530,237,000
L{failure.Failure.cleanFailure} sets the C{__traceback__} attribute of the exception to L{None} in Python 3.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_cleanFailureRemovesTracebackInPython3
XZH950926/meizitu
python
def test_cleanFailureRemovesTracebackInPython3(self): '\n L{failure.Failure.cleanFailure} sets the C{__traceback__} attribute of\n the exception to L{None} in Python 3.\n ' f = getDivisionFailure() self.assertIsNotNone(f.tb) self.assertIs(f.value.__traceback__, f.tb) f.cleanFail...
def test_repr(self): '\n The C{repr} of a L{failure.Failure} shows the type and string\n representation of the underlying exception.\n ' f = getDivisionFailure() typeName = reflect.fullyQualifiedName(ZeroDivisionError) self.assertEqual(repr(f), ('<twisted.python.failure.Failure %s: ...
58,509,812,011,884,360
The C{repr} of a L{failure.Failure} shows the type and string representation of the underlying exception.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_repr
XZH950926/meizitu
python
def test_repr(self): '\n The C{repr} of a L{failure.Failure} shows the type and string\n representation of the underlying exception.\n ' f = getDivisionFailure() typeName = reflect.fullyQualifiedName(ZeroDivisionError) self.assertEqual(repr(f), ('<twisted.python.failure.Failure %s: ...
def _brokenValueTest(self, detail): '\n Construct a L{Failure} with an exception that raises an exception from\n its C{__str__} method and then call C{getTraceback} with the specified\n detail and verify that it returns a string.\n ' x = BrokenStr() f = failure.Failure(x) tra...
5,467,890,743,580,913,000
Construct a L{Failure} with an exception that raises an exception from its C{__str__} method and then call C{getTraceback} with the specified detail and verify that it returns a string.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
_brokenValueTest
XZH950926/meizitu
python
def _brokenValueTest(self, detail): '\n Construct a L{Failure} with an exception that raises an exception from\n its C{__str__} method and then call C{getTraceback} with the specified\n detail and verify that it returns a string.\n ' x = BrokenStr() f = failure.Failure(x) tra...
def test_brokenValueBriefDetail(self): '\n A L{Failure} might wrap an exception with a C{__str__} method which\n raises an exception. In this case, calling C{getTraceback} on the\n failure with the C{"brief"} detail does not raise an exception.\n ' self._brokenValueTest('brief')
-1,727,253,668,860,962,600
A L{Failure} might wrap an exception with a C{__str__} method which raises an exception. In this case, calling C{getTraceback} on the failure with the C{"brief"} detail does not raise an exception.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_brokenValueBriefDetail
XZH950926/meizitu
python
def test_brokenValueBriefDetail(self): '\n A L{Failure} might wrap an exception with a C{__str__} method which\n raises an exception. In this case, calling C{getTraceback} on the\n failure with the C{"brief"} detail does not raise an exception.\n ' self._brokenValueTest('brief')
def test_brokenValueDefaultDetail(self): '\n Like test_brokenValueBriefDetail, but for the C{"default"} detail case.\n ' self._brokenValueTest('default')
-260,785,803,897,932,000
Like test_brokenValueBriefDetail, but for the C{"default"} detail case.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_brokenValueDefaultDetail
XZH950926/meizitu
python
def test_brokenValueDefaultDetail(self): '\n \n ' self._brokenValueTest('default')
def test_brokenValueVerboseDetail(self): '\n Like test_brokenValueBriefDetail, but for the C{"default"} detail case.\n ' self._brokenValueTest('verbose')
8,684,888,862,353,874,000
Like test_brokenValueBriefDetail, but for the C{"default"} detail case.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_brokenValueVerboseDetail
XZH950926/meizitu
python
def test_brokenValueVerboseDetail(self): '\n \n ' self._brokenValueTest('verbose')
def _brokenTypeTest(self, detail): '\n Construct a L{Failure} with an exception type that raises an exception\n from its C{__str__} method and then call C{getTraceback} with the\n specified detail and verify that it returns a string.\n ' f = failure.Failure(BrokenExceptionType()) ...
-6,259,474,326,034,104,000
Construct a L{Failure} with an exception type that raises an exception from its C{__str__} method and then call C{getTraceback} with the specified detail and verify that it returns a string.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
_brokenTypeTest
XZH950926/meizitu
python
def _brokenTypeTest(self, detail): '\n Construct a L{Failure} with an exception type that raises an exception\n from its C{__str__} method and then call C{getTraceback} with the\n specified detail and verify that it returns a string.\n ' f = failure.Failure(BrokenExceptionType()) ...
def test_brokenTypeBriefDetail(self): '\n A L{Failure} might wrap an exception the type object of which has a\n C{__str__} method which raises an exception. In this case, calling\n C{getTraceback} on the failure with the C{"brief"} detail does not raise\n an exception.\n ' se...
4,389,251,325,825,251,000
A L{Failure} might wrap an exception the type object of which has a C{__str__} method which raises an exception. In this case, calling C{getTraceback} on the failure with the C{"brief"} detail does not raise an exception.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_brokenTypeBriefDetail
XZH950926/meizitu
python
def test_brokenTypeBriefDetail(self): '\n A L{Failure} might wrap an exception the type object of which has a\n C{__str__} method which raises an exception. In this case, calling\n C{getTraceback} on the failure with the C{"brief"} detail does not raise\n an exception.\n ' se...
def test_brokenTypeDefaultDetail(self): '\n Like test_brokenTypeBriefDetail, but for the C{"default"} detail case.\n ' self._brokenTypeTest('default')
-5,164,781,728,596,901,000
Like test_brokenTypeBriefDetail, but for the C{"default"} detail case.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_brokenTypeDefaultDetail
XZH950926/meizitu
python
def test_brokenTypeDefaultDetail(self): '\n \n ' self._brokenTypeTest('default')
def test_brokenTypeVerboseDetail(self): '\n Like test_brokenTypeBriefDetail, but for the C{"verbose"} detail case.\n ' self._brokenTypeTest('verbose')
7,688,043,825,222,599,000
Like test_brokenTypeBriefDetail, but for the C{"verbose"} detail case.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_brokenTypeVerboseDetail
XZH950926/meizitu
python
def test_brokenTypeVerboseDetail(self): '\n \n ' self._brokenTypeTest('verbose')
def test_findNoFailureInExceptionHandler(self): '\n Within an exception handler, _findFailure should return\n L{None} in case no Failure is associated with the current\n exception.\n ' try: (1 / 0) except: self.assertIsNone(failure.Failure._findFailure()) else...
970,034,958,631,364,700
Within an exception handler, _findFailure should return L{None} in case no Failure is associated with the current exception.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_findNoFailureInExceptionHandler
XZH950926/meizitu
python
def test_findNoFailureInExceptionHandler(self): '\n Within an exception handler, _findFailure should return\n L{None} in case no Failure is associated with the current\n exception.\n ' try: (1 / 0) except: self.assertIsNone(failure.Failure._findFailure()) else...
def test_findNoFailure(self): '\n Outside of an exception handler, _findFailure should return None.\n ' if (sys.version_info < (3, 0)): sys.exc_clear() self.assertIsNone(sys.exc_info()[(- 1)]) self.assertIsNone(failure.Failure._findFailure())
-2,677,873,085,622,452,700
Outside of an exception handler, _findFailure should return None.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_findNoFailure
XZH950926/meizitu
python
def test_findNoFailure(self): '\n \n ' if (sys.version_info < (3, 0)): sys.exc_clear() self.assertIsNone(sys.exc_info()[(- 1)]) self.assertIsNone(failure.Failure._findFailure())
def test_findFailure(self): '\n Within an exception handler, it should be possible to find the\n original Failure that caused the current exception (if it was\n caused by raiseException).\n ' f = getDivisionFailure() f.cleanFailure() try: f.raiseException() except...
8,117,886,591,194,119,000
Within an exception handler, it should be possible to find the original Failure that caused the current exception (if it was caused by raiseException).
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_findFailure
XZH950926/meizitu
python
def test_findFailure(self): '\n Within an exception handler, it should be possible to find the\n original Failure that caused the current exception (if it was\n caused by raiseException).\n ' f = getDivisionFailure() f.cleanFailure() try: f.raiseException() except...
def test_failureConstructionFindsOriginalFailure(self): '\n When a Failure is constructed in the context of an exception\n handler that is handling an exception raised by\n raiseException, the new Failure should be chained to that\n original Failure.\n ' f = getDivisionFailure...
6,428,602,133,564,756,000
When a Failure is constructed in the context of an exception handler that is handling an exception raised by raiseException, the new Failure should be chained to that original Failure.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_failureConstructionFindsOriginalFailure
XZH950926/meizitu
python
def test_failureConstructionFindsOriginalFailure(self): '\n When a Failure is constructed in the context of an exception\n handler that is handling an exception raised by\n raiseException, the new Failure should be chained to that\n original Failure.\n ' f = getDivisionFailure...
def test_failureConstructionWithMungedStackSucceeds(self): '\n Pyrex and Cython are known to insert fake stack frames so as to give\n more Python-like tracebacks. These stack frames with empty code objects\n should not break extraction of the exception.\n ' try: raiser.raiseE...
6,947,278,950,813,051,000
Pyrex and Cython are known to insert fake stack frames so as to give more Python-like tracebacks. These stack frames with empty code objects should not break extraction of the exception.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_failureConstructionWithMungedStackSucceeds
XZH950926/meizitu
python
def test_failureConstructionWithMungedStackSucceeds(self): '\n Pyrex and Cython are known to insert fake stack frames so as to give\n more Python-like tracebacks. These stack frames with empty code objects\n should not break extraction of the exception.\n ' try: raiser.raiseE...
def test_singleFrame(self): '\n A C{_Traceback} object constructed with a single frame should be able\n to be passed to L{traceback.extract_tb}, and we should get a singleton\n list containing a (filename, lineno, methodname, line) tuple.\n ' tb = failure._Traceback([['method', 'file...
-1,393,764,764,254,306,000
A C{_Traceback} object constructed with a single frame should be able to be passed to L{traceback.extract_tb}, and we should get a singleton list containing a (filename, lineno, methodname, line) tuple.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_singleFrame
XZH950926/meizitu
python
def test_singleFrame(self): '\n A C{_Traceback} object constructed with a single frame should be able\n to be passed to L{traceback.extract_tb}, and we should get a singleton\n list containing a (filename, lineno, methodname, line) tuple.\n ' tb = failure._Traceback([['method', 'file...
def test_manyFrames(self): '\n A C{_Traceback} object constructed with multiple frames should be able\n to be passed to L{traceback.extract_tb}, and we should get a list\n containing a tuple for each frame.\n ' tb = failure._Traceback([['method1', 'filename.py', 123, {}, {}], ['metho...
-3,130,121,095,846,734,300
A C{_Traceback} object constructed with multiple frames should be able to be passed to L{traceback.extract_tb}, and we should get a list containing a tuple for each frame.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_manyFrames
XZH950926/meizitu
python
def test_manyFrames(self): '\n A C{_Traceback} object constructed with multiple frames should be able\n to be passed to L{traceback.extract_tb}, and we should get a list\n containing a tuple for each frame.\n ' tb = failure._Traceback([['method1', 'filename.py', 123, {}, {}], ['metho...
def test_fakeFrameAttributes(self): '\n L{_Frame} instances have the C{f_globals} and C{f_locals} attributes\n bound to C{dict} instance. They also have the C{f_code} attribute\n bound to something like a code object.\n ' frame = failure._Frame('dummyname', 'dummyfilename') self...
-2,995,569,665,752,570,400
L{_Frame} instances have the C{f_globals} and C{f_locals} attributes bound to C{dict} instance. They also have the C{f_code} attribute bound to something like a code object.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_fakeFrameAttributes
XZH950926/meizitu
python
def test_fakeFrameAttributes(self): '\n L{_Frame} instances have the C{f_globals} and C{f_locals} attributes\n bound to C{dict} instance. They also have the C{f_code} attribute\n bound to something like a code object.\n ' frame = failure._Frame('dummyname', 'dummyfilename') self...
def setUp(self): "\n Override pdb.post_mortem so we can make sure it's called.\n " post_mortem = pdb.post_mortem origInit = failure.Failure.__init__ def restore(): pdb.post_mortem = post_mortem failure.Failure.__init__ = origInit self.addCleanup(restore) self.resul...
6,436,035,593,134,350,000
Override pdb.post_mortem so we can make sure it's called.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
setUp
XZH950926/meizitu
python
def setUp(self): "\n \n " post_mortem = pdb.post_mortem origInit = failure.Failure.__init__ def restore(): pdb.post_mortem = post_mortem failure.Failure.__init__ = origInit self.addCleanup(restore) self.result = [] pdb.post_mortem = self.result.append failu...
def test_regularFailure(self): '\n If startDebugMode() is called, calling Failure() will first call\n pdb.post_mortem with the traceback.\n ' try: (1 / 0) except: (typ, exc, tb) = sys.exc_info() f = failure.Failure() self.assertEqual(self.result, [tb]) se...
-740,433,790,781,489,700
If startDebugMode() is called, calling Failure() will first call pdb.post_mortem with the traceback.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_regularFailure
XZH950926/meizitu
python
def test_regularFailure(self): '\n If startDebugMode() is called, calling Failure() will first call\n pdb.post_mortem with the traceback.\n ' try: (1 / 0) except: (typ, exc, tb) = sys.exc_info() f = failure.Failure() self.assertEqual(self.result, [tb]) se...
def test_captureVars(self): '\n If startDebugMode() is called, passing captureVars to Failure() will\n not blow up.\n ' try: (1 / 0) except: (typ, exc, tb) = sys.exc_info() f = failure.Failure(captureVars=True) self.assertEqual(self.result, [tb]) self.ass...
-213,307,526,298,185,900
If startDebugMode() is called, passing captureVars to Failure() will not blow up.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_captureVars
XZH950926/meizitu
python
def test_captureVars(self): '\n If startDebugMode() is called, passing captureVars to Failure() will\n not blow up.\n ' try: (1 / 0) except: (typ, exc, tb) = sys.exc_info() f = failure.Failure(captureVars=True) self.assertEqual(self.result, [tb]) self.ass...
def test_throwExceptionIntoGenerator(self): '\n It should be possible to throw the exception that a Failure\n represents into a generator.\n ' stuff = [] def generator(): try: (yield) except: stuff.append(sys.exc_info()) else: ...
-7,581,980,284,546,282,000
It should be possible to throw the exception that a Failure represents into a generator.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_throwExceptionIntoGenerator
XZH950926/meizitu
python
def test_throwExceptionIntoGenerator(self): '\n It should be possible to throw the exception that a Failure\n represents into a generator.\n ' stuff = [] def generator(): try: (yield) except: stuff.append(sys.exc_info()) else: ...
def test_findFailureInGenerator(self): '\n Within an exception handler, it should be possible to find the\n original Failure that caused the current exception (if it was\n caused by throwExceptionIntoGenerator).\n ' f = getDivisionFailure() f.cleanFailure() foundFailures = []...
-5,148,197,409,422,034,000
Within an exception handler, it should be possible to find the original Failure that caused the current exception (if it was caused by throwExceptionIntoGenerator).
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_findFailureInGenerator
XZH950926/meizitu
python
def test_findFailureInGenerator(self): '\n Within an exception handler, it should be possible to find the\n original Failure that caused the current exception (if it was\n caused by throwExceptionIntoGenerator).\n ' f = getDivisionFailure() f.cleanFailure() foundFailures = []...
def test_failureConstructionFindsOriginalFailure(self): '\n When a Failure is constructed in the context of an exception\n handler that is handling an exception raised by\n throwExceptionIntoGenerator, the new Failure should be chained to that\n original Failure.\n ' f = getDi...
4,226,784,292,072,206,000
When a Failure is constructed in the context of an exception handler that is handling an exception raised by throwExceptionIntoGenerator, the new Failure should be chained to that original Failure.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_failureConstructionFindsOriginalFailure
XZH950926/meizitu
python
def test_failureConstructionFindsOriginalFailure(self): '\n When a Failure is constructed in the context of an exception\n handler that is handling an exception raised by\n throwExceptionIntoGenerator, the new Failure should be chained to that\n original Failure.\n ' f = getDi...
def test_ambiguousFailureInGenerator(self): '\n When a generator reraises a different exception,\n L{Failure._findFailure} inside the generator should find the reraised\n exception rather than original one.\n ' def generator(): try: try: (yield) ...
-2,900,656,017,749,723,600
When a generator reraises a different exception, L{Failure._findFailure} inside the generator should find the reraised exception rather than original one.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_ambiguousFailureInGenerator
XZH950926/meizitu
python
def test_ambiguousFailureInGenerator(self): '\n When a generator reraises a different exception,\n L{Failure._findFailure} inside the generator should find the reraised\n exception rather than original one.\n ' def generator(): try: try: (yield) ...
def test_ambiguousFailureFromGenerator(self): '\n When a generator reraises a different exception,\n L{Failure._findFailure} above the generator should find the reraised\n exception rather than original one.\n ' def generator(): try: (yield) except: ...
2,801,333,408,657,701,400
When a generator reraises a different exception, L{Failure._findFailure} above the generator should find the reraised exception rather than original one.
fang/Twisted-18.4.0/src/twisted/test/test_failure.py
test_ambiguousFailureFromGenerator
XZH950926/meizitu
python
def test_ambiguousFailureFromGenerator(self): '\n When a generator reraises a different exception,\n L{Failure._findFailure} above the generator should find the reraised\n exception rather than original one.\n ' def generator(): try: (yield) except: ...
def __init__(self, ad: AppDaemon): 'Constructor.\n\n Args:\n ad: Reference to the AppDaemon object\n ' self.AD = ad self.logger = ad.logging.get_child('_events')
6,886,154,475,808,460,000
Constructor. Args: ad: Reference to the AppDaemon object
appdaemon/events.py
__init__
DTTerastar/appdaemon
python
def __init__(self, ad: AppDaemon): 'Constructor.\n\n Args:\n ad: Reference to the AppDaemon object\n ' self.AD = ad self.logger = ad.logging.get_child('_events')
async def add_event_callback(self, name, namespace, cb, event, **kwargs): 'Adds a callback for an event which is called internally by apps.\n\n Args:\n name (str): Name of the app.\n namespace (str): Namespace of the event.\n cb: Callback function.\n event (str): ...
-440,333,686,961,987,840
Adds a callback for an event which is called internally by apps. Args: name (str): Name of the app. namespace (str): Namespace of the event. cb: Callback function. event (str): Name of the event. **kwargs: List of values to filter on, and additional arguments to pass to the callback. Returns: ...
appdaemon/events.py
add_event_callback
DTTerastar/appdaemon
python
async def add_event_callback(self, name, namespace, cb, event, **kwargs): 'Adds a callback for an event which is called internally by apps.\n\n Args:\n name (str): Name of the app.\n namespace (str): Namespace of the event.\n cb: Callback function.\n event (str): ...
async def cancel_event_callback(self, name, handle): 'Cancels an event callback.\n\n Args:\n name (str): Name of the app or module.\n handle: Previously supplied callback handle for the callback.\n\n Returns:\n None.\n\n ' executed = False async with sel...
895,694,378,937,561,600
Cancels an event callback. Args: name (str): Name of the app or module. handle: Previously supplied callback handle for the callback. Returns: None.
appdaemon/events.py
cancel_event_callback
DTTerastar/appdaemon
python
async def cancel_event_callback(self, name, handle): 'Cancels an event callback.\n\n Args:\n name (str): Name of the app or module.\n handle: Previously supplied callback handle for the callback.\n\n Returns:\n None.\n\n ' executed = False async with sel...
async def info_event_callback(self, name, handle): 'Gets the information of an event callback.\n\n Args:\n name (str): Name of the app or subsystem.\n handle: Previously supplied handle for the callback.\n\n Returns:\n A dictionary of callback entries or rise a ``Value...
-1,162,147,695,080,955,400
Gets the information of an event callback. Args: name (str): Name of the app or subsystem. handle: Previously supplied handle for the callback. Returns: A dictionary of callback entries or rise a ``ValueError`` if an invalid handle is provided.
appdaemon/events.py
info_event_callback
DTTerastar/appdaemon
python
async def info_event_callback(self, name, handle): 'Gets the information of an event callback.\n\n Args:\n name (str): Name of the app or subsystem.\n handle: Previously supplied handle for the callback.\n\n Returns:\n A dictionary of callback entries or rise a ``Value...
async def fire_event(self, namespace, event, **kwargs): 'Fires an event.\n\n If the namespace does not have a plugin associated with it, the event will be fired locally.\n If a plugin is associated, the firing of the event will be delegated to the plugin, under the\n understanding that when the...
1,890,551,796,475,495,000
Fires an event. If the namespace does not have a plugin associated with it, the event will be fired locally. If a plugin is associated, the firing of the event will be delegated to the plugin, under the understanding that when the event is fired, the plugin will notify appdaemon that it occurred, usually via the syste...
appdaemon/events.py
fire_event
DTTerastar/appdaemon
python
async def fire_event(self, namespace, event, **kwargs): 'Fires an event.\n\n If the namespace does not have a plugin associated with it, the event will be fired locally.\n If a plugin is associated, the firing of the event will be delegated to the plugin, under the\n understanding that when the...
async def process_event(self, namespace, data): 'Processes an event that has been received either locally or from a plugin.\n\n Args:\n namespace (str): Namespace the event was fired in.\n data: Data associated with the event.\n\n Returns:\n None.\n\n ' try:...
6,674,242,740,453,871,000
Processes an event that has been received either locally or from a plugin. Args: namespace (str): Namespace the event was fired in. data: Data associated with the event. Returns: None.
appdaemon/events.py
process_event
DTTerastar/appdaemon
python
async def process_event(self, namespace, data): 'Processes an event that has been received either locally or from a plugin.\n\n Args:\n namespace (str): Namespace the event was fired in.\n data: Data associated with the event.\n\n Returns:\n None.\n\n ' try:...
async def has_log_callback(self, name): 'Returns ``True`` if the app has a log callback, ``False`` otherwise.\n\n Used to prevent callback loops. In the calling logic, if this function returns\n ``True`` the resulting logging event will be suppressed.\n\n Args:\n name (str): Name of ...
1,133,120,197,770,422,000
Returns ``True`` if the app has a log callback, ``False`` otherwise. Used to prevent callback loops. In the calling logic, if this function returns ``True`` the resulting logging event will be suppressed. Args: name (str): Name of the app.
appdaemon/events.py
has_log_callback
DTTerastar/appdaemon
python
async def has_log_callback(self, name): 'Returns ``True`` if the app has a log callback, ``False`` otherwise.\n\n Used to prevent callback loops. In the calling logic, if this function returns\n ``True`` the resulting logging event will be suppressed.\n\n Args:\n name (str): Name of ...
async def process_event_callbacks(self, namespace, data): 'Processes a pure event callback.\n\n Locate any callbacks that may be registered for this event, check for filters and if appropriate,\n dispatch the event for further checking and eventual action.\n\n Args:\n namespace (str)...
1,583,161,895,843,194,000
Processes a pure event callback. Locate any callbacks that may be registered for this event, check for filters and if appropriate, dispatch the event for further checking and eventual action. Args: namespace (str): Namespace of the event. data: Data associated with the event. Returns: None.
appdaemon/events.py
process_event_callbacks
DTTerastar/appdaemon
python
async def process_event_callbacks(self, namespace, data): 'Processes a pure event callback.\n\n Locate any callbacks that may be registered for this event, check for filters and if appropriate,\n dispatch the event for further checking and eventual action.\n\n Args:\n namespace (str)...
def source_regex_locations(self): ' Test that restricting source expressions to files & to functions. ' exe = os.path.join(os.getcwd(), 'a.out') target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) target_files = lldb.SBFileSpecList() target_files.Append(lldb.SBFileSpec('a.c...
9,138,448,826,118,702,000
Test that restricting source expressions to files & to functions.
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py
source_regex_locations
Polidea/SiriusObfuscator
python
def source_regex_locations(self): ' ' exe = os.path.join(os.getcwd(), 'a.out') target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) target_files = lldb.SBFileSpecList() target_files.Append(lldb.SBFileSpec('a.c')) func_names = lldb.SBStringList() func_names.AppendStr...
def source_regex_restrictions(self): ' Test that restricting source expressions to files & to functions. ' exe = os.path.join(os.getcwd(), 'a.out') target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) target_files = lldb.SBFileSpecList() target_files.Append(lldb.SBFileSpec('...
8,368,960,995,021,304,000
Test that restricting source expressions to files & to functions.
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py
source_regex_restrictions
Polidea/SiriusObfuscator
python
def source_regex_restrictions(self): ' ' exe = os.path.join(os.getcwd(), 'a.out') target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) target_files = lldb.SBFileSpecList() target_files.Append(lldb.SBFileSpec('main.c')) source_regex = 'Set . breakpoint here' main_bre...
def new_connection(self, workerId: str, socket): ' Create a mapping structure to establish a bond between a workerId and a socket descriptor.\n\n Args:\n workerId: UUID string used to identify workers.\n socket: Socket descriptor that will be used to send/receive messages fr...
7,135,368,950,734,366,000
Create a mapping structure to establish a bond between a workerId and a socket descriptor. Args: workerId: UUID string used to identify workers. socket: Socket descriptor that will be used to send/receive messages from this client. Returns: Worker: a worker instance with the corresponding workerId
gridnetwork/events/socket_handler.py
new_connection
kuronosec/PyGridNetwork
python
def new_connection(self, workerId: str, socket): ' Create a mapping structure to establish a bond between a workerId and a socket descriptor.\n\n Args:\n workerId: UUID string used to identify workers.\n socket: Socket descriptor that will be used to send/receive messages fr...
def send_msg(self, workerId: str, message: str): ' Find the socket descriptor mapped by workerId and send them a message.\n\n Args:\n workerId: UUID string used to identify and retrieve a worker.\n message: Message to be send.\n ' socket = self.connections.get(wor...
-830,059,463,909,367,300
Find the socket descriptor mapped by workerId and send them a message. Args: workerId: UUID string used to identify and retrieve a worker. message: Message to be send.
gridnetwork/events/socket_handler.py
send_msg
kuronosec/PyGridNetwork
python
def send_msg(self, workerId: str, message: str): ' Find the socket descriptor mapped by workerId and send them a message.\n\n Args:\n workerId: UUID string used to identify and retrieve a worker.\n message: Message to be send.\n ' socket = self.connections.get(wor...
def get(self, query): 'Retrieve a worker by its UUID string or its socket descriptor.' if isinstance(query, str): return self.connections.get(query, None) else: return self.__retrieve_worker_by_socket(query)
5,881,453,422,708,374,000
Retrieve a worker by its UUID string or its socket descriptor.
gridnetwork/events/socket_handler.py
get
kuronosec/PyGridNetwork
python
def get(self, query): if isinstance(query, str): return self.connections.get(query, None) else: return self.__retrieve_worker_by_socket(query)
def remove(self, socket) -> str: ' Remove a socket descriptor from mapping structure. It will be used when the socket connection is closed.\n\n Args:\n socket: socket descriptor used to send/receive messages.\n\n Returns:\n workerId: Worker id linked to that conne...
-1,422,404,848,341,396,700
Remove a socket descriptor from mapping structure. It will be used when the socket connection is closed. Args: socket: socket descriptor used to send/receive messages. Returns: workerId: Worker id linked to that connection.
gridnetwork/events/socket_handler.py
remove
kuronosec/PyGridNetwork
python
def remove(self, socket) -> str: ' Remove a socket descriptor from mapping structure. It will be used when the socket connection is closed.\n\n Args:\n socket: socket descriptor used to send/receive messages.\n\n Returns:\n workerId: Worker id linked to that conne...
@property def nodes(self) -> list: 'Return all the connected nodes as a list of tuples of (worker_id, worker)' return list(self.connections.items())
6,549,633,896,146,046,000
Return all the connected nodes as a list of tuples of (worker_id, worker)
gridnetwork/events/socket_handler.py
nodes
kuronosec/PyGridNetwork
python
@property def nodes(self) -> list: return list(self.connections.items())
def __len__(self) -> int: ' Number of connections handled by this server.\n\n Returns:\n length: number of connections handled by this server.\n ' return len(self.connections)
-5,961,706,619,804,543,000
Number of connections handled by this server. Returns: length: number of connections handled by this server.
gridnetwork/events/socket_handler.py
__len__
kuronosec/PyGridNetwork
python
def __len__(self) -> int: ' Number of connections handled by this server.\n\n Returns:\n length: number of connections handled by this server.\n ' return len(self.connections)
def _get_vco(verts_orig, loop): '\n Get vertex original coordinate from loop\n ' for vo in verts_orig: if ((vo['vidx'] == loop.vert.index) and (vo['moved'] is False)): return vo['vco'] return loop.vert.co
-7,784,488,194,725,501,000
Get vertex original coordinate from loop
engine/2.80/scripts/addons/magic_uv/op/texture_lock.py
_get_vco
byteinc/Phasor
python
def _get_vco(verts_orig, loop): '\n \n ' for vo in verts_orig: if ((vo['vidx'] == loop.vert.index) and (vo['moved'] is False)): return vo['vco'] return loop.vert.co
def _get_link_loops(vert): '\n Get loop linked to vertex\n ' link_loops = [] for f in vert.link_faces: adj_loops = [] for loop in f.loops: if (loop.vert == vert): l = loop else: for e in loop.vert.link_edges: i...
-2,814,715,461,684,407,000
Get loop linked to vertex
engine/2.80/scripts/addons/magic_uv/op/texture_lock.py
_get_link_loops
byteinc/Phasor
python
def _get_link_loops(vert): '\n \n ' link_loops = [] for f in vert.link_faces: adj_loops = [] for loop in f.loops: if (loop.vert == vert): l = loop else: for e in loop.vert.link_edges: if (e.other_vert(loop.vert...
def _get_ini_geom(link_loop, uv_layer, verts_orig, v_orig): '\n Get initial geometory\n (Get interior angle of face in vertex/UV space)\n ' u = link_loop['l'][uv_layer].uv v0 = _get_vco(verts_orig, link_loop['l0']) u0 = link_loop['l0'][uv_layer].uv v1 = _get_vco(verts_orig, link_loop['l1'])...
3,110,401,165,743,732,000
Get initial geometory (Get interior angle of face in vertex/UV space)
engine/2.80/scripts/addons/magic_uv/op/texture_lock.py
_get_ini_geom
byteinc/Phasor
python
def _get_ini_geom(link_loop, uv_layer, verts_orig, v_orig): '\n Get initial geometory\n (Get interior angle of face in vertex/UV space)\n ' u = link_loop['l'][uv_layer].uv v0 = _get_vco(verts_orig, link_loop['l0']) u0 = link_loop['l0'][uv_layer].uv v1 = _get_vco(verts_orig, link_loop['l1'])...
def _get_target_uv(link_loop, uv_layer, verts_orig, v, ini_geom): '\n Get target UV coordinate\n ' v0 = _get_vco(verts_orig, link_loop['l0']) lo0 = link_loop['l0'] v1 = _get_vco(verts_orig, link_loop['l1']) lo1 = link_loop['l1'] v0v1 = (v1 - v0) v0v = (v.co - v0) v1v = (v.co - v1) ...
3,503,573,570,658,573,000
Get target UV coordinate
engine/2.80/scripts/addons/magic_uv/op/texture_lock.py
_get_target_uv
byteinc/Phasor
python
def _get_target_uv(link_loop, uv_layer, verts_orig, v, ini_geom): '\n \n ' v0 = _get_vco(verts_orig, link_loop['l0']) lo0 = link_loop['l0'] v1 = _get_vco(verts_orig, link_loop['l1']) lo1 = link_loop['l1'] v0v1 = (v1 - v0) v0v = (v.co - v0) v1v = (v.co - v1) theta0 = v0v1.angle(...
def _calc_tri_vert(v0, v1, angle0, angle1): '\n Calculate rest coordinate from other coordinates and angle of end\n ' angle = ((math.pi - angle0) - angle1) alpha = atan2((v1.y - v0.y), (v1.x - v0.x)) d = ((v1.x - v0.x) / cos(alpha)) a = ((d * sin(angle0)) / sin(angle)) b = ((d * sin(angle1...
240,756,091,218,326,300
Calculate rest coordinate from other coordinates and angle of end
engine/2.80/scripts/addons/magic_uv/op/texture_lock.py
_calc_tri_vert
byteinc/Phasor
python
def _calc_tri_vert(v0, v1, angle0, angle1): '\n \n ' angle = ((math.pi - angle0) - angle1) alpha = atan2((v1.y - v0.y), (v1.x - v0.x)) d = ((v1.x - v0.x) / cos(alpha)) a = ((d * sin(angle0)) / sin(angle)) b = ((d * sin(angle1)) / sin(angle)) s = (((a + b) + d) / 2.0) if (fabs(d) < ...
def __update_uv(self, context): '\n Update UV when vertex coordinates are changed\n ' obj = context.active_object bm = bmesh.from_edit_mesh(obj.data) if (common.check_version(2, 73, 0) >= 0): bm.verts.ensure_lookup_table() bm.edges.ensure_lookup_table() bm.faces.ens...
9,013,071,885,757,533,000
Update UV when vertex coordinates are changed
engine/2.80/scripts/addons/magic_uv/op/texture_lock.py
__update_uv
byteinc/Phasor
python
def __update_uv(self, context): '\n \n ' obj = context.active_object bm = bmesh.from_edit_mesh(obj.data) if (common.check_version(2, 73, 0) >= 0): bm.verts.ensure_lookup_table() bm.edges.ensure_lookup_table() bm.faces.ensure_lookup_table() if (not bm.loops.layer...
def create_figure_and_sliders(name, state_dim): '\n Creating a window for the latent space visualization,\n and another one for the sliders to control it.\n\n :param name: name of model (str)\n :param state_dim: (int)\n :return:\n ' cv2.namedWindow(name, cv2.WINDOW_NORMAL) cv2.resizeWindow...
-3,995,013,066,744,532,500
Creating a window for the latent space visualization, and another one for the sliders to control it. :param name: name of model (str) :param state_dim: (int) :return:
ae/enjoy_latent.py
create_figure_and_sliders
araffin/aae-train-donkeycar
python
def create_figure_and_sliders(name, state_dim): '\n Creating a window for the latent space visualization,\n and another one for the sliders to control it.\n\n :param name: name of model (str)\n :param state_dim: (int)\n :return:\n ' cv2.namedWindow(name, cv2.WINDOW_NORMAL) cv2.resizeWindow...
def nms(dets, thresh): 'Apply classic DPM-style greedy NMS.' if (dets.shape[0] == 0): return dets[[], :] scores = dets[:, 0] x1 = dets[:, 1] y1 = dets[:, 2] x2 = dets[:, 3] y2 = dets[:, 4] areas = (((x2 - x1) + 1) * ((y2 - y1) + 1)) order = scores.argsort()[::(- 1)] ndets...
80,342,114,398,799,000
Apply classic DPM-style greedy NMS.
ppdet/modeling/post_process.py
nms
gbstack/PaddleDetection
python
def nms(dets, thresh): if (dets.shape[0] == 0): return dets[[], :] scores = dets[:, 0] x1 = dets[:, 1] y1 = dets[:, 2] x2 = dets[:, 3] y2 = dets[:, 4] areas = (((x2 - x1) + 1) * ((y2 - y1) + 1)) order = scores.argsort()[::(- 1)] ndets = dets.shape[0] suppressed = np....
def forward(self, head_out, rois, im_shape, scale_factor): '\n Decode the bbox and do NMS if needed. \n\n Args:\n head_out (tuple): bbox_pred and cls_prob of bbox_head output.\n rois (tuple): roi and rois_num of rpn_head output.\n im_shape (Tensor): The shape of the in...
-2,970,551,212,598,684,000
Decode the bbox and do NMS if needed. Args: head_out (tuple): bbox_pred and cls_prob of bbox_head output. rois (tuple): roi and rois_num of rpn_head output. im_shape (Tensor): The shape of the input image. scale_factor (Tensor): The scale factor of the input image. Returns: bbox_pred (Tensor): The...
ppdet/modeling/post_process.py
forward
gbstack/PaddleDetection
python
def forward(self, head_out, rois, im_shape, scale_factor): '\n Decode the bbox and do NMS if needed. \n\n Args:\n head_out (tuple): bbox_pred and cls_prob of bbox_head output.\n rois (tuple): roi and rois_num of rpn_head output.\n im_shape (Tensor): The shape of the in...
def get_pred(self, bboxes, bbox_num, im_shape, scale_factor): '\n Rescale, clip and filter the bbox from the output of NMS to \n get final prediction. \n \n Notes:\n Currently only support bs = 1.\n\n Args:\n bboxes (Tensor): The output bboxes with shape [N, 6] a...
3,043,091,144,749,047,000
Rescale, clip and filter the bbox from the output of NMS to get final prediction. Notes: Currently only support bs = 1. Args: bboxes (Tensor): The output bboxes with shape [N, 6] after decode and NMS, including labels, scores and bboxes. bbox_num (Tensor): The number of prediction boxes of each batc...
ppdet/modeling/post_process.py
get_pred
gbstack/PaddleDetection
python
def get_pred(self, bboxes, bbox_num, im_shape, scale_factor): '\n Rescale, clip and filter the bbox from the output of NMS to \n get final prediction. \n \n Notes:\n Currently only support bs = 1.\n\n Args:\n bboxes (Tensor): The output bboxes with shape [N, 6] a...
def paste_mask(self, masks, boxes, im_h, im_w): '\n Paste the mask prediction to the original image.\n ' (x0, y0, x1, y1) = paddle.split(boxes, 4, axis=1) masks = paddle.unsqueeze(masks, [0, 1]) img_y = (paddle.arange(0, im_h, dtype='float32') + 0.5) img_x = (paddle.arange(0, im_w, dty...
8,498,504,445,264,646,000
Paste the mask prediction to the original image.
ppdet/modeling/post_process.py
paste_mask
gbstack/PaddleDetection
python
def paste_mask(self, masks, boxes, im_h, im_w): '\n \n ' (x0, y0, x1, y1) = paddle.split(boxes, 4, axis=1) masks = paddle.unsqueeze(masks, [0, 1]) img_y = (paddle.arange(0, im_h, dtype='float32') + 0.5) img_x = (paddle.arange(0, im_w, dtype='float32') + 0.5) img_y = ((((img_y - y0)...
def __call__(self, mask_out, bboxes, bbox_num, origin_shape): '\n Decode the mask_out and paste the mask to the origin image.\n\n Args:\n mask_out (Tensor): mask_head output with shape [N, 28, 28].\n bbox_pred (Tensor): The output bboxes with shape [N, 6] after decode\n ...
-6,449,566,251,477,395,000
Decode the mask_out and paste the mask to the origin image. Args: mask_out (Tensor): mask_head output with shape [N, 28, 28]. bbox_pred (Tensor): The output bboxes with shape [N, 6] after decode and NMS, including labels, scores and bboxes. bbox_num (Tensor): The number of prediction boxes of each ...
ppdet/modeling/post_process.py
__call__
gbstack/PaddleDetection
python
def __call__(self, mask_out, bboxes, bbox_num, origin_shape): '\n Decode the mask_out and paste the mask to the origin image.\n\n Args:\n mask_out (Tensor): mask_head output with shape [N, 28, 28].\n bbox_pred (Tensor): The output bboxes with shape [N, 6] after decode\n ...
def __call__(self, fcos_head_outs, scale_factor): '\n Decode the bbox and do NMS in FCOS.\n ' (locations, cls_logits, bboxes_reg, centerness) = fcos_head_outs (bboxes, score) = self.decode(locations, cls_logits, bboxes_reg, centerness, scale_factor) (bbox_pred, bbox_num, _) = self.nms(bbox...
-9,044,059,880,495,126,000
Decode the bbox and do NMS in FCOS.
ppdet/modeling/post_process.py
__call__
gbstack/PaddleDetection
python
def __call__(self, fcos_head_outs, scale_factor): '\n \n ' (locations, cls_logits, bboxes_reg, centerness) = fcos_head_outs (bboxes, score) = self.decode(locations, cls_logits, bboxes_reg, centerness, scale_factor) (bbox_pred, bbox_num, _) = self.nms(bboxes, score) return (bbox_pred, b...
def forward(self, pred_scores, pred_bboxes): '\n pred_scores : [N, M] score\n pred_bboxes : [N, 5] xc, yc, w, h, a\n im_shape : [N, 2] im_shape\n scale_factor : [N, 2] scale_factor\n ' pred_ploys0 = rbox2poly(pred_bboxes) pred_ploys = paddle.unsqueeze(pred_ploys0, axis...
-2,744,508,617,960,272,400
pred_scores : [N, M] score pred_bboxes : [N, 5] xc, yc, w, h, a im_shape : [N, 2] im_shape scale_factor : [N, 2] scale_factor
ppdet/modeling/post_process.py
forward
gbstack/PaddleDetection
python
def forward(self, pred_scores, pred_bboxes): '\n pred_scores : [N, M] score\n pred_bboxes : [N, 5] xc, yc, w, h, a\n im_shape : [N, 2] im_shape\n scale_factor : [N, 2] scale_factor\n ' pred_ploys0 = rbox2poly(pred_bboxes) pred_ploys = paddle.unsqueeze(pred_ploys0, axis...
def get_pred(self, bboxes, bbox_num, im_shape, scale_factor): '\n Rescale, clip and filter the bbox from the output of NMS to\n get final prediction.\n Args:\n bboxes(Tensor): bboxes [N, 10]\n bbox_num(Tensor): bbox_num\n im_shape(Tensor): [1 2]\n sca...
-2,542,100,866,437,608,400
Rescale, clip and filter the bbox from the output of NMS to get final prediction. Args: bboxes(Tensor): bboxes [N, 10] bbox_num(Tensor): bbox_num im_shape(Tensor): [1 2] scale_factor(Tensor): [1 2] Returns: bbox_pred(Tensor): The output is the prediction with shape [N, 8] incl...
ppdet/modeling/post_process.py
get_pred
gbstack/PaddleDetection
python
def get_pred(self, bboxes, bbox_num, im_shape, scale_factor): '\n Rescale, clip and filter the bbox from the output of NMS to\n get final prediction.\n Args:\n bboxes(Tensor): bboxes [N, 10]\n bbox_num(Tensor): bbox_num\n im_shape(Tensor): [1 2]\n sca...
def forward(self, head_out, anchors): "\n Decode the bbox and do NMS for JDE model. \n\n Args:\n head_out (list): Bbox_pred and cls_prob of bbox_head output.\n anchors (list): Anchors of JDE model.\n\n Returns:\n boxes_idx (Tensor): The index of kept bboxes afte...
1,565,260,054,661,251,800
Decode the bbox and do NMS for JDE model. Args: head_out (list): Bbox_pred and cls_prob of bbox_head output. anchors (list): Anchors of JDE model. Returns: boxes_idx (Tensor): The index of kept bboxes after decode 'JDEBox'. bbox_pred (Tensor): The output is the prediction with shape [N, 6] i...
ppdet/modeling/post_process.py
forward
gbstack/PaddleDetection
python
def forward(self, head_out, anchors): "\n Decode the bbox and do NMS for JDE model. \n\n Args:\n head_out (list): Bbox_pred and cls_prob of bbox_head output.\n anchors (list): Anchors of JDE model.\n\n Returns:\n boxes_idx (Tensor): The index of kept bboxes afte...
def __call__(self, head_out, im_shape, scale_factor): '\n Decode the bbox.\n\n Args:\n head_out (tuple): bbox_pred, cls_logit and masks of bbox_head output.\n im_shape (Tensor): The shape of the input image.\n scale_factor (Tensor): The scale factor of the input image....
-4,586,366,687,494,497,300
Decode the bbox. Args: head_out (tuple): bbox_pred, cls_logit and masks of bbox_head output. im_shape (Tensor): The shape of the input image. scale_factor (Tensor): The scale factor of the input image. Returns: bbox_pred (Tensor): The output prediction with shape [N, 6], including labels, score...
ppdet/modeling/post_process.py
__call__
gbstack/PaddleDetection
python
def __call__(self, head_out, im_shape, scale_factor): '\n Decode the bbox.\n\n Args:\n head_out (tuple): bbox_pred, cls_logit and masks of bbox_head output.\n im_shape (Tensor): The shape of the input image.\n scale_factor (Tensor): The scale factor of the input image....
def __call__(self, box_cls, box_pred, scale_factor_wh, img_whwh): '\n Arguments:\n box_cls (Tensor): tensor of shape (batch_size, num_proposals, K).\n The tensor predicts the classification probability for each proposal.\n box_pred (Tensor): tensors of shape (batch_size, ...
-8,142,696,661,722,245,000
Arguments: box_cls (Tensor): tensor of shape (batch_size, num_proposals, K). The tensor predicts the classification probability for each proposal. box_pred (Tensor): tensors of shape (batch_size, num_proposals, 4). The tensor predicts 4-vector (x,y,w,h) box regression values for every pr...
ppdet/modeling/post_process.py
__call__
gbstack/PaddleDetection
python
def __call__(self, box_cls, box_pred, scale_factor_wh, img_whwh): '\n Arguments:\n box_cls (Tensor): tensor of shape (batch_size, num_proposals, K).\n The tensor predicts the classification probability for each proposal.\n box_pred (Tensor): tensors of shape (batch_size, ...
def __init__(self, lst, start_x, start_y, height, width, headers=None) -> None: 'Lst is 2-d. i th list in lst is content of i+1 tab\n\n Each string in lst should not be of more length than width\n scroling is available only in vertical direction\n ' self.start_x = start_x self.start_y =...
3,092,889,274,640,904,000
Lst is 2-d. i th list in lst is content of i+1 tab Each string in lst should not be of more length than width scroling is available only in vertical direction
src/client/ui/widget/displaylist.py
__init__
Tubular-Terriers/code-jam
python
def __init__(self, lst, start_x, start_y, height, width, headers=None) -> None: 'Lst is 2-d. i th list in lst is content of i+1 tab\n\n Each string in lst should not be of more length than width\n scroling is available only in vertical direction\n ' self.start_x = start_x self.start_y =...
def authenticated_view(request): '\n This view can be used to test requests with an authenticated user. Create a\n user with a default username, save it and then use this user to log in.\n Always returns a 200.\n ' user = User(username='Jane Doe') user.save() login(request, user) return ...
-7,649,399,858,114,833,000
This view can be used to test requests with an authenticated user. Create a user with a default username, save it and then use this user to log in. Always returns a 200.
tests/contrib/django/django_app/urls.py
authenticated_view
AlexandreYang/dd-trace-py
python
def authenticated_view(request): '\n This view can be used to test requests with an authenticated user. Create a\n user with a default username, save it and then use this user to log in.\n Always returns a 200.\n ' user = User(username='Jane Doe') user.save() login(request, user) return ...
def gelu(x): 'Gaussian Error Linear Unit.\n This is a smoother version of the RELU.\n Original paper: https://arxiv.org/abs/1606.08415\n Args:\n x: float Tensor to perform activation.\n Returns:\n `x` with the GELU activation applied.\n ' cdf = (0.5 * (1.0 + tf.tanh((np.sqrt((2 / np...
3,645,099,331,411,212,300
Gaussian Error Linear Unit. This is a smoother version of the RELU. Original paper: https://arxiv.org/abs/1606.08415 Args: x: float Tensor to perform activation. Returns: `x` with the GELU activation applied.
transformers/modeling_tf_openai.py
gelu
richardbaihe/semantic_unwritten
python
def gelu(x): 'Gaussian Error Linear Unit.\n This is a smoother version of the RELU.\n Original paper: https://arxiv.org/abs/1606.08415\n Args:\n x: float Tensor to perform activation.\n Returns:\n `x` with the GELU activation applied.\n ' cdf = (0.5 * (1.0 + tf.tanh((np.sqrt((2 / np...
@staticmethod def causal_attention_mask(nd, ns, dtype): "1's in the lower triangle, counting from the lower right corner.\n Same as tf.matrix_band_part(tf.ones([nd, ns]), -1, ns-nd), but doesn't produce garbage on TPUs.\n " i = tf.range(nd)[:, None] j = tf.range(ns) m = (i >= ((j - ns) + n...
458,533,279,018,134,600
1's in the lower triangle, counting from the lower right corner. Same as tf.matrix_band_part(tf.ones([nd, ns]), -1, ns-nd), but doesn't produce garbage on TPUs.
transformers/modeling_tf_openai.py
causal_attention_mask
richardbaihe/semantic_unwritten
python
@staticmethod def causal_attention_mask(nd, ns, dtype): "1's in the lower triangle, counting from the lower right corner.\n Same as tf.matrix_band_part(tf.ones([nd, ns]), -1, ns-nd), but doesn't produce garbage on TPUs.\n " i = tf.range(nd)[:, None] j = tf.range(ns) m = (i >= ((j - ns) + n...
def _prune_heads(self, heads_to_prune): ' Prunes heads of the model.\n heads_to_prune: dict of {layer_num: list of heads to prune in this layer}\n ' raise NotImplementedError
-86,650,990,666,581,820
Prunes heads of the model. heads_to_prune: dict of {layer_num: list of heads to prune in this layer}
transformers/modeling_tf_openai.py
_prune_heads
richardbaihe/semantic_unwritten
python
def _prune_heads(self, heads_to_prune): ' Prunes heads of the model.\n heads_to_prune: dict of {layer_num: list of heads to prune in this layer}\n ' raise NotImplementedError
def get_pileup_vect(alignments, contig, pos, ref, alt): 'Create feature vector for selected variant\n\n Args:\n alignments(pysam.AlignmentFile) : Handle to alignmentfile\n contig(str) : contig to perform pileup\n pos(int) : zeros based position of variant to pileup\n ref(str) : refer...
5,540,029,937,697,622,000
Create feature vector for selected variant Args: alignments(pysam.AlignmentFile) : Handle to alignmentfile contig(str) : contig to perform pileup pos(int) : zeros based position of variant to pileup ref(str) : reference base alt(str) : alternative base Returns total(int) : Total amount of bas...
singlecellmultiomics/bamProcessing/bamFeatures.py
get_pileup_vect
BuysDB/SingleCellMultiOmics
python
def get_pileup_vect(alignments, contig, pos, ref, alt): 'Create feature vector for selected variant\n\n Args:\n alignments(pysam.AlignmentFile) : Handle to alignmentfile\n contig(str) : contig to perform pileup\n pos(int) : zeros based position of variant to pileup\n ref(str) : refer...
def get_mapping_q_vect(alignments_handle, contig, pos, radius=150): 'Obtain histogram of mapping qualties, clipped at 60\n\n Args:\n alignments(pysam.AlignmentFile) : Handle to alignmentfile\n contig(str) : contig\n pos(int) : zeros based position of location to check mapping qualties\n ...
4,255,158,074,448,860,000
Obtain histogram of mapping qualties, clipped at 60 Args: alignments(pysam.AlignmentFile) : Handle to alignmentfile contig(str) : contig pos(int) : zeros based position of location to check mapping qualties radius(int) : radius to check around selected location Returns: mapping_qualities(list) : ...
singlecellmultiomics/bamProcessing/bamFeatures.py
get_mapping_q_vect
BuysDB/SingleCellMultiOmics
python
def get_mapping_q_vect(alignments_handle, contig, pos, radius=150): 'Obtain histogram of mapping qualties, clipped at 60\n\n Args:\n alignments(pysam.AlignmentFile) : Handle to alignmentfile\n contig(str) : contig\n pos(int) : zeros based position of location to check mapping qualties\n ...
def __init__(self, default_parameter, trial_run_parameter, lower_is_better, objective, filename_objective, argo_ip, argo_port, k8_namespace, storage_strategy='keep', output_dir=''): "Set init values\n\n Args:\n default_parameter (dict): Parameter that will be submitted with the argo workflow in a ...
-1,925,804,667,319,815,000
Set init values Args: default_parameter (dict): Parameter that will be submitted with the argo workflow in a kind of input flags. rebuild_parameter (dict): Parameter that were genereted when creating the hp for sherpa. lower_is_better (bool): whether to minimize or maximize the objective objective (str...
argo_scheduler.py
__init__
predictive-quality/ml-pipeline-blocks-hpo-sherpa
python
def __init__(self, default_parameter, trial_run_parameter, lower_is_better, objective, filename_objective, argo_ip, argo_port, k8_namespace, storage_strategy='keep', output_dir=): "Set init values\n\n Args:\n default_parameter (dict): Parameter that will be submitted with the argo workflow in a ki...