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
b249f5f34bed748685ad1ddd
train
function
def _get_fiedler_func(method): """Return a function that solves the Fiedler eigenvalue problem. """ match = _tracemin_method.match(method) if match: method = match.group(1) def find_fiedler(L, x, normalized, tol): q = 2 if method == 'pcg' else min(4, L.shape[0] - 1) ...
def _get_fiedler_func(method):
"""Return a function that solves the Fiedler eigenvalue problem. """ match = _tracemin_method.match(method) if match: method = match.group(1) def find_fiedler(L, x, normalized, tol): q = 2 if method == 'pcg' else min(4, L.shape[0] - 1) X = asmatrix(normal(size=(q,...
1. / D # Since TraceMIN is globally convergent, the relative residual can # be loose. X -= solver.solve(W, 0.1) else: # Compute X = L \ X / (X' * (L \ X)). L \ X can have an arbitrary # projection on the nullspace of L, which will be eliminated. ...
136
136
454
9
127
theaverageguy/networkx
networkx/linalg/algebraicconnectivity.py
Python
_get_fiedler_func
_get_fiedler_func
265
302
265
265
1329541649b9e6e6bd381caee2bd95520bb5b824
bigcode/the-stack
train
a935c767c2aa033d9c168d47
train
function
def setup_module(module): from nose import SkipTest try: import numpy import scipy.sparse except ImportError: raise SkipTest('SciPy not available.')
def setup_module(module):
from nose import SkipTest try: import numpy import scipy.sparse except ImportError: raise SkipTest('SciPy not available.')
iedler = find_fiedler(L, x, normalized, tol)[1] order.extend( u for x, c, u in sorted(zip(fiedler, range(size), component))) else: order.extend(component) return order # fixture for nose tests def setup_module(module):
64
64
40
5
58
theaverageguy/networkx
networkx/linalg/algebraicconnectivity.py
Python
setup_module
setup_module
549
555
549
549
41d824305b62eb60b08347ae1d09bce017dc81be
bigcode/the-stack
train
bb38ead2734fc3d17316d4f5
train
function
@not_implemented_for('directed') def algebraic_connectivity(G, weight='weight', normalized=False, tol=1e-8, method='tracemin'): """Return the algebraic connectivity of an undirected graph. The algebraic connectivity of a connected undirected graph is the second smallest eigenvalu...
@not_implemented_for('directed') def algebraic_connectivity(G, weight='weight', normalized=False, tol=1e-8, method='tracemin'):
"""Return the algebraic connectivity of an undirected graph. The algebraic connectivity of a connected undirected graph is the second smallest eigenvalue of its Laplacian matrix. Parameters ---------- G : NetworkX graph An undirected graph. weight : object, optional The da...
, return_eigenvectors=True) return sigma[1], X[:, 1] else: X = asarray(asmatrix(x).T) M = spdiags(1. / L.diagonal(), [0], n, n) Y = ones(n) if normalized: Y /= D.diagonal() ...
181
181
605
37
143
theaverageguy/networkx
networkx/linalg/algebraicconnectivity.py
Python
algebraic_connectivity
algebraic_connectivity
305
382
305
307
583c9f90abcfa3f3f3def28726e45f92d785f6b8
bigcode/the-stack
train
85bc22226048ae4e9d27d64a
train
function
@not_implemented_for('directed') def fiedler_vector(G, weight='weight', normalized=False, tol=1e-8, method='tracemin'): """Return the Fiedler vector of a connected undirected graph. The Fiedler vector of a connected undirected graph is the eigenvector corresponding to the second smallest...
@not_implemented_for('directed') def fiedler_vector(G, weight='weight', normalized=False, tol=1e-8, method='tracemin'):
"""Return the Fiedler vector of a connected undirected graph. The Fiedler vector of a connected undirected graph is the eigenvector corresponding to the second smallest eigenvalue of the Laplacian matrix of of the graph. Parameters ---------- G : NetworkX graph An undirected graph....
laplacian_matrix """ if len(G) < 2: raise nx.NetworkXError('graph has less than two nodes.') G = _preprocess_graph(G, weight) if not nx.is_connected(G): return 0. L = nx.laplacian_matrix(G) if L.shape[0] == 2: return 2. * L[0, 0] if not normalized else 2. find_f...
186
186
623
37
149
theaverageguy/networkx
networkx/linalg/algebraicconnectivity.py
Python
fiedler_vector
fiedler_vector
385
463
385
387
0f12bd9248eb82c20eb54f47a52bd0d7bd479384
bigcode/the-stack
train
aedaa1b956a107c294b0594c
train
function
def _rcm_estimate(G, nodelist): """Estimate the Fiedler vector using the reverse Cuthill-McKee ordering. """ G = G.subgraph(nodelist) order = reverse_cuthill_mckee_ordering(G) n = len(nodelist) index = dict(zip(nodelist, range(n))) x = ndarray(n, dtype=float) for i, u in enumerate(order)...
def _rcm_estimate(G, nodelist):
"""Estimate the Fiedler vector using the reverse Cuthill-McKee ordering. """ G = G.subgraph(nodelist) order = reverse_cuthill_mckee_ordering(G) n = len(nodelist) index = dict(zip(nodelist, range(n))) x = ndarray(n, dtype=float) for i, u in enumerate(order): x[index[u]] = i x ...
.edges() if u != v) H = nx.Graph() H.add_nodes_from(G) H.add_weighted_edges_from((u, v, e) for u, v, e in edges if e != 0) return H def _rcm_estimate(G, nodelist):
64
64
120
12
51
theaverageguy/networkx
networkx/linalg/algebraicconnectivity.py
Python
_rcm_estimate
_rcm_estimate
151
162
151
151
b9b5b5149ea1e4e3b6b3ed91895e401b99a3db70
bigcode/the-stack
train
4978639f92a36392fa8b7240
train
class
class _PCGSolver(object): """Preconditioned conjugate gradient method. """ def __init__(self, A, M): self._A = A self._M = M or (lambda x: x.copy()) def solve(self, B, tol): B = asarray(B) X = ndarray(B.shape, order='F') for j in range(B.shape[1]): X...
class _PCGSolver(object):
"""Preconditioned conjugate gradient method. """ def __init__(self, A, M): self._A = A self._M = M or (lambda x: x.copy()) def solve(self, B, tol): B = asarray(B) X = ndarray(B.shape, order='F') for j in range(B.shape[1]): X[:, j] = self._solve(B[:, ...
# Make sure the imports succeeded. # Use minimal replacements if BLAS is unavailable from SciPy. dasum = partial(norm, ord=1) ddot = dot def daxpy(x, y, a): y += a * x return y _tracemin_method = compile('^tracemin(?:_(.*))?$') class _PCGSolver(object):...
84
84
280
7
77
theaverageguy/networkx
networkx/linalg/algebraicconnectivity.py
Python
_PCGSolver
_PCGSolver
47
83
47
47
3cb8387c99bf69e45966fb7d94232f30c456998f
bigcode/the-stack
train
09007c6e96e43ff6840ddace
train
function
def _tracemin_fiedler(L, X, normalized, tol, method): """Compute the Fiedler vector of L using the TraceMIN-Fiedler algorithm. """ n = X.shape[0] if normalized: # Form the normalized Laplacian matrix and determine the eigenvector of # its nullspace. e = sqrt(L.diagonal()) ...
def _tracemin_fiedler(L, X, normalized, tol, method):
"""Compute the Fiedler vector of L using the TraceMIN-Fiedler algorithm. """ n = X.shape[0] if normalized: # Form the normalized Laplacian matrix and determine the eigenvector of # its nullspace. e = sqrt(L.diagonal()) D = spdiags(1. / e, [0], n, n, format='csr') ...
, abs(e.get(weight, 1.))) for u, v, e in G.edges(data=True) if u != v) else: edges = ((u, v, sum(abs(e.get(weight, 1.)) for e in G[u][v].values())) for u, v in G.edges() if u != v) H = nx.Graph() H.add_nodes_from(G) H.add_weighted_edges_from((u, v, e) for u, v, ...
256
256
1,019
18
237
theaverageguy/networkx
networkx/linalg/algebraicconnectivity.py
Python
_tracemin_fiedler
_tracemin_fiedler
165
262
165
165
39d2bb365c729e7101fc7ba733b0611f0e012d38
bigcode/the-stack
train
8283326d9aa12a8210bd5482
train
class
class DSU: def __init__(self, N): self.p = range(N) def find(self, x): if self.p[x] != x: self.p[x] = self.find(self.p[x]) return self.p[x] def union(self, x, y): xr = self.find(x) yr = self.find(y) self.p[xr] = yr
class DSU:
def __init__(self, N): self.p = range(N) def find(self, x): if self.p[x] != x: self.p[x] = self.find(self.p[x]) return self.p[x] def union(self, x, y): xr = self.find(x) yr = self.find(y) self.p[xr] = yr
2x2 grid is as follows: # # Note: # # 1 <= grid.length == grid[0].length <= 30 # grid[i][j] is either '/', '\', or ' '. # import unittest # 396ms 27.27% class DSU:
64
64
86
4
60
JulyKikuAkita/PythonPrac
cs15211/RegionsCutBySlashes.py
Python
DSU
DSU
75
87
75
75
681d90d52bbf2219e6c1e581e83adb3d0ca6d50e
bigcode/the-stack
train
7e74579d12e5fb82db99a90a
train
class
class TestMethods(unittest.TestCase): def test_Local(self): self.assertEqual(1, 1)
class TestMethods(unittest.TestCase):
def test_Local(self): self.assertEqual(1, 1)
2, (root+4) + 1) if c-1 >= 0: dsu.union(root + 1, (root-4) + 2) return sum(dsu.find(x) == x for x in xrange(4*N*N)) class TestMethods(unittest.TestCase):
64
64
23
7
57
JulyKikuAkita/PythonPrac
cs15211/RegionsCutBySlashes.py
Python
TestMethods
TestMethods
111
113
111
111
6b1fe9c6e828796aec1648920d3a13c200ac4ee9
bigcode/the-stack
train
46807104f12d0eda0664ff69
train
class
class Solution(object): def regionsBySlashes(self, grid): N = len(grid) dsu = DSU(4 * N * N) for r, row in enumerate(grid): for c, val in enumerate(row): root = 4 * (r*N + c) if val in '/ ': dsu.union(root + 0, root + 1) ...
class Solution(object):
def regionsBySlashes(self, grid): N = len(grid) dsu = DSU(4 * N * N) for r, row in enumerate(grid): for c, val in enumerate(row): root = 4 * (r*N + c) if val in '/ ': dsu.union(root + 0, root + 1) dsu.union(r...
, N): self.p = range(N) def find(self, x): if self.p[x] != x: self.p[x] = self.find(self.p[x]) return self.p[x] def union(self, x, y): xr = self.find(x) yr = self.find(y) self.p[xr] = yr class Solution(object):
80
80
268
4
75
JulyKikuAkita/PythonPrac
cs15211/RegionsCutBySlashes.py
Python
Solution
Solution
89
109
89
89
68fcc819d8ccbaba02aa50672dd918b858e1ddac
bigcode/the-stack
train
c08057ff2d176de9f79df975
train
function
def concatenate(samplesets, defaults=None): """Combine SampleSets. Args: samplesets (iterable[:obj:`.SampleSet`): An iterable of sample sets. defaults (dict, optional): Dictionary mapping data vector names to the corresponding default values. Returns: :obj:...
def concatenate(samplesets, defaults=None):
"""Combine SampleSets. Args: samplesets (iterable[:obj:`.SampleSet`): An iterable of sample sets. defaults (dict, optional): Dictionary mapping data vector names to the corresponding default values. Returns: :obj:`.SampleSet`: A sample set with the same var...
(arr) elif labels: # is not None and len > 0 arr = arr.reshape((0, len(labels))) else: arr = arr.reshape((0, 0)) # ok we're basically done, just need to check against the labels if labels is None: return arr, list(range(arr.shape[1])) elif len(labels) != arr...
116
116
388
8
107
sbconlon/Qallse_v2.0
my_virtualenv/lib/python3.7/site-packages/dimod-0.8.12-py3.7-linux-x86_64.egg/dimod/sampleset.py
Python
concatenate
concatenate
189
234
189
189
1c9afb23d40d6222a79484e3579192e1769eea93
bigcode/the-stack
train
e83c364c93b388e6ca11edf2
train
function
def _iter_records(samplesets, vartype, variables): # coerce each record into the correct vartype and variable-order for samples in samplesets: # coerce vartype if samples.vartype is not vartype: samples = samples.change_vartype(vartype, inplace=False) if samples.variables !...
def _iter_records(samplesets, vartype, variables): # coerce each record into the correct vartype and variable-order
for samples in samplesets: # coerce vartype if samples.vartype is not vartype: samples = samples.change_vartype(vartype, inplace=False) if samples.variables != variables: new_record = samples.record.copy() order = [samples.variables.index[v] for v in var...
changing. record = recfunctions.stack_arrays(records, defaults=defaults, asrecarray=True, usemask=False) return SampleSet(record, variables, {}, vartype) def _iter_records(samplesets, vartype, variables): # coerce each record into the correct vartype and variable-ord...
64
64
128
27
37
sbconlon/Qallse_v2.0
my_virtualenv/lib/python3.7/site-packages/dimod-0.8.12-py3.7-linux-x86_64.egg/dimod/sampleset.py
Python
_iter_records
_iter_records
237
252
237
238
e5aba8df7bcc6c14faae4bc3d881c9ae4360fdb5
bigcode/the-stack
train
27c4e23e255b100c5d3ca5e7
train
function
def as_samples(samples_like, dtype=None, copy=False, order='C'): """Convert a samples_like object to a NumPy array and list of labels. Args: samples_like (samples_like): A collection of raw samples. `samples_like` is an extension of NumPy's array_like_ structure. See examples be...
def as_samples(samples_like, dtype=None, copy=False, order='C'):
"""Convert a samples_like object to a NumPy array and list of labels. Args: samples_like (samples_like): A collection of raw samples. `samples_like` is an extension of NumPy's array_like_ structure. See examples below. dtype (data-type, optional): dtype for ...
. # 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 on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impl...
256
256
1,339
16
240
sbconlon/Qallse_v2.0
my_virtualenv/lib/python3.7/site-packages/dimod-0.8.12-py3.7-linux-x86_64.egg/dimod/sampleset.py
Python
as_samples
as_samples
44
186
44
44
3b6fd5777fe909e0492fa0d5ae2afc793c473dbf
bigcode/the-stack
train
01d1f47844b451cf179d8cd5
train
class
class SampleSet(abc.Iterable, abc.Sized): """Samples and any other data returned by dimod samplers. Args: record (:obj:`numpy.recarray`) A NumPy record array. Must have 'sample', 'energy' and 'num_occurrences' as fields. The 'sample' field should be a 2D NumPy array where each r...
class SampleSet(abc.Iterable, abc.Sized):
"""Samples and any other data returned by dimod samplers. Args: record (:obj:`numpy.recarray`) A NumPy record array. Must have 'sample', 'energy' and 'num_occurrences' as fields. The 'sample' field should be a 2D NumPy array where each row is a sample and each column...
dev note: I was able to get ~2x performance boost when trying to # implement the same functionality here by hand (I didn't know that # this function existed then). However I think it is better to use # numpy's function and rely on their testing etc. If however this becomes # a performance bottleneck in...
256
256
10,833
12
243
sbconlon/Qallse_v2.0
my_virtualenv/lib/python3.7/site-packages/dimod-0.8.12-py3.7-linux-x86_64.egg/dimod/sampleset.py
Python
SampleSet
SampleSet
255
1,452
255
255
a0f529b9a255faff9e46bc79fe26ceee33b11656
bigcode/the-stack
train
2543d47e5ed334b7db34d1e0
train
function
@task(clean, test, check_version, check_version_tag) def release(): """Check that tests pass, the version is correct, then build source, wheel distributions, upload to PyPI using twine.""" check_output(['python', 'setup.py', 'sdist', 'bdist_wheel']) check_output(['twine', 'upload', 'dist/*'])
@task(clean, test, check_version, check_version_tag) def release():
"""Check that tests pass, the version is correct, then build source, wheel distributions, upload to PyPI using twine.""" check_output(['python', 'setup.py', 'sdist', 'bdist_wheel']) check_output(['twine', 'upload', 'dist/*'])
(version {0})? [y/N]\n".format( setuppy_version)).lower() if choice[0] == 'y': print("Continuing") else: raise ValueError("Stopping.") @task(clean, test, check_version, check_version_tag) def release():
63
64
79
16
47
ryanpdwyer/sigutils
tasks.py
Python
release
release
187
192
187
188
8468fadaf2e17c87d1357d5716231b4711e07f9d
bigcode/the-stack
train
d000e221953e733e2a55f71e
train
function
@task def check_version(): """Raise an error if the version number is not PEP440 compatible""" packaging.version.Version(version()) print("Version okay.")
@task def check_version():
"""Raise an error if the version number is not PEP440 compatible""" packaging.version.Version(version()) print("Version okay.")
[cod]")) rm_rf('build', '__pycache__') rm_rf(*cwd.glob('*.egg')) @task def test(): """Test the package using python setup.py test""" check_output(['python', 'setup.py', 'test']) @task def check_version():
63
64
35
7
56
ryanpdwyer/sigutils
tasks.py
Python
check_version
check_version
161
165
161
162
cf86ad26685b2e4d7b3657c4eb749c25ebb71de9
bigcode/the-stack
train
00702ecdf75839e4922e10eb
train
function
def check_output(*args, **kwargs): """Subprocess check_output, but prints commands and output by default. Also allows printing of error message for helpful debugging. Use print_all=False to turn off all printing.""" print_all = kwargs.pop('print_all', None) if print_all is not None: print_i...
def check_output(*args, **kwargs):
"""Subprocess check_output, but prints commands and output by default. Also allows printing of error message for helpful debugging. Use print_all=False to turn off all printing.""" print_all = kwargs.pop('print_all', None) if print_all is not None: print_in = print_all print_out = p...
import shutil import platform import pathlib import packaging.version from six.moves import input from invoke import task # Use subprocess32 if available try: import subprocess32 as subprocess except: import subprocess as subprocess cwd = pathlib.Path('.') def check_output(*args, **kwargs):
64
64
204
9
54
ryanpdwyer/sigutils
tasks.py
Python
check_output
check_output
29
57
29
29
23e58f3e4de69562c015ca08535fde3f1961c220
bigcode/the-stack
train
0be0e41ccf95af154dd54679
train
function
@task def check_version_tag(): """Before releasing, check that the version matches the git tag""" git_describe_version = git_describe() setuppy_version = version() if setuppy_version == git_describe_version: print("Versions match.") elif 'dirty' in git_describe_version: raise ValueEr...
@task def check_version_tag():
"""Before releasing, check that the version matches the git tag""" git_describe_version = git_describe() setuppy_version = version() if setuppy_version == git_describe_version: print("Versions match.") elif 'dirty' in git_describe_version: raise ValueError("""Working directory has un...
using python setup.py test""" check_output(['python', 'setup.py', 'test']) @task def check_version(): """Raise an error if the version number is not PEP440 compatible""" packaging.version.Version(version()) print("Version okay.") @task def check_version_tag():
63
64
148
8
55
ryanpdwyer/sigutils
tasks.py
Python
check_version_tag
check_version_tag
168
184
168
169
3aec452d4dc7b2e187a89bcbc0011bbd54c333c2
bigcode/the-stack
train
49af3a277c1778d35dc8e21a
train
function
def find_git_cmd(windows): """Determine whether the git command is git or git.cmd on Windows. This changed in version 1.8.3""" git = 'git' if windows: try: check_output([git, '--version']) except subprocess.CalledProcessError: try: git = 'git.cmd'...
def find_git_cmd(windows):
"""Determine whether the git command is git or git.cmd on Windows. This changed in version 1.8.3""" git = 'git' if windows: try: check_output([git, '--version']) except subprocess.CalledProcessError: try: git = 'git.cmd' check_outp...
except subprocess.CalledProcessError as e: # Wrap in try/except so that check_output can print raise e if print_out: for line in out_lines: print(line) return out_lines windows = platform.system() == 'Windows' def find_git_cmd(windows):
64
64
118
7
57
ryanpdwyer/sigutils
tasks.py
Python
find_git_cmd
find_git_cmd
63
79
63
63
ce2b702d17ca7fd75c95fbe5939c9b914ab222b3
bigcode/the-stack
train
84b4bf325dba00a0180edcc0
train
function
def rm_rf(*args): """Recursively delete directories, if they exist""" for directory in args: try: shutil.rmtree(str(directory)) except OSError: pass
def rm_rf(*args):
"""Recursively delete directories, if they exist""" for directory in args: try: shutil.rmtree(str(directory)) except OSError: pass
, '--version']) except subprocess.CalledProcessError: msg = "git does not appear to be on your path." raise subprocess.CalledProcessError(msg) return git git = find_git_cmd(windows) # Helper functions for unix-like removing folders and files. def rm_rf(*args):
64
64
41
6
58
ryanpdwyer/sigutils
tasks.py
Python
rm_rf
rm_rf
85
91
85
85
7f3d9f220d50ec092bcafc9d161aabbe62aa2feb
bigcode/the-stack
train
cbd8abe232f7a1b6d8f865ff
train
function
def version(): result = check_output(['python', 'setup.py', '--version']) return result[0]
def version():
result = check_output(['python', 'setup.py', '--version']) return result[0]
for path in args: try: os.remove(str(args)) except OSError: pass # Helper functions for getting version numbers def git_describe(): result = check_output(['git', 'describe', '--tags', '--dirty', '--always']) return result[0] def version():
64
64
24
3
61
ryanpdwyer/sigutils
tasks.py
Python
version
version
109
111
109
109
0f550947107c9da39b6ca7f29780190e62c14724
bigcode/the-stack
train
cc3ce1757e80d994aff986fc
train
function
@task def clean(): """Remove build directories, compiled python files""" rm_rf('dist') rm(*cwd.rglob("*.py[cod]")) rm_rf('build', '__pycache__') rm_rf(*cwd.glob('*.egg'))
@task def clean():
"""Remove build directories, compiled python files""" rm_rf('dist') rm(*cwd.rglob("*.py[cod]")) rm_rf('build', '__pycache__') rm_rf(*cwd.glob('*.egg'))
os.chdir('docs') check_output(['invoke', 'html', 'open']) @task def build_docs(): """Just build the docs using Sphinx, don't open in a browser""" os.chdir('docs') check_output(['invoke', 'html']) @task def clean():
63
64
56
6
57
ryanpdwyer/sigutils
tasks.py
Python
clean
clean
144
152
144
145
49c9004c4df0ceb61b24f66d376579e0cb1ace29
bigcode/the-stack
train
ac7eb3a3dd409b0dbbef6036
train
function
def rm(*args): """Delete all files provided""" for path in args: try: os.remove(str(args)) except OSError: pass
def rm(*args):
"""Delete all files provided""" for path in args: try: os.remove(str(args)) except OSError: pass
= find_git_cmd(windows) # Helper functions for unix-like removing folders and files. def rm_rf(*args): """Recursively delete directories, if they exist""" for directory in args: try: shutil.rmtree(str(directory)) except OSError: pass def rm(*args):
64
64
35
5
58
ryanpdwyer/sigutils
tasks.py
Python
rm
rm
94
100
94
94
c92d0025e164466a1db26f798de87c1cdf531f8c
bigcode/the-stack
train
5d4956b58124fcf8c18145eb
train
function
@task def docs(): """Use the docs subdirectory tasks.py to build and open docs.""" os.chdir('docs') check_output(['invoke', 'html', 'open'])
@task def docs():
"""Use the docs subdirectory tasks.py to build and open docs.""" os.chdir('docs') check_output(['invoke', 'html', 'open'])
build_docs build the docs clean Remove compiled python files, build directories test Run tests for package (python setup.py test) release Upload to PyPI after running tests and checking version number To see more about a specific task, run invoke --help task""") @task def docs():
64
64
39
6
58
ryanpdwyer/sigutils
tasks.py
Python
docs
docs
130
134
130
131
58c903a6a6bc0af2ab5a2f172bdcb48866e448d2
bigcode/the-stack
train
8927ad9bfc93a12671af9d7c
train
function
@task def build_docs(): """Just build the docs using Sphinx, don't open in a browser""" os.chdir('docs') check_output(['invoke', 'html'])
@task def build_docs():
"""Just build the docs using Sphinx, don't open in a browser""" os.chdir('docs') check_output(['invoke', 'html'])
number To see more about a specific task, run invoke --help task""") @task def docs(): """Use the docs subdirectory tasks.py to build and open docs.""" os.chdir('docs') check_output(['invoke', 'html', 'open']) @task def build_docs():
63
64
38
7
56
ryanpdwyer/sigutils
tasks.py
Python
build_docs
build_docs
137
141
137
138
0f00dcc8b96a137f0c4b104b300ac1eba4df84b4
bigcode/the-stack
train
3c8efe7db362b1843ad5d458
train
function
@task def test(): """Test the package using python setup.py test""" check_output(['python', 'setup.py', 'test'])
@task def test():
"""Test the package using python setup.py test""" check_output(['python', 'setup.py', 'test'])
) @task def clean(): """Remove build directories, compiled python files""" rm_rf('dist') rm(*cwd.rglob("*.py[cod]")) rm_rf('build', '__pycache__') rm_rf(*cwd.glob('*.egg')) @task def test():
63
64
30
6
57
ryanpdwyer/sigutils
tasks.py
Python
test
test
155
158
155
156
bbb61c1bc78821dc9512e07d2aff6bd183029b67
bigcode/the-stack
train
d44a93818911c19d185b46b8
train
function
@task(default=True) def help(): print(""" Usage: inv[oke] [--core-opts] task1 [--task1-opts] ... taskN [--taskN-opts] Tasks: docs build the docs and open in a webbrowser build_docs build the docs clean Remove compiled python files, build directories test Run tests for package...
@task(default=True) def help():
print(""" Usage: inv[oke] [--core-opts] task1 [--task1-opts] ... taskN [--taskN-opts] Tasks: docs build the docs and open in a webbrowser build_docs build the docs clean Remove compiled python files, build directories test Run tests for package (python setup.py test) release ...
def git_describe(): result = check_output(['git', 'describe', '--tags', '--dirty', '--always']) return result[0] def version(): result = check_output(['python', 'setup.py', '--version']) return result[0] @task(default=True) def help():
64
64
115
8
56
ryanpdwyer/sigutils
tasks.py
Python
help
help
114
127
114
115
a771f2e3c563d27921190b16e004a52e9fa14799
bigcode/the-stack
train
06414c3357475b885521fb1b
train
function
def git_describe(): result = check_output(['git', 'describe', '--tags', '--dirty', '--always']) return result[0]
def git_describe():
result = check_output(['git', 'describe', '--tags', '--dirty', '--always']) return result[0]
: shutil.rmtree(str(directory)) except OSError: pass def rm(*args): """Delete all files provided""" for path in args: try: os.remove(str(args)) except OSError: pass # Helper functions for getting version numbers def git_describe():
64
64
31
5
58
ryanpdwyer/sigutils
tasks.py
Python
git_describe
git_describe
104
106
104
104
4b2f8c458b77db204e419a5f6f47d7197482fd84
bigcode/the-stack
train
533b8ba7eb90091ba46deb73
train
function
@task def load_all_query_data(raw_data_dir, filename, blacklist): """Loads data from previous queries """ df_raw = analysis_extract.load_data( raw_data_dir=raw_data_dir, filename=filename) df = transform.clean_data(df_raw, blacklist=blacklist) return df
@task def load_all_query_data(raw_data_dir, filename, blacklist):
"""Loads data from previous queries """ df_raw = analysis_extract.load_data( raw_data_dir=raw_data_dir, filename=filename) df = transform.clean_data(df_raw, blacklist=blacklist) return df
, geo) df = transform.clean_data(df_raw, blacklist=blacklist) return df @task def export(df, path): load.write_to_csv(df, filename=path) # ~-- DASHBOARD DATA @task def load_all_query_data(raw_data_dir, filename, blacklist):
64
64
64
16
47
philippschmalen/ESG-trending-topics-radar
pipelines/pipelines.py
Python
load_all_query_data
load_all_query_data
54
60
54
55
f284d23c9d647218af78377b30a5df167a950e0f
bigcode/the-stack
train
63218420d371e20023dab8de
train
function
@task def transform_analysis_data(df): """Generate statistics for analysis in Streamlit dashboard """ df_analysis = analysis_transform.dashboard_data(df=df) return df_analysis
@task def transform_analysis_data(df):
"""Generate statistics for analysis in Streamlit dashboard """ df_analysis = analysis_transform.dashboard_data(df=df) return df_analysis
_data_dir, filename, blacklist): """Loads data from previous queries """ df_raw = analysis_extract.load_data( raw_data_dir=raw_data_dir, filename=filename) df = transform.clean_data(df_raw, blacklist=blacklist) return df @task def transform_analysis_data(df):
64
64
36
9
54
philippschmalen/ESG-trending-topics-radar
pipelines/pipelines.py
Python
transform_analysis_data
transform_analysis_data
63
67
63
64
aad33810d02903c8282354c290fdd22af15e06d1
bigcode/the-stack
train
f17b4d6a0e53c66e60f69c61
train
function
@task def export(df, path): load.write_to_csv(df, filename=path)
@task def export(df, path):
load.write_to_csv(df, filename=path)
kw_list): return extract.get_queries(kw_list) @task def transform_related_queries(response, geo, blacklist): df_raw = transform.create_response_df(response, geo) df = transform.clean_data(df_raw, blacklist=blacklist) return df @task def export(df, path):
64
64
20
9
54
philippschmalen/ESG-trending-topics-radar
pipelines/pipelines.py
Python
export
export
48
50
48
49
d8e705706224ff4c7b0381dd8065481aad4baa92
bigcode/the-stack
train
b2982810d66491268470112a
train
function
@task def web_deployment(df_trend, df_top, project_name, top_n): figure = deploy.create_plot(df_trend, df_top) deploy.deploy_plot(figure, filename=project_name + '_all') figure = deploy.create_plot_rising(df_trend) deploy.deploy_plot(figure, filename=project_name)
@task def web_deployment(df_trend, df_top, project_name, top_n):
figure = deploy.create_plot(df_trend, df_top) deploy.deploy_plot(figure, filename=project_name + '_all') figure = deploy.create_plot_rising(df_trend) deploy.deploy_plot(figure, filename=project_name)
_uppercase, top_n): df_trend, df_top = transform.plot_data(df, to_uppercase=to_uppercase, top_n=top_n) return df_trend, df_top @task def web_deployment(df_trend, df_top, project_name, top_n):
64
64
72
20
43
philippschmalen/ESG-trending-topics-radar
pipelines/pipelines.py
Python
web_deployment
web_deployment
79
84
79
80
b5a63a346640292862586d40f3abfec42c603859
bigcode/the-stack
train
cd0ec69765fee98351c4c7cf
train
function
@task(nout=2) def transform_plot_data(df, to_uppercase, top_n): df_trend, df_top = transform.plot_data(df, to_uppercase=to_uppercase, top_n=top_n) return df_trend, df_top
@task(nout=2) def transform_plot_data(df, to_uppercase, top_n):
df_trend, df_top = transform.plot_data(df, to_uppercase=to_uppercase, top_n=top_n) return df_trend, df_top
task def transform_analysis_data(df): """Generate statistics for analysis in Streamlit dashboard """ df_analysis = analysis_transform.dashboard_data(df=df) return df_analysis # ~-- TREEMAP PLOT @task(nout=2) def transform_plot_data(df, to_uppercase, top_n):
64
64
58
20
43
philippschmalen/ESG-trending-topics-radar
pipelines/pipelines.py
Python
transform_plot_data
transform_plot_data
71
76
71
72
080b971ad86502d87909897157264af07eb3b79a
bigcode/the-stack
train
449a691b49f8f71e21ba7453
train
function
@task def transform_related_queries(response, geo, blacklist): df_raw = transform.create_response_df(response, geo) df = transform.clean_data(df_raw, blacklist=blacklist) return df
@task def transform_related_queries(response, geo, blacklist):
df_raw = transform.create_response_df(response, geo) df = transform.clean_data(df_raw, blacklist=blacklist) return df
Graphviz/bin/' # ~-- SOURCE DATA: GOOGLE TRENDS @task(max_retries=3, retry_delay=timedelta(seconds=40)) def extract_related_queries(kw_list): return extract.get_queries(kw_list) @task def transform_related_queries(response, geo, blacklist):
64
64
43
13
51
philippschmalen/ESG-trending-topics-radar
pipelines/pipelines.py
Python
transform_related_queries
transform_related_queries
41
45
41
42
fc0dbb17baee17decd622d176e6b57dc30ba923e
bigcode/the-stack
train
eae7b24320cafba755a26b5d
train
function
def main(): # ~----------------- CONFIG -----------------~ with open('../settings.yml') as file: config = yaml.full_load(file) timestamp = datetime.now().strftime("%y%m%d_%H%M") PROJECT = config['project']['name'] KW_LIST = config['query']['kw_list'] BLACKLIST = config['...
def main(): # ~----------------- CONFIG -----------------~
with open('../settings.yml') as file: config = yaml.full_load(file) timestamp = datetime.now().strftime("%y%m%d_%H%M") PROJECT = config['project']['name'] KW_LIST = config['query']['kw_list'] BLACKLIST = config['query']['blacklist'] TO_UPPERCASE = config['query']['up...
=blacklist) return df @task def transform_analysis_data(df): """Generate statistics for analysis in Streamlit dashboard """ df_analysis = analysis_transform.dashboard_data(df=df) return df_analysis # ~-- TREEMAP PLOT @task(nout=2) def transform_plot_data(df, to_uppercase, top_n): df_trend, df_to...
195
195
652
12
183
philippschmalen/ESG-trending-topics-radar
pipelines/pipelines.py
Python
main
main
87
156
87
88
21cc5d022215d32b6bf29c12a6f64d92b555089b
bigcode/the-stack
train
841f1869989bcf7665cf8df5
train
function
@task(max_retries=3, retry_delay=timedelta(seconds=40)) def extract_related_queries(kw_list): return extract.get_queries(kw_list)
@task(max_retries=3, retry_delay=timedelta(seconds=40)) def extract_related_queries(kw_list):
return extract.get_queries(kw_list)
visualization with graphviz # os.environ["PATH"] += os.pathsep + 'C:/Program Files/Graphviz/bin/' # ~-- SOURCE DATA: GOOGLE TRENDS @task(max_retries=3, retry_delay=timedelta(seconds=40)) def extract_related_queries(kw_list):
64
64
35
26
37
philippschmalen/ESG-trending-topics-radar
pipelines/pipelines.py
Python
extract_related_queries
extract_related_queries
36
38
36
37
f73e4ccc42cac45fbc564319cbbcad0d68f4ef59
bigcode/the-stack
train
aae2eee18bc185650b2e6a7c
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_22_minus_13_carry_1(setup): run_sbc_test( "nmos", True, 0x22, 0x13, True, 0x09, [("C", True), ("Z", False), ("V", False), ("N", False)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_22_minus_13_carry_1(setup):
run_sbc_test( "nmos", True, 0x22, 0x13, True, 0x09, [("C", True), ("Z", False), ("V", False), ("N", False)], )
22, 0x13, False, 0x08, [("C", True), ("Z", False), ("V", False), ("N", False)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_22_minus_13_carry_1(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_22_minus_13_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_22_minus_13_carry_1
290
299
290
290
b00bea090053d0db92d797e2d33e666c0899d2c3
bigcode/the-stack
train
ba1536943d55c4eebc4ae05b
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_22_minus_13_carry_0(setup): run_sbc_test( "nmos", True, 0x22, 0x13, False, 0x08, [("C", True), ("Z", False), ("V", False), ("N", False)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_22_minus_13_carry_0(setup):
run_sbc_test( "nmos", True, 0x22, 0x13, False, 0x08, [("C", True), ("Z", False), ("V", False), ("N", False)], )
44, 0x22, True, 0x22, [("C", True), ("Z", False), ("V", False), ("N", False)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_22_minus_13_carry_0(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_22_minus_13_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_22_minus_13_carry_0
278
287
278
278
2f770b97de51a4e9196e0dd66c238809e913ebdb
bigcode/the-stack
train
dbb245345b99e8f3ae4838a5
train
function
def build_computer(chip_line=None): computer = None search = re.compile(".*[^a-zA-Z0-9_-].*") if (chip_line is not None) and (search.search(chip_line) is not None): raise Exception("Invalid chip_line, contains non-alphanumeric characters") fn = "chip/6502.json" if chip_line is not None: ...
def build_computer(chip_line=None):
computer = None search = re.compile(".*[^a-zA-Z0-9_-].*") if (chip_line is not None) and (search.search(chip_line) is not None): raise Exception("Invalid chip_line, contains non-alphanumeric characters") fn = "chip/6502.json" if chip_line is not None: fn = "chip/{}-6502.json".form...
.memory.memory # TODO Maybe refactor so these are not needed from bitey.cpu.addressing_mode import ImmediateAddressingMode from bitey.cpu.instruction.opcode import Opcode from bitey.cpu.instruction.sbc import SBCCMOS, SBCNMOS def build_computer(chip_line=None):
64
64
137
9
54
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
build_computer
build_computer
13
29
13
13
cb14e7dfbe538be81ef255993f0fd9347f90604a
bigcode/the-stack
train
7e0c34ade0452755289dca39
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_02_carry_1(setup): run_sbc_test( "nmos", True, 0x01, 0x02, True, 0x99, [("C", False), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_02_carry_1(setup):
run_sbc_test( "nmos", True, 0x01, 0x02, True, 0x99, [("C", False), ("Z", False), ("V", False), ("N", True)], )
01, 0x02, False, 0x98, [("C", False), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_02_carry_1(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_02_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_02_carry_1
170
179
170
170
95b48ca91058fc69fd948037c61bdd609230cd26
bigcode/the-stack
train
12b9e87c7a4d38c59ab01da8
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_01_carry_1(setup): run_sbc_test( "nmos", True, 0x01, 0x01, True, 0x00, [("C", True), ("Z", True), ("V", False), ("N", False)], # [("C", False), ("Z", True), ("V", False), ("N", False)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_01_carry_1(setup):
run_sbc_test( "nmos", True, 0x01, 0x01, True, 0x00, [("C", True), ("Z", True), ("V", False), ("N", False)], # [("C", False), ("Z", True), ("V", False), ("N", False)], )
01, 0x01, False, 0x99, [("C", False), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_01_carry_1(setup):
64
64
105
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_01_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_01_carry_1
121
131
121
121
91dad45992b57427490ee84b06db32bfd32decfc
bigcode/the-stack
train
a4db491a61d010a1564f03e1
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_99_minus_00_carry_0(setup): run_sbc_test( "nmos", True, 0x99, 0x00, False, 0x98, [("C", True), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_99_minus_00_carry_0(setup):
run_sbc_test( "nmos", True, 0x99, 0x00, False, 0x98, [("C", True), ("Z", False), ("V", False), ("N", True)], )
01, 0x02, True, 0x99, [("C", False), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_99_minus_00_carry_0(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_99_minus_00_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_99_minus_00_carry_0
182
191
182
182
2d2a7d2d16d36db88c3d8cce3ef0f05a7b6b45b6
bigcode/the-stack
train
f3a63ff6a2b295035452a885
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_99_minus_00_carry_1(setup): run_sbc_test( "nmos", True, 0x99, 0x00, True, 0x99, [("C", True), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_99_minus_00_carry_1(setup):
run_sbc_test( "nmos", True, 0x99, 0x00, True, 0x99, [("C", True), ("Z", False), ("V", False), ("N", True)], )
99, 0x00, False, 0x98, [("C", True), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_99_minus_00_carry_1(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_99_minus_00_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_99_minus_00_carry_1
194
203
194
194
df3eb8037be8c857b0d60bf8e1483b3ed10c27a8
bigcode/the-stack
train
032d91ebc107da130e60ca18
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_00_carry_0(setup): run_sbc_test( "nmos", True, 0x00, 0x00, False, 0x99, [("C", False), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_00_carry_0(setup):
run_sbc_test( "nmos", True, 0x00, 0x00, False, 0x99, [("C", False), ("Z", False), ("V", False), ("N", True)], )
") tests.computer.computer.execute_explicit_instruction( computer, i1_opcode, i1, [("A", expected_accumulator)], expected_flags, [], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_00_carry_0(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_00_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_00_carry_0
85
94
85
85
3c0c475a6bdb93b87314a13542097f52a96ff64f
bigcode/the-stack
train
17f2e67850ad8aa49b8fe911
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_02_carry_0(setup): run_sbc_test( "nmos", True, 0x01, 0x02, False, 0x98, [("C", False), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_02_carry_0(setup):
run_sbc_test( "nmos", True, 0x01, 0x02, False, 0x98, [("C", False), ("Z", False), ("V", False), ("N", True)], )
02, 0x01, True, 0x01, [("C", True), ("Z", False), ("V", False), ("N", False)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_02_carry_0(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_02_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_02_carry_0
158
167
158
158
b93390b8839eff04e2726ed44f6dc054a8c3486c
bigcode/the-stack
train
0eccf332b102a84170ddfd1c
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_02_minus_01_carry_1(setup): run_sbc_test( "nmos", True, 0x02, 0x01, True, 0x01, [("C", True), ("Z", False), ("V", False), ("N", False)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_02_minus_01_carry_1(setup):
run_sbc_test( "nmos", True, 0x02, 0x01, True, 0x01, [("C", True), ("Z", False), ("V", False), ("N", False)], )
02, 0x01, False, 0x00, [("C", True), ("Z", True), ("V", False), ("N", False)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_02_minus_01_carry_1(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_02_minus_01_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_02_minus_01_carry_1
146
155
146
146
f016f21fdbbf635b8e59ee7ad4746291ab385abc
bigcode/the-stack
train
6d5f013fa7bdc5546a1bf145
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_0B_carry_1(setup): run_sbc_test( "nmos", True, 0x00, 0x0B, True, 0x9F, [("C", False), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_0B_carry_1(setup):
run_sbc_test( "nmos", True, 0x00, 0x0B, True, 0x9F, [("C", False), ("Z", False), ("V", False), ("N", True)], )
0x0B, False, 0x9E, [("C", False), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_0B_carry_1(setup):
64
64
85
24
40
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_0B_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_0B_carry_1
364
373
364
364
cf0b304abbe27b9e754b6bd53b84d3e464709cc3
bigcode/the-stack
train
a6e7d43a6ebd0a9558cdbe49
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_0B_carry_0(setup): run_sbc_test( "nmos", True, 0x00, 0x0B, False, 0x9E, [("C", False), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_0B_carry_0(setup):
run_sbc_test( "nmos", True, 0x00, 0x0B, False, 0x9E, [("C", False), ("Z", False), ("V", False), ("N", True)], )
, 0x23, True, 0x88, [("C", False), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_0B_carry_0(setup):
64
64
85
24
40
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_0B_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_0B_carry_0
352
361
352
352
dc8b239af4ae2bcdf701d44eb482722d89ea2943
bigcode/the-stack
train
29e8913e106630ad88f9f5cf
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_44_minus_22_carry_0(setup): run_sbc_test( "nmos", True, 0x44, 0x22, False, 0x21, [("C", True), ("Z", False), ("V", False), ("N", False)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_44_minus_22_carry_0(setup):
run_sbc_test( "nmos", True, 0x44, 0x22, False, 0x21, [("C", True), ("Z", False), ("V", False), ("N", False)], )
, 0xAA, True, 0xF0, [("C", False), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_44_minus_22_carry_0(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_44_minus_22_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_44_minus_22_carry_0
254
263
254
254
1175aaff178a7b04599c2759081565908eb36ff7
bigcode/the-stack
train
ba0cb93dc30f078e757211de
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_AA_carry_0(setup): run_sbc_test( "nmos", True, 0x00, 0xAA, False, 0xFF, [("C", False), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_AA_carry_0(setup):
run_sbc_test( "nmos", True, 0x00, 0xAA, False, 0xFF, [("C", False), ("Z", False), ("V", False), ("N", True)], )
AA, 0x00, True, 0xAA, [("C", True), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_AA_carry_0(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_AA_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_AA_carry_0
230
239
230
230
39ddc610f9ecdedd85c62d16c95110a0c6801604
bigcode/the-stack
train
9924108ea895346a9a5a2a5a
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_80_carry_1(setup): run_sbc_test( "nmos", True, 0x01, 0x80, True, 0x21, [("C", False), ("Z", False), ("V", True), ("N", False)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_80_carry_1(setup):
run_sbc_test( "nmos", True, 0x01, 0x80, True, 0x21, [("C", False), ("Z", False), ("V", True), ("N", False)], )
01, 0x80, False, 0x20, [("C", False), ("Z", False), ("V", True), ("N", False)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_80_carry_1(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_80_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_80_carry_1
412
421
412
412
919f716f56fd4a68d8b4d25db7bdb458fe631a46
bigcode/the-stack
train
a811cd2af557cafeaa0a7f17
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_AA_carry_1(setup): run_sbc_test( "nmos", True, 0x00, 0xAA, True, 0xF0, [("C", False), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_AA_carry_1(setup):
run_sbc_test( "nmos", True, 0x00, 0xAA, True, 0xF0, [("C", False), ("Z", False), ("V", False), ("N", True)], )
00, 0xAA, False, 0xFF, [("C", False), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_AA_carry_1(setup):
64
64
83
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_AA_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_AA_carry_1
242
251
242
242
124be404130dd276ebfbb7be7c2a561b40992493
bigcode/the-stack
train
3b7761920257dbb1dbb3c83b
train
function
@pytest.fixture(scope="module") def setup(): computer = tests.computer.computer.init_computer() yield computer
@pytest.fixture(scope="module") def setup():
computer = tests.computer.computer.init_computer() yield computer
{}-6502.json".format(chip_line) with open(fn) as f: chip_data = f.read() computer = Computer.build_from_json(chip_data) return computer return None # module scope means run once per test module @pytest.fixture(scope="module") def setup():
64
64
25
9
54
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
setup
setup
33
36
33
34
b4a805c2f83b74050d9c0ef2c1601e4dc62591db
bigcode/the-stack
train
5b98f92cd1988e3d5b88b29e
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_80_carry_0(setup): run_sbc_test( "nmos", True, 0x01, 0x80, False, 0x20, [("C", False), ("Z", False), ("V", True), ("N", False)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_80_carry_0(setup):
run_sbc_test( "nmos", True, 0x01, 0x80, False, 0x20, [("C", False), ("Z", False), ("V", True), ("N", False)], )
00, 0x20, True, 0x80, [("C", False), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_80_carry_0(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_80_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_80_carry_0
400
409
400
400
2c5cdef0d42b62a18be780a756612915a934ebb3
bigcode/the-stack
train
369815e4d64d42b4692e63f9
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_04_minus_13_carry_0(setup): run_sbc_test( "nmos", True, 0x04, 0x13, False, 0x90, # [("C", False), ("Z", False), ("V", False), ("N", True)], [("C", False), ("Z", False), ("V", False), ("N", True)], ...
def test_cpu_instruction_sbc_decimal_subtract_nmos_04_minus_13_carry_0(setup):
run_sbc_test( "nmos", True, 0x04, 0x13, False, 0x90, # [("C", False), ("Z", False), ("V", False), ("N", True)], [("C", False), ("Z", False), ("V", False), ("N", True)], )
22, 0x13, True, 0x09, [("C", True), ("Z", False), ("V", False), ("N", False)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_04_minus_13_carry_0(setup):
64
64
105
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_04_minus_13_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_04_minus_13_carry_0
302
312
302
302
258dc950e5f0d6be342a48ea116cd7e31521e4da
bigcode/the-stack
train
38ed448661533a72fb5c56d9
train
function
def run_sbc_test( chip, decimal_mode, accumulator, memory, carry, expected_accumulator, expected_flags, ): if (chip == "nmos") or (chip == "cmos"): computer = build_computer(chip) else: computer = build_computer() computer.reset() computer.cpu.registers["PC"]...
def run_sbc_test( chip, decimal_mode, accumulator, memory, carry, expected_accumulator, expected_flags, ):
if (chip == "nmos") or (chip == "cmos"): computer = build_computer(chip) else: computer = build_computer() computer.reset() computer.cpu.registers["PC"].set(0x00) computer.cpu.registers["A"].set(accumulator) if decimal_mode: computer.cpu.flags["D"].set() else: ...
= Computer.build_from_json(chip_data) return computer return None # module scope means run once per test module @pytest.fixture(scope="module") def setup(): computer = tests.computer.computer.init_computer() yield computer def run_sbc_test( chip, decimal_mode, accumulator, memory...
84
84
281
32
51
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
run_sbc_test
run_sbc_test
39
82
39
47
990fa0fa45cd9fecfef4ca25747168348887fa3b
bigcode/the-stack
train
acffe1a5bf7799be90db5c07
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_44_minus_22_carry_1(setup): run_sbc_test( "nmos", True, 0x44, 0x22, True, 0x22, [("C", True), ("Z", False), ("V", False), ("N", False)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_44_minus_22_carry_1(setup):
run_sbc_test( "nmos", True, 0x44, 0x22, True, 0x22, [("C", True), ("Z", False), ("V", False), ("N", False)], )
44, 0x22, False, 0x21, [("C", True), ("Z", False), ("V", False), ("N", False)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_44_minus_22_carry_1(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_44_minus_22_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_44_minus_22_carry_1
266
275
266
266
5cb4840e12448b741f6d2e81cb08062725969ccc
bigcode/the-stack
train
8768cee94ae0807b22cca422
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_AA_minus_00_carry_1(setup): run_sbc_test( "nmos", True, 0xAA, 0x00, True, 0xAA, [("C", True), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_AA_minus_00_carry_1(setup):
run_sbc_test( "nmos", True, 0xAA, 0x00, True, 0xAA, [("C", True), ("Z", False), ("V", False), ("N", True)], )
, 0x00, False, 0xA9, [("C", True), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_AA_minus_00_carry_1(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_AA_minus_00_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_AA_minus_00_carry_1
218
227
218
218
1e2b165f47cae5843c8d45478792a0531e486ac6
bigcode/the-stack
train
ff1fe9e11b987ba6b023f5fc
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_04_minus_13_carry_1(setup): run_sbc_test( "nmos", True, 0x04, 0x13, True, 0x91, # [("C", False), ("Z", False), ("V", False), ("N", True)], [("C", False), ("Z", False), ("V", False), ("N", True)], )...
def test_cpu_instruction_sbc_decimal_subtract_nmos_04_minus_13_carry_1(setup):
run_sbc_test( "nmos", True, 0x04, 0x13, True, 0x91, # [("C", False), ("Z", False), ("V", False), ("N", True)], [("C", False), ("Z", False), ("V", False), ("N", True)], )
False), ("Z", False), ("V", False), ("N", True)], [("C", False), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_04_minus_13_carry_1(setup):
64
64
105
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_04_minus_13_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_04_minus_13_carry_1
315
325
315
315
120277565eb34cea6b55c12143719eb9414ea3d9
bigcode/the-stack
train
0c8b332946e781e361e96b2f
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_20_carry_1(setup): run_sbc_test( "nmos", True, 0x00, 0x20, True, 0x80, [("C", False), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_20_carry_1(setup):
run_sbc_test( "nmos", True, 0x00, 0x20, True, 0x80, [("C", False), ("Z", False), ("V", False), ("N", True)], )
00, 0x20, False, 0x79, [("C", False), ("Z", False), ("V", False), ("N", False)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_20_carry_1(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_20_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_20_carry_1
388
397
388
388
f60042abc4f2c3d375bbdec6394bbd664cd1bf69
bigcode/the-stack
train
3a2d55864117d9bb6c88e50e
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_00_carry_1(setup): run_sbc_test( "nmos", True, 0x00, 0x00, True, 0x00, [("C", True), ("Z", True), ("V", False), ("N", False)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_00_carry_1(setup):
run_sbc_test( "nmos", True, 0x00, 0x00, True, 0x00, [("C", True), ("Z", True), ("V", False), ("N", False)], )
00, 0x00, False, 0x99, [("C", False), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_00_carry_1(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_00_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_00_carry_1
97
106
97
97
a443041f7d36e6c6db0d0f0c2d5d1b47c8b188b8
bigcode/the-stack
train
c3a8a738d51133815310bad0
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_AA_minus_00_carry_0(setup): run_sbc_test( "nmos", True, 0xAA, 0x00, False, 0xA9, [("C", True), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_AA_minus_00_carry_0(setup):
run_sbc_test( "nmos", True, 0xAA, 0x00, False, 0xA9, [("C", True), ("Z", False), ("V", False), ("N", True)], )
99, 0x00, True, 0x99, [("C", True), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_AA_minus_00_carry_0(setup):
64
64
83
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_AA_minus_00_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_AA_minus_00_carry_0
206
215
206
206
76caa050517e356a769045be3ee65e669e768783
bigcode/the-stack
train
3a707802caba65e67e3a1164
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_01_carry_0(setup): run_sbc_test( "nmos", True, 0x01, 0x01, False, 0x99, [("C", False), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_01_carry_0(setup):
run_sbc_test( "nmos", True, 0x01, 0x01, False, 0x99, [("C", False), ("Z", False), ("V", False), ("N", True)], )
00, 0x00, True, 0x00, [("C", True), ("Z", True), ("V", False), ("N", False)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_01_carry_0(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_01_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_01_minus_01_carry_0
109
118
109
109
b22cfdb5274012c1383e4cb794f08b02c3503fed
bigcode/the-stack
train
18ae9667e9f5983c544653a1
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_20_carry_0(setup): run_sbc_test( "nmos", True, 0x00, 0x20, False, 0x79, [("C", False), ("Z", False), ("V", False), ("N", False)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_20_carry_0(setup):
run_sbc_test( "nmos", True, 0x00, 0x20, False, 0x79, [("C", False), ("Z", False), ("V", False), ("N", False)], )
0x0B, True, 0x9F, [("C", False), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_20_carry_0(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_20_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_00_minus_20_carry_0
376
385
376
376
d6dbded65013bebd1e636ac0ab49bc8f40fd438f
bigcode/the-stack
train
f0fc2d46c03e9db7a1278973
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_11_minus_23_carry_0(setup): run_sbc_test( "nmos", True, 0x11, 0x23, False, 0x87, [("C", False), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_11_minus_23_carry_0(setup):
run_sbc_test( "nmos", True, 0x11, 0x23, False, 0x87, [("C", False), ("Z", False), ("V", False), ("N", True)], )
False), ("Z", False), ("V", False), ("N", True)], [("C", False), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_11_minus_23_carry_0(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_11_minus_23_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_11_minus_23_carry_0
328
337
328
328
04c106191b3a1abe637cad2651cd3db39fc8fb30
bigcode/the-stack
train
94d1c38220aace4287b9d514
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_11_minus_23_carry_1(setup): run_sbc_test( "nmos", True, 0x11, 0x23, True, 0x88, [("C", False), ("Z", False), ("V", False), ("N", True)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_11_minus_23_carry_1(setup):
run_sbc_test( "nmos", True, 0x11, 0x23, True, 0x88, [("C", False), ("Z", False), ("V", False), ("N", True)], )
11, 0x23, False, 0x87, [("C", False), ("Z", False), ("V", False), ("N", True)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_11_minus_23_carry_1(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_11_minus_23_carry_1
test_cpu_instruction_sbc_decimal_subtract_nmos_11_minus_23_carry_1
340
349
340
340
784c5c6efcd1109ab587bc23a4286f15eb15700c
bigcode/the-stack
train
e005c358794199ca587b5423
train
function
def test_cpu_instruction_sbc_decimal_subtract_nmos_02_minus_01_carry_0(setup): run_sbc_test( "nmos", True, 0x02, 0x01, False, 0x00, [("C", True), ("Z", True), ("V", False), ("N", False)], )
def test_cpu_instruction_sbc_decimal_subtract_nmos_02_minus_01_carry_0(setup):
run_sbc_test( "nmos", True, 0x02, 0x01, False, 0x00, [("C", True), ("Z", True), ("V", False), ("N", False)], )
), ("Z", True), ("V", False), ("N", False)], # [("C", False), ("Z", True), ("V", False), ("N", False)], ) def test_cpu_instruction_sbc_decimal_subtract_nmos_02_minus_01_carry_0(setup):
64
64
82
23
41
jgerrish/bitey
tests/cpu/instruction/test_bitey_cpu_instruction_sbc_decimal_nmos.py
Python
test_cpu_instruction_sbc_decimal_subtract_nmos_02_minus_01_carry_0
test_cpu_instruction_sbc_decimal_subtract_nmos_02_minus_01_carry_0
134
143
134
134
d676b07e7b27a21e550f96da2203245bab2c3316
bigcode/the-stack
train
8586a102f2eb9ca698394bfa
train
class
class VideoSlider(QSlider): seeked = pyqtSignal(int) updatePosition = pyqtSignal(int) def __init__(self): super().__init__() self.__pressed = None self.__initUi() def __initUi(self): self.setOrientation(Qt.Horizontal) PyQtResourceHelper.setStyleSheet([self], ['...
class VideoSlider(QSlider):
seeked = pyqtSignal(int) updatePosition = pyqtSignal(int) def __init__(self): super().__init__() self.__pressed = None self.__initUi() def __initUi(self): self.setOrientation(Qt.Horizontal) PyQtResourceHelper.setStyleSheet([self], ['style/slider.css']) ...
from PyQt5.QtWidgets import QSlider from PyQt5.QtCore import Qt, pyqtSignal from pyqt_resource_helper.pyqtResourceHelper import PyQtResourceHelper class VideoSlider(QSlider):
44
87
292
6
37
yjg30737/pyqt-graphics-video-item-video-player
pyqt_graphics_video_item_video_player/videoSlider.py
Python
VideoSlider
VideoSlider
7
50
7
7
ba7611de96646a5a76cfa88b0c44ada4168daa97
bigcode/the-stack
train
bcd0af247248012ab9e12701
train
class
class Node: def __init__(self,value): self.value = value self.next = None
class Node:
def __init__(self,value): self.value = value self.next = None
class Node:
3
64
23
3
0
jaycvilla/nucamppython_fundamentals
week4/linked_list1.py
Python
Node
Node
1
4
1
1
3aae5d45985db480a00de9b5447559735f5bbe03
bigcode/the-stack
train
e3cca0d36116dfc693e83f8e
train
function
def count_redundancy(g): pos = 0 grcs_claws = [] mf_to_grcs = defaultdict(set) for grc_id, dendrite_count in enumerate(g.dendrite_counts): claws = [] for j in range(dendrite_count): mf_id = g.dendrite_mf_map[pos] pos += 1 claws.append(mf_id) ...
def count_redundancy(g):
pos = 0 grcs_claws = [] mf_to_grcs = defaultdict(set) for grc_id, dendrite_count in enumerate(g.dendrite_counts): claws = [] for j in range(dendrite_count): mf_id = g.dendrite_mf_map[pos] pos += 1 claws.append(mf_id) mf_to_grcs[mf_id].add(g...
_by_activation_level( # g, # print_output=True, # test_len=4096, # activation_levels=config.activation_levels, # noise_probs=config.noise_probs, # seed=0, # ) from collections import defaultdict import itertools def count_redundancy(g):
64
64
207
8
55
htem/cb2_project_analysis
analysis/dimensionalty_sim/make_global_random_model.py
Python
count_redundancy
count_redundancy
112
130
112
112
ae536817f11c977472eb661fccd476d175993580
bigcode/the-stack
train
41678f4196b4bc481d00919a
train
class
class VPNServicesTable(tables.DataTable): STATUS_CHOICES = ( ("Active", True), ("Down", True), ("Error", False), ) id = tables.Column('id', verbose_name=_('Id'), hidden=True) name = tables.Column("name", verbose_name=_('Name'), link="horizon:project:vpn:v...
class VPNServicesTable(tables.DataTable):
STATUS_CHOICES = ( ("Active", True), ("Down", True), ("Error", False), ) id = tables.Column('id', verbose_name=_('Id'), hidden=True) name = tables.Column("name", verbose_name=_('Name'), link="horizon:project:vpn:vpnservicedetails") description = table...
: name = "ipsecsiteconnectionstable" verbose_name = _("IPSec Site Connections") table_actions = (AddIPSecSiteConnectionLink, DeleteIPSecSiteConnectionLink) row_actions = (DeleteIPSecSiteConnectionLink,) class VPNServicesTable(tables.DataTable):
63
64
213
10
53
Juniper/horizon
openstack_dashboard/dashboards/project/vpn/tables.py
Python
VPNServicesTable
VPNServicesTable
116
138
116
116
a662b649227cc6fc5f1db3433944cbe7680af358
bigcode/the-stack
train
206e0a8ed03b3646ed09aa74
train
class
class AddIKEPolicyLink(tables.LinkAction): name = "addikepolicy" verbose_name = _("Add IKE Policy") url = "horizon:project:vpn:addikepolicy" classes = ("ajax-modal", "btn-addikepolicy",)
class AddIKEPolicyLink(tables.LinkAction):
name = "addikepolicy" verbose_name = _("Add IKE Policy") url = "horizon:project:vpn:addikepolicy" classes = ("ajax-modal", "btn-addikepolicy",)
limitations # under the License. # # @author: Tatiana Mazur from django.template.defaultfilters import title # noqa from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables from horizon.utils import filters class AddIKEPolicyLink(tables.LinkAction):
64
64
56
10
53
Juniper/horizon
openstack_dashboard/dashboards/project/vpn/tables.py
Python
AddIKEPolicyLink
AddIKEPolicyLink
27
31
27
27
1b43ed6fbc2191c3d9b278582404a497c89ba2d7
bigcode/the-stack
train
53679b1d03eed9eff5174065
train
class
class DeleteVPNServiceLink(tables.DeleteAction): name = "deletevpnservice" action_present = _("Delete") action_past = _("Scheduled deletion of %(data_type)s") data_type_singular = _("VPN Service") data_type_plural = _("VPN Services")
class DeleteVPNServiceLink(tables.DeleteAction):
name = "deletevpnservice" action_present = _("Delete") action_past = _("Scheduled deletion of %(data_type)s") data_type_singular = _("VPN Service") data_type_plural = _("VPN Services")
): name = "addipsecsiteconnection" verbose_name = _("Add IPSec Site Connection") url = "horizon:project:vpn:addipsecsiteconnection" classes = ("ajax-modal", "btn-addipsecsiteconnection",) class DeleteVPNServiceLink(tables.DeleteAction):
64
64
58
10
54
Juniper/horizon
openstack_dashboard/dashboards/project/vpn/tables.py
Python
DeleteVPNServiceLink
DeleteVPNServiceLink
55
60
55
55
169d05cbd746c48adf8e4e2a69a71e11573a87c3
bigcode/the-stack
train
97f67b8118de9bef0c4585e8
train
class
class IPSecSiteConnectionsTable(tables.DataTable): STATUS_CHOICES = ( ("Active", True), ("Down", True), ("Error", False), ) id = tables.Column('id', verbose_name=_('Id'), hidden=True) name = tables.Column('name', verbose_name=_('Name'), link="horizon:proj...
class IPSecSiteConnectionsTable(tables.DataTable):
STATUS_CHOICES = ( ("Active", True), ("Down", True), ("Error", False), ) id = tables.Column('id', verbose_name=_('Id'), hidden=True) name = tables.Column('name', verbose_name=_('Name'), link="horizon:project:vpn:ipsecsiteconnectiondetails") vpnservice...
ConnectionLink(tables.DeleteAction): name = "deleteipsecsiteconnection" action_present = _("Delete") action_past = _("Scheduled deletion of %(data_type)s") data_type_singular = _("IPSec Site Connection") data_type_plural = _("IPSec Site Connections") class IPSecSiteConnectionsTable(tables.DataTable)...
72
72
242
11
61
Juniper/horizon
openstack_dashboard/dashboards/project/vpn/tables.py
Python
IPSecSiteConnectionsTable
IPSecSiteConnectionsTable
87
113
87
87
03cec74a5b25f99b1cb037f0eecd3016184d9046
bigcode/the-stack
train
e895d8a7e1bbe4ac55ecf17a
train
class
class IPSecPoliciesTable(tables.DataTable): id = tables.Column('id', verbose_name=_('Id'), hidden=True) name = tables.Column("name", verbose_name=_('Name'), link="horizon:project:vpn:ipsecpolicydetails") auth_algorithm = tables.Column('auth_algorithm', ...
class IPSecPoliciesTable(tables.DataTable):
id = tables.Column('id', verbose_name=_('Id'), hidden=True) name = tables.Column("name", verbose_name=_('Name'), link="horizon:project:vpn:ipsecpolicydetails") auth_algorithm = tables.Column('auth_algorithm', verbose_name=_('Authorization algorithm...
verbose_name=_('PFS')) class Meta: name = "ikepoliciestable" verbose_name = _("IKE Policies") table_actions = (AddIKEPolicyLink, DeleteIKEPolicyLink) row_actions = (DeleteIKEPolicyLink,) class IPSecPoliciesTable(tables.DataTable):
63
64
164
10
53
Juniper/horizon
openstack_dashboard/dashboards/project/vpn/tables.py
Python
IPSecPoliciesTable
IPSecPoliciesTable
159
174
159
159
1c18ffa70f4da0dd4083a830a3886a0a383a6d79
bigcode/the-stack
train
cdc1edef800ebfede2052fb1
train
class
class AddIPSecSiteConnectionLink(tables.LinkAction): name = "addipsecsiteconnection" verbose_name = _("Add IPSec Site Connection") url = "horizon:project:vpn:addipsecsiteconnection" classes = ("ajax-modal", "btn-addipsecsiteconnection",)
class AddIPSecSiteConnectionLink(tables.LinkAction):
name = "addipsecsiteconnection" verbose_name = _("Add IPSec Site Connection") url = "horizon:project:vpn:addipsecsiteconnection" classes = ("ajax-modal", "btn-addipsecsiteconnection",)
ServiceLink(tables.LinkAction): name = "addvpnservice" verbose_name = _("Add VPN Service") url = "horizon:project:vpn:addvpnservice" classes = ("ajax-modal", "btn-addvpnservice",) class AddIPSecSiteConnectionLink(tables.LinkAction):
64
64
65
12
52
Juniper/horizon
openstack_dashboard/dashboards/project/vpn/tables.py
Python
AddIPSecSiteConnectionLink
AddIPSecSiteConnectionLink
48
52
48
48
b94b097956e6faabae21b66fb6c4567e8b0a048c
bigcode/the-stack
train
92097b913a4045c80fbbcc7e
train
class
class AddIPSecPolicyLink(tables.LinkAction): name = "addipsecpolicy" verbose_name = _("Add IPSec Policy") url = "horizon:project:vpn:addipsecpolicy" classes = ("ajax-modal", "btn-addipsecpolicy",)
class AddIPSecPolicyLink(tables.LinkAction):
name = "addipsecpolicy" verbose_name = _("Add IPSec Policy") url = "horizon:project:vpn:addipsecpolicy" classes = ("ajax-modal", "btn-addipsecpolicy",)
PolicyLink(tables.LinkAction): name = "addikepolicy" verbose_name = _("Add IKE Policy") url = "horizon:project:vpn:addikepolicy" classes = ("ajax-modal", "btn-addikepolicy",) class AddIPSecPolicyLink(tables.LinkAction):
64
64
60
11
53
Juniper/horizon
openstack_dashboard/dashboards/project/vpn/tables.py
Python
AddIPSecPolicyLink
AddIPSecPolicyLink
34
38
34
34
b2b6167e137f4079b708017f4f93f8d84fcb0350
bigcode/the-stack
train
7ff69bb3465210d7ca840224
train
class
class AddVPNServiceLink(tables.LinkAction): name = "addvpnservice" verbose_name = _("Add VPN Service") url = "horizon:project:vpn:addvpnservice" classes = ("ajax-modal", "btn-addvpnservice",)
class AddVPNServiceLink(tables.LinkAction):
name = "addvpnservice" verbose_name = _("Add VPN Service") url = "horizon:project:vpn:addvpnservice" classes = ("ajax-modal", "btn-addvpnservice",)
(tables.LinkAction): name = "addipsecpolicy" verbose_name = _("Add IPSec Policy") url = "horizon:project:vpn:addipsecpolicy" classes = ("ajax-modal", "btn-addipsecpolicy",) class AddVPNServiceLink(tables.LinkAction):
64
64
55
10
54
Juniper/horizon
openstack_dashboard/dashboards/project/vpn/tables.py
Python
AddVPNServiceLink
AddVPNServiceLink
41
45
41
41
a43897a0a111dda799bf76a89d06d99dcd1fdec0
bigcode/the-stack
train
611a87395029ce53b49d496b
train
class
class DeleteIPSecPolicyLink(tables.DeleteAction): name = "deleteipsecpolicy" action_present = _("Delete") action_past = _("Scheduled deletion of %(data_type)s") data_type_singular = _("IPSec Policy") data_type_plural = _("IPSec Policies")
class DeleteIPSecPolicyLink(tables.DeleteAction):
name = "deleteipsecpolicy" action_present = _("Delete") action_past = _("Scheduled deletion of %(data_type)s") data_type_singular = _("IPSec Policy") data_type_plural = _("IPSec Policies")
(tables.DeleteAction): name = "deleteikepolicy" action_present = _("Delete") action_past = _("Scheduled deletion of %(data_type)s") data_type_singular = _("IKE Policy") data_type_plural = _("IKE Policies") class DeleteIPSecPolicyLink(tables.DeleteAction):
64
64
62
11
53
Juniper/horizon
openstack_dashboard/dashboards/project/vpn/tables.py
Python
DeleteIPSecPolicyLink
DeleteIPSecPolicyLink
71
76
71
71
659c3b9a56c24cd9c5e8532a14b501c76f65ed66
bigcode/the-stack
train
61b08622fb52764b976276dd
train
class
class IKEPoliciesTable(tables.DataTable): id = tables.Column('id', verbose_name=_('Id'), hidden=True) name = tables.Column("name", verbose_name=_('Name'), link="horizon:project:vpn:ikepolicydetails") auth_algorithm = tables.Column('auth_algorithm', ...
class IKEPoliciesTable(tables.DataTable):
id = tables.Column('id', verbose_name=_('Id'), hidden=True) name = tables.Column("name", verbose_name=_('Name'), link="horizon:project:vpn:ikepolicydetails") auth_algorithm = tables.Column('auth_algorithm', verbose_name=_('Authorization algorithm')...
status_choices=STATUS_CHOICES) class Meta: name = "vpnservicestable" verbose_name = _("VPN Services") table_actions = (AddVPNServiceLink, DeleteVPNServiceLink) row_actions = (DeleteVPNServiceLink,) class IKEPoliciesTable(tables.DataTable):
63
64
159
10
53
Juniper/horizon
openstack_dashboard/dashboards/project/vpn/tables.py
Python
IKEPoliciesTable
IKEPoliciesTable
141
156
141
141
b53df5924c6eca53c05195180963fe6fe476ee93
bigcode/the-stack
train
9cc2ef82418f16685f76fab4
train
class
class DeleteIPSecSiteConnectionLink(tables.DeleteAction): name = "deleteipsecsiteconnection" action_present = _("Delete") action_past = _("Scheduled deletion of %(data_type)s") data_type_singular = _("IPSec Site Connection") data_type_plural = _("IPSec Site Connections")
class DeleteIPSecSiteConnectionLink(tables.DeleteAction):
name = "deleteipsecsiteconnection" action_present = _("Delete") action_past = _("Scheduled deletion of %(data_type)s") data_type_singular = _("IPSec Site Connection") data_type_plural = _("IPSec Site Connections")
): name = "deleteipsecpolicy" action_present = _("Delete") action_past = _("Scheduled deletion of %(data_type)s") data_type_singular = _("IPSec Policy") data_type_plural = _("IPSec Policies") class DeleteIPSecSiteConnectionLink(tables.DeleteAction):
64
64
66
12
52
Juniper/horizon
openstack_dashboard/dashboards/project/vpn/tables.py
Python
DeleteIPSecSiteConnectionLink
DeleteIPSecSiteConnectionLink
79
84
79
79
8ea3bb638738c06e45988e3dfd3a7732f7350ee2
bigcode/the-stack
train
5d0ebe0c88c4c44115d2b6f5
train
class
class DeleteIKEPolicyLink(tables.DeleteAction): name = "deleteikepolicy" action_present = _("Delete") action_past = _("Scheduled deletion of %(data_type)s") data_type_singular = _("IKE Policy") data_type_plural = _("IKE Policies")
class DeleteIKEPolicyLink(tables.DeleteAction):
name = "deleteikepolicy" action_present = _("Delete") action_past = _("Scheduled deletion of %(data_type)s") data_type_singular = _("IKE Policy") data_type_plural = _("IKE Policies")
Link(tables.DeleteAction): name = "deletevpnservice" action_present = _("Delete") action_past = _("Scheduled deletion of %(data_type)s") data_type_singular = _("VPN Service") data_type_plural = _("VPN Services") class DeleteIKEPolicyLink(tables.DeleteAction):
64
64
58
10
54
Juniper/horizon
openstack_dashboard/dashboards/project/vpn/tables.py
Python
DeleteIKEPolicyLink
DeleteIKEPolicyLink
63
68
63
63
efa52477684d5660b3151d5ffa569965c1d541b9
bigcode/the-stack
train
0c201d47826949c300e1b6ef
train
function
@pytest.mark.parametrize(timestamp_inputs, timestamp_cases) def test_end_time(timestamp_string): case = Case() case.set_end_time_now() case.set_end_time(timestamp_string) assert case.get_end_time() == timestamp_string
@pytest.mark.parametrize(timestamp_inputs, timestamp_cases) def test_end_time(timestamp_string):
case = Case() case.set_end_time_now() case.set_end_time(timestamp_string) assert case.get_end_time() == timestamp_string
] @pytest.mark.parametrize(timestamp_inputs, timestamp_cases) def test_start_time(timestamp_string): case = Case() case.set_start_time_now() case.set_start_time(timestamp_string) assert case.get_start_time() == timestamp_string @pytest.mark.parametrize(timestamp_inputs, timestamp_cases) def test_end_ti...
64
64
47
16
47
alextsaihi/ga4gh-testbed-lib
tests/test_unit/test_ga4gh/test_testbed/test_mixins/test_has_timestamps.py
Python
test_end_time
test_end_time
17
22
17
18
de7397a2423572671c8189ef5b95ba4dbb221800
bigcode/the-stack
train
0bb0c8a22f2e202483819c93
train
function
@pytest.mark.parametrize(timestamp_inputs, timestamp_cases) def test_start_time(timestamp_string): case = Case() case.set_start_time_now() case.set_start_time(timestamp_string) assert case.get_start_time() == timestamp_string
@pytest.mark.parametrize(timestamp_inputs, timestamp_cases) def test_start_time(timestamp_string):
case = Case() case.set_start_time_now() case.set_start_time(timestamp_string) assert case.get_start_time() == timestamp_string
.case import Case timestamp_inputs = "timestamp_string" timestamp_cases = [ ("2020-03-10T15:00:00Z"), ("2021-10-22T12:30:45Z") ] @pytest.mark.parametrize(timestamp_inputs, timestamp_cases) def test_start_time(timestamp_string):
64
64
47
16
48
alextsaihi/ga4gh-testbed-lib
tests/test_unit/test_ga4gh/test_testbed/test_mixins/test_has_timestamps.py
Python
test_start_time
test_start_time
10
15
10
11
b97c5ec3dfa9757d58acbf843292efbf263c84ba
bigcode/the-stack
train
13a3b9cc3aeb790c274408b3
train
class
class Gerant(models.Model): nom = models.CharField(max_length=30) prenom = models.CharField(max_length=30) def __str__(self): return '%s %s' % (self.nom, self.prenom)
class Gerant(models.Model):
nom = models.CharField(max_length=30) prenom = models.CharField(max_length=30) def __str__(self): return '%s %s' % (self.nom, self.prenom)
): nom = models.CharField(max_length=30) prenom = models.CharField(max_length=30) fonction = models.CharField(max_length=30) def __str__(self): return '%s %s' % (self.nom, self.prenom) class Gerant(models.Model):
64
64
52
6
58
HamaBarhamou/Gestion_Materiels
Gestion_Materiel/Magasin/models.py
Python
Gerant
Gerant
18
23
18
18
6742c249d74fa0bd2ac0af01382aaf0e60e44745
bigcode/the-stack
train
d032c79e6e876afc3c10dc68
train
class
class Materiel(models.Model): nom = models.CharField(max_length=30) caracteristique = models.CharField(max_length=50) typemateriel = models.ForeignKey(TypeMateriel, on_delete=models.CASCADE) magasin = models.ForeignKey(Magasin, on_delete=models.CASCADE) demandes = models.ManyToManyField(Personne,t...
class Materiel(models.Model):
nom = models.CharField(max_length=30) caracteristique = models.CharField(max_length=50) typemateriel = models.ForeignKey(TypeMateriel, on_delete=models.CASCADE) magasin = models.ForeignKey(Magasin, on_delete=models.CASCADE) demandes = models.ManyToManyField(Personne,through='Demande') def __s...
s' % (self.nom, self.prenom) class Magasin(models.Model): nom = models.CharField(max_length=30) gerant = models.ManyToManyField(Gerant) def __str__(self): return '%s' % (self.nom) class Materiel(models.Model):
64
64
104
6
58
HamaBarhamou/Gestion_Materiels
Gestion_Materiel/Magasin/models.py
Python
Materiel
Materiel
32
40
32
32
4b94632ea4e50cf454c4c2d0fdefbb3cca2f8f6e
bigcode/the-stack
train
c2409b2774039716ac7a0de4
train
class
class Personne(models.Model): nom = models.CharField(max_length=30) prenom = models.CharField(max_length=30) fonction = models.CharField(max_length=30) def __str__(self): return '%s %s' % (self.nom, self.prenom)
class Personne(models.Model):
nom = models.CharField(max_length=30) prenom = models.CharField(max_length=30) fonction = models.CharField(max_length=30) def __str__(self): return '%s %s' % (self.nom, self.prenom)
from django.db import models # Create your models here. class TypeMateriel(models.Model): nom = models.CharField(max_length=30) def __str__(self): return '%s' % (self.nom) class Personne(models.Model):
53
64
63
6
47
HamaBarhamou/Gestion_Materiels
Gestion_Materiel/Magasin/models.py
Python
Personne
Personne
10
16
10
10
b5e50b39ff810897cc5d245e0a8982d0fa4c3c02
bigcode/the-stack
train
ef1e328f7cb67e9cfa6559d5
train
class
class TypeMateriel(models.Model): nom = models.CharField(max_length=30) def __str__(self): return '%s' % (self.nom)
class TypeMateriel(models.Model):
nom = models.CharField(max_length=30) def __str__(self): return '%s' % (self.nom)
from django.db import models # Create your models here. class TypeMateriel(models.Model):
19
64
35
7
12
HamaBarhamou/Gestion_Materiels
Gestion_Materiel/Magasin/models.py
Python
TypeMateriel
TypeMateriel
4
8
4
4
02a8358df9b2b1e41c22a6110157f9d33714e503
bigcode/the-stack
train
e7dc7060750b1159c6a66529
train
class
class Magasin(models.Model): nom = models.CharField(max_length=30) gerant = models.ManyToManyField(Gerant) def __str__(self): return '%s' % (self.nom)
class Magasin(models.Model):
nom = models.CharField(max_length=30) gerant = models.ManyToManyField(Gerant) def __str__(self): return '%s' % (self.nom)
.nom, self.prenom) class Gerant(models.Model): nom = models.CharField(max_length=30) prenom = models.CharField(max_length=30) def __str__(self): return '%s %s' % (self.nom, self.prenom) class Magasin(models.Model):
64
64
47
6
58
HamaBarhamou/Gestion_Materiels
Gestion_Materiel/Magasin/models.py
Python
Magasin
Magasin
25
30
25
25
60bad9a74c29bea716c4a1b243cbdbcb287a50ca
bigcode/the-stack
train
03ed0b65b7179a934e724252
train
class
class Demande(models.Model): person = models.ForeignKey(Personne, on_delete=models.CASCADE) materiel = models.ForeignKey(Materiel, on_delete=models.CASCADE) date = models.DateField() motif_demande = models.CharField(max_length=64) def __str__(self): return '%s %s' % (self.date, self.motif_d...
class Demande(models.Model):
person = models.ForeignKey(Personne, on_delete=models.CASCADE) materiel = models.ForeignKey(Materiel, on_delete=models.CASCADE) date = models.DateField() motif_demande = models.CharField(max_length=64) def __str__(self): return '%s %s' % (self.date, self.motif_demande)
) magasin = models.ForeignKey(Magasin, on_delete=models.CASCADE) demandes = models.ManyToManyField(Personne,through='Demande') def __str__(self): return '%s %s' % (self.nom, self.caracteristique) class Demande(models.Model):
64
64
81
6
58
HamaBarhamou/Gestion_Materiels
Gestion_Materiel/Magasin/models.py
Python
Demande
Demande
42
49
42
42
f01bb327752f11d800d0f67621e38ca2025d45ed
bigcode/the-stack
train
14e4b23fc34253eaef15614c
train
class
class TestHysteresisDriver(TestDriver): def test_script(self): hd = oc.HysteresisDriver() script = hd._script(self.system, Hmin=(0, 0, 0), Hmax=(10, 10, 10), n=10) assert script[0] == "#" assert script[-1] == "1" assert script.count("#") == 6 ...
class TestHysteresisDriver(TestDriver):
def test_script(self): hd = oc.HysteresisDriver() script = hd._script(self.system, Hmin=(0, 0, 0), Hmax=(10, 10, 10), n=10) assert script[0] == "#" assert script[-1] == "1" assert script.count("#") == 6 assert script.count("Specify") == 4...
import os import glob import shutil import pytest import oommfc as oc from .test_driver import TestDriver class TestHysteresisDriver(TestDriver):
36
157
525
9
26
gamdow/oommfc
oommfc/tests/test_hysteresisdriver.py
Python
TestHysteresisDriver
TestHysteresisDriver
9
65
9
9
1c5db6b41d8e699b4b32c773733bf82f6672fa7f
bigcode/the-stack
train
3fd483122fd2acdc7ccf8984
train
class
class TestPrunedModel(test_case.TestCase): def setUp(self): super(TestPrunedModel, self).setUp() self.model = InnerProductModel(10) self.example = torch.ones(1, 10) self.label = torch.ones(1) * 40.0 self.optimizer = torch.optim.SGD(self.model.parameters(), lr=0.01) def t...
class TestPrunedModel(test_case.TestCase):
def setUp(self): super(TestPrunedModel, self).setUp() self.model = InnerProductModel(10) self.example = torch.ones(1, 10) self.label = torch.ones(1) * 40.0 self.optimizer = torch.optim.SGD(self.model.parameters(), lr=0.01) def test_mask_with_ones_forward(self): m...
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import os import torch from foundations import paths from foundations.step import Step from pruning.mask import Mask from p...
103
256
1,117
10
92
chenw23/open_lth
pruning/test/test_pruned_model.py
Python
TestPrunedModel
TestPrunedModel
18
131
18
18
2c9924ed78031125c00fe69553d7a7cb8cbc70f8
bigcode/the-stack
train
fc06d0007b20363284033cdc
train
function
def convert_df_to_dict(x): """ Converts a pandas.DataFrame to a dict""" check_type(x=x,allowed=pd.DataFrame) x = x.to_dict(orient="index") x = {k: pd.DataFrame().from_dict(data=v, orient="index").T.rename(index={0:k}) for k,v in x.items()} return x
def convert_df_to_dict(x):
""" Converts a pandas.DataFrame to a dict""" check_type(x=x,allowed=pd.DataFrame) x = x.to_dict(orient="index") x = {k: pd.DataFrame().from_dict(data=v, orient="index").T.rename(index={0:k}) for k,v in x.items()} return x
dfs = list(x.keys()), list(x.values()) # Concat all dataframes x = pd.concat(objs=dfs, axis=0, ignore_index=True, sort=False) # Overwrite index x.index = keys return x def convert_df_to_dict(x):
64
64
79
7
56
muhlbach/bodyguard
src/bodyguard/convert.py
Python
convert_df_to_dict
convert_df_to_dict
28
35
28
28
958d7ec2b125a6840dd4cea02aceb398208b9050
bigcode/the-stack
train
5dd10b9c260e275492573970
train
function
def convert_dict_to_df(x): """ Converts a dictionary to a pandas.DataFrame """ check_type(x=x,allowed=dict) try: x = pd.DataFrame().from_dict(data=x,orient="index") except ValueError: # This happens because we have already named the index keys, dfs = list(x.keys()), list...
def convert_dict_to_df(x):
""" Converts a dictionary to a pandas.DataFrame """ check_type(x=x,allowed=dict) try: x = pd.DataFrame().from_dict(data=x,orient="index") except ValueError: # This happens because we have already named the index keys, dfs = list(x.keys()), list(x.values()) ...
#------------------------------------------------------------------------------ # Libraries #------------------------------------------------------------------------------ # Standard import pandas as pd from .sanity_check import check_type #------------------------------------------------------------------------------ ...
38
64
124
7
31
muhlbach/bodyguard
src/bodyguard/convert.py
Python
convert_dict_to_df
convert_dict_to_df
10
26
10
10
c21f819f061f1e95e549d895d2d5ea705d2bb170
bigcode/the-stack
train
c7a4d65c442f2a40e4533eec
train
function
def deal_pic(x, y, left, right): with Image.open(PIC_PATH + "\\" + "001.png") as im: img = im.crop((x, y, left, right)) img.save(PIC_PATH + "\\" + "001-1.png") im.close() img.close() with Image.open(PIC_PATH + "\\" + "001-1.png") as img_pi...
def deal_pic(x, y, left, right):
with Image.open(PIC_PATH + "\\" + "001.png") as im: img = im.crop((x, y, left, right)) img.save(PIC_PATH + "\\" + "001-1.png") im.close() img.close() with Image.open(PIC_PATH + "\\" + "001-1.png") as img_pic: imgry = img_pi...
from utils.config import PIC_PATH from PIL import Image import pytesseract def deal_pic(x, y, left, right):
28
64
128
11
16
wacky1992/Test_framework
utils/deal_imgs.py
Python
deal_pic
deal_pic
6
19
6
6
4c4cc16b0181a7a62bca65d03ab6d01d5df41a76
bigcode/the-stack
train
cbe6ae475454369adc3b892c
train
class
class DataIndexableCol(DataCol): """ represent a data column that can be indexed """ is_data_indexable = True def validate_names(self): if not Index(self.values).is_object(): raise ValueError("cannot have non-object label DataIndexableCol") def get_atom_string(self, block, itemsiz...
class DataIndexableCol(DataCol):
""" represent a data column that can be indexed """ is_data_indexable = True def validate_names(self): if not Index(self.values).is_object(): raise ValueError("cannot have non-object label DataIndexableCol") def get_atom_string(self, block, itemsize): return _tables().Strin...
_attr(self): """ set the data for this column """ setattr(self.attrs, self.kind_attr, self.values) setattr(self.attrs, self.meta_attr, self.meta) if self.dtype is not None: setattr(self.attrs, self.dtype_attr, self.dtype) class DataIndexableCol(DataCol):
64
64
145
8
56
getschomp/pandas
pandas/io/pytables.py
Python
DataIndexableCol
DataIndexableCol
2,261
2,280
2,261
2,262
40afd364d5f3aae0bf8498a0419d0eb940a3606c
bigcode/the-stack
train
c63fb4567adbf74b6567a4a1
train
function
def _is_metadata_of(group, parent_group): """Check if a given group is a metadata group for a given parent_group.""" if group._v_depth <= parent_group._v_depth: return False current = group while current._v_depth > 1: parent = current._v_parent if parent == parent_group and curr...
def _is_metadata_of(group, parent_group):
"""Check if a given group is a metadata group for a given parent_group.""" if group._v_depth <= parent_group._v_depth: return False current = group while current._v_depth > 1: parent = current._v_parent if parent == parent_group and current._v_name == 'meta': return ...
return store.select(key, auto_close=auto_close, **kwargs) except (ValueError, TypeError): # if there is an error, close the store try: store.close() except AttributeError: pass raise def _is_metadata_of(group, parent_group):
64
64
98
10
53
getschomp/pandas
pandas/io/pytables.py
Python
_is_metadata_of
_is_metadata_of
408
419
408
408
5cdaf38191ae141a58ebe23217c140894a18469f
bigcode/the-stack
train
f3b260c6301431acc476dc0d
train
class
class WORMTable(Table): """ a write-once read-many table: this format DOES NOT ALLOW appending to a table. writing is a one-time operation the data are stored in a format that allows for searching the data on disk """ table_type = u'worm' def read(self, **kwargs): """ re...
class WORMTable(Table):
""" a write-once read-many table: this format DOES NOT ALLOW appending to a table. writing is a one-time operation the data are stored in a format that allows for searching the data on disk """ table_type = u'worm' def read(self, **kwargs): """ read the indices and the in...
(a.convert(c[start:stop], nan_rep=self.nan_rep, encoding=self.encoding, errors=self.errors ).take_data(), ...
64
64
178
6
58
getschomp/pandas
pandas/io/pytables.py
Python
WORMTable
WORMTable
3,834
3,852
3,834
3,835
0d779394ab7fbd21a1391b73af28f687af38fe2b
bigcode/the-stack
train
bb9dcfa6d65814ef2974c891
train
class
class AppendableMultiSeriesTable(AppendableSeriesTable): """ support the new appendable table formats """ pandas_kind = u'series_table' table_type = u'appendable_multiseries' def write(self, obj, **kwargs): """ we are going to write this as a frame table """ name = obj.name or 'values' ...
class AppendableMultiSeriesTable(AppendableSeriesTable):
""" support the new appendable table formats """ pandas_kind = u'series_table' table_type = u'appendable_multiseries' def write(self, obj, **kwargs): """ we are going to write this as a frame table """ name = obj.name or 'values' obj, self.levels = self.validate_multiindex(obj) ...
) if is_multi_index: s.set_index(self.levels, inplace=True) s = s.iloc[:, 0] # remove the default name if s.name == 'values': s.name = None return s class AppendableMultiSeriesTable(AppendableSeriesTable):
64
64
126
12
51
getschomp/pandas
pandas/io/pytables.py
Python
AppendableMultiSeriesTable
AppendableMultiSeriesTable
4,320
4,332
4,320
4,320
2fd7d3c2e487e957d9872d2ab6656486faafd86d
bigcode/the-stack
train
e740c1caf7ec2569a8435fd6
train
function
def get_store(path, **kwargs): """ Backwards compatible alias for ``HDFStore`` """ warnings.warn( "get_store is deprecated and be " "removed in a future version\n" "HDFStore(path, **kwargs) is the replacement", FutureWarning, stacklevel=6) return HDFStore(path, *...
def get_store(path, **kwargs):
""" Backwards compatible alias for ``HDFStore`` """ warnings.warn( "get_store is deprecated and be " "removed in a future version\n" "HDFStore(path, **kwargs) is the replacement", FutureWarning, stacklevel=6) return HDFStore(path, **kwargs)
complib, **kwargs) if s.is_table and index: s.create_index(columns=index) def _read_group(self, group, **kwargs): s = self._create_storer(group) s.infer_axes() return s.read(**kwargs) def get_store(path, **kwargs):
64
64
79
8
56
getschomp/pandas
pandas/io/pytables.py
Python
get_store
get_store
1,426
1,436
1,426
1,426
a8de4a65dcee199e0e638a9c0f3ccf022563e467
bigcode/the-stack
train