uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
d1c937615de8dfd37828a010
train
function
def ones(shape, ctx=None, dtype=None, **kwargs): """Returns a new array filled with all ones, with the given shape and type. Parameters ---------- shape : int or tuple of int or list of int The shape of the empty array. ctx : Context, optional An optional device context. Def...
def ones(shape, ctx=None, dtype=None, **kwargs):
"""Returns a new array filled with all ones, with the given shape and type. Parameters ---------- shape : int or tuple of int or list of int The shape of the empty array. ctx : Context, optional An optional device context. Defaults to the current default context (``mxnet.con...
) def onehot_encode(indices, out): """One-hot encoding indices into matrix out. .. note:: `onehot_encode` is deprecated. Use `one_hot` instead. """ # pylint: disable= no-member, protected-access return _internal._onehot_encode(indices, out, out=out) # pylint: enable= no-member, protected-acc...
93
93
312
13
79
paroda/incubator-mxnet
python/mxnet/ndarray/ndarray.py
Python
ones
ones
2,387
2,421
2,387
2,387
cf923780692892ec7387594171b30fadddc77901
bigcode/the-stack
train
7fd11a036b41b61bec0af222
train
function
def _dlpack_deleter(pycapsule): pycapsule = ctypes.c_void_p(pycapsule) if ctypes.pythonapi.PyCapsule_IsValid(pycapsule, _c_str_dltensor): ptr = ctypes.c_void_p( ctypes.pythonapi.PyCapsule_GetPointer(pycapsule, _c_str_dltensor)) check_call(_LIB.MXNDArrayCallDLPackDeleter(ptr))
def _dlpack_deleter(pycapsule):
pycapsule = ctypes.c_void_p(pycapsule) if ctypes.pythonapi.PyCapsule_IsValid(pycapsule, _c_str_dltensor): ptr = ctypes.c_void_p( ctypes.pythonapi.PyCapsule_GetPointer(pycapsule, _c_str_dltensor)) check_call(_LIB.MXNDArrayCallDLPackDeleter(ptr))
protected-access, redefined-builtin PyCapsuleDestructor = ctypes.CFUNCTYPE(None, ctypes.c_void_p) _c_str_dltensor = c_str('dltensor') _c_str_used_dltensor = c_str('used_dltensor') def _dlpack_deleter(pycapsule):
64
64
97
12
52
paroda/incubator-mxnet
python/mxnet/ndarray/ndarray.py
Python
_dlpack_deleter
_dlpack_deleter
3,913
3,918
3,913
3,913
f045356fa2407600b2d588470233c29e33e5df3b
bigcode/the-stack
train
5d6debb5153a2debcc87eb07
train
function
def long_task(): global q1 while True: sleep(5) q1 = random()
def long_task():
global q1 while True: sleep(5) q1 = random()
from random import random from threading import Thread from time import sleep def short_task(): global q2 while True: sleep(2) q2 = random() def long_task():
43
64
24
4
39
Rylan-Meilutis/EDD-Go-Cart
threading test.py
Python
long_task
long_task
13
17
13
13
5a0a79ac12082ad396c407ca33c07ac62670485d
bigcode/the-stack
train
599e92b97061da026f0bc662
train
function
def short_task(): global q2 while True: sleep(2) q2 = random()
def short_task():
global q2 while True: sleep(2) q2 = random()
from random import random from threading import Thread from time import sleep def short_task():
19
64
24
4
14
Rylan-Meilutis/EDD-Go-Cart
threading test.py
Python
short_task
short_task
6
10
6
6
61cea12fb820901ba7e160ef78ee4af6345f8edd
bigcode/the-stack
train
1e6e62c83caf3ea43c52ec58
train
function
def main(): while True: print(q1) print(q2) sleep(1)
def main():
while True: print(q1) print(q2) sleep(1)
import random from threading import Thread from time import sleep def short_task(): global q2 while True: sleep(2) q2 = random() def long_task(): global q1 while True: sleep(5) q1 = random() def main():
64
64
22
3
61
Rylan-Meilutis/EDD-Go-Cart
threading test.py
Python
main
main
20
24
20
20
1e5cb3c10bdf43cbb92722c24e3fe99175bd1fcc
bigcode/the-stack
train
9a39603a10e9e553a7826390
train
function
def main(): root = tkinter.Tk() frame1 = ttk.Frame(root, padding=10) frame1.grid() my_entry_box = ttk.Entry(frame1) my_entry_box.grid() print_entry_button = ttk.Button(frame1, text='Print entry') print_entry_button['command'] = (lambda: print_contents(...
def main():
root = tkinter.Tk() frame1 = ttk.Frame(root, padding=10) frame1.grid() my_entry_box = ttk.Entry(frame1) my_entry_box.grid() print_entry_button = ttk.Button(frame1, text='Print entry') print_entry_button['command'] = (lambda: print_contents(my_entry_box...
utchler, Vibha Alangar, Matt Boutell, Dave Fisher, Mark Hays, Amanda Stouder, Aaron Wilkin, their colleagues, and Daniel Decker. """ # Done: 1. PUT YOUR NAME IN THE ABOVE LINE. import tkinter from tkinter import ttk def main():
64
64
86
3
60
deckerdj/24-Tkinter
src/m4e_text_entry_box.py
Python
main
main
29
43
29
29
c59249131b52650e43aee86f847e579ce1ddaeff
bigcode/the-stack
train
53ab79ea5a4ac58131465a21
train
function
def print_contents(entry_box): """ Prints onto the Console the contents of the given ttk.Entry. In this example, it is used as the function that is "CALLED BACK" when an event (namely, the pressing of a certain Button) occurs. Type hints: :type entry_box: ttk.Entry """ conten...
def print_contents(entry_box):
""" Prints onto the Console the contents of the given ttk.Entry. In this example, it is used as the function that is "CALLED BACK" when an event (namely, the pressing of a certain Button) occurs. Type hints: :type entry_box: ttk.Entry """ contents_of_entry_box = entry_box.get...
my_entry_box = ttk.Entry(frame1) my_entry_box.grid() print_entry_button = ttk.Button(frame1, text='Print entry') print_entry_button['command'] = (lambda: print_contents(my_entry_box)) print_entry_button.grid() root.mainloop() def print_contents(entry_box):
64
64
90
6
58
deckerdj/24-Tkinter
src/m4e_text_entry_box.py
Python
print_contents
print_contents
46
57
46
46
a8ab33ff4193dbfdd36f0570ed85886b4c6ece5e
bigcode/the-stack
train
2eaf8eedfa6f0c205ba52c44
train
class
class ThurstoneMostellerFull: def __init__(self, game, team_rating: Callable, **options): self.constants = Constants(**options) self.EPSILON = self.constants.EPSILON self.TWO_BETA_SQUARED = self.constants.TWO_BETA_SQUARED self.team_ratings = team_rating(game, **options) self....
class ThurstoneMostellerFull:
def __init__(self, game, team_rating: Callable, **options): self.constants = Constants(**options) self.EPSILON = self.constants.EPSILON self.TWO_BETA_SQUARED = self.constants.TWO_BETA_SQUARED self.team_ratings = team_rating(game, **options) self.gamma = gamma(**options) ...
import math from typing import Callable from openskill.constants import Constants from openskill.statistics import v, vt, w, wt from openskill.util import gamma class ThurstoneMostellerFull:
42
166
554
7
34
philihp/openskill.py
openskill/models/thurstone_mosteller_full.py
Python
ThurstoneMostellerFull
ThurstoneMostellerFull
9
72
9
9
8e98c325eef6af5e5225bfd617f554875aae6eca
bigcode/the-stack
train
d00a9442e7f16025106f608f
train
class
class WalletBackupTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 4 self.setup_clean_chain = True # nodes 1, 2,3 are spenders, let's give them a keypool=100 # whitelist all peers to speed up tx relay / mempool sync self.extra_args = [ ["-wh...
class WalletBackupTest(BitcoinTestFramework):
def set_test_params(self): self.num_nodes = 4 self.setup_clean_chain = True # nodes 1, 2,3 are spenders, let's give them a keypool=100 # whitelist all peers to speed up tx relay / mempool sync self.extra_args = [ ["-whitelist=noban@127.0.0.1", "-keypool=100"], ...
th node is a miner. 1 2 3 each mine a block to start, then Miner creates 240 blocks so 1 2 3 each have 50,000 mature coins to spend. Then 5 iterations of 1/2/3 sending coins amongst themselves to get transactions in the wallets, and the miner mining one block. Wallets are backed up using dumpwallet/backupwallet. Then ...
256
256
1,917
9
247
rnicoll/dogecoin
test/functional/wallet_backup.py
Python
WalletBackupTest
WalletBackupTest
45
226
45
45
e4bfa42025e9091978375eb899f808dd29264473
bigcode/the-stack
train
566da397a57b35badae31017
train
class
@rfm.simple_test class SurfaceFeatureExtract(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = ('OpenFOAM check of surfaceFeatureExtract: ' 'motorbike tutorial') self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout)
@rfm.simple_test class SurfaceFeatureExtract(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = ('OpenFOAM check of surfaceFeatureExtract: ' 'motorbike tutorial') self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout)
_tasks_per_node = 6 self.sanity_patterns = sn.all([ sn.assert_found('Finalising parallel run', self.stdout), sn.assert_found(r'^\s*[Ee]nd', self.stdout) ]) @rfm.simple_test class SurfaceFeatureExtract(OpenFOAMBaseTest):
63
64
71
16
47
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
SurfaceFeatureExtract
SurfaceFeatureExtract
259
265
259
260
b3a1164f445687d57a87865c5fd34445bccaeb65
bigcode/the-stack
train
012a19c19067e0892085edf4
train
class
@rfm.simple_test class TopoSet(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of topoSet: heatexchanger tutorial' self.executable_opts = ['-region air', '-dict system/topoSetDict.1'] self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.st...
@rfm.simple_test class TopoSet(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of topoSet: heatexchanger tutorial' self.executable_opts = ['-region air', '-dict system/topoSetDict.1'] self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout)
super().__init__() self.descr = ('OpenFOAM check of surfaceFeatureExtract: ' 'motorbike tutorial') self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout) @rfm.simple_test class TopoSet(OpenFOAMBaseTest):
64
64
89
16
48
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
TopoSet
TopoSet
268
274
268
269
4a7733b79b0a4290b62ba7ef86114719ed4db16d
bigcode/the-stack
train
346bcad61b619c46f4c9f11d
train
class
@rfm.simple_test class PotentialFoam(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of potentialFoam: motorbike tutorial' self.executable_opts = ['-parallel'] self.num_tasks = 6 self.num_tasks_per_node = 6 residual = sn.extracta...
@rfm.simple_test class PotentialFoam(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of potentialFoam: motorbike tutorial' self.executable_opts = ['-parallel'] self.num_tasks = 6 self.num_tasks_per_node = 6 residual = sn.extractall(r'Final residual = (?P<res>-?\S+),', ...
.sanity_patterns = sn.all(sn.chain( sn.map(lambda x: sn.assert_lt(x, 5.e-05), residual), [sn.assert_found(r'^\s*[Ee]nd', self.stdout)], )) @rfm.simple_test class PotentialFoam(OpenFOAMBaseTest):
63
64
182
16
47
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
PotentialFoam
PotentialFoam
176
191
176
177
a8867a1b55a5c57eb3050acd9ebd8c04141058c4
bigcode/the-stack
train
bb75b913350a0811fc902dbd
train
class
@rfm.simple_test class ReconstructParMesh(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of reconstructParMesh: motorbike tutorial' self.executable_opts = ['-constant'] self.readonly_files = ['processor0', 'processor1', 'processor2', ...
@rfm.simple_test class ReconstructParMesh(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of reconstructParMesh: motorbike tutorial' self.executable_opts = ['-constant'] self.readonly_files = ['processor0', 'processor1', 'processor2', 'processor3', 'processor4', 'processor...
', 'processor3'] self.sanity_patterns = sn.all([ sn.assert_found('Time = 2000', self.stdout), sn.assert_found(r'^\s*[Ee]nd', self.stdout) ]) @rfm.simple_test class ReconstructParMesh(OpenFOAMBaseTest):
63
64
111
17
46
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
ReconstructParMesh
ReconstructParMesh
208
216
208
209
f023cfe45dbcd569a34d15bcc48fa526e23bddb6
bigcode/the-stack
train
f7a90f2195cfd73d458342c9
train
class
class OpenFOAMBaseTest(rfm.RunOnlyRegressionTest): def __init__(self): dirname = self.name[0].lower() + self.name[1:] self.name = 'OpenFoam_' + self.name self.executable = dirname self.sourcesdir = os.path.join(self.current_system.resourcesdir, ...
class OpenFOAMBaseTest(rfm.RunOnlyRegressionTest):
def __init__(self): dirname = self.name[0].lower() + self.name[1:] self.name = 'OpenFoam_' + self.name self.executable = dirname self.sourcesdir = os.path.join(self.current_system.resourcesdir, 'OpenFOAM', dirname) # OpenFOAM currently ...
CSCS/ETH Zurich) # ReFrame Project Developers. See the top-level LICENSE file for details. # # SPDX-License-Identifier: BSD-3-Clause import os import reframe as rfm import reframe.utility.sanity as sn class OpenFOAMBaseTest(rfm.RunOnlyRegressionTest):
64
64
205
13
50
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
OpenFOAMBaseTest
OpenFOAMBaseTest
12
32
12
12
f1dd744a5c71a57c34259172093b154b9f64a0d6
bigcode/the-stack
train
4b0786770747d3b985019aeb
train
class
@rfm.simple_test class InterMixingFoam(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of interMixingFoam: dambreak tutorial' self.sanity_patterns = sn.all([ sn.assert_eq( sn.count(sn.findall('(?P<line>Air phase volume fracti...
@rfm.simple_test class InterMixingFoam(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of interMixingFoam: dambreak tutorial' self.sanity_patterns = sn.all([ sn.assert_eq( sn.count(sn.findall('(?P<line>Air phase volume fraction)', self.stdout)), 2...
( [sn.assert_found('Time = 100\n', self.stdout), sn.assert_found('Finalising parallel run', self.stdout), sn.assert_found(r'^\s*[Ee]nd', self.stdout)]) @rfm.simple_test class InterMixingFoam(OpenFOAMBaseTest):
63
64
107
18
45
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
InterMixingFoam
InterMixingFoam
135
145
135
136
b16d0a3cc361531a2828ed8de1d664b49bbcc2c0
bigcode/the-stack
train
33122b39875641c9e1dbf32e
train
class
@rfm.simple_test class BuoyantBoussinesqSimpleFoam(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = ('OpenFOAM check of buoyantBoussinesqSimpleFoam: ' 'hotroom tutorial') self.executable = 'buoyantBoussinesqSimpleFoam' residual = sn.extract...
@rfm.simple_test class BuoyantBoussinesqSimpleFoam(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = ('OpenFOAM check of buoyantBoussinesqSimpleFoam: ' 'hotroom tutorial') self.executable = 'buoyantBoussinesqSimpleFoam' residual = sn.extractall(r'\sglobal\s=\s(?P<res>\S+),', self.stdout, ...
super().__init__() self.descr = 'OpenFOAM blockMesh from the dambreak tutorial' self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout) @rfm.simple_test class BuoyantBoussinesqSimpleFoam(OpenFOAMBaseTest):
64
64
157
22
42
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
BuoyantBoussinesqSimpleFoam
BuoyantBoussinesqSimpleFoam
43
54
43
44
5a3d9130af704a2908c3d899e7753a0e930722be
bigcode/the-stack
train
b2e4107b54781d9a2ef37429
train
class
@rfm.simple_test class SimpleFoam(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of simpleFoam: motorbike tutorial' self.executable_opts = ['-parallel'] self.num_tasks = 6 self.num_tasks_per_node = 6 self.sanity_patterns = sn.al...
@rfm.simple_test class SimpleFoam(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of simpleFoam: motorbike tutorial' self.executable_opts = ['-parallel'] self.num_tasks = 6 self.num_tasks_per_node = 6 self.sanity_patterns = sn.all([ sn.assert_found('Finalising parallel ...
init__(self): super().__init__() self.descr = 'OpenFOAM check of setFields: dambreak tutorial' self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout) @rfm.simple_test class SimpleFoam(OpenFOAMBaseTest):
64
64
175
16
48
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
SimpleFoam
SimpleFoam
227
242
227
228
bd5de3fd4ffaec9d32e666b246163481de4dec1d
bigcode/the-stack
train
0fe9cc9b483da652d8d9d7a4
train
class
@rfm.simple_test class CheckMesh(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of checkMesh: flange tutorial' self.executable_opts = ['-latestTime', '-allTopology', '-allGeometry', '-parallel'] self.num_tasks = ...
@rfm.simple_test class CheckMesh(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of checkMesh: flange tutorial' self.executable_opts = ['-latestTime', '-allTopology', '-allGeometry', '-parallel'] self.num_tasks = 8 self.num_tasks_per_node = 8 self.s...
) self.sanity_patterns = sn.all(sn.chain( sn.map(lambda x: sn.assert_lt(x, 1.e-17), residual), [sn.assert_found(r'^\s*[Ee]nd', self.stdout)])) @rfm.simple_test class CheckMesh(OpenFOAMBaseTest):
64
64
125
15
49
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
CheckMesh
CheckMesh
57
69
57
58
e2c03e335644aa562aeff3b97f605aa8dbec563c
bigcode/the-stack
train
97c0a87eada4367955b2da3e
train
class
@rfm.simple_test class DecomposePar(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of decomposePar: heatexchanger tutorial' self.executable_opts = ['-region air'] self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout)
@rfm.simple_test class DecomposePar(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of decomposePar: heatexchanger tutorial' self.executable_opts = ['-region air'] self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout)
FOAM check of createBaffles: heatexchanger tutorial' self.executable_opts = ['-region air', '-overwrite'] self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout) @rfm.simple_test class DecomposePar(OpenFOAMBaseTest):
64
64
80
16
48
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
DecomposePar
DecomposePar
112
118
112
113
700f8bffa9ab407978fa0cd69480cb365c5f42ac
bigcode/the-stack
train
c21c9050ca6e4b302601798b
train
class
@rfm.simple_test class ReconstructPar(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of reconstructPar: heatexchanger tutorial' self.executable_opts = ['-latestTime', '-region air'] self.readonly_files = ['processor0', 'processor1', ...
@rfm.simple_test class ReconstructPar(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of reconstructPar: heatexchanger tutorial' self.executable_opts = ['-latestTime', '-region air'] self.readonly_files = ['processor0', 'processor1', 'processor2', 'processor3'] ...
07), residual), [sn.assert_eq(5, sn.count(residual)), sn.assert_found('Finalising parallel run', self.stdout), sn.assert_found(r'^\s*[Ee]nd', self.stdout)]) ) @rfm.simple_test class ReconstructPar(OpenFOAMBaseTest):
64
64
127
16
48
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
ReconstructPar
ReconstructPar
194
205
194
195
52b57f1d6e807630709f223d5758287272e31bf4
bigcode/the-stack
train
e683df05c2bee194ed13055c
train
class
@rfm.simple_test class BlockMesh(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM blockMesh from the dambreak tutorial' self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout)
@rfm.simple_test class BlockMesh(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM blockMesh from the dambreak tutorial' self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout)
= 1 self.maintainers = ['MKr', 'AJ'] self.tags = {'scs', 'production', 'external-resources'} self.prerun_cmds = ['source $FOAM_BASH'] @rfm.simple_test class BlockMesh(OpenFOAMBaseTest):
64
64
65
15
49
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
BlockMesh
BlockMesh
35
40
35
36
c0df7a3e4cb951818c7e7e50164c1f226b111394
bigcode/the-stack
train
5ca64a8c549e2580038fc1f0
train
class
@rfm.simple_test class SetFields(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of setFields: dambreak tutorial' self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout)
@rfm.simple_test class SetFields(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of setFields: dambreak tutorial' self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout)
_files = ['processor0', 'processor1', 'processor2', 'processor3', 'processor4', 'processor5'] self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout) @rfm.simple_test class SetFields(OpenFOAMBaseTest):
64
64
66
15
49
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
SetFields
SetFields
219
224
219
220
a7bd30a9c6813c8e0c3de384f1167e788f0d4898
bigcode/the-stack
train
f78a85eac9cdb2b6d5b28d6a
train
class
@rfm.simple_test class PatchSummary(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of patchSummary: motorbike tutorial' self.executable_opts = ['-parallel'] self.num_tasks = 6 self.num_tasks_per_node = 6 self.sanity_patterns = s...
@rfm.simple_test class PatchSummary(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of patchSummary: motorbike tutorial' self.executable_opts = ['-parallel'] self.num_tasks = 6 self.num_tasks_per_node = 6 self.sanity_patterns = sn.all([ sn.assert_found('Finalising paralle...
([ sn.assert_eq( sn.count(sn.findall('(?P<line>Air phase volume fraction)', self.stdout)), 2534), sn.assert_found(r'^\s*[Ee]nd', self.stdout) ]) @rfm.simple_test class PatchSummary(OpenFOAMBaseTest):
63
64
113
15
48
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
PatchSummary
PatchSummary
148
159
148
149
637e58759074aababda0087712d02a3fdbb37b0e
bigcode/the-stack
train
c6ebbcaa5a16ff476352bb41
train
class
@rfm.simple_test class FoamyHexMesh(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of foamyHexMesh: motorbike tutorial' self.executable_opts = ['-parallel'] self.num_tasks = 8 self.num_tasks_per_node = 8 self.sanity_patterns = s...
@rfm.simple_test class FoamyHexMesh(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of foamyHexMesh: motorbike tutorial' self.executable_opts = ['-parallel'] self.num_tasks = 8 self.num_tasks_per_node = 8 self.sanity_patterns = sn.all( [sn.assert_found('Time = 100\n', sel...
'OpenFOAM check of decomposePar: heatexchanger tutorial' self.executable_opts = ['-region air'] self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout) @rfm.simple_test class FoamyHexMesh(OpenFOAMBaseTest):
64
64
130
17
47
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
FoamyHexMesh
FoamyHexMesh
121
132
121
122
3c5511d90ffc38474da35f03eefe9a6e4b919a14
bigcode/the-stack
train
6267f0765c3b8bf8e4be8e29
train
class
@rfm.simple_test class PimpleFoam(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of pimpleFoam: tjunction tutorial' residual = sn.extractall(r'Solving for epsilon, \w+\s\w+\s=\s\d.\d+.\s' r'Final residual\s=\s(?P<res>-?...
@rfm.simple_test class PimpleFoam(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of pimpleFoam: tjunction tutorial' residual = sn.extractall(r'Solving for epsilon, \w+\s\w+\s=\s\d.\d+.\s' r'Final residual\s=\s(?P<res>-?\S+),', self.stdout,...
_per_node = 6 self.sanity_patterns = sn.all([ sn.assert_found('Finalising parallel run', self.stdout), sn.assert_found(r'^\s*[Ee]nd', self.stdout) ]) @rfm.simple_test class PimpleFoam(OpenFOAMBaseTest):
63
64
155
17
46
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
PimpleFoam
PimpleFoam
162
173
162
163
223a30241f547bd0f0eb5a7f930ac02a08869ad3
bigcode/the-stack
train
f5f07ad8c4707ca7b1794986
train
class
@rfm.simple_test class CollapseEdges(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of collapseEdges: flange tutorial' self.executable_opts = ['-latestTime', '-collapseFaces', '-parallel'] self.num_tasks = 8 self.num_tasks_per_node = 8 ...
@rfm.simple_test class CollapseEdges(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of collapseEdges: flange tutorial' self.executable_opts = ['-latestTime', '-collapseFaces', '-parallel'] self.num_tasks = 8 self.num_tasks_per_node = 8 self.sanity_patterns = sn.all( [sn.a...
.e-03), residual), [sn.assert_eq(10, sn.count(residual)), sn.assert_found('Finalising parallel run', self.stdout), sn.assert_found(r'^\s*[Ee]nd', self.stdout)])) @rfm.simple_test class CollapseEdges(OpenFOAMBaseTest):
64
64
119
15
49
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
CollapseEdges
CollapseEdges
90
100
90
91
b91b075414e4cdd8c3a40b5f33340707865b31a3
bigcode/the-stack
train
88c61b50c52dbb507534e084
train
class
@rfm.simple_test class CreateBaffles(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of createBaffles: heatexchanger tutorial' self.executable_opts = ['-region air', '-overwrite'] self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout...
@rfm.simple_test class CreateBaffles(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of createBaffles: heatexchanger tutorial' self.executable_opts = ['-region air', '-overwrite'] self.sanity_patterns = sn.assert_found(r'^\s*[Ee]nd', self.stdout)
.num_tasks_per_node = 8 self.sanity_patterns = sn.all( [sn.assert_found('Finalising parallel run', self.stdout), sn.assert_found(r'^\s*[Ee]nd', self.stdout)]) @rfm.simple_test class CreateBaffles(OpenFOAMBaseTest):
63
64
83
16
47
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
CreateBaffles
CreateBaffles
103
109
103
104
88aeb830640df47d669c8979b0e68a35d17b621f
bigcode/the-stack
train
8862bb08f39f2898356654cb
train
class
@rfm.simple_test class ChtMultiRegionSimpleFoam(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = ('OpenFOAM check of chtMultiRegionSimpleFoam:' ' heatexchanger tutorial') self.executable_opts = ['-parallel'] self.num_tasks = 4 self....
@rfm.simple_test class ChtMultiRegionSimpleFoam(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = ('OpenFOAM check of chtMultiRegionSimpleFoam:' ' heatexchanger tutorial') self.executable_opts = ['-parallel'] self.num_tasks = 4 self.num_tasks_per_node = 4 residual = sn.extractall(r'\sglobal\...
8 self.sanity_patterns = sn.all([ sn.assert_found('Finalising parallel run', self.stdout), sn.assert_found(r'^\s*[Ee]nd', self.stdout) ]) @rfm.simple_test class ChtMultiRegionSimpleFoam(OpenFOAMBaseTest):
63
64
193
20
43
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
ChtMultiRegionSimpleFoam
ChtMultiRegionSimpleFoam
72
87
72
73
7db65bcf94f4010ebea3a9818632808e0c1ee9f4
bigcode/the-stack
train
e1bf4ac0b8e512e46d8dd77b
train
class
@rfm.simple_test class SnappyHexMesh(OpenFOAMBaseTest): def __init__(self): super().__init__() self.descr = 'OpenFOAM check of snappyHexMesh: motorbike tutorial' self.executable_opts = ['-overwrite', ' -parallel'] self.num_tasks = 6 self.num_tasks_per_node = 6 self.sa...
@rfm.simple_test class SnappyHexMesh(OpenFOAMBaseTest):
def __init__(self): super().__init__() self.descr = 'OpenFOAM check of snappyHexMesh: motorbike tutorial' self.executable_opts = ['-overwrite', ' -parallel'] self.num_tasks = 6 self.num_tasks_per_node = 6 self.sanity_patterns = sn.all([ sn.assert_found('Fi...
errors : \S+\s\S+ = \S+\s' r'global = (?P<res>-?\S+),', self.stdout, 'res', float)), 1.e-04) ]) @rfm.simple_test class SnappyHexMesh(OpenFOAMBaseTest):
63
64
121
17
46
MaximeVdB/reframe
cscs-checks/apps/openfoam/check_openfoam.py
Python
SnappyHexMesh
SnappyHexMesh
245
256
245
246
ae07227496fe59f77892ba2f72e96b9b575c2f08
bigcode/the-stack
train
c84a4d34433b3a62585d15c1
train
function
async def test_template_icon_with_trigger(hass): """Test trigger based template select.""" with assert_setup_component(1, "input_select"): assert await setup.async_setup_component( hass, "input_select", { "input_select": { "option":...
async def test_template_icon_with_trigger(hass):
"""Test trigger based template select.""" with assert_setup_component(1, "input_select"): assert await setup.async_setup_component( hass, "input_select", { "input_select": { "option": { "options": ["a", "b"],...
await hass.async_start() await hass.async_block_till_done() state = hass.states.get(_TEST_SELECT) assert state.state == "a" assert state.attributes[ATTR_ICON] == "mdi:greater" await hass.services.async_call( INPUT_SELECT_DOMAIN, INPUT_SELECT_SERVICE_SELECT_OPTION, {CONF...
142
142
474
10
132
picopock/core
tests/components/template/test_select.py
Python
test_template_icon_with_trigger
test_template_icon_with_trigger
344
412
344
344
486506259c06f7c681b86ee08144e12942bd2334
bigcode/the-stack
train
e0a8980d66186006b965295a
train
function
async def test_multiple_configs(hass): """Test: multiple select entities get created.""" with assert_setup_component(1, "template"): assert await setup.async_setup_component( hass, "template", { "template": { "select": [ ...
async def test_multiple_configs(hass):
"""Test: multiple select entities get created.""" with assert_setup_component(1, "template"): assert await setup.async_setup_component( hass, "template", { "template": { "select": [ { ...
['a', 'b'] }}", } } }, ) await hass.async_block_till_done() await hass.async_start() await hass.async_block_till_done() _verify(hass, "a", ["a", "b"]) async def test_multiple_configs(hass):
63
64
206
8
55
picopock/core
tests/components/template/test_select.py
Python
test_multiple_configs
test_multiple_configs
51
80
51
51
783ab7442ea2334b44216a4b6a6dd84a491630d4
bigcode/the-stack
train
ebf0979d457c7f218c082161
train
function
async def test_missing_optional_config(hass): """Test: missing optional template is ok.""" with assert_setup_component(1, "template"): assert await setup.async_setup_component( hass, "template", { "template": { "select": { ...
async def test_missing_optional_config(hass):
"""Test: missing optional template is ok.""" with assert_setup_component(1, "template"): assert await setup.async_setup_component( hass, "template", { "template": { "select": { "state": "{{ 'a' }}", ...
from homeassistant.core import Context from homeassistant.helpers.entity_registry import async_get from tests.common import assert_setup_component, async_capture_events _TEST_SELECT = "select.template_select" # Represent for select's current_option _OPTION_INPUT_SELECT = "input_select.option" async def test_missing_...
64
64
140
9
55
picopock/core
tests/components/template/test_select.py
Python
test_missing_optional_config
test_missing_optional_config
27
48
27
27
117656db66304bb0d6223fdc7c9da12512957c12
bigcode/the-stack
train
561439db7c37bcaf63e6df84
train
function
async def test_template_icon_with_entities(hass): """Test templates with values from other entities.""" with assert_setup_component(1, "input_select"): assert await setup.async_setup_component( hass, "input_select", { "input_select": { ...
async def test_template_icon_with_entities(hass):
"""Test templates with values from other entities.""" with assert_setup_component(1, "input_select"): assert await setup.async_setup_component( hass, "input_select", { "input_select": { "option": { "options":...
SELECT_SERVICE_SELECT_OPTION, {CONF_ENTITY_ID: "select.hello_name", SELECT_ATTR_OPTION: "alamo"}, blocking=True, ) assert len(events) == 1 assert events[0].event_type == "test_number_event" def _verify(hass, expected_current_option, expected_options, entity_name=_TEST_SELECT): """Veri...
128
128
429
10
117
picopock/core
tests/components/template/test_select.py
Python
test_template_icon_with_entities
test_template_icon_with_entities
281
341
281
281
622b9ee277aa1c6bde1c7fa3cace8f16c09752ac
bigcode/the-stack
train
7ebb18bd407208ee0c435230
train
function
async def test_missing_required_keys(hass): """Test: missing required fields will fail.""" with assert_setup_component(0, "template"): assert await setup.async_setup_component( hass, "template", { "template": { "select": { ...
async def test_missing_required_keys(hass):
"""Test: missing required fields will fail.""" with assert_setup_component(0, "template"): assert await setup.async_setup_component( hass, "template", { "template": { "select": { "select_option": {"service": ...
] } }, ) await hass.async_block_till_done() await hass.async_start() await hass.async_block_till_done() _verify(hass, "a", ["a", "b"]) _verify(hass, "a", ["a", "b"], f"{_TEST_SELECT}_2") async def test_missing_required_keys(hass):
79
79
264
9
70
picopock/core
tests/components/template/test_select.py
Python
test_missing_required_keys
test_missing_required_keys
83
131
83
83
579c814a6c6500d423382f7fc7013462dabb50da
bigcode/the-stack
train
32e9471887ba8bb2783722f8
train
function
async def test_trigger_select(hass): """Test trigger based template select.""" events = async_capture_events(hass, "test_number_event") assert await setup.async_setup_component( hass, "template", { "template": [ {"invalid": "config"}, # Con...
async def test_trigger_select(hass):
"""Test trigger based template select.""" events = async_capture_events(hass, "test_number_event") assert await setup.async_setup_component( hass, "template", { "template": [ {"invalid": "config"}, # Config after invalid should still be set...
INPUT_SELECT_ATTR_OPTIONS: ["a", "b", "c"], }, blocking=True, ) await hass.async_block_till_done() _verify(hass, "b", ["a", "b", "c"]) await hass.services.async_call( SELECT_DOMAIN, SELECT_SERVICE_SELECT_OPTION, {CONF_ENTITY_ID: _TEST_SELECT, SELECT_A...
116
117
393
8
108
picopock/core
tests/components/template/test_select.py
Python
test_trigger_select
test_trigger_select
216
270
216
216
2e20e4a427dc77f504495b36542f13eb3bb380ca
bigcode/the-stack
train
67271949d04c0e31f6caf1d9
train
function
def _verify(hass, expected_current_option, expected_options, entity_name=_TEST_SELECT): """Verify select's state.""" state = hass.states.get(entity_name) attributes = state.attributes assert state.state == str(expected_current_option) assert attributes.get(SELECT_ATTR_OPTIONS) == expected_options
def _verify(hass, expected_current_option, expected_options, entity_name=_TEST_SELECT):
"""Verify select's state.""" state = hass.states.get(entity_name) attributes = state.attributes assert state.state == str(expected_current_option) assert attributes.get(SELECT_ATTR_OPTIONS) == expected_options
_ID: "select.hello_name", SELECT_ATTR_OPTION: "alamo"}, blocking=True, ) assert len(events) == 1 assert events[0].event_type == "test_number_event" def _verify(hass, expected_current_option, expected_options, entity_name=_TEST_SELECT):
64
64
64
19
45
picopock/core
tests/components/template/test_select.py
Python
_verify
_verify
273
278
273
273
bea0e206fa6ab2862bca1820997c5f84ad4f9dd1
bigcode/the-stack
train
789709071d7d3da89afddecc
train
function
async def test_templates_with_entities(hass): """Test templates with values from other entities.""" with assert_setup_component(1, "input_select"): assert await setup.async_setup_component( hass, "input_select", { "input_select": { ...
async def test_templates_with_entities(hass):
"""Test templates with values from other entities.""" with assert_setup_component(1, "input_select"): assert await setup.async_setup_component( hass, "input_select", { "input_select": { "option": { "options":...
{ "template": { "select": { "state": "{{ 'a' }}", "select_option": {"service": "script.select_option"}, } } }, ) with assert_setup_component(0, "select"): ...
156
157
526
9
147
picopock/core
tests/components/template/test_select.py
Python
test_templates_with_entities
test_templates_with_entities
134
213
134
134
f3a23de5653582345d7126020a2e9c1d664266b6
bigcode/the-stack
train
fbd7c700ab63ab318dcb326c
train
function
@pytest.fixture def auth(client): return AuthActions(client)
@pytest.fixture def auth(client):
return AuthActions(client)
def login(self, email="user1@email.com", password="qwerty"): return self._client.post( '/login', data={ 'email': email, 'password': password } ) def logout(self): return self._client.get('/logout') @pytest.fixture def auth(client):
64
64
13
7
57
zachfedor/flask-boilerplate
tests/conftest.py
Python
auth
auth
55
57
55
56
41112c5463de6c51259044f6a1a70ccaca40fc7a
bigcode/the-stack
train
1feb6487c055cbd2ccbaf614
train
function
@pytest.fixture def client(app): return app.test_client()
@pytest.fixture def client(app):
return app.test_client()
tests data_file = os.path.join(os.path.dirname(__file__), 'data.sql') with open(data_file, 'rb') as f: with get_db() as con: with con.cursor() as cur: cur.execute(f.read()) yield app @pytest.fixture def client(app):
64
64
13
7
56
zachfedor/flask-boilerplate
tests/conftest.py
Python
client
client
31
33
31
32
7dbbad1af9ed5a06f11ea69b361d6da02fcc46b6
bigcode/the-stack
train
9e22582cba96917942fee081
train
function
@pytest.fixture def runner(app): return app.test_cli_runner()
@pytest.fixture def runner(app):
return app.test_cli_runner()
file__), 'data.sql') with open(data_file, 'rb') as f: with get_db() as con: with con.cursor() as cur: cur.execute(f.read()) yield app @pytest.fixture def client(app): return app.test_client() @pytest.fixture def runner(app):
64
64
14
7
57
zachfedor/flask-boilerplate
tests/conftest.py
Python
runner
runner
36
38
36
37
45907f58c10a4731800106939fed60736e72a66c
bigcode/the-stack
train
afe9521296b88a091efef900
train
function
@pytest.fixture def app(): app = create_app({ 'TESTING': True, 'DB_NAME': 'flask_boilerplate_test', 'DB_USER': 'flask_boilerplate_user', }) with app.app_context(): # Create the database in a blank state init_db() # Fill the database with mock data for tests ...
@pytest.fixture def app():
app = create_app({ 'TESTING': True, 'DB_NAME': 'flask_boilerplate_test', 'DB_USER': 'flask_boilerplate_user', }) with app.app_context(): # Create the database in a blank state init_db() # Fill the database with mock data for tests data_file = os.path...
import os import pytest from flask_boilerplate import create_app from flask_boilerplate.db import get_db, init_db @pytest.fixture def app():
34
64
133
6
27
zachfedor/flask-boilerplate
tests/conftest.py
Python
app
app
9
28
9
10
0e2f0815af6342f2f49d6df825ba7a808395ee9a
bigcode/the-stack
train
f1868826806b532c231a22f7
train
class
class AuthActions(object): def __init__(self, client): self._client = client def login(self, email="user1@email.com", password="qwerty"): return self._client.post( '/login', data={ 'email': email, 'password': password } ) def logout(self): return sel...
class AuthActions(object):
def __init__(self, client): self._client = client def login(self, email="user1@email.com", password="qwerty"): return self._client.post( '/login', data={ 'email': email, 'password': password } ) def logout(self): return self._client.get('/logout')
'rb') as f: with get_db() as con: with con.cursor() as cur: cur.execute(f.read()) yield app @pytest.fixture def client(app): return app.test_client() @pytest.fixture def runner(app): return app.test_cli_runner() class AuthActions(object):
64
64
79
5
59
zachfedor/flask-boilerplate
tests/conftest.py
Python
AuthActions
AuthActions
41
52
41
41
c64883365c26e88fc7e7fe4500ec129de040418b
bigcode/the-stack
train
d7b5fe45eb9c88698d1ad13c
train
function
def test_surprise_machine(): with patch("builtins.print") as mock_print: with patch("lesson_5.exercise_5.surprise_machine_clean.random.randint", return_value=4): with patch("lesson_5.exercise_5.surprise_machine_clean.time.sleep") as mock_sleep: surprise_machine() ...
def test_surprise_machine():
with patch("builtins.print") as mock_print: with patch("lesson_5.exercise_5.surprise_machine_clean.random.randint", return_value=4): with patch("lesson_5.exercise_5.surprise_machine_clean.time.sleep") as mock_sleep: surprise_machine() mock_sleep.assert_called_...
# pylint: disable=missing-function-docstring from unittest.mock import patch from lesson_5.exercise_5.surprise_machine_clean import surprise_machine def test_surprise_machine():
38
64
87
6
31
PONSASIKALA/signal-interpreter-server
tests/exercise5/lesson_5/exercise_5/test_surprise_machine_clean.py
Python
test_surprise_machine
test_surprise_machine
8
14
8
8
366e0590814c456d1c545dcf7632e390b550fdae
bigcode/the-stack
train
3519cb3bb014767880f92f81
train
class
class Line(): def __init__(self): # was the line detected in the last iteration? self.detected = False # x values of the last n fits of the line self.recent_fitted = [np.array([False])] #average x values of the fitted line over the last n iterations self.bestx = Non...
class Line():
def __init__(self): # was the line detected in the last iteration? self.detected = False # x values of the last n fits of the line self.recent_fitted = [np.array([False])] #average x values of the fitted line over the last n iterations self.bestx = None ...
# -*- coding: utf-8 -*- """ Created on Tue Oct 10 19:38:04 2017 @author: yang """ import numpy as np # Define a class to receive the characteristics of each line detection class Line():
51
137
458
3
47
SSyangguang/railroad-detection
line.py
Python
Line
Line
10
59
10
10
6d2833458c1505f69708ca9cd457922a1b51fe74
bigcode/the-stack
train
474479ff915b4ec2fac0a22b
train
class
class TestApplications(unittest.TestCase): server_type = None s = None server_sep = '/' data_dir = None def setUp(self): swat.reset_option() swat.options.cas.print_messages = False swat.options.interactive_mode = False self.s = swat.CAS() self.server_type = t...
class TestApplications(unittest.TestCase):
server_type = None s = None server_sep = '/' data_dir = None def setUp(self): swat.reset_option() swat.options.cas.print_messages = False swat.options.interactive_mode = False self.s = swat.CAS() self.server_type = tm.get_cas_host_type(self.s) self.s...
License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed...
256
256
8,962
7
248
arharvey918/python-dlpy
dlpy/tests/test_applications.py
Python
TestApplications
TestApplications
36
959
36
36
06653524dd1044bfa3fe89e11b2c8b0f08c1678a
bigcode/the-stack
train
1272fb1368467ea6bb22d2c5
train
function
def test_surplus_features_2(): index = ( PackageRecord(**{ 'name': 'feature', 'version': '1.0', 'build': '0', 'build_number': 0, 'track_features': 'feature', }), PackageRecord(**{ 'name': 'package1', 'version...
def test_surplus_features_2():
index = ( PackageRecord(**{ 'name': 'feature', 'version': '1.0', 'build': '0', 'build_number': 0, 'track_features': 'feature', }), PackageRecord(**{ 'name': 'package1', 'version': '1.0', 'build': ...
'0', 'build_number': 0, 'features': 'feature', }), ) r = Resolve(OrderedDict((prec, prec) for prec in index)) install = r.install(['package2', 'feature']) assert 'package1' not in set(d.name for d in install) def test_surplus_features_2():
75
75
251
8
67
twinssbc/conda
tests/test_resolve.py
Python
test_surplus_features_2
test_surplus_features_2
1,847
1,881
1,847
1,847
c625ff9e0041ebcdb8d3b7a1af1626cb0a6ad542
bigcode/the-stack
train
e6f1e93be41433dbaed9667e
train
function
def test_channel_priority_2(): this_index = index.copy() index4, r4 = get_index_r_4() this_index.update(index4) spec = (MatchSpec('pandas'), MatchSpec('python 2.7*')) channels = (Channel('channel-1'), Channel('channel-3')) this_r = Resolve(this_index, channels=channels) with env_var("CONDA_C...
def test_channel_priority_2():
this_index = index.copy() index4, r4 = get_index_r_4() this_index.update(index4) spec = (MatchSpec('pandas'), MatchSpec('python 2.7*')) channels = (Channel('channel-1'), Channel('channel-3')) this_r = Resolve(this_index, channels=channels) with env_var("CONDA_CHANNEL_PRIORITY", "True", stack...
it has highest channel priority, even though # 'channel-1::pandas-0.11.1-np17py27_0.tar.bz2' would otherwise be preferred installed1 = r2.install(spec) assert record_2 in installed1 assert record_1 not in installed1 assert record_0 not in installed1 r3 = Resolve(index2,...
256
256
11,142
7
248
twinssbc/conda
tests/test_resolve.py
Python
test_channel_priority_2
test_channel_priority_2
1,251
1,723
1,251
1,251
c5ce5307a45707fab17d820b0cfec7877762c3d7
bigcode/the-stack
train
9842d3d2c859a76bc498acf5
train
function
def test_unsat_simple(): # a and b depend on conflicting versions of c index = ( simple_rec(name='a', depends=['c >=1,<2']), simple_rec(name='b', depends=['c >=2,<3']), simple_rec(name='c', version='1.0'), simple_rec(name='c', version='2.0'), ) r = Resolve(OrderedDict((pr...
def test_unsat_simple(): # a and b depend on conflicting versions of c
index = ( simple_rec(name='a', depends=['c >=1,<2']), simple_rec(name='b', depends=['c >=2,<3']), simple_rec(name='c', version='1.0'), simple_rec(name='c', version='2.0'), ) r = Resolve(OrderedDict((prec, prec) for prec in index)) with pytest.raises(UnsatisfiableError) as...
return PackageRecord(**{ 'name': name, 'version': version, 'depends': depends, 'build': build, 'build_number': build_number, 'channel': channel, }) def test_unsat_simple(): # a and b depend on conflicting versions of c
64
64
162
18
46
twinssbc/conda
tests/test_resolve.py
Python
test_unsat_simple
test_unsat_simple
340
352
340
341
2b52c5c6a098cff53a3ad4fb6d44fba471a0898b
bigcode/the-stack
train
4d3e16a0fcfe17b451e7e7e1
train
function
def test_unsat_any_two_not_three(): # can install any two of a, b and c but not all three index = ( simple_rec(name='a', version='1.0', depends=['d >=1,<2']), simple_rec(name='a', version='2.0', depends=['d >=2,<3']), simple_rec(name='b', version='1.0', depends=['d >=1,<2']), si...
def test_unsat_any_two_not_three(): # can install any two of a, b and c but not all three
index = ( simple_rec(name='a', version='1.0', depends=['d >=1,<2']), simple_rec(name='a', version='2.0', depends=['d >=2,<3']), simple_rec(name='b', version='1.0', depends=['d >=1,<2']), simple_rec(name='b', version='2.0', depends=['d >=3,<4']), simple_rec(name='c', version...
2.0', depends=['d >=2,<3']), simple_rec(name='d', version='2.0'), ) r = Resolve(OrderedDict((prec, prec) for prec in index)) with pytest.raises(UnsatisfiableError) as excinfo: r.install(['a', 'e']) assert "a -> b -> c[version='>=1,<2'] -> d[version='>=1,<2']" in str(excinfo.value) as...
157
157
524
26
131
twinssbc/conda
tests/test_resolve.py
Python
test_unsat_any_two_not_three
test_unsat_any_two_not_three
375
409
375
376
9fdf536b9e903ed4288b4009afa1c80fdf8a8b8c
bigcode/the-stack
train
8596f57d7778c22a3c163532
train
function
def test_get_dists(): reduced_index = r.get_reduced_index((MatchSpec("anaconda 1.5.0"), )) dist_strs = [prec.dist_str() for prec in reduced_index] assert 'channel-1::anaconda-1.5.0-np17py27_0' in dist_strs assert 'channel-1::dynd-python-0.3.0-np17py33_0' in dist_strs
def test_get_dists():
reduced_index = r.get_reduced_index((MatchSpec("anaconda 1.5.0"), )) dist_strs = [prec.dist_str() for prec in reduced_index] assert 'channel-1::anaconda-1.5.0-np17py27_0' in dist_strs assert 'channel-1::dynd-python-0.3.0-np17py33_0' in dist_strs
8-1', 'channel-1::tk-8.5.13-0', 'channel-1::unixodbc-2.3.1-0', 'channel-1::zlib-1.2.7-0', ] def test_get_dists():
63
64
102
6
57
twinssbc/conda
tests/test_resolve.py
Python
test_get_dists
test_get_dists
156
160
156
156
979ccfa48ff67348d9e3b654c5af20122041a072
bigcode/the-stack
train
66c8110b09de0b32012ee605
train
function
def test_noarch_preferred_over_arch_when_build_greater(): index = ( PackageRecord(**{ 'name': 'abc', 'version': '1.0', 'build': '1', "subdir": "noarch", 'build_number': 1, }), PackageRecord(**{ 'name': 'abc', ...
def test_noarch_preferred_over_arch_when_build_greater():
index = ( PackageRecord(**{ 'name': 'abc', 'version': '1.0', 'build': '1', "subdir": "noarch", 'build_number': 1, }), PackageRecord(**{ 'name': 'abc', 'version': '1.0', 'build': '0', "...
r = Resolve(OrderedDict((prec, prec) for prec in index)) install = r.install(['abc']) for d in install: assert d.subdir == 'noarch' assert d.version == '2.0' def test_noarch_preferred_over_arch_when_build_greater():
64
64
163
13
51
twinssbc/conda
tests/test_resolve.py
Python
test_noarch_preferred_over_arch_when_build_greater
test_noarch_preferred_over_arch_when_build_greater
2,052
2,073
2,052
2,052
326a6552ad7fe166957c68723f7d190b1f0cf5ec
bigcode/the-stack
train
46304e4332ef944ab16b02f1
train
function
def test_noarch_preferred_over_arch_when_version_greater(): index = ( PackageRecord(**{ 'name': 'abc', 'version': '2.0', 'build': '0', "subdir": "noarch", 'build_number': 0, }), PackageRecord(**{ 'name': 'abc', ...
def test_noarch_preferred_over_arch_when_version_greater():
index = ( PackageRecord(**{ 'name': 'abc', 'version': '2.0', 'build': '0', "subdir": "noarch", 'build_number': 0, }), PackageRecord(**{ 'name': 'abc', 'version': '1.0', 'build': '0', "...
0.24" }), ) r = Resolve(OrderedDict((prec, prec) for prec in index)) install = r.install(['itsdangerous']) for d in install: assert d.subdir == context.subdir def test_noarch_preferred_over_arch_when_version_greater():
64
64
164
13
50
twinssbc/conda
tests/test_resolve.py
Python
test_noarch_preferred_over_arch_when_version_greater
test_noarch_preferred_over_arch_when_version_greater
2,028
2,049
2,028
2,028
473357638f338dff2dbde2780d898e71fa27c5b6
bigcode/the-stack
train
8f69faf36b4183bae5f60e0b
train
function
def test_broken_install(): installed = r.install(['pandas', 'python 2.7*', 'numpy 1.6*']) _installed = [rec.dist_str() for rec in installed] assert _installed == [ 'channel-1::dateutil-2.1-py27_1', 'channel-1::numpy-1.6.2-py27_4', 'channel-1::openssl-1.0.1c-0', 'channel-1::pa...
def test_broken_install():
installed = r.install(['pandas', 'python 2.7*', 'numpy 1.6*']) _installed = [rec.dist_str() for rec in installed] assert _installed == [ 'channel-1::dateutil-2.1-py27_1', 'channel-1::numpy-1.6.2-py27_4', 'channel-1::openssl-1.0.1c-0', 'channel-1::pandas-0.11.0-np16py27_1', ...
-py27_p5', # and this are different. 'channel-1::openssl-1.0.1c-0', 'channel-1::pandas-0.12.0-np16py27_0', 'channel-1::python-2.7.5-0', 'channel-1::pytz-2013b-py27_0', 'channel-1::readline-6.2-0', 'channel-1::six-1.3.0-py27_0', 'channel-1::sqlite-3.7.13-0', ...
192
193
646
6
186
twinssbc/conda
tests/test_resolve.py
Python
test_broken_install
test_broken_install
1,083
1,126
1,083
1,083
1bba8ed40963987867211f409fdcc25204369b07
bigcode/the-stack
train
a9ecdf80f07e4750c49fa8ec
train
function
def test_nonexistent_deps(): index2 = index.copy() p1 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", "fn": "doesnt-matter-here", 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'python 3.3*', 'notarealpa...
def test_nonexistent_deps():
index2 = index.copy() p1 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", "fn": "doesnt-matter-here", 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'python 3.3*', 'notarealpackage 2.0*'], 'name':...
k.version.startswith('1.2') for k in installed1) assert any(k.name == 'mypackage' and k.build == 'hash12_0' for k in installed1) installed2 = r.install(['libpng 1.5.*', 'mypackage']) assert any(k.name == 'libpng' and k.version.startswith('1.5') for k in installed2) assert any(k.name == 'mypackage' and ...
256
256
3,105
7
248
twinssbc/conda
tests/test_resolve.py
Python
test_nonexistent_deps
test_nonexistent_deps
528
778
528
528
d35114c36d67bfc42ebddc3925b20ee14f684d0b
bigcode/the-stack
train
778c3ec8da62e7c468bae977
train
function
def test_install_package_with_feature(): index2 = index.copy() p1 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", "fn": "doesnt-matter-here", 'build': 'featurepy33_0', 'build_number': 0, 'depends': ['python 3.3*'],...
def test_install_package_with_feature():
index2 = index.copy() p1 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", "fn": "doesnt-matter-here", 'build': 'featurepy33_0', 'build_number': 0, 'depends': ['python 3.3*'], 'name': 'mypackage', 've...
1::readline-6.2-0', 'channel-1::sqlite-3.7.13-0', 'channel-1::system-5.8-1', 'channel-1::tk-8.5.13-0', 'channel-1::zlib-1.2.7-0', ] def test_install_package_with_feature():
83
84
283
7
76
twinssbc/conda
tests/test_resolve.py
Python
test_install_package_with_feature
test_install_package_with_feature
781
812
781
781
80405e2a723e61e49a64dc56d78fed18263ad350
bigcode/the-stack
train
72cd25c0856c2506d230ac1c
train
function
def test_optional_dependencies(): index2 = index.copy() p1 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", "fn": "doesnt-matter-here", 'build': '0', 'build_number': 0, 'constrains': ['package2 >1.0'], 'name...
def test_optional_dependencies():
index2 = index.copy() p1 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", "fn": "doesnt-matter-here", 'build': '0', 'build_number': 0, 'constrains': ['package2 >1.0'], 'name': 'package1', 'requires':...
Resolve(index2) assert set(prec.dist_str() for prec in r.find_matches(MatchSpec('package1'))) == { 'defaults::package1-1.0-0', } assert set(prec.dist_str() for prec in r.get_reduced_index((MatchSpec('package1'), )).keys()) == { 'defaults::package1-1.0-0', 'defaults::package2-1.0-0'...
181
182
609
5
176
twinssbc/conda
tests/test_resolve.py
Python
test_optional_dependencies
test_optional_dependencies
884
946
884
884
3b1eac0ac0b7b4e5939733858eb2948c12deecef
bigcode/the-stack
train
9b865755d16fd20a901aeb6a
train
function
def test_unsat_chain(): # a -> b -> c=1.x -> d=1.x # e -> c=2.x -> d=2.x index = ( simple_rec(name='a', depends=['b']), simple_rec(name='b', depends=['c >=1,<2']), simple_rec(name='c', version='1.0', depends=['d >=1,<2']), simple_rec(name='d', version='1.0'), si...
def test_unsat_chain(): # a -> b -> c=1.x -> d=1.x # e -> c=2.x -> d=2.x
index = ( simple_rec(name='a', depends=['b']), simple_rec(name='b', depends=['c >=1,<2']), simple_rec(name='c', version='1.0', depends=['d >=1,<2']), simple_rec(name='d', version='1.0'), simple_rec(name='e', depends=['c >=2,<3']), simple_rec(name='c', version='2.0', ...
a -> c[version='>=1,<2']" in str(excinfo.value) assert "b -> c[version='>=2,<3']" in str(excinfo.value) def test_unsat_chain(): # a -> b -> c=1.x -> d=1.x # e -> c=2.x -> d=2.x
76
76
256
37
39
twinssbc/conda
tests/test_resolve.py
Python
test_unsat_chain
test_unsat_chain
355
372
355
357
71d79f8932c4e3b48dbb9ce44546f31bea9c8ef1
bigcode/the-stack
train
f597bf8ea4af22a3dd16ebf2
train
class
class TestSolve(unittest.TestCase): def assert_have_mkl(self, precs, names): for prec in precs: if prec.name in names: assert 'mkl' in prec.features # def test_explicit0(self): # self.assertEqual(r.explicit([]), []) # # def test_explicit1(self): # se...
class TestSolve(unittest.TestCase):
def assert_have_mkl(self, precs, names): for prec in precs: if prec.name in names: assert 'mkl' in prec.features # def test_explicit0(self): # self.assertEqual(r.explicit([]), []) # # def test_explicit1(self): # self.assertEqual(r.explicit(['pycosat 0...
from __future__ import absolute_import, print_function from collections import OrderedDict from os.path import isdir, join from pprint import pprint import unittest import pytest from conda.base.context import context, conda_tests_ctxt_mgmt_def_pol from conda.common.compat import iteritems, itervalues from conda.com...
190
256
1,287
7
183
twinssbc/conda
tests/test_resolve.py
Python
TestSolve
TestSolve
25
119
25
26
4c50cf56f919a0d515f36d81c1c7b5c5aec2fccf
bigcode/the-stack
train
bd5461fcb34e9a9e67991035
train
function
def test_generate_eq_1(): reduced_index = r.get_reduced_index((MatchSpec('anaconda'), )) r2 = Resolve(reduced_index, True) C = r2.gen_clauses() eqc, eqv, eqb, eqa, eqt = r2.generate_version_metrics(C, list(r2.groups.keys())) # Should satisfy the following criteria: # - lower versions of the sam...
def test_generate_eq_1():
reduced_index = r.get_reduced_index((MatchSpec('anaconda'), )) r2 = Resolve(reduced_index, True) C = r2.gen_clauses() eqc, eqv, eqb, eqa, eqt = r2.generate_version_metrics(C, list(r2.groups.keys())) # Should satisfy the following criteria: # - lower versions of the same package should should ha...
-0.3.0-np17py33_0' in dist_strs def test_get_reduced_index_unmanageable(): index, r = get_index_r_4() index = index.copy() channels = r.channels prefix_path = join(TEST_DATA_DIR, "env_metadata", "envpy27osx") if not isdir(prefix_path): pytest.skip("test files not found: %s" % prefix_path) ...
255
256
2,649
7
248
twinssbc/conda
tests/test_resolve.py
Python
test_generate_eq_1
test_generate_eq_1
181
306
181
181
42a5d97770dfbe2633a9f2d28b6ed29da46fb008
bigcode/the-stack
train
5703b5f5d591012a08c68f8a
train
function
def test_get_reduced_index_unmanageable(): index, r = get_index_r_4() index = index.copy() channels = r.channels prefix_path = join(TEST_DATA_DIR, "env_metadata", "envpy27osx") if not isdir(prefix_path): pytest.skip("test files not found: %s" % prefix_path) anchor_file = "lib/python2.7/s...
def test_get_reduced_index_unmanageable():
index, r = get_index_r_4() index = index.copy() channels = r.channels prefix_path = join(TEST_DATA_DIR, "env_metadata", "envpy27osx") if not isdir(prefix_path): pytest.skip("test files not found: %s" % prefix_path) anchor_file = "lib/python2.7/site-packages/requests-2.19.1-py2.7.egg/EGG-...
_index] assert 'channel-1::anaconda-1.5.0-np17py27_0' in dist_strs assert 'channel-1::dynd-python-0.3.0-np17py33_0' in dist_strs def test_get_reduced_index_unmanageable():
68
68
229
9
58
twinssbc/conda
tests/test_resolve.py
Python
test_get_reduced_index_unmanageable
test_get_reduced_index_unmanageable
163
178
163
163
6b5759a2703afda7af3d336ea8129d42ca17d0b8
bigcode/the-stack
train
1e02e7d7275ca4af1506e8fe
train
function
def test_noarch_preferred_over_arch_when_version_greater_dep(): index = ( PackageRecord(**{ 'name': 'abc', 'version': '2.0', 'build': '0', "subdir": "noarch", 'build_number': 0, }), PackageRecord(**{ 'name': 'abc', ...
def test_noarch_preferred_over_arch_when_version_greater_dep():
index = ( PackageRecord(**{ 'name': 'abc', 'version': '2.0', 'build': '0', "subdir": "noarch", 'build_number': 0, }), PackageRecord(**{ 'name': 'abc', 'version': '1.0', 'build': '0', "...
}), ) r = Resolve(OrderedDict((prec, prec) for prec in index)) install = r.install(['foo']) for d in install: if d.name == 'itsdangerous': assert d.subdir == context.subdir def test_noarch_preferred_over_arch_when_version_greater_dep():
68
68
227
14
53
twinssbc/conda
tests/test_resolve.py
Python
test_noarch_preferred_over_arch_when_version_greater_dep
test_noarch_preferred_over_arch_when_version_greater_dep
2,127
2,157
2,127
2,127
ed04c54e13d608f3d8a8911bf1ccc07ad734cab1
bigcode/the-stack
train
4f7b85553dbbf6efc644b836
train
function
def test_unsat_expand_single(): # if install maps to a single package, examine its dependencies index = ( simple_rec(name='a', depends=['b', 'c']), simple_rec(name='b', depends=['d >=1,<2']), simple_rec(name='c', depends=['d >=2,<3']), simple_rec(name='d', version='1.0'), ...
def test_unsat_expand_single(): # if install maps to a single package, examine its dependencies
index = ( simple_rec(name='a', depends=['b', 'c']), simple_rec(name='b', depends=['d >=1,<2']), simple_rec(name='c', depends=['d >=2,<3']), simple_rec(name='d', version='1.0'), simple_rec(name='d', version='2.0'), ) r = Resolve(OrderedDict((prec, prec) for prec in ind...
#assert "b -> d[version='>=1,<2']" in str(excinfo.value) #assert "c -> d[version='>=2,<3']" in str(excinfo.value) def test_unsat_expand_single(): # if install maps to a single package, examine its dependencies
64
64
176
21
43
twinssbc/conda
tests/test_resolve.py
Python
test_unsat_expand_single
test_unsat_expand_single
416
429
416
417
dae377348524fe770324fec4efc3edaf55c46bee
bigcode/the-stack
train
35eac90ba3920f327e4d39c3
train
function
def test_update_deps(): installed = r.install(['python 2.7*', 'numpy 1.6*', 'pandas 0.10.1']) result = [rec.dist_str() for rec in installed] assert result == [ 'channel-1::dateutil-2.1-py27_1', 'channel-1::numpy-1.6.2-py27_4', 'channel-1::openssl-1.0.1c-0', 'channel-1::pandas...
def test_update_deps():
installed = r.install(['python 2.7*', 'numpy 1.6*', 'pandas 0.10.1']) result = [rec.dist_str() for rec in installed] assert result == [ 'channel-1::dateutil-2.1-py27_1', 'channel-1::numpy-1.6.2-py27_4', 'channel-1::openssl-1.0.1c-0', 'channel-1::pandas-0.10.1-np16py27_0', ...
.1c-0', 'channel-1::readline-6.2-0', 'channel-1::sqlite-3.7.13-0', 'channel-1::system-5.8-1', 'channel-1::tk-8.5.13-0', 'channel-1::zlib-1.2.7-0', 'channel-1::python-2.7.5-0', 'channel-1::numpy-1.6.2-py27_4', 'channel-1::pytz-2013b-py27_0', 'channe...
256
256
897
6
249
twinssbc/conda
tests/test_resolve.py
Python
test_update_deps
test_update_deps
1,751
1,807
1,751
1,751
76ddaf84c12e8c558ddfbd121ceeb7c0d6d97ece
bigcode/the-stack
train
058ec64cd5621ba523eefb22
train
function
def test_get_reduced_index_broadening_preferred_solution(): # test that order of index reduction does not eliminate what should be a preferred solution # https://github.com/conda/conda/pull/8117#discussion_r249216068 index = ( PackageRecord(**{ 'name': 'top', 'version': '1...
def test_get_reduced_index_broadening_preferred_solution(): # test that order of index reduction does not eliminate what should be a preferred solution # https://github.com/conda/conda/pull/8117#discussion_r249216068
index = ( PackageRecord(**{ 'name': 'top', 'version': '1.0', 'build': '0', 'build_number': 0, # this is the first processed record, and imposes a broadening constraint on bottom # if things are overly restricted, we'll end up with bo...
0', 'build_number': 0, 'depends': [], }) ) r = Resolve(OrderedDict((prec, prec) for prec in index)) install = r.install(['a']) assert 'a' in set(d.name for d in install) assert 'b' in set(d.name for d in install) assert 'c' in set(d.name for d in install) def tes...
142
142
475
56
86
twinssbc/conda
tests/test_resolve.py
Python
test_get_reduced_index_broadening_preferred_solution
test_get_reduced_index_broadening_preferred_solution
1,931
1,983
1,931
1,933
6c406c226d7c21c32fcb697d70c3d6c1051b0e3f
bigcode/the-stack
train
900ed5e9ef2e28fb317f20a8
train
function
def test_irrational_version(): result = r.install(['pytz 2012d', 'python 3*'], returnall=True) result = [rec.dist_str() for rec in result] assert result == [ 'channel-1::openssl-1.0.1c-0', 'channel-1::python-3.3.2-0', 'channel-1::pytz-2012d-py33_0', 'channel-1::readline-6.2-0...
def test_irrational_version():
result = r.install(['pytz 2012d', 'python 3*'], returnall=True) result = [rec.dist_str() for rec in result] assert result == [ 'channel-1::openssl-1.0.1c-0', 'channel-1::python-3.3.2-0', 'channel-1::pytz-2012d-py33_0', 'channel-1::readline-6.2-0', 'channel-1::sqlite-3...
0-0', ] assert raises(UnsatisfiableError, lambda: r.install(['package1', 'package2 <2.0'])) assert raises(UnsatisfiableError, lambda: r.install(['package1', 'package2 1.0'])) def test_irrational_version():
63
64
181
7
56
twinssbc/conda
tests/test_resolve.py
Python
test_irrational_version
test_irrational_version
949
961
949
949
543e939089a715fe1dd7807cb293d9059f2d0539
bigcode/the-stack
train
5f16ceb6a56313ef3f8f09d5
train
function
def test_surplus_features_1(): index = ( PackageRecord(**{ 'name': 'feature', 'version': '1.0', 'build': '0', 'build_number': 0, 'track_features': 'feature', }), PackageRecord(**{ 'name': 'package1', 'version...
def test_surplus_features_1():
index = ( PackageRecord(**{ 'name': 'feature', 'version': '1.0', 'build': '0', 'build_number': 0, 'track_features': 'feature', }), PackageRecord(**{ 'name': 'package1', 'version': '1.0', 'build': ...
', 'channel-1::sqlite-3.7.13-0', 'channel-1::system-5.8-1', 'channel-1::tk-8.5.13-0', 'channel-1::zlib-1.2.7-0', ] def test_surplus_features_1():
74
75
251
8
66
twinssbc/conda
tests/test_resolve.py
Python
test_surplus_features_1
test_surplus_features_1
1,810
1,844
1,810
1,810
4cd58bdd2ac948b1eed24ebf696620da0940ec7b
bigcode/the-stack
train
8102de41fea7c6b296225dfe
train
function
def test_arch_preferred_over_noarch_when_otherwise_equal_dep(): index = ( PackageRecord(**{ "build": "py36_0", "build_number": 0, "date": "2016-12-17", "license": "BSD", "md5": "9b4568068e3a7ac81be87902827d949e", "name": "itsdangerous",...
def test_arch_preferred_over_noarch_when_otherwise_equal_dep():
index = ( PackageRecord(**{ "build": "py36_0", "build_number": 0, "date": "2016-12-17", "license": "BSD", "md5": "9b4568068e3a7ac81be87902827d949e", "name": "itsdangerous", "size": 19688, "version": "0.24" ...
"noarch", 'build_number': 1, }), PackageRecord(**{ 'name': 'abc', 'version': '1.0', 'build': '0', "subdir": context.subdir, 'build_number': 0, }), ) r = Resolve(OrderedDict((prec, prec) for prec in index)) insta...
127
127
426
14
112
twinssbc/conda
tests/test_resolve.py
Python
test_arch_preferred_over_noarch_when_otherwise_equal_dep
test_arch_preferred_over_noarch_when_otherwise_equal_dep
2,076
2,124
2,076
2,076
60d38c9abfd1c89098cbc162b2dda89b98bb9754
bigcode/the-stack
train
1f96611653d7d258ad8ac6b5
train
function
def test_timestamps_and_deps(): # If timestamp maximization is performed too early in the solve optimization, # it will force unnecessary changes to dependencies. Timestamp maximization needs # to be done at low priority so that conda is free to consider packages with the # same version and build that a...
def test_timestamps_and_deps(): # If timestamp maximization is performed too early in the solve optimization, # it will force unnecessary changes to dependencies. Timestamp maximization needs # to be done at low priority so that conda is free to consider packages with the # same version and build that a...
index2 = {key: value for key, value in iteritems(index)} mypackage1 = PackageRecord(**{ 'build': 'hash12_0', 'build_number': 0, 'depends': ['libpng 1.2.*'], 'name': 'mypackage', 'requires': ['libpng 1.2.*'], 'version': '1.0', 'timestamp': 1, }) ind...
c[version='>=2,<3']" in str(excinfo.value) def test_nonexistent(): assert not r.find_matches(MatchSpec('notarealpackage 2.0*')) assert raises(ResolvePackageNotFound, lambda: r.install(['notarealpackage 2.0*'])) # This exact version of NumPy does not exist assert raises(ResolvePackageNotFound, lambda:...
170
171
573
73
97
twinssbc/conda
tests/test_resolve.py
Python
test_timestamps_and_deps
test_timestamps_and_deps
484
526
484
488
3a22865c2672ac0395ba35be61b019382671dcab
bigcode/the-stack
train
55221b44159a9d8e4de3ca8f
train
function
def test_arch_preferred_over_noarch_when_otherwise_equal(): index = ( PackageRecord(**{ "build": "py36_0", "build_number": 0, "date": "2016-12-17", "license": "BSD", "md5": "9b4568068e3a7ac81be87902827d949e", "name": "itsdangerous", ...
def test_arch_preferred_over_noarch_when_otherwise_equal():
index = ( PackageRecord(**{ "build": "py36_0", "build_number": 0, "date": "2016-12-17", "license": "BSD", "md5": "9b4568068e3a7ac81be87902827d949e", "name": "itsdangerous", "size": 19688, "version": "0.24" ...
Dict((prec, prec) for prec in index)) install = r.install(['top']) for d in install: if d.name == 'top': assert d.version == '2.0', "top version should be 2.0, but is {}".format(d.version) elif d.name == 'bottom': assert d.version == '2.5', "bottom version should be 2.5,...
108
108
361
13
95
twinssbc/conda
tests/test_resolve.py
Python
test_arch_preferred_over_noarch_when_otherwise_equal
test_arch_preferred_over_noarch_when_otherwise_equal
1,986
2,025
1,986
1,986
b1b828515b49e0192f2a86c71089dbc521fb961d
bigcode/the-stack
train
f1c1fc3a2931eb57e1b52567
train
function
def test_pseudo_boolean(): # The latest version of iopro, 1.5.0, was not built against numpy 1.5 installed = r.install(['iopro', 'python 2.7*', 'numpy 1.5*'], returnall=True) installed = [rec.dist_str() for rec in installed] assert installed == [ 'channel-1::iopro-1.4.3-np15py27_p0', 'ch...
def test_pseudo_boolean(): # The latest version of iopro, 1.5.0, was not built against numpy 1.5
installed = r.install(['iopro', 'python 2.7*', 'numpy 1.5*'], returnall=True) installed = [rec.dist_str() for rec in installed] assert installed == [ 'channel-1::iopro-1.4.3-np15py27_p0', 'channel-1::numpy-1.5.1-py27_4', 'channel-1::openssl-1.0.1c-0', 'channel-1::python-2.7.5...
scipy-0.12.0-np17py27_p0' in dist_strs def test_anaconda_nomkl(self): precs = r.install(['anaconda 1.5.0', 'python 2.7*', 'numpy 1.7*']) assert len(precs) == 107 dist_strs = [prec.dist_str() for prec in precs] assert 'channel-1::scipy-0.12.0-np17py27_0' in dist_strs def test_pseudo_...
148
148
496
32
115
twinssbc/conda
tests/test_resolve.py
Python
test_pseudo_boolean
test_pseudo_boolean
122
153
122
123
625a0b187b129345b2e1dcd3729c01e85447b734
bigcode/the-stack
train
b488b8b9275fbafd8c331945
train
function
def test_dependency_sort(): specs = ['pandas','python 2.7*','numpy 1.6*'] installed = r.install(specs) must_have = {prec.name: prec for prec in installed} installed = r.dependency_sort(must_have) results_should_be = [ 'channel-1::openssl-1.0.1c-0', 'channel-1::readline-6.2-0', ...
def test_dependency_sort():
specs = ['pandas','python 2.7*','numpy 1.6*'] installed = r.install(specs) must_have = {prec.name: prec for prec in installed} installed = r.dependency_sort(must_have) results_should_be = [ 'channel-1::openssl-1.0.1c-0', 'channel-1::readline-6.2-0', 'channel-1::sqlite-3.7.13...
.0-ha6073c6_4', 'channel-4::six-1.11.0-py27_1', 'channel-4::sqlite-3.24.0-h84994c4_0', 'channel-4::tk-8.6.7-hc745277_3', 'channel-4::zlib-1.2.11-ha838bed_2', } def test_dependency_sort():
97
97
326
5
92
twinssbc/conda
tests/test_resolve.py
Python
test_dependency_sort
test_dependency_sort
1,726
1,748
1,726
1,726
652ca59b0cfe9fd5a730fe7d3ebfbb38f131edf4
bigcode/the-stack
train
db745a0a3894627bb416eea9
train
function
def test_unintentional_feature_downgrade(): # See https://github.com/conda/conda/issues/6765 # With the bug in place, this bad build of scipy # will be selected for install instead of a later # build of scipy 0.11.0. good_rec_match = MatchSpec("channel-1::scipy==0.11.0=np17py33_3") good_rec = ne...
def test_unintentional_feature_downgrade(): # See https://github.com/conda/conda/issues/6765 # With the bug in place, this bad build of scipy # will be selected for install instead of a later # build of scipy 0.11.0.
good_rec_match = MatchSpec("channel-1::scipy==0.11.0=np17py33_3") good_rec = next(prec for prec in itervalues(index) if good_rec_match.match(prec)) bad_deps = tuple(d for d in good_rec.depends if not d.startswith('numpy')) bad_rec = PackageRecord.from_objects(good_rec, ...
r.install(['mypackage','feature 1.0']) def test_unintentional_feature_downgrade(): # See https://github.com/conda/conda/issues/6765 # With the bug in place, this bad build of scipy # will be selected for install instead of a later # build of scipy 0.11.0.
79
80
268
67
12
twinssbc/conda
tests/test_resolve.py
Python
test_unintentional_feature_downgrade
test_unintentional_feature_downgrade
815
834
815
819
0e76af1e8a00903515c26ec114c403b7b54628ed
bigcode/the-stack
train
9e9b56f2212f8fa7c3ab202e
train
function
def test_noarch_preferred_over_arch_when_build_greater_dep(): index = ( PackageRecord(**{ 'name': 'abc', 'version': '1.0', 'build': '1', "subdir": "noarch", 'build_number': 1, }), PackageRecord(**{ 'name': 'abc', ...
def test_noarch_preferred_over_arch_when_build_greater_dep():
index = ( PackageRecord(**{ 'name': 'abc', 'version': '1.0', 'build': '1', "subdir": "noarch", 'build_number': 1, }), PackageRecord(**{ 'name': 'abc', 'version': '1.0', 'build': '0', "...
Dict((prec, prec) for prec in index)) install = r.install(['foo']) for d in install: if d.name == 'abc': assert d.subdir == 'noarch' assert d.version == '2.0' def test_noarch_preferred_over_arch_when_build_greater_dep():
67
67
226
14
53
twinssbc/conda
tests/test_resolve.py
Python
test_noarch_preferred_over_arch_when_build_greater_dep
test_noarch_preferred_over_arch_when_build_greater_dep
2,160
2,190
2,160
2,160
9feef47557a1f701e9930d0deb70e40a8680e252
bigcode/the-stack
train
de672c30492374ebf16b6e2e
train
function
def test_unsat_from_r1(): # scipy 0.12.0b1 is not built for numpy 1.5, only 1.6 and 1.7 with pytest.raises(UnsatisfiableError) as excinfo: r.install(['numpy 1.5*', 'scipy 0.12.0b1']) assert "numpy=1.5" in str(excinfo.value) assert "scipy==0.12.0b1 -> numpy=1.7" in str(excinfo.value) # numpy ...
def test_unsat_from_r1(): # scipy 0.12.0b1 is not built for numpy 1.5, only 1.6 and 1.7
with pytest.raises(UnsatisfiableError) as excinfo: r.install(['numpy 1.5*', 'scipy 0.12.0b1']) assert "numpy=1.5" in str(excinfo.value) assert "scipy==0.12.0b1 -> numpy=1.7" in str(excinfo.value) # numpy 1.5 does not have a python 3 package with pytest.raises(UnsatisfiableError) as excinfo: ...
channel-1::zeromq-2.2.0-0': 1 } # No timestamps in the current data set assert eqt == {} def test_unsat_from_r1(): # scipy 0.12.0b1 is not built for numpy 1.5, only 1.6 and 1.7
77
78
262
40
37
twinssbc/conda
tests/test_resolve.py
Python
test_unsat_from_r1
test_unsat_from_r1
309
323
309
310
eea16a0fbc52ecff892ed2f31aa107abf9290f07
bigcode/the-stack
train
15ef44aa702a66ee28c6e2df
train
function
def simple_rec(name='a', version='1.0', depends=None, build='0', build_number=0, channel='channel-1'): if depends is None: depends = [] return PackageRecord(**{ 'name': name, 'version': version, 'depends': depends, 'build': build, 'build_number': bu...
def simple_rec(name='a', version='1.0', depends=None, build='0', build_number=0, channel='channel-1'):
if depends is None: depends = [] return PackageRecord(**{ 'name': name, 'version': version, 'depends': depends, 'build': build, 'build_number': build_number, 'channel': channel, })
*']) assert "numpy=1.5" in str(excinfo.value) assert "numpy=1.6" in str(excinfo.value) def simple_rec(name='a', version='1.0', depends=None, build='0', build_number=0, channel='channel-1'):
64
64
88
32
32
twinssbc/conda
tests/test_resolve.py
Python
simple_rec
simple_rec
326
337
326
327
c086652bc4eed5c802af67717d7f0e8847da8101
bigcode/the-stack
train
4ee5e33e580e5ca1a789a548
train
function
def test_unsat_missing_dep(): # an install target has a missing dependency index = ( simple_rec(name='a', depends=['b', 'c']), simple_rec(name='b', depends=['c >=2,<3']), simple_rec(name='c', version='1.0'), ) r = Resolve(OrderedDict((prec, prec) for prec in index)) # this ra...
def test_unsat_missing_dep(): # an install target has a missing dependency
index = ( simple_rec(name='a', depends=['b', 'c']), simple_rec(name='b', depends=['c >=2,<3']), simple_rec(name='c', version='1.0'), ) r = Resolve(OrderedDict((prec, prec) for prec in index)) # this raises ResolvePackageNotFound not UnsatisfiableError assert raises(ResolvePac...
r.install(['a']) assert "b -> d[version='>=1,<2']" in str(excinfo.value) assert "c -> d[version='>=2,<3']" in str(excinfo.value) def test_unsat_missing_dep(): # an install target has a missing dependency
64
64
115
17
47
twinssbc/conda
tests/test_resolve.py
Python
test_unsat_missing_dep
test_unsat_missing_dep
432
441
432
433
81ce90e9fbb609d5c1e6746a74152309b97c0a95
bigcode/the-stack
train
7d82a15c392e2dbd778b24aa
train
function
def test_remove(): installed = r.install(['pandas', 'python 2.7*']) _installed = [rec.dist_str() for rec in installed] assert _installed == [ 'channel-1::dateutil-2.1-py27_1', 'channel-1::numpy-1.7.1-py27_0', 'channel-1::openssl-1.0.1c-0', 'channel-1::pandas-0.11.0-np17py27_1...
def test_remove():
installed = r.install(['pandas', 'python 2.7*']) _installed = [rec.dist_str() for rec in installed] assert _installed == [ 'channel-1::dateutil-2.1-py27_1', 'channel-1::numpy-1.7.1-py27_0', 'channel-1::openssl-1.0.1c-0', 'channel-1::pandas-0.11.0-np17py27_1', 'channel...
_matcher.match(prec)) installed3 = list(installed) installed3[1] = numpy_prec installed3[3] = pandas_prec_1 installed4 = r.remove(['pandas'], installed3) assert r.bad_installed(installed4, [])[0] is None # Tests removed involving packages not in the index, because we # always insure install...
216
216
720
4
211
twinssbc/conda
tests/test_resolve.py
Python
test_remove
test_remove
1,146
1,196
1,146
1,146
987c1ba96ae61d0c83cf3c703a08ba6423d4248c
bigcode/the-stack
train
9699be43f0681a05ffa69fb3
train
function
def test_circular_dependencies(): index2 = index.copy() package1 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", "fn": "doesnt-matter-here", 'build': '0', 'build_number': 0, 'depends': ['package2'], 'name':...
def test_circular_dependencies():
index2 = index.copy() package1 = PackageRecord(**{ "channel": "defaults", "subdir": context.subdir, "md5": "0123456789", "fn": "doesnt-matter-here", 'build': '0', 'build_number': 0, 'depends': ['package2'], 'name': 'package1', 'requires': [...
_objects(good_rec, build=good_rec.build.replace('_3','_x0'), build_number=0, depends=bad_deps, fn=good_rec.fn.replace('_3','_x0'), url=good_rec.url.replace(...
127
127
426
6
121
twinssbc/conda
tests/test_resolve.py
Python
test_circular_dependencies
test_circular_dependencies
837
881
837
837
1251cfe1d794556d411ece97477a420a4c0905b2
bigcode/the-stack
train
862fb004e8f2bbe4698a6907
train
function
def test_get_reduced_index_broadening_with_unsatisfiable_early_dep(): # Test that spec broadening reduction doesn't kill valid solutions # In other words, the order of packages in the index should not affect the # overall result of the reduced index. # see discussion at https://github.com/conda/co...
def test_get_reduced_index_broadening_with_unsatisfiable_early_dep(): # Test that spec broadening reduction doesn't kill valid solutions # In other words, the order of packages in the index should not affect the # overall result of the reduced index. # see discussion at https://github.com/conda/co...
index = ( PackageRecord(**{ 'name': 'a', 'version': '1.0', 'build': '0', 'build_number': 0, # not satisfiable. This record should come first, so that its c==2 # constraint tries to mess up the inclusion of the c record below, ...
) for prec in index)) install = r.install(['package2', 'feature']) assert 'package1' not in set(d.name for d in install) def test_get_reduced_index_broadening_with_unsatisfiable_early_dep(): # Test that spec broadening reduction doesn't kill valid solutions # In other words, the order of packages in ...
120
120
400
86
34
twinssbc/conda
tests/test_resolve.py
Python
test_get_reduced_index_broadening_with_unsatisfiable_early_dep
test_get_reduced_index_broadening_with_unsatisfiable_early_dep
1,884
1,928
1,884
1,888
19ab6de3bd7f702c498e8b4daee311a97d1cc492
bigcode/the-stack
train
30785c055df278693c7d43ff
train
function
def test_pip_depends_removed_on_inconsistent_env(): installed = r.install(['python 2.7*']) pkg_names = [p.name for p in installed] assert 'python' in pkg_names assert 'pip' not in pkg_names # add pip as python dependency for pkg in installed: if pkg.name == 'python': pkg.depe...
def test_pip_depends_removed_on_inconsistent_env():
installed = r.install(['python 2.7*']) pkg_names = [p.name for p in installed] assert 'python' in pkg_names assert 'pip' not in pkg_names # add pip as python dependency for pkg in installed: if pkg.name == 'python': pkg.depends += ('pip', ) assert pkg.name != 'pip' ...
.remove(['pandas'], installed3) assert r.bad_installed(installed4, [])[0] is None # Tests removed involving packages not in the index, because we # always insure installed packages _are_ in the index def test_pip_depends_removed_on_inconsistent_env():
64
64
119
12
51
twinssbc/conda
tests/test_resolve.py
Python
test_pip_depends_removed_on_inconsistent_env
test_pip_depends_removed_on_inconsistent_env
1,132
1,143
1,132
1,132
1f654a594d7406d78ecdb8d0d63ccf694958d740
bigcode/the-stack
train
228ea62cb94e526430ee44ac
train
function
def test_channel_priority_1(): channels = ( Channel("channel-A"), Channel("channel-1"), Channel("channel-B"), ) index2 = index.copy() pandas_matcher_1 = MatchSpec('channel-1::pandas==0.11.0=np17py27_1') pandas_prec_1 = next(prec for prec in index2 if pandas_matcher_1.match(p...
def test_channel_priority_1():
channels = ( Channel("channel-A"), Channel("channel-1"), Channel("channel-B"), ) index2 = index.copy() pandas_matcher_1 = MatchSpec('channel-1::pandas==0.11.0=np17py27_1') pandas_prec_1 = next(prec for prec in index2 if pandas_matcher_1.match(prec)) record_0 = pandas_pre...
openssl-1.0.1c-0', 'channel-1::python-2.7.5-0', 'channel-1::pytz-2013b-py27_0', 'channel-1::readline-6.2-0', 'channel-1::six-1.3.0-py27_0', 'channel-1::sqlite-3.7.13-0', 'channel-1::system-5.8-1', 'channel-1::tk-8.5.13-0', 'channel-1::zlib-1.2.7-0', ] ...
152
153
511
7
145
twinssbc/conda
tests/test_resolve.py
Python
test_channel_priority_1
test_channel_priority_1
1,199
1,248
1,199
1,199
bc0b9fb8038979a95e9d0c3f0259d0f3e829b60f
bigcode/the-stack
train
71cf642153659412b5e8b116
train
function
def test_unsat_channel_priority(): # b depends on c 2.x which is only available in channel-2 index = ( simple_rec(name='a', version='1.0', depends=['c'], channel='channel-1'), simple_rec(name='b', version='1.0', depends=['c >=2,<3'], channel='channel-1'), simple_rec(name='c', version='1....
def test_unsat_channel_priority(): # b depends on c 2.x which is only available in channel-2
index = ( simple_rec(name='a', version='1.0', depends=['c'], channel='channel-1'), simple_rec(name='b', version='1.0', depends=['c >=2,<3'], channel='channel-1'), simple_rec(name='c', version='1.0', channel='channel-1'), simple_rec(name='a', version='2.0', depends=['c'], channel='ch...
[version='>=2,<3']" in str(excinfo.value) def test_unsat_missing_dep(): # an install target has a missing dependency index = ( simple_rec(name='a', depends=['b', 'c']), simple_rec(name='b', depends=['c >=2,<3']), simple_rec(name='c', version='1.0'), ) r = Resolve(OrderedDict((p...
155
156
523
25
130
twinssbc/conda
tests/test_resolve.py
Python
test_unsat_channel_priority
test_unsat_channel_priority
444
474
444
445
2cea54efe745dddaceb6bb65db85d87b9002d056
bigcode/the-stack
train
510195d6bc39fb4290e6620d
train
function
def test_no_features(): # Without this, there would be another solution including 'scipy-0.11.0-np16py26_p3.tar.bz2'. result = r.install(['python 2.6*', 'numpy 1.6*', 'scipy 0.11*'], returnall=True) result = [rec.dist_str() for rec in result] assert result == [ 'channel-1::numpy-1.6.2-py26_4', ...
def test_no_features(): # Without this, there would be another solution including 'scipy-0.11.0-np16py26_p3.tar.bz2'.
result = r.install(['python 2.6*', 'numpy 1.6*', 'scipy 0.11*'], returnall=True) result = [rec.dist_str() for rec in result] assert result == [ 'channel-1::numpy-1.6.2-py26_4', 'channel-1::openssl-1.0.1c-0', 'channel-1::python-2.6.8-6', 'channel-1::readline-6.2-0', 'c...
package1', 'package2 <2.0'])) assert raises(UnsatisfiableError, lambda: r.install(['package1', 'package2 1.0'])) def test_irrational_version(): result = r.install(['pytz 2012d', 'python 3*'], returnall=True) result = [rec.dist_str() for rec in result] assert result == [ 'channel-1::openssl-1.0...
255
256
1,469
37
218
twinssbc/conda
tests/test_resolve.py
Python
test_no_features
test_no_features
964
1,080
964
965
4ce38e5ccfffd0cbc846849a3f567ea5d0af354f
bigcode/the-stack
train
b73bc3f662d73c06304344ba
train
function
def test_nonexistent(): assert not r.find_matches(MatchSpec('notarealpackage 2.0*')) assert raises(ResolvePackageNotFound, lambda: r.install(['notarealpackage 2.0*'])) # This exact version of NumPy does not exist assert raises(ResolvePackageNotFound, lambda: r.install(['numpy 1.5']))
def test_nonexistent():
assert not r.find_matches(MatchSpec('notarealpackage 2.0*')) assert raises(ResolvePackageNotFound, lambda: r.install(['notarealpackage 2.0*'])) # This exact version of NumPy does not exist assert raises(ResolvePackageNotFound, lambda: r.install(['numpy 1.5']))
STRICT", stack_callback=conda_tests_ctxt_mgmt_def_pol): with pytest.raises(UnsatisfiableError) as excinfo: r.install(['a', 'b']) assert "b -> c[version='>=2,<3']" in str(excinfo.value) def test_nonexistent():
64
64
81
5
59
twinssbc/conda
tests/test_resolve.py
Python
test_nonexistent
test_nonexistent
477
481
477
477
9144ee5a4818f531d7453c15c268107ce9a31228
bigcode/the-stack
train
ea7c4a85e8d649a26cdc4662
train
class
class StimulusDrivenSimulator(Simulator): ''' Stimulus-driven ODE simulator. ''' def __init__(self, *args, stim=None, **kwargs): ''' Initialization. :param stim: stimulus object ''' super().__init__(*args, **kwargs) self.stim = stim self.stim.update(0.) ...
class StimulusDrivenSimulator(Simulator):
''' Stimulus-driven ODE simulator. ''' def __init__(self, *args, stim=None, **kwargs): ''' Initialization. :param stim: stimulus object ''' super().__init__(*args, **kwargs) self.stim = stim self.stim.update(0.) def fire_event(self, xevent): '''...
param tstop: stopping time (ms) ''' # Initialize system self.initialize(y0, **kwargs) # Integrate until tstop self.integrate_until(tstop, remove_first=True) @property def solution(self): ''' Return solution as a pandas dataframe. :return: timeseries...
186
186
621
8
177
tjjlemaire/IntroNE
simulators.py
Python
StimulusDrivenSimulator
StimulusDrivenSimulator
143
221
143
143
51945667e109c5624558f6a679afcf6907a4608f
bigcode/the-stack
train
fd0138c65a3c113035384a96
train
class
class Simulator: ''' Generic interface to ODE simulator object. ''' def __init__(self, ykeys, dfunc, dt=None): ''' Initialization. :param ykeys: list of differential variables names :param dfunc: derivative function :param dt: integration time step (ms) ''' ...
class Simulator:
''' Generic interface to ODE simulator object. ''' def __init__(self, ykeys, dfunc, dt=None): ''' Initialization. :param ykeys: list of differential variables names :param dfunc: derivative function :param dt: integration time step (ms) ''' self.ykey...
# -*- coding: utf-8 -*- # @Author: Theo Lemaire # @Date: 2022-01-31 10:46:44 # @Last Modified by: Theo Lemaire # @Last Modified time: 2022-02-11 14:26:44 import numpy as np from scipy.integrate import odeint, solve_ivp from tqdm import tqdm from logger import * from constants import * from solution import Solutio...
106
256
1,125
3
102
tjjlemaire/IntroNE
simulators.py
Python
Simulator
Simulator
16
140
16
16
9314fb4ef97926b9ab7ac3464c5f47c7549c01d8
bigcode/the-stack
train
baa9a2e717bffe46e37a5368
train
function
def URLify(string): # compute length of new string based on # of spaces in input string new_len = 0 reader = len(string) - 1 # index at end of un-extended string for char in string: if char == ' ': new_len += 3 else: new_len += 1 # extend length of string to ...
def URLify(string): # compute length of new string based on # of spaces in input string
new_len = 0 reader = len(string) - 1 # index at end of un-extended string for char in string: if char == ' ': new_len += 3 else: new_len += 1 # extend length of string to fit URL string += [' '] * (new_len - len(string)) writer = len(string) - 1 # index ...
the string. Space complexity: O(N) even though we minimized space use, the input could still be all spaces which would force us to extend the input string by 2*N characters. """ # in Python, strings are immutable, thus we are forced to implement with lists of single characters def URLify(string): # compute lengt...
81
81
271
21
59
isayapin/cracking-the-coding-interview
python_solutions/chapter_01_arrays_and_strings/problem_01_03_URLify.py
Python
URLify
URLify
32
55
32
33
4b32661c63e65d32035a1b94a032d61cdf3dcbb7
bigcode/the-stack
train
b86060297ae7639bba0d0467
train
class
class SquadExample(): """extract column contents from raw data""" def __init__(self, qas_id, question_text, doc_tokens, orig_answer_text=None, start_position=None, end_position=None, is_imposs...
class SquadExample():
"""extract column contents from raw data""" def __init__(self, qas_id, question_text, doc_tokens, orig_answer_text=None, start_position=None, end_position=None, is_impossible=False): s...
an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ """create squad data""" import collections...
64
64
117
4
59
mindspore-ai/models
research/nlp/albert/src/create_squad_data.py
Python
SquadExample
SquadExample
23
40
23
23
f2ddb7b12f276a7cbdafd8868b9edfc10c5cd6e6
bigcode/the-stack
train
364cee03bd0fba32dcd18892
train
function
def _check_is_max_context(doc_spans, cur_span_index, position): """Check if this is the 'max context' doc span for the token.""" best_score = None best_span_index = None for (span_index, doc_span) in enumerate(doc_spans): end = doc_span.start + doc_span.length - 1 if position < doc_span....
def _check_is_max_context(doc_spans, cur_span_index, position):
"""Check if this is the 'max context' doc span for the token.""" best_score = None best_span_index = None for (span_index, doc_span) in enumerate(doc_spans): end = doc_span.start + doc_span.length - 1 if position < doc_span.start: continue if position > end: ...
qas"]: one_example = process_one_example(qa, is_training, version_2_with_negative, doc_tokens, char_to_word_offset) if one_example is not None: examples.append(one_example) return examples def _check_is_max_context...
64
64
173
16
47
mindspore-ai/models
research/nlp/albert/src/create_squad_data.py
Python
_check_is_max_context
_check_is_max_context
145
161
145
145
6a6f4c04bab235c5ebbcdaf7d82a49857a4804ee
bigcode/the-stack
train
b4de3a3e0c749310010575b7
train
function
def convert_examples_to_features(examples, tokenizer, max_seq_length, doc_stride, max_query_length, is_training, output_fn, vocab_file): """Loads a data file into a list of `InputBatch`s.""" unique_id = 1000000000 output = [] for (example_index, example) in enumerate(exa...
def convert_examples_to_features(examples, tokenizer, max_seq_length, doc_stride, max_query_length, is_training, output_fn, vocab_file):
"""Loads a data file into a list of `InputBatch`s.""" unique_id = 1000000000 output = [] for (example_index, example) in enumerate(examples): query_tokens = tokenizer.tokenize(example.question_text) if len(query_tokens) > max_query_length: query_tokens = query_tokens[0:max_q...
< doc_span.start: continue if position > end: continue num_left_context = position - doc_span.start num_right_context = end - position score = min(num_left_context, num_right_context) + 0.01 * doc_span.length if best_score is None or score > best_score: ...
256
256
1,161
31
225
mindspore-ai/models
research/nlp/albert/src/create_squad_data.py
Python
convert_examples_to_features
convert_examples_to_features
178
311
178
179
310c82a592fd112be4573c57150f1e80f612eb8d
bigcode/the-stack
train
1305a64fa6cfe0e5c63758ed
train
function
def read_squad_examples(input_file, is_training, version_2_with_negative=False): """Return list of SquadExample from input_data or input_file (SQuAD json file)""" with open(input_file, "r") as reader: input_data = json.load(reader)["data"] def is_whitespace(c): if c == " " or c == "\t" or c...
def read_squad_examples(input_file, is_training, version_2_with_negative=False):
"""Return list of SquadExample from input_data or input_file (SQuAD json file)""" with open(input_file, "r") as reader: input_data = json.load(reader)["data"] def is_whitespace(c): if c == " " or c == "\t" or c == "\r" or c == "\n" or ord(c) == 0x202F: return True return...
of data.""" def __init__(self, unique_id, example_index, doc_span_index, tokens, token_to_orig_map, token_is_max_context, input_ids, input_mask, segment_ids, ...
190
190
635
18
171
mindspore-ai/models
research/nlp/albert/src/create_squad_data.py
Python
read_squad_examples
read_squad_examples
73
142
73
73
58744a71c6174ed134833c48f4c7d8ba77391e05
bigcode/the-stack
train
c9797c7aff26fd1d5bb9a433
train
class
class InputFeatures(): """A single set of features of data.""" def __init__(self, unique_id, example_index, doc_span_index, tokens, token_to_orig_map, token_is_max_context, input_ids, ...
class InputFeatures():
"""A single set of features of data.""" def __init__(self, unique_id, example_index, doc_span_index, tokens, token_to_orig_map, token_is_max_context, input_ids, input_mask, ...
.qas_id = qas_id self.question_text = question_text self.doc_tokens = doc_tokens self.orig_answer_text = orig_answer_text self.start_position = start_position self.end_position = end_position self.is_impossible = is_impossible class InputFeatures():
64
64
183
4
59
mindspore-ai/models
research/nlp/albert/src/create_squad_data.py
Python
InputFeatures
InputFeatures
43
70
43
43
fd5cb37314fab851fec9a189726f32f2608c2bdf
bigcode/the-stack
train
749350dc345fc67687c03bdd
train
function
def _improve_answer_span(doc_tokens, input_start, input_end, tokenizer, orig_answer_text): """Returns tokenized answer spans that better match the annotated answer.""" tok_answer_text = " ".join(tokenizer.tokenize(orig_answer_text)) for new_start in range(input_start, input_end + 1...
def _improve_answer_span(doc_tokens, input_start, input_end, tokenizer, orig_answer_text):
"""Returns tokenized answer spans that better match the annotated answer.""" tok_answer_text = " ".join(tokenizer.tokenize(orig_answer_text)) for new_start in range(input_start, input_end + 1): for new_end in range(input_end, new_start - 1, -1): text_span = " ".join(doc_tokens[new_start...
01 * doc_span.length if best_score is None or score > best_score: best_score = score best_span_index = span_index return cur_span_index == best_span_index def _improve_answer_span(doc_tokens, input_start, input_end, tokenizer, orig_answer_text):
64
64
130
22
41
mindspore-ai/models
research/nlp/albert/src/create_squad_data.py
Python
_improve_answer_span
_improve_answer_span
164
175
164
165
81fe5869ccdfee96a52ab5a270e6cf106b27942e
bigcode/the-stack
train
c95ddbb86fd667a78916002f
train
function
def create_site(apps, schema_editor): Site = apps.get_model("sites", "Site") custom_domain = "writemysong-31931.botics.co" site_params = { "name": "WriteMySong", } if custom_domain: site_params["domain"] = custom_domain Site.objects.update_or_create(defaults=site_params, id=1)
def create_site(apps, schema_editor):
Site = apps.get_model("sites", "Site") custom_domain = "writemysong-31931.botics.co" site_params = { "name": "WriteMySong", } if custom_domain: site_params["domain"] = custom_domain Site.objects.update_or_create(defaults=site_params, id=1)
from django.db import migrations def create_site(apps, schema_editor):
15
64
85
9
5
crowdbotics-apps/writemysong-31931
backend/home/migrations/0001_load_initial_data.py
Python
create_site
create_site
4
14
4
4
75dc2bdf59ff56d388f6291f9f41eadad9bf7e8a
bigcode/the-stack
train
fff4c73d97d913d05cd3cf65
train
class
class Migration(migrations.Migration): dependencies = [ ("sites", "0002_alter_domain_unique"), ] operations = [ migrations.RunPython(create_site), ]
class Migration(migrations.Migration):
dependencies = [ ("sites", "0002_alter_domain_unique"), ] operations = [ migrations.RunPython(create_site), ]
emysong-31931.botics.co" site_params = { "name": "WriteMySong", } if custom_domain: site_params["domain"] = custom_domain Site.objects.update_or_create(defaults=site_params, id=1) class Migration(migrations.Migration):
64
64
38
7
57
crowdbotics-apps/writemysong-31931
backend/home/migrations/0001_load_initial_data.py
Python
Migration
Migration
17
25
17
18
a00e759b1f365f6ee5c2b777b5b85c800f49887b
bigcode/the-stack
train
ce2e60111fed5caea6fa8b2c
train
class
class Migration(migrations.Migration): dependencies = [ ('logtailer', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='logfile', options={'verbose_name': 'Log file', 'verbose_name_plural': 'Log files'}, ), migrations.AlterModelOp...
class Migration(migrations.Migration):
dependencies = [ ('logtailer', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='logfile', options={'verbose_name': 'Log file', 'verbose_name_plural': 'Log files'}, ), migrations.AlterModelOptions( name='logsclipboard',...
# Generated by Django 2.2.1 on 2020-01-09 15:36 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
45
64
145
7
37
thaeny-dev/django-logtailer
logtailer/migrations/0002_auto_20200109_1636.py
Python
Migration
Migration
7
27
7
8
cd67abe5859cbb02c072f5a3858f783b46275975
bigcode/the-stack
train
19be12ecceee126e7cd2ec2d
train
class
class MultiWalletTest(GlobalBitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 2 self.supports_cli = True def skip_test_if_missing_module(self): self.skip_if_no_wallet() def run_test(self): node = self.nodes[0] ...
class MultiWalletTest(GlobalBitcoinTestFramework):
def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 2 self.supports_cli = True def skip_test_if_missing_module(self): self.skip_if_no_wallet() def run_test(self): node = self.nodes[0] data_dir = lambda *p: os.path.join(node.datadir, 'r...
#!/usr/bin/env python3 # Copyright (c) 2017-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test multiwallet. Verify that a globalbitcoind node can load multiple wallet files """ import os impor...
126
256
3,713
9
117
cibadmin/GLBTC
test/functional/wallet_multiwallet.py
Python
MultiWalletTest
MultiWalletTest
21
305
21
21
cdb6e2b0832415ba3731ee93052e4ce02344bce8
bigcode/the-stack
train
08abd76c134c3d416f88e406
train
class
class MultiDataModuleTestObject(MultiDataModule): def __init__(self, batch_size): self.batch_size = batch_size config = OmegaConf.create( { "use_features": True, "annotations": { "train": "not_a_real_annotations_dataset", ...
class MultiDataModuleTestObject(MultiDataModule):
def __init__(self, batch_size): self.batch_size = batch_size config = OmegaConf.create( { "use_features": True, "annotations": { "train": "not_a_real_annotations_dataset", "val": "not_a_real_annotations_dataset", ...
# Copyright (c) Facebook, Inc. and its affiliates. import functools import torch from mmf.datasets.mmf_dataset_builder import MMFDatasetBuilder from mmf.datasets.multi_datamodule import MultiDataModule from omegaconf import OmegaConf from tests.datasets.test_mmf_dataset_builder import SimpleMMFDataset class MultiDataM...
80
88
296
11
68
dk25021999/mmf
tests/datasets/test_multi_datamodule.py
Python
MultiDataModuleTestObject
MultiDataModuleTestObject
11
52
11
11
28d00d693b9a0a5c1b55aa1c8d84507d74294e0b
bigcode/the-stack
train
bc14537b2d8ce6b241746f1e
train
class
class SavePrepareMixin(RelationMixin, AliasMixin): """ Used to prepare models to be saved in database """ if TYPE_CHECKING: # pragma: nocover _choices_fields: Optional[Set] _skip_ellipsis: Callable __fields__: Dict[str, pydantic.fields.ModelField] @classmethod def prep...
class SavePrepareMixin(RelationMixin, AliasMixin):
""" Used to prepare models to be saved in database """ if TYPE_CHECKING: # pragma: nocover _choices_fields: Optional[Set] _skip_ellipsis: Callable __fields__: Dict[str, pydantic.fields.ModelField] @classmethod def prepare_model_to_save(cls, new_kwargs: dict) -> dict: ...
import uuid from typing import ( Any, Callable, Collection, Dict, List, Optional, Set, TYPE_CHECKING, cast, ) import pydantic import ormar # noqa: I100, I202 from ormar.exceptions import ModelPersistenceError from ormar.models.mixins import AliasMixin from ormar.models.mixins.rela...
122
256
2,503
11
110
collerek/ormar
ormar/models/mixins/save_mixin.py
Python
SavePrepareMixin
SavePrepareMixin
25
334
25
25
9946ec18e1a167fd229afe87129768bbbfa20eec
bigcode/the-stack
train
b53280059c59eea8aa2fce41
train
class
class ListNode: def __init__(self, x): self.val = x self.next = None
class ListNode:
def __init__(self, x): self.val = x self.next = None
尾节点并且一定是链表中的一个有效节点。 不要从你的函数中返回任何结果。 """ THINKING = """ 删除该节点之后,该节点的值为下一节点的值,该节点的下一节点为下下个节点 """ # Definition for singly-linked list. class ListNode:
64
64
25
4
60
reedwave/leetcode-cn
DeleteNodeInALinkedList.py
Python
ListNode
ListNode
37
40
37
37
b304fd0b516bc03440a350450e054ed063e946db
bigcode/the-stack
train