function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def cleanup_the_mock(self): self.patch.stop()
benjamin-hodgson/poll
[ 10, 2, 10, 2, 1438953343 ]
def function_to_break(self): self.x += 1 raise self.expected_exception
benjamin-hodgson/poll
[ 10, 2, 10, 2, 1438953343 ]
def given_the_circuit_was_half_broken_and_the_function_failed_again(self): self.x = 0 self.patch = mock.patch('time.perf_counter', return_value=0) self.mock = self.patch.start() contexts.catch(self.function_to_break) contexts.catch(self.function_to_break) contexts.catch(s...
benjamin-hodgson/poll
[ 10, 2, 10, 2, 1438953343 ]
def it_should_not_call_the_function(self): assert self.x == 4
benjamin-hodgson/poll
[ 10, 2, 10, 2, 1438953343 ]
def cleanup_the_mock(self): self.patch.stop()
benjamin-hodgson/poll
[ 10, 2, 10, 2, 1438953343 ]
def __init__(self, situation, name, suffix=None): '''Actions subclass nothing, but require situations to hold them''' # a situation is like "outdoors", "indoors", or "fighting" self._situation = situation self._game = None if situation is None else situation.game() # "name" ...
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def name(self): '''getting the name of this action''' return self._name
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def suffix(self): '''getting the suffix of this action name (e.g. "Move" might be the name, and "West" might be the suffix.) ''' return self._suffix
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def game(self): '''getting the current subclass of game''' return self._game
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def situation(self): '''getting the situation this action is related to''' return self._situation
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def info(self): '''placeholder: generic return a string describing this action''' return ''
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def always_known(self): '''Is this action Always Known in this game?''' return False
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def can_do(self): '''Each action will have to define a method that determines if the action is currently valid or not. ''' raise Exception("Not Implemented")
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def do(self): '''Each Action will have to define a method that will actually perform some changes to the Game or UI ''' raise Exception("Not Implemented")
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def execute(self): '''Convience method, checks if the action can be performed, if so it does it. ''' if not self.can_do(): return
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def __str__(self): if self.suffix() is None: return self.name()
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def __init__(self, situtation): Action.__init__(self, situtation, 'Quit')
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def can_do(self): '''You can always exit the program. Break this functionality, and your users will hate you. ''' return True
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def do(self): '''In this simple implementation, no window pops up to ask you if you're sure or if you want to save the game first. ''' sys.exit()
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def __init__(self, situtation): Action.__init__(self, situtation, 'Do Nothing')
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def can_do(self): '''Doing nothing is always an option.''' return True
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def do(self): '''Sometimes the best thing you can do is nothing.''' pass
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def __setitem__(self, key, value): '''Simple type-checking for the Action Key Dict''' if not isinstance(key, str): raise TypeError('The action keys key must be a string.') if not isinstance(value, int): raise TypeError('The action keys value must be an integer.')
theJollySin/pytextgame
[ 1, 1, 1, 2, 1441841366 ]
def print_phase_header(message): global COUNTER; print ("\n[" + str("%02d" % int(COUNTER)) + "] >>> " + message) COUNTER += 1;
gbowerman/azurerm
[ 43, 30, 43, 4, 1453075796 ]
def print_phase_message(message): time_stamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") print (str(time_stamp) + ": " + message)
gbowerman/azurerm
[ 43, 30, 43, 4, 1453075796 ]
def uploadCallback(current, total): if (current != None): print_phase_message('{0:2,f}/{1:2,.0f} MB'.format(current,total/1024/1024))
gbowerman/azurerm
[ 43, 30, 43, 4, 1453075796 ]
def create_widget(self): """Create the underlying widget.""" d = self.declaration self.widget = GridLayout(self.get_context(), None, d.style)
codelv/enaml-native
[ 250, 22, 250, 4, 1495306152 ]
def set_orientation(self, orientation): self.widget.setOrientation(0 if orientation == "horizontal" else 1)
codelv/enaml-native
[ 250, 22, 250, 4, 1495306152 ]
def set_columns(self, columns): self.widget.setColumnCount(columns)
codelv/enaml-native
[ 250, 22, 250, 4, 1495306152 ]
def set_rows(self, rows): self.widget.setRowCount(rows)
codelv/enaml-native
[ 250, 22, 250, 4, 1495306152 ]
def main(): args = parse_args() phenotypes = _create_genetest_phenotypes( args.grs_filename, args.phenotypes_filename, args.phenotypes_sample_column, args.phenotypes_separator ) if args.outcome_type == "continuous": y_g_test = "linear" elif args.outcome_type == "discrete": ...
legaultmarc/grstools
[ 4, 2, 4, 6, 1485209970 ]
def __init__( self, signal_hound: SignalHound_USB_SA124B, frequency=None, Navg=1, delay=0.1, prepare_for_each_point=False, prepare_function=None, prepare_function_kwargs: dict = {}
DiCarloLab-Delft/PycQED_py3
[ 51, 39, 51, 31, 1451987534 ]
def acquire_data_point(self, **kw): if self.prepare_for_each_point: self.prepare() time.sleep(self.delay) if version.parse(qc.__version__) < version.parse('0.1.11'): return self.SH.get_power_at_freq(Navg=self.Navg) else: self.SH.avg(self.Navg) ...
DiCarloLab-Delft/PycQED_py3
[ 51, 39, 51, 31, 1451987534 ]
def finish(self, **kw): self.SH.abort()
DiCarloLab-Delft/PycQED_py3
[ 51, 39, 51, 31, 1451987534 ]
def __init__( self, signal_hound: SignalHound_USB_SA124B, Navg=1, delay=0.1, **kw
DiCarloLab-Delft/PycQED_py3
[ 51, 39, 51, 31, 1451987534 ]
def acquire_data_point(self, **kw): frequency = self.swp.pop() self.SH.set('frequency', frequency) self.SH.prepare_for_measurement() time.sleep(self.delay) return self.SH.get_power_at_freq(Navg=self.Navg)
DiCarloLab-Delft/PycQED_py3
[ 51, 39, 51, 31, 1451987534 ]
def prepare(self, sweep_points): self.swp = list(sweep_points) # self.SH.prepare_for_measurement()
DiCarloLab-Delft/PycQED_py3
[ 51, 39, 51, 31, 1451987534 ]
def __init__( self, frequency, QI_amp_ratio, IQ_phase, SH: SignalHound_USB_SA124B, I_ch, Q_ch, station, Navg=1, delay=0.1, f_mod=10e6, verbose=False, **kw): super(SH_mi...
DiCarloLab-Delft/PycQED_py3
[ 51, 39, 51, 31, 1451987534 ]
def generate_awg_seq(self, QI_ratio, skewness, f_mod): SSB_modulation_el = element.Element('SSB_modulation_el', pulsar=self.pulsar) cos_pulse = pulse.CosPulse(channel=self.I_ch, name='cos_pulse') sin_pulse = pulse.CosPulse(channel=self.Q_ch, name='sin_...
DiCarloLab-Delft/PycQED_py3
[ 51, 39, 51, 31, 1451987534 ]
def __init__(self, Map, CostPrior, RewardPrior, CostParams, RewardParams, Capacity=-1, Minimum=0, SoftmaxChoice=True, SoftmaxAction=True, choiceTau=1, actionTau=0.01, CNull=0, RNull=0, Restrict=False): """ Agent class. Create an agent with a set of costs and rewards. If sampling paramet...
julianje/Bishop
[ 12, 5, 12, 3, 1424995890 ]
def ResampleCosts(self): """ Reset agent's costs. """ # Resample the agent's competence self.costs = self.Sample( self.CostDimensions, self.CostParams, Kind=self.CostPrior) self.costs = [ 0 if random.random() <= self.CNull else i for i in self.cost...
julianje/Bishop
[ 12, 5, 12, 3, 1424995890 ]
def Sample(self, dimensions, SamplingParam, Kind): """ Generate a sample from some distribution Args: dimensions (int): Number of dimensions SamplingParam (list): Parameter to use on distribution Kind (str): Name of distribution Returns: ...
julianje/Bishop
[ 12, 5, 12, 3, 1424995890 ]
def GetSamplingParameters(self): """ Return cost and reward sampling parameters, respectively """ return [self.CostParams, self.RewardParams]
julianje/Bishop
[ 12, 5, 12, 3, 1424995890 ]
def SetRewardSamplingParams(self, samplingparams): """ Set sampling parameters for costs """ if len(samplingparams) != len(self.RewardParams): print("Vector of parameters is not the right size") else: self.RewardParams = samplingparams
julianje/Bishop
[ 12, 5, 12, 3, 1424995890 ]
def plateau(array, threshold): """Find plateaus in an array, i.e continuous regions that exceed threshold Given an array of numbers, return a 2d array such that out[:,0] marks the indices where the array crosses threshold from below, and out[:,1] marks the next time the array crosses that same threshold from ...
barentsen/dave
[ 4, 3, 4, 8, 1441063936 ]
def outlierRemoval(time, flux): fluxDetrended = medianDetrend(flux, 3) out1 = plateau(fluxDetrended, 5 * np.std(fluxDetrended)) out2 = plateau(-fluxDetrended, 5 * np.std(fluxDetrended)) if out1 == [] and out2 == []: singleOutlierIndices = [] else: outliers = np.append(out1, out2).reshape(-1,2) # Only...
barentsen/dave
[ 4, 3, 4, 8, 1441063936 ]
def medianDetrend(flux, binWidth): halfNumPoints = binWidth // 2 medians = [] for i in range(len(flux)): if i < halfNumPoints: medians.append(np.median(flux[:i+halfNumPoints+1])) elif i > len(flux) - halfNumPoints - 1: medians.append(np.median(flux[i-halfNumPoints:])) else: medians.append(np....
barentsen/dave
[ 4, 3, 4, 8, 1441063936 ]
def getPhase(time, flux, period, epoch, centerPhase = 0): """Get the phase of a lightcurve. How it works using an example where epoch = 2, period = 3: 1. Subtract the epoch from all times [1, 2, 3, 4, 5, 6, 7] to get [-1, 0, 1, 2, 3, 4, 5] then divide by the period [3] to get all time values in phase valu...
barentsen/dave
[ 4, 3, 4, 8, 1441063936 ]
def fitModel(time, flux, guessDict, freeParPlanet, ferr = 0): if not np.all(ferr): ferr = np.ones_like(flux)*1.E-5 freeParStar = ['rho'] # Make the fitting object according to guess dictionary fitT = FitTransit() fitT.add_guess_star(ld1 = 0, ld2 = 0) fitT.add_guess_planet(period = guessDict['period'], ...
barentsen/dave
[ 4, 3, 4, 8, 1441063936 ]
def do_bls_and_fit(time, flux, min_period, max_period): S = clean_and_search.Search(time, flux + 1, np.ones_like(flux)*1.E-5) S.do_bls2(min_period = min_period, max_period = max_period, min_duration_hours = 1.5, max_duration_hours = 6., freq_step = 1.E-4, doplot = False, norm = F...
barentsen/dave
[ 4, 3, 4, 8, 1441063936 ]
def computePointSigma(time, flux, transitModel, period, epoch, duration): t2, f2 = removeTransits(time, flux, period, epoch, duration) mt2, mf2 = removeTransits(time, transitModel, period, epoch, duration) return np.nanstd(f2 - mf2)
barentsen/dave
[ 4, 3, 4, 8, 1441063936 ]
def removeTransits(time, flux, period, epoch, duration): halfDur = 0.5 * duration / 24. bad = np.where(time < epoch - period + halfDur)[0] for p in np.arange(epoch, time[-1] + period, period): bad = np.append(bad, np.where((p - halfDur < time) & (time < p + halfDur))[0]) good = np.setxor1d(range(len(time)), ...
barentsen/dave
[ 4, 3, 4, 8, 1441063936 ]
def computeTransitDuration(period, rho, k): b = 0.1 # Impact parameter (default value in ktransit) G = 6.67384e-11 # Gravitational constant P = period * 86400 # Period in seconds stellarDensity = rho * 1000 rStarOverA = ((4 * np.pi**2) / (G * stellarDensity * P**2))**(1./3.) cosI = b * rStarOve...
barentsen/dave
[ 4, 3, 4, 8, 1441063936 ]
def findSecondary(time, flux, period, epoch, duration): t2, f2 = removeTransits(time, flux, period, epoch, duration) minp, maxp = period - 0.1, period + 0.1 if t2[-1] - t2[0] == 0 or 1./maxp < 1./(t2[-1] - t2[0]): return (np.nan,)*5 if minp < 0.5: minp = 0.5 planetInfo = do_bls_and_fit(t2, f2, minp, max...
barentsen/dave
[ 4, 3, 4, 8, 1441063936 ]
def computeOddEvenModels(time, flux, per, epo): gdOdd = {'period': per * 2, 'T0': epo} gdEven = {'period': per * 2, 'T0': epo + per} freeParPlanet = ['rprs'] fitT_odd = fitModel(time, flux, gdOdd, freeParPlanet) fitT_even = fitModel(time, flux, gdEven, freeParPlanet) return fitT_odd, fitT_even
barentsen/dave
[ 4, 3, 4, 8, 1441063936 ]
def main(filename): """Fit a transit model to a lightcurve. 1. Remove outliers. 2. Detrend the data with a binwidth of 26 cadences. Since MAX_DURATION_HOURS = 6, and 6 hours = ~13 cadences (ceiling of 12.245), detrending with a binwidth of double this value will preserve all events with a duration of 13...
barentsen/dave
[ 4, 3, 4, 8, 1441063936 ]
def getResults(): rfn = '/Users/Yash/Desktop/NASA/Summer2014/k2/changedWhichpix/run1/results.txt' names, periods = np.genfromtxt(rfn, usecols = (0,2), unpack = True) return names, periods
barentsen/dave
[ 4, 3, 4, 8, 1441063936 ]
def find_preference(name): try: return prefs_manager.get_preference(name) except KeyError: raise CommandError("No such preference **{}** exists.".format(name))
sk89q/Plumeria
[ 35, 2, 35, 2, 1471646188 ]
def __init__(self, key: bytes = b'\x00' * 8, name: str = None): self.key = key self.name = name self.number = 0
half2me/libant
[ 23, 9, 23, 4, 1471543401 ]
def __init__(self, driver: Driver, initMessages, out: Queue, onSucces, onFailure): super().__init__() self._stopper = threading.Event() self._driver = driver self._out = out self._initMessages = initMessages self._waiters = [] self._onSuccess = onSucces se...
half2me/libant
[ 23, 9, 23, 4, 1471543401 ]
def stopped(self): return self._stopper.isSet()
half2me/libant
[ 23, 9, 23, 4, 1471543401 ]
def __init__(self, driver: Driver, name: str = None): self._driver = driver self._name = name self._out = Queue() self._init = [] self._pump = None self._configMessages = Queue()
half2me/libant
[ 23, 9, 23, 4, 1471543401 ]
def __exit__(self, exc_type, exc_val, exc_tb): self.stop()
half2me/libant
[ 23, 9, 23, 4, 1471543401 ]
def enableRxScanMode(self, networkKey=ANTPLUS_NETWORK_KEY, channelType=CHANNEL_TYPE_ONEWAY_RECEIVE, frequency: int = 2457, rxTimestamp: bool = True, rssi: bool = True, channelId: bool = True): self._init.append(SystemResetMessage()) self._init.append(SetNetworkKeyMessage(0, netw...
half2me/libant
[ 23, 9, 23, 4, 1471543401 ]
def isRunning(self): if self._pump is None: return False return self._pump.is_alive()
half2me/libant
[ 23, 9, 23, 4, 1471543401 ]
def test_first_and_last_slashes_trimmed_for_query_string (self): created_collection = self.config.create_multi_partition_collection_with_custom_pk_if_not_exist(self.client) document_definition = {'pk': 'pk', 'id':'myId'} self.client.CreateItem(created_collection['_self'], document_definition) ...
Azure/azure-documentdb-python
[ 148, 143, 148, 23, 1407452788 ]
def test_populate_query_metrics (self): created_collection = self.config.create_multi_partition_collection_with_custom_pk_if_not_exist(self.client) document_definition = {'pk': 'pk', 'id':'myId'} self.client.CreateItem(created_collection['_self'], document_definition) query_options = {'...
Azure/azure-documentdb-python
[ 148, 143, 148, 23, 1407452788 ]
def validate_query_requests_count(self, query_iterable, expected_count): self.count = 0 self.OriginalExecuteFunction = retry_utility._ExecuteFunction retry_utility._ExecuteFunction = self._MockExecuteFunction block = query_iterable.fetch_next_block() while block: bloc...
Azure/azure-documentdb-python
[ 148, 143, 148, 23, 1407452788 ]
def lookups(self, request, model_admin): def first_two(s): s = unicode(s) if len(s) < 2: return s else: return s[:2] prefixes = [first_two(alias.name) for alias in model_admin.model.objects.only('name')] pr...
joneskoo/sikteeri
[ 4, 8, 4, 3, 1276636698 ]
def hashToHex(hash): return format(hash, '064x')
qtumproject/qtum
[ 1170, 396, 1170, 38, 1488529031 ]
def allInvsMatch(invsExpected, testnode): for x in range(60): with mininode_lock: if (sorted(invsExpected) == sorted(testnode.txinvs)): return True time.sleep(1) return False
qtumproject/qtum
[ 1170, 396, 1170, 38, 1488529031 ]
def __init__(self): super().__init__() self.txinvs = []
qtumproject/qtum
[ 1170, 396, 1170, 38, 1488529031 ]
def clear_invs(self): with mininode_lock: self.txinvs = []
qtumproject/qtum
[ 1170, 396, 1170, 38, 1488529031 ]
def set_test_params(self): self.num_nodes = 2 # We lower the various required feerates for this test # to catch a corner-case where feefilter used to slightly undercut # mempool and wallet feerate calculation based on GetFee # rounding down 3 places, leading to stranded transacti...
qtumproject/qtum
[ 1170, 396, 1170, 38, 1488529031 ]
def run_test(self): node1 = self.nodes[1] node0 = self.nodes[0] # Get out of IBD node1.generate(1) self.sync_blocks() self.nodes[0].add_p2p_connection(TestP2PConn()) # Test that invs are received by test connection for all txs at # feerate of 20 sat/byte...
qtumproject/qtum
[ 1170, 396, 1170, 38, 1488529031 ]
def setup(self, parser): parser.add_argument("-m", "--mark", action='append', default=[], help="Highlight some registers.") parser.add_argument("-M", "--mark-used", action='store_true', help="Highlight currently used registers.")
wapiflapi/gxf
[ 49, 7, 49, 3, 1415495222 ]
def test_package_data(self): sources = self.mkdtemp() f = open(os.path.join(sources, "__init__.py"), "w") f.write("# Pretend this is a package.") f.close() f = open(os.path.join(sources, "README.txt"), "w") f.write("Info about this package") f.close()
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_empty_package_dir (self): # See SF 1668596/1720897. cwd = os.getcwd()
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_dont_write_bytecode(self): # makes sure byte_compile is not used pkg_dir, dist = self.create_dist() cmd = build_py(dist) cmd.compile = 1 cmd.optimize = 1
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_suite(): return unittest.makeSuite(BuildPyTestCase)
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def __init__(self, vgg16_npy_path=None): if vgg16_npy_path is None: path = inspect.getfile(Vgg16) path = os.path.abspath(os.path.join(path, os.pardir)) path = os.path.join(path, 'vgg16.npy') vgg16_npy_path = path print path self.data_dict = np...
huangshiyu13/RPNplus
[ 183, 87, 183, 15, 1488787933 ]
def avg_pool(self, bottom, name): return tf.nn.avg_pool(bottom, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME', name=name)
huangshiyu13/RPNplus
[ 183, 87, 183, 15, 1488787933 ]
def conv_layer(self, bottom, name): with tf.variable_scope(name): filt = self.get_conv_filter(name) conv = tf.nn.conv2d(bottom, filt, [1, 1, 1, 1], padding='SAME') conv_biases = self.get_bias(name) bias = tf.nn.bias_add(conv, conv_biases) relu = tf.n...
huangshiyu13/RPNplus
[ 183, 87, 183, 15, 1488787933 ]
def conv_layer_new(self, bottom, name, kernel_size=[3, 3], out_channel=512, stddev=0.01): with tf.variable_scope(name): shape = bottom.get_shape().as_list()[-1] filt = tf.Variable( tf.random_normal([kernel_size[0], kernel_size[1], shape, out_channel], mean=0.0, stddev=std...
huangshiyu13/RPNplus
[ 183, 87, 183, 15, 1488787933 ]
def get_bias(self, name): return tf.Variable(self.data_dict[name][1], name='biases')
huangshiyu13/RPNplus
[ 183, 87, 183, 15, 1488787933 ]
def get_bias_const(self, name): return tf.constant(self.data_dict[name][1], name='biases')
huangshiyu13/RPNplus
[ 183, 87, 183, 15, 1488787933 ]
def checkFile(fileName): if os.path.isfile(fileName): return True else: print fileName, 'is not found!' exit()
huangshiyu13/RPNplus
[ 183, 87, 183, 15, 1488787933 ]
def __str__(self): return self.nome
bczmufrn/frequencia
[ 2, 4, 2, 1, 1501159947 ]
def __str__(self): return ( '%s: [%s]' if self.isArray() else '%s: %s' ) % ( 'Interface' if self.isInterface() else 'Primitive' if self.isPrimitive() else 'Class', self.getName() )
kivy/pyjnius
[ 1284, 251, 1284, 140, 1344908347 ]
def ensureclass(clsname): if clsname in registers: return jniname = clsname.replace('.', '/') if MetaJavaClass.get_javaclass(jniname): return registers.append(clsname) autoclass(clsname)
kivy/pyjnius
[ 1284, 251, 1284, 140, 1344908347 ]
def bean_getter(s): return (s.startswith('get') and len(s) > 3 and s[3].isupper()) or (s.startswith('is') and len(s) > 2 and s[2].isupper())
kivy/pyjnius
[ 1284, 251, 1284, 140, 1344908347 ]
def identify_hierarchy(cls, level, concrete=True): supercls = cls.getSuperclass() if supercls is not None: for sup, lvl in identify_hierarchy(supercls, level + 1, concrete=concrete): yield sup, lvl # we could use yield from when we drop python2 interfaces = cls.getInterfaces() for ...
kivy/pyjnius
[ 1284, 251, 1284, 140, 1344908347 ]
def autoclass(clsname, include_protected=True, include_private=True): jniname = clsname.replace('.', '/') cls = MetaJavaClass.get_javaclass(jniname, classparams=(include_protected, include_private)) if cls: return cls classDict = {} cls_start_packagename = '.'.join(clsname.split('.')[:-1]) ...
kivy/pyjnius
[ 1284, 251, 1284, 140, 1344908347 ]
def _getitem(self, index): ''' dunder method for List ''' try: return self.get(index) except JavaException as e: # initialize the subclass before getting the Class.forName # otherwise isInstance does not know of the subclass mock_exception_object = autoclass(e.classname)() ...
kivy/pyjnius
[ 1284, 251, 1284, 140, 1344908347 ]
def __init__(self, java_iterator): self.java_iterator = java_iterator
kivy/pyjnius
[ 1284, 251, 1284, 140, 1344908347 ]
def next(self): log.debug("monkey patched next() called") if not self.java_iterator.hasNext(): raise StopIteration() return self.java_iterator.next()
kivy/pyjnius
[ 1284, 251, 1284, 140, 1344908347 ]
def _iterator_next(self): ''' dunder method for java.util.Iterator''' if not self.hasNext(): raise StopIteration() return self.next()
kivy/pyjnius
[ 1284, 251, 1284, 140, 1344908347 ]
def setUp(self): HTTPretty.reset() HTTPretty.enable()
futurecolors/gopython3
[ 2, 2, 2, 13, 1379656339 ]
def test_get_most_popular_repo(self): HTTPretty.register_uri(HTTPretty.GET, 'https://api.github.com/search/repositories', '{"items":[{"full_name": "coagulant/requests2", "name": "requests2"},' '{"full_name": "kennethreitz/fake_requests", "name": "fake_requests"}]}',...
futurecolors/gopython3
[ 2, 2, 2, 13, 1379656339 ]
def test_crawl_py3_issues(self): HTTPretty.register_uri(HTTPretty.GET, 'https://api.github.com/repos/embedly/embedly-python/issues', responses=[HTTPretty.Response('[{"state": "open", "title": "WTF?", "html_url": "https://github.com/embedly/embedly-python/issues/1"},' ...
futurecolors/gopython3
[ 2, 2, 2, 13, 1379656339 ]