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
e6446f5b17c92e9bda9ae915
train
function
def spectral_helper(x, NFFT=None, Fs=None, detrend_func=None, window=None, noverlap=None, pad_to=None, scale_by_freq=None, mode=None, skip_fft=False): if Fs is None: Fs = 2 if noverlap is None: noverlap = 0 if detrend_func is None: detrend_func...
def spectral_helper(x, NFFT=None, Fs=None, detrend_func=None, window=None, noverlap=None, pad_to=None, scale_by_freq=None, mode=None, skip_fft=False):
if Fs is None: Fs = 2 if noverlap is None: noverlap = 0 if detrend_func is None: detrend_func = detrend_none if window is None: window = window_hanning # if NFFT is set to None use the whole signal if NFFT is None: NFFT = 256 if mode is None or mode ...
#!/usr/bin/env python3 import argparse import concurrent.futures import gzip import os import time import numpy as np from matplotlib.mlab import detrend from matplotlib.mlab import detrend_none from matplotlib.mlab import stride_windows from matplotlib.mlab import window_hanning import matplotlib.pyplot as plt from s...
167
256
987
43
123
cglewis/gamutRF
gamutrf/specgram.py
Python
spectral_helper
spectral_helper
21
126
21
23
86317555a0b5b3544ecd94c39a039acc4d3435b9
bigcode/the-stack
train
87071d2c875d47cdda817d34
train
function
def specgram(x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None, noverlap=None, xextent=None, pad_to=None, scale_by_freq=None, mode=None, scale=None, skip_fft=False, **kwargs): if NFFT is None: NFFT = 256 # same default as in mlab.spec...
def specgram(x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None, noverlap=None, xextent=None, pad_to=None, scale_by_freq=None, mode=None, scale=None, skip_fft=False, **kwargs):
if NFFT is None: NFFT = 256 # same default as in mlab.specgram() if Fc is None: Fc = 0 # same default as in mlab._spectral_helper() if noverlap is None: noverlap = 128 # same default as in mlab.specgram() if Fs is None: Fs = 2 # same default as in mlab._spectral_helpe...
result = np.apply_along_axis(np.real, 1, result) if lastresult is None: lastresult = result else: lastresult = np.hstack((lastresult, result)) t_x = lastresult.shape[0] * lastresult.shape[1] t = np.arange(NFFT/2, t_x - NFFT/2 + 1, NFFT - noverlap)/Fs return lastres...
159
159
533
58
100
cglewis/gamutRF
gamutrf/specgram.py
Python
specgram
specgram
129
186
129
134
9538791a401a0d38e96a5c3f48e203e565bdd676
bigcode/the-stack
train
7a8f8f5407b247864dd598ac
train
function
def process_all_recordings(args): if os.path.isdir(args.recording): recordings = get_nondot_files(args.recording) else: recordings = [args.recording] if args.workers == 1: for recording in sorted(recordings): process_recording(args, recording) else: with concu...
def process_all_recordings(args):
if os.path.isdir(args.recording): recordings = get_nondot_files(args.recording) else: recordings = [args.recording] if args.workers == 1: for recording in sorted(recordings): process_recording(args, recording) else: with concurrent.futures.ProcessPoolExecutor(...
sample_len) plot_spectrogram( samples, spectrogram_filename, args.nfft, sample_rate, freq_center, args.cmap, args.ytics, args.bare, args.noverlap, args.skip_fft) def process_all_recordings(args):
64
64
109
7
57
cglewis/gamutRF
gamutrf/specgram.py
Python
process_all_recordings
process_all_recordings
280
292
280
280
6519f1ceed8767aebbe4103c6d7ddc271300d56e
bigcode/the-stack
train
fbe560a2179b5114b989ab88
train
function
def plot_spectrogram(x, spectrogram_filename, nfft, fs, fc, cmap, ytics, bare, noverlap, skip_fft): fig = plt.figure() fig.set_size_inches(11, 8) axes = fig.add_subplot(111) axes.set_xlabel('time (s)') axes.set_ylabel('freq (MHz)') Z, extent = specgram( x, NFFT=nfft, Fs=fs, cmap=cmap, Fc...
def plot_spectrogram(x, spectrogram_filename, nfft, fs, fc, cmap, ytics, bare, noverlap, skip_fft):
fig = plt.figure() fig.set_size_inches(11, 8) axes = fig.add_subplot(111) axes.set_xlabel('time (s)') axes.set_ylabel('freq (MHz)') Z, extent = specgram( x, NFFT=nfft, Fs=fs, cmap=cmap, Fc=fc, noverlap=noverlap, skip_fft=skip_fft) im = axes.imshow(Z, cmap=cmap, extent=extent, origin=...
_samples == 0: break x1d = np.frombuffer(sample_buffer, dtype=sample_dtype, count=buffered_samples) yield x1d['i'] + np.csingle(1j) * x1d['q'] def plot_spectrogram(x, spectrogram_filename, nfft, fs, fc, cmap, ytics, bare, noverlap, skip_fft):
86
86
288
32
54
cglewis/gamutRF
gamutrf/specgram.py
Python
plot_spectrogram
plot_spectrogram
221
248
221
221
f9f5700fdaaafa947cc6632ef98c13813cd10f59
bigcode/the-stack
train
187fea473fb305328531ca83
train
function
def read_recording(filename, sample_rate, sample_dtype, sample_len): reader = get_reader(filename) with reader(filename) as infile: while True: sample_buffer = infile.read(sample_rate * sample_len) buffered_samples = int(len(sample_buffer) / sample_len) if buffered_sa...
def read_recording(filename, sample_rate, sample_dtype, sample_len):
reader = get_reader(filename) with reader(filename) as infile: while True: sample_buffer = infile.read(sample_rate * sample_len) buffered_samples = int(len(sample_buffer) / sample_len) if buffered_samples == 0: break x1d = np.frombuffer(sam...
, 'rb')) def default_reader(x): return open(x, 'rb') if filename.endswith('.gz'): return gzip_reader if filename.endswith('.zst'): return zst_reader return default_reader def read_recording(filename, sample_rate, sample_dtype, sample_len):
64
64
116
15
48
cglewis/gamutRF
gamutrf/specgram.py
Python
read_recording
read_recording
208
218
208
208
2591d33d09cdb433fc37e297763e4fe3e722309b
bigcode/the-stack
train
0332996a2f61359118de028a
train
function
def main(): parser = argparse.ArgumentParser( description='draw spectrogram from recording') parser.add_argument('recording', default='', type=str, help='filename of recording, or directory') parser.add_argument('--nfft', default=int(2048), type=int, h...
def main():
parser = argparse.ArgumentParser( description='draw spectrogram from recording') parser.add_argument('recording', default='', type=str, help='filename of recording, or directory') parser.add_argument('--nfft', default=int(2048), type=int, help='number ...
, freq_center, args.cmap, args.ytics, args.bare, args.noverlap, args.skip_fft) def process_all_recordings(args): if os.path.isdir(args.recording): recordings = get_nondot_files(args.recording) else: recordings = [args.recording] if args.worke...
144
144
481
3
141
cglewis/gamutRF
gamutrf/specgram.py
Python
main
main
295
332
295
295
7cdb9ec1ccfb9c3a2ff93da53f4c261f2e25d6b8
bigcode/the-stack
train
47e646e84afe80ecb169607a
train
function
def get_reader(filename): def gzip_reader(x): return gzip.open(x, 'rb') def zst_reader(x): return zstandard.ZstdDecompressor().stream_reader(open(x, 'rb')) def default_reader(x): return open(x, 'rb') if filename.endswith('.gz'): return gzip_reader if filename.ends...
def get_reader(filename):
def gzip_reader(x): return gzip.open(x, 'rb') def zst_reader(x): return zstandard.ZstdDecompressor().stream_reader(open(x, 'rb')) def default_reader(x): return open(x, 'rb') if filename.endswith('.gz'): return gzip_reader if filename.endswith('.zst'): retur...
freqs /= 1e6 extent = xmin, xmax, freqs[0], freqs[-1] if 'origin' in kwargs: raise TypeError('specgram() got an unexpected keyword argument ' "'origin'") return Z, extent def get_reader(filename):
64
64
90
5
58
cglewis/gamutRF
gamutrf/specgram.py
Python
get_reader
get_reader
189
205
189
190
c78e3aad905ef49abe349c53b699cd37b8179492
bigcode/the-stack
train
1744c559beaa065ede46b609
train
class
class WorkflowManagementTestCase(SeleniumTestCase): ensure_registered = True @selenium_test def test_import_from_url(self): self.workflow_index_open() self._workflow_import_from_url() table_elements = self.workflow_index_table_elements() assert len(table_elements) == 1 ...
class WorkflowManagementTestCase(SeleniumTestCase):
ensure_registered = True @selenium_test def test_import_from_url(self): self.workflow_index_open() self._workflow_import_from_url() table_elements = self.workflow_index_table_elements() assert len(table_elements) == 1 new_workflow = table_elements[0].find_element_b...
from .framework import ( retry_assertion_during_transitions, selenium_test, SeleniumTestCase, ) class WorkflowManagementTestCase(SeleniumTestCase):
34
248
828
10
24
tdans1/Use-Galaxy
test/selenium_tests/test_workflow_management.py
Python
WorkflowManagementTestCase
WorkflowManagementTestCase
8
117
8
9
5d795288370c601dd0d6da08cd3efabe1124d3be
bigcode/the-stack
train
81355153f08823c5b022d457
train
function
def run_edges(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(edges=sys.stdout, precision=args.precision)
def run_edges(args):
tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(edges=sys.stdout, precision=args.precision)
(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(individuals=sys.stdout, precision=args.precision) def run_nodes(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(nodes=sys.stdout, precision=args.precision) def run_edges(args):
64
64
30
5
59
brianzhang01/tskit
python/tskit/cli.py
Python
run_edges
run_edges
101
103
101
101
77d8c90515a9d4b4900805d5d7c502aad5962823
bigcode/the-stack
train
c0519a746cb900289faac8d9
train
function
def run_individuals(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(individuals=sys.stdout, precision=args.precision)
def run_individuals(args):
tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(individuals=sys.stdout, precision=args.precision)
Duplicate mutation positions in the source file detected.\n\n" "This is not supported in the current file format. Running \"upgrade -d\" " "will remove these duplicate positions. However, this will result in loss " "of data from the original file!") def run_individuals(args):
63
64
34
7
56
brianzhang01/tskit
python/tskit/cli.py
Python
run_individuals
run_individuals
91
93
91
91
e6c07a49b6c636b58d6b986270231cf575a59ae0
bigcode/the-stack
train
8d2c9f2467d72081cd0e863a
train
function
def run_trees(args): ts = load_tree_sequence(args.tree_sequence) for tree in ts.trees(): print("tree {}:".format(tree.index)) print(" num_sites: {}".format(tree.num_sites)) left, right = tree.interval print(" interval: ({0:.{2}f}, {1:.{2}f})".format(left, right, args.precision...
def run_trees(args):
ts = load_tree_sequence(args.tree_sequence) for tree in ts.trees(): print("tree {}:".format(tree.index)) print(" num_sites: {}".format(tree.num_sites)) left, right = tree.interval print(" interval: ({0:.{2}f}, {1:.{2}f})".format(left, right, args.precision)) if args.dr...
ts.num_sites) print("mutations: ", ts.num_mutations) print("migrations: ", ts.num_migrations) print("populations: ", ts.num_populations) print("provenances: ", ts.num_provenances) def run_trees(args):
64
64
102
6
58
brianzhang01/tskit
python/tskit/cli.py
Python
run_trees
run_trees
68
76
68
68
e851cf889df306c8bd02c411ddaa641eb8076a13
bigcode/the-stack
train
b786d1224b81a357674ab3b1
train
function
def run_info(args): ts = load_tree_sequence(args.tree_sequence) print("sequence_length: ", ts.sequence_length) print("trees: ", ts.num_trees) print("samples: ", ts.num_samples) print("individuals: ", ts.num_individuals) print("nodes: ", ts.num_nodes) print("ed...
def run_info(args):
ts = load_tree_sequence(args.tree_sequence) print("sequence_length: ", ts.sequence_length) print("trees: ", ts.num_trees) print("samples: ", ts.num_samples) print("individuals: ", ts.num_individuals) print("nodes: ", ts.num_nodes) print("edges: ", ts...
.signal(signal.SIGPIPE, signal.SIG_DFL) def exit(message): sys.exit(message) def load_tree_sequence(path): try: return tskit.load(path) except tskit.FileFormatError as e: exit("Load error: {}".format(e)) def run_info(args):
64
64
150
5
59
brianzhang01/tskit
python/tskit/cli.py
Python
run_info
run_info
53
65
53
53
4151f05239b61de27b20745f8c19a170f9958277
bigcode/the-stack
train
a841aafe656e9777bcb97226
train
function
def run_fasta(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.write_fasta(sys.stdout, wrap_width=args.wrap)
def run_fasta(args):
tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.write_fasta(sys.stdout, wrap_width=args.wrap)
in tree_sequence.provenances(): d = json.loads(provenance.record) print("id={}, timestamp={}, record={}".format( provenance.id, provenance.timestamp, json.dumps(d, indent=4))) else: tree_sequence.dump_text(provenances=sys.stdout) def run_fasta(args):
64
64
31
6
58
brianzhang01/tskit
python/tskit/cli.py
Python
run_fasta
run_fasta
132
134
132
132
a688186da01befbcc2efd2ae3276033c96b63300
bigcode/the-stack
train
1a56a25758d0475fa4c55e88
train
function
def run_mutations(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(mutations=sys.stdout, precision=args.precision)
def run_mutations(args):
tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(mutations=sys.stdout, precision=args.precision)
(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(edges=sys.stdout, precision=args.precision) def run_sites(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(sites=sys.stdout, precision=args.precision) def run_mutations(args):
64
64
32
6
58
brianzhang01/tskit
python/tskit/cli.py
Python
run_mutations
run_mutations
111
113
111
111
f55a3f563357d5489bbcc21a5161e334e096cfcf
bigcode/the-stack
train
d1f9f4a0030b7fabc4d36274
train
function
def set_sigpipe_handler(): if os.name == "posix": # Set signal handler for SIGPIPE to quietly kill the program. signal.signal(signal.SIGPIPE, signal.SIG_DFL)
def set_sigpipe_handler():
if os.name == "posix": # Set signal handler for SIGPIPE to quietly kill the program. signal.signal(signal.SIGPIPE, signal.SIG_DFL)
TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """ Command line utilities for tskit. """ import argparse import json import os import signal import sys import tskit def set_sigpipe_handler():
64
64
43
6
57
brianzhang01/tskit
python/tskit/cli.py
Python
set_sigpipe_handler
set_sigpipe_handler
36
39
36
36
2e72731c0c838369996cd8e1174e4a8920c9a3a8
bigcode/the-stack
train
736487f661e7a287101212ae
train
function
def exit(message): sys.exit(message)
def exit(message):
sys.exit(message)
import json import os import signal import sys import tskit def set_sigpipe_handler(): if os.name == "posix": # Set signal handler for SIGPIPE to quietly kill the program. signal.signal(signal.SIGPIPE, signal.SIG_DFL) def exit(message):
64
64
9
4
60
brianzhang01/tskit
python/tskit/cli.py
Python
exit
exit
42
43
42
42
172a6c2bcc06a97a63341aa707162924fd453f1c
bigcode/the-stack
train
d433b859c784bac8cd8159e2
train
function
def run_upgrade(args): try: tree_sequence = tskit.load_legacy(args.source, args.remove_duplicate_positions) tree_sequence.dump(args.destination) except tskit.DuplicatePositionsError: exit( "Error: Duplicate mutation positions in the source file detected.\n\n" "Thi...
def run_upgrade(args):
try: tree_sequence = tskit.load_legacy(args.source, args.remove_duplicate_positions) tree_sequence.dump(args.destination) except tskit.DuplicatePositionsError: exit( "Error: Duplicate mutation positions in the source file detected.\n\n" "This is not supported in t...
(tree.num_sites)) left, right = tree.interval print(" interval: ({0:.{2}f}, {1:.{2}f})".format(left, right, args.precision)) if args.draw: print(tree.draw(format="unicode")) def run_upgrade(args):
63
64
106
5
58
brianzhang01/tskit
python/tskit/cli.py
Python
run_upgrade
run_upgrade
79
88
79
79
3ab20e23c486ad248c4812859f1b4478ebd2dbd0
bigcode/the-stack
train
9aaef88f6437422ea2765fbf
train
function
def run_provenances(args): tree_sequence = load_tree_sequence(args.tree_sequence) if args.human: for provenance in tree_sequence.provenances(): d = json.loads(provenance.record) print("id={}, timestamp={}, record={}".format( provenance.id, provenance.timestamp, js...
def run_provenances(args):
tree_sequence = load_tree_sequence(args.tree_sequence) if args.human: for provenance in tree_sequence.provenances(): d = json.loads(provenance.record) print("id={}, timestamp={}, record={}".format( provenance.id, provenance.timestamp, json.dumps(d, indent=4))) ...
_mutations(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(mutations=sys.stdout, precision=args.precision) def run_populations(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(populations=sys.stdout) def run_provenances(args):
64
64
85
7
57
brianzhang01/tskit
python/tskit/cli.py
Python
run_provenances
run_provenances
121
129
121
121
730bbb5a5f506a0f3118f1875ba42fd9b1749880
bigcode/the-stack
train
81e09c0b8df18288ac7aca16
train
function
def run_vcf(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.write_vcf(sys.stdout, ploidy=args.ploidy)
def run_vcf(args):
tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.write_vcf(sys.stdout, ploidy=args.ploidy)
.id, provenance.timestamp, json.dumps(d, indent=4))) else: tree_sequence.dump_text(provenances=sys.stdout) def run_fasta(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.write_fasta(sys.stdout, wrap_width=args.wrap) def run_vcf(args):
64
64
34
6
58
brianzhang01/tskit
python/tskit/cli.py
Python
run_vcf
run_vcf
137
139
137
137
76e3713377224c1b74c1f21cd04c52ceb05246ed
bigcode/the-stack
train
d476915dec90f2133ae6ae77
train
function
def tskit_main(arg_list=None): set_sigpipe_handler() parser = get_tskit_parser() args = parser.parse_args(arg_list) args.runner(args)
def tskit_main(arg_list=None):
set_sigpipe_handler() parser = get_tskit_parser() args = parser.parse_args(arg_list) args.runner(args)
add_tree_sequence_argument(parser) parser.add_argument( "-H", "--human", action="store_true", help="Print out the provenances in a human readable format") parser.set_defaults(runner=run_provenances) return top_parser def tskit_main(arg_list=None):
64
64
38
9
54
brianzhang01/tskit
python/tskit/cli.py
Python
tskit_main
tskit_main
266
270
266
266
88f8656c18c8ae6aef1a3d4c5202a880522bf5ab
bigcode/the-stack
train
4ebd4bbfa4af0d3af0d21d7b
train
function
def add_precision_argument(parser): parser.add_argument( "--precision", "-p", type=int, default=6, help="The number of decimal places to print in records")
def add_precision_argument(parser):
parser.add_argument( "--precision", "-p", type=int, default=6, help="The number of decimal places to print in records")
cf(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.write_vcf(sys.stdout, ploidy=args.ploidy) def add_tree_sequence_argument(parser): parser.add_argument( "tree_sequence", help="The tskit tree sequence file") def add_precision_argument(parser):
64
64
38
6
58
brianzhang01/tskit
python/tskit/cli.py
Python
add_precision_argument
add_precision_argument
147
150
147
147
d5a43fa20f836bf5b378c364536549d7bcf76fa6
bigcode/the-stack
train
06522b6770d1a74196475aa1
train
function
def run_sites(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(sites=sys.stdout, precision=args.precision)
def run_sites(args):
tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(sites=sys.stdout, precision=args.precision)
run_nodes(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(nodes=sys.stdout, precision=args.precision) def run_edges(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(edges=sys.stdout, precision=args.precision) def run_sites(arg...
64
64
31
5
59
brianzhang01/tskit
python/tskit/cli.py
Python
run_sites
run_sites
106
108
106
106
474eda6b978a273023b8a2b388659f3249700c9a
bigcode/the-stack
train
8b87b6630e103b3f64481408
train
function
def add_tree_sequence_argument(parser): parser.add_argument( "tree_sequence", help="The tskit tree sequence file")
def add_tree_sequence_argument(parser):
parser.add_argument( "tree_sequence", help="The tskit tree sequence file")
_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.write_fasta(sys.stdout, wrap_width=args.wrap) def run_vcf(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.write_vcf(sys.stdout, ploidy=args.ploidy) def add_tree_sequence_argument(parser):
64
64
27
7
57
brianzhang01/tskit
python/tskit/cli.py
Python
add_tree_sequence_argument
add_tree_sequence_argument
142
144
142
142
cd76a49e10d0ea938c9bebea154edb6f3f19313d
bigcode/the-stack
train
b2831854117d62977198fa76
train
function
def get_tskit_parser(): top_parser = argparse.ArgumentParser( description="Command line interface for tskit.") top_parser.add_argument( "-V", "--version", action='version', version='%(prog)s {}'.format(tskit.__version__)) subparsers = top_parser.add_subparsers(dest="subcommand") ...
def get_tskit_parser():
top_parser = argparse.ArgumentParser( description="Command line interface for tskit.") top_parser.add_argument( "-V", "--version", action='version', version='%(prog)s {}'.format(tskit.__version__)) subparsers = top_parser.add_subparsers(dest="subcommand") subparsers.required = Tr...
.stdout, precision=args.precision) def run_populations(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(populations=sys.stdout) def run_provenances(args): tree_sequence = load_tree_sequence(args.tree_sequence) if args.human: for provenance in tree_sequenc...
256
256
869
7
249
brianzhang01/tskit
python/tskit/cli.py
Python
get_tskit_parser
get_tskit_parser
153
263
153
153
f322fb054e0264de90a9fbb74186b12862f33971
bigcode/the-stack
train
f1c283a78c3c3f5bd1616641
train
function
def run_populations(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(populations=sys.stdout)
def run_populations(args):
tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(populations=sys.stdout)
tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(sites=sys.stdout, precision=args.precision) def run_mutations(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(mutations=sys.stdout, precision=args.precision) def run_populations(args):
64
64
27
6
58
brianzhang01/tskit
python/tskit/cli.py
Python
run_populations
run_populations
116
118
116
116
d825195ea918349f3e9f661d9c26183fa0ed531f
bigcode/the-stack
train
ed4cdb1d687168c5a52e419d
train
function
def run_nodes(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(nodes=sys.stdout, precision=args.precision)
def run_nodes(args):
tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(nodes=sys.stdout, precision=args.precision)
"will remove these duplicate positions. However, this will result in loss " "of data from the original file!") def run_individuals(args): tree_sequence = load_tree_sequence(args.tree_sequence) tree_sequence.dump_text(individuals=sys.stdout, precision=args.precision) def run_nodes(args):
64
64
30
5
59
brianzhang01/tskit
python/tskit/cli.py
Python
run_nodes
run_nodes
96
98
96
96
84dd924138443de1ebd28b3ff2adc383de50aac5
bigcode/the-stack
train
e7159f6979f340e0a0099839
train
function
def load_tree_sequence(path): try: return tskit.load(path) except tskit.FileFormatError as e: exit("Load error: {}".format(e))
def load_tree_sequence(path):
try: return tskit.load(path) except tskit.FileFormatError as e: exit("Load error: {}".format(e))
import tskit def set_sigpipe_handler(): if os.name == "posix": # Set signal handler for SIGPIPE to quietly kill the program. signal.signal(signal.SIGPIPE, signal.SIG_DFL) def exit(message): sys.exit(message) def load_tree_sequence(path):
64
64
38
6
58
brianzhang01/tskit
python/tskit/cli.py
Python
load_tree_sequence
load_tree_sequence
46
50
46
46
ac1b3f35e0e902c4ff14df408cb7a5d0d7358ba6
bigcode/the-stack
train
33dd3f9190c2d512ad2dd686
train
class
class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0012_alter_user_first_name_max_length'), ] operations = [ migrations.CreateModel( name='Snippet', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key...
class Migration(migrations.Migration):
initial = True dependencies = [ ('auth', '0012_alter_user_first_name_max_length'), ] operations = [ migrations.CreateModel( name='Snippet', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID...
# Generated by Django 4.0 on 2021-12-30 10:19 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
43
66
223
7
35
SimonOkello/codewithsimon-api
Codewithsimon/apps/snippets/migrations/0001_initial.py
Python
Migration
Migration
7
30
7
8
fba5f6083682fca1f146dc468ef9e1f3114321d5
bigcode/the-stack
train
a20767e0b6376f62c7c4ce30
train
function
def RndState(): TX=["Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "M...
def RndState():
TX=["Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebras...
from random import randint def RndState():
10
64
210
5
4
JupyterJones/COVID-19-Jupyter-Notebooks
RandomState.py
Python
RndState
RndState
2
5
2
2
16058d149203981d8bef7bbce3bc28f95d304498
bigcode/the-stack
train
3f3713457581eec714263e43
train
function
def zopeTearDown(test): rdb.Session.remove() cleanup.cleanUp()
def zopeTearDown(test):
rdb.Session.remove() cleanup.cleanUp()
earDown(test): # make sure scope func is empty before we tear down component architecture rdb.Session.remove() module.tearDown(test) cleanup.cleanUp() def zopeSetUp(test): zope.component.eventtesting.setUp(test) def zopeTearDown(test):
64
64
19
8
56
prsephton/megrok.rdb
src/megrok/rdb/tests/test_rdb.py
Python
zopeTearDown
zopeTearDown
28
30
28
28
0c867f7f5edec484e00143e4e1b813ff99f35f81
bigcode/the-stack
train
7a768695dd0f41727d9a9b29
train
function
def moduleTearDown(test): # make sure scope func is empty before we tear down component architecture rdb.Session.remove() module.tearDown(test) cleanup.cleanUp()
def moduleTearDown(test): # make sure scope func is empty before we tear down component architecture
rdb.Session.remove() module.tearDown(test) cleanup.cleanUp()
def moduleSetUp(test): # using zope.testing.module.setUp to work around # __module__ being '__builtin__' by default module.setUp(test, 'foo') def moduleTearDown(test): # make sure scope func is empty before we tear down component architecture
63
64
41
22
41
prsephton/megrok.rdb
src/megrok/rdb/tests/test_rdb.py
Python
moduleTearDown
moduleTearDown
18
23
18
19
2ad6d484d08bb807e7998d919a6ab2375e2c2e62
bigcode/the-stack
train
6b212e1f318db40f6ebccbea
train
function
def test_suite(): optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS globs = {} suite = unittest.TestSuite() suite.addTest(doctest.DocFileSuite( '../README.txt', optionflags=optionflags, setUp=moduleSetUp, tearDown=moduleTearDown, globs=globs)...
def test_suite():
optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS globs = {} suite = unittest.TestSuite() suite.addTest(doctest.DocFileSuite( '../README.txt', optionflags=optionflags, setUp=moduleSetUp, tearDown=moduleTearDown, globs=globs)) suite.addTes...
around # __module__ being '__builtin__' by default module.setUp(test, 'foo') def moduleTearDown(test): # make sure scope func is empty before we tear down component architecture rdb.Session.remove() module.tearDown(test) cleanup.cleanUp() def zopeSetUp(test): zope.component.e...
107
108
362
4
103
prsephton/megrok.rdb
src/megrok/rdb/tests/test_rdb.py
Python
test_suite
test_suite
32
75
32
32
8d3e2dc0a107be413e93561e8b2db3d2410a9485
bigcode/the-stack
train
3cfed1c273548789cf61bb6e
train
function
def moduleSetUp(test): # using zope.testing.module.setUp to work around # __module__ being '__builtin__' by default module.setUp(test, 'foo')
def moduleSetUp(test): # using zope.testing.module.setUp to work around # __module__ being '__builtin__' by default
module.setUp(test, 'foo')
rdb from z3c.saconfig.interfaces import IEngineFactory, IScopedSession from megrok.rdb.tests import tableargs, polymorphic def moduleSetUp(test): # using zope.testing.module.setUp to work around # __module__ being '__builtin__' by default
64
64
41
32
31
prsephton/megrok.rdb
src/megrok/rdb/tests/test_rdb.py
Python
moduleSetUp
moduleSetUp
13
16
13
15
7d99b76937a6b5b58566c459fd4ecea87ac90494
bigcode/the-stack
train
39b8372fea6e7c838f36215e
train
function
def zopeSetUp(test): zope.component.eventtesting.setUp(test)
def zopeSetUp(test):
zope.component.eventtesting.setUp(test)
__' by default module.setUp(test, 'foo') def moduleTearDown(test): # make sure scope func is empty before we tear down component architecture rdb.Session.remove() module.tearDown(test) cleanup.cleanUp() def zopeSetUp(test):
63
64
17
7
56
prsephton/megrok.rdb
src/megrok/rdb/tests/test_rdb.py
Python
zopeSetUp
zopeSetUp
25
26
25
25
c32bc8ca32912a17798f46dda792c42acdd0970b
bigcode/the-stack
train
ae9817b830c31a944312b863
train
function
def run_task(*_): """ Wrap PPO training task in the run_task function. :param _: :return: """ env = TfEnv(normalize(gym.make("InvertedDoublePendulum-v2"))) policy = GaussianMLPPolicy(env_spec=env.spec, hidden_sizes=(64, 64)) baseline = GaussianMLPBaseline(env_spec=env.spec) algo ...
def run_task(*_):
""" Wrap PPO training task in the run_task function. :param _: :return: """ env = TfEnv(normalize(gym.make("InvertedDoublePendulum-v2"))) policy = GaussianMLPPolicy(env_spec=env.spec, hidden_sizes=(64, 64)) baseline = GaussianMLPBaseline(env_spec=env.spec) algo = PPO( env...
import gym from garage.envs import normalize from garage.experiment import run_experiment from garage.tf.algos import PPO from garage.tf.baselines import GaussianMLPBaseline from garage.tf.envs import TfEnv from garage.tf.policies import GaussianMLPPolicy def run_task(*_):
64
64
161
6
57
yuanzhaoYZ/garage
examples/tf/ppo_pendulum.py
Python
run_task
run_task
21
45
21
21
8a12b2a55805fb76f82ccc3d7b32c56b71ea898f
bigcode/the-stack
train
69e693738eb320f253338c4b
train
function
def add_performance_alarm(profile, performance_test_passed, total_time): add_alarm( profile, 'Performance Failure', performance_test_passed )
def add_performance_alarm(profile, performance_test_passed, total_time):
add_alarm( profile, 'Performance Failure', performance_test_passed )
: if existing_alarm: existing_alarm.is_active = False existing_alarm.save() def add_availability_alarm(profile, availability_test_passed): add_alarm( profile, 'Availability Failure', availability_test_passed ) def add_performance_alarm(profile, performance_test_passed, ...
64
64
33
15
49
hseritt/alfmonitor
agents/lib/alarm/alarm_handlers.py
Python
add_performance_alarm
add_performance_alarm
39
42
39
39
2ab5943ed6cfbbf93fbf63bb02dcc7b72c7c39ae
bigcode/the-stack
train
03ab1fe0bd5828fddd40a550
train
function
def add_availability_alarm(profile, availability_test_passed): add_alarm( profile, 'Availability Failure', availability_test_passed )
def add_availability_alarm(profile, availability_test_passed):
add_alarm( profile, 'Availability Failure', availability_test_passed )
alarm = Alarm() alarm.profile = profile alarm.event_time = timezone.now() alarm.alarm_type = alarm_type alarm.save() else: if existing_alarm: existing_alarm.is_active = False existing_alarm.save() def add_availability_alarm(profile, a...
64
64
30
12
52
hseritt/alfmonitor
agents/lib/alarm/alarm_handlers.py
Python
add_availability_alarm
add_availability_alarm
33
36
33
33
9fe18dff58b9df1a3688ef9d342ebcd1c32adbce
bigcode/the-stack
train
f6cbdd92c1b0c6870b8e51e3
train
function
def add_alarm(profile, alarm_type, test): try: existing_alarm = Alarm.objects.get( profile=profile, is_active=True, alarm_type=alarm_type ) except Alarm.DoesNotExist: existing_alarm = None if not test: if existing_alarm: pass else...
def add_alarm(profile, alarm_type, test):
try: existing_alarm = Alarm.objects.get( profile=profile, is_active=True, alarm_type=alarm_type ) except Alarm.DoesNotExist: existing_alarm = None if not test: if existing_alarm: pass else: alarm = Alarm() ...
""" Alarm handler module.""" from django.utils import timezone from agents.models import Alarm def add_alarm(profile, alarm_type, test):
27
64
121
10
16
hseritt/alfmonitor
agents/lib/alarm/alarm_handlers.py
Python
add_alarm
add_alarm
7
30
7
7
76f95f8625881af882dc4cccf282eaf1d52f9227
bigcode/the-stack
train
9a1aba5a896e7260868a7c3d
train
class
class ChipClusters: SUCCESS_DELEGATE = ctypes.CFUNCTYPE(None) FAILURE_DELEGATE = ctypes.CFUNCTYPE(None, ctypes.c_uint8) _ACCOUNT_LOGIN_CLUSTER_INFO = { "clusterName": "AccountLogin", "clusterId": 0x0000050E, "commands": { 0x00000000: { "commandId": 0x0000...
class ChipClusters:
SUCCESS_DELEGATE = ctypes.CFUNCTYPE(None) FAILURE_DELEGATE = ctypes.CFUNCTYPE(None, ctypes.c_uint8) _ACCOUNT_LOGIN_CLUSTER_INFO = { "clusterName": "AccountLogin", "clusterId": 0x0000050E, "commands": { 0x00000000: { "commandId": 0x00000000, ...
''' /* * * Copyright (c) 2021 Project CHIP Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless re...
182
256
105,138
4
178
XQ-Huang/connectedhomeip
src/controller/python/chip/clusters/CHIPClusters.py
Python
ChipClusters
ChipClusters
29
8,175
29
29
efc23cd12d0932faf962970f0c95794d10771b22
bigcode/the-stack
train
c6412ce1f7903483f613a758
train
function
def iterate_ratingsFile(): # movie_hash = movie_hash_map() # # filename = "ratings.csv" # line_count = 0 # with open(filename, 'r', encoding='utf-8') as ratingfile: # for row in ratingfile: # line_count += 1 # if line_count == 1: # continue # ...
def iterate_ratingsFile(): # movie_hash = movie_hash_map() # # filename = "ratings.csv" # line_count = 0 # with open(filename, 'r', encoding='utf-8') as ratingfile: # for row in ratingfile: # line_count += 1 # if line_count == 1: # continue # ...
with open('dict.pickle', 'rb') as handle: movie_hash1 = pickle.load(handle) return movie_hash1
def iterate_ratingsFile(): # movie_hash = movie_hash_map() # # filename = "ratings.csv" # line_count = 0 # with open(filename, 'r', encoding='utf-8') as ratingfile: # for row in ratingfile: # line_count += 1 # if line_count == 1: # continue # ...
287
94
316
287
0
AlphaDexter/Movie_Recommendation_System
Iterate_ratingsFile.py
Python
iterate_ratingsFile
iterate_ratingsFile
5
28
5
24
7306e7c05ccbe1a9d929a565f8d1fc22b728dee0
bigcode/the-stack
train
d9f436fa7cac80e9f78908b7
train
class
class Label(Component): """A Label component. A component for adding labels to inputs in forms with added sizing controls. Keyword arguments: - children (a list of or a singular dash component, string or number; optional): The children of this component - id (string; optional): The ID of this component, used to id...
class Label(Component):
"""A Label component. A component for adding labels to inputs in forms with added sizing controls. Keyword arguments: - children (a list of or a singular dash component, string or number; optional): The children of this component - id (string; optional): The ID of this component, used to identify dash components i...
# AUTO GENERATED FILE - DO NOT EDIT from dash.development.base_component import Component, _explicitize_args class Label(Component):
27
256
1,094
4
22
paulsavala/Covid19-model
covid_venv/lib/python3.7/site-packages/dash_bootstrap_components/_components/Label.py
Python
Label
Label
6
77
6
6
47ef1f966d31b58532e338a5a129a214b7d7e39e
bigcode/the-stack
train
ceceb2aaa1f912c82605a789
train
function
def surface_to_texture(pygame_surface, texture_id): rgb_surface = pygame.image.tostring(pygame_surface, 'RGB') glBindTexture(GL_TEXTURE_2D, texture_id) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glTexParameteri(...
def surface_to_texture(pygame_surface, texture_id):
rgb_surface = pygame.image.tostring(pygame_surface, 'RGB') glBindTexture(GL_TEXTURE_2D, texture_id) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP) glTe...
= pygame.image.tostring(textSurface, "RGBA", True) glWindowPos2d(x, y - font_size * i) glDrawPixels(textSurface.get_width(), textSurface.get_height(), GL_RGBA, GL_UNSIGNED_BYTE, textData) def surface_to_texture(pygame_surface, texture_id):
64
64
190
12
52
MichalKacprzak99/WFIIS-3D-Graphics-2021
src/utils/drawing_utils.py
Python
surface_to_texture
surface_to_texture
20
31
20
20
a39f8a829973eb2c9c24263cde4a4e646805e849
bigcode/the-stack
train
1c07b1c964d5c3d522896f9f
train
function
def draw_text(x: int, y: int, text: str, font_name: str, font_size: int, color: Union[Sequence, pygame.Color, str]): font = pygame.font.SysFont(font_name, font_size) lines = text.splitlines() for i, line in enumerate(lines): # screen.blit(sys_font.render(l, 0, hecolor), (x, y + fsize * i)) ...
def draw_text(x: int, y: int, text: str, font_name: str, font_size: int, color: Union[Sequence, pygame.Color, str]):
font = pygame.font.SysFont(font_name, font_size) lines = text.splitlines() for i, line in enumerate(lines): # screen.blit(sys_font.render(l, 0, hecolor), (x, y + fsize * i)) textSurface = font.render(line, True, color).convert_alpha() textData = pygame.image.tostring(textSurface, "...
from typing import Sequence, Union import pygame from OpenGL.GL import * def draw_text(x: int, y: int, text: str, font_name: str, font_size: int, color: Union[Sequence, pygame.Color, str]):
52
64
160
36
16
MichalKacprzak99/WFIIS-3D-Graphics-2021
src/utils/drawing_utils.py
Python
draw_text
draw_text
7
17
7
7
41817eb49e782d8c8bafc0b8d03cd713942aabfb
bigcode/the-stack
train
44794c6725708ee2bb5ef8ae
train
function
def draw_texture(texture_id): glEnable(GL_TEXTURE_2D) glColor3fv((1, 1, 1)) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glBindTexture(GL_TEXTURE_2D, texture_id) glBegin(GL_QUADS) glTexCoord2f(0, 0) glVertex2f(-1, 1) glTexCoord2f(0, 1) glVertex2f(-1, -1) glTexCoord2f(1, 1) ...
def draw_texture(texture_id):
glEnable(GL_TEXTURE_2D) glColor3fv((1, 1, 1)) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glBindTexture(GL_TEXTURE_2D, texture_id) glBegin(GL_QUADS) glTexCoord2f(0, 0) glVertex2f(-1, 1) glTexCoord2f(0, 1) glVertex2f(-1, -1) glTexCoord2f(1, 1) glVertex2f(1, -1) glTex...
(GL_TEXTURE_2D, 0, GL_RGB, surface_rect.width, surface_rect.height, 0, GL_RGB, GL_UNSIGNED_BYTE, rgb_surface) glGenerateMipmap(GL_TEXTURE_2D) glBindTexture(GL_TEXTURE_2D, 0) def draw_texture(texture_id):
64
64
168
6
58
MichalKacprzak99/WFIIS-3D-Graphics-2021
src/utils/drawing_utils.py
Python
draw_texture
draw_texture
34
50
34
34
9335716d90555aaadf5cad5bf108934304e60c31
bigcode/the-stack
train
5fa3d87748b060b4b6a08233
train
function
def nearby_duplicate(string): if len(string) == 1: return string if string[0] == string[1]: return nearby_duplicate(string[1:]) return string[0] + nearby_duplicate(string[1:])
def nearby_duplicate(string):
if len(string) == 1: return string if string[0] == string[1]: return nearby_duplicate(string[1:]) return string[0] + nearby_duplicate(string[1:])
def nearby_duplicate(string):
5
64
50
5
0
AkashSDas/DataStructures-and-Algorithms
problems/recursion/near-by-duplicates/code.py
Python
nearby_duplicate
nearby_duplicate
1
6
1
1
9d8bcfa88a2615822e36c522093c51a15508fdb3
bigcode/the-stack
train
e80a9e8706e7ddb5f491f495
train
class
class MarginClusteringSampler(Strategy): """ Based on https://arxiv.org/abs/2107.14263 """ def __init__(self, train_set, al_set, net, train_args, eval_idxs, comet_experiment, test_set=None, **kwargs): super().__init__(train_set, al_set, net, train_args, eval_idxs, comet_experime...
class MarginClusteringSampler(Strategy):
""" Based on https://arxiv.org/abs/2107.14263 """ def __init__(self, train_set, al_set, net, train_args, eval_idxs, comet_experiment, test_set=None, **kwargs): super().__init__(train_set, al_set, net, train_args, eval_idxs, comet_experiment, test_set, **...
import numpy as np import torch from torch.utils.data import DataLoader, Subset from sklearn.cluster import AgglomerativeClustering from .strategy import Strategy import torch.nn as nn class MarginClusteringSampler(Strategy):
49
256
908
8
40
zeyademam/active_learning
src/query_strategies/margin_clustering_sampler.py
Python
MarginClusteringSampler
MarginClusteringSampler
9
90
9
9
42eb0be3d92072f26325da7e1e08aa56d8024d28
bigcode/the-stack
train
192f801c6231cdf312f53447
train
function
@click.command('install_dependencies') @click.argument("tool_id", type=str) @pass_context @custom_exception @dict_output def cli(ctx, tool_id): """Install dependencies for a given tool via a resolver. This works only for Conda currently. This functionality is available since Galaxy release_16.10 and is available on...
@click.command('install_dependencies') @click.argument("tool_id", type=str) @pass_context @custom_exception @dict_output def cli(ctx, tool_id):
"""Install dependencies for a given tool via a resolver. This works only for Conda currently. This functionality is available since Galaxy release_16.10 and is available only to Galaxy admins. Output: Tool requirement status """ return ctx.gi.tools.install_dependencies(tool_id)
import click from parsec.cli import pass_context, json_loads from parsec.decorators import custom_exception, dict_output @click.command('install_dependencies') @click.argument("tool_id", type=str) @pass_context @custom_exception @dict_output def cli(ctx, tool_id):
60
64
93
34
25
innovate-invent/parsec
parsec/commands/tools/install_dependencies.py
Python
cli
cli
6
18
6
11
6db61249566e4d0f2bb5940a34205a3f179b33d6
bigcode/the-stack
train
301488e2406e96a79db1ab28
train
class
class FMPClient(object): """ A FinancialModellingPrep API wrapper. """ def __init__(self): self.requester = self.Requester() self._attach_endpoints() def _attach_endpoints(self): """ Generate and attach endpoints """ for name, endpoint in inspect.getmembers(self...
class FMPClient(object):
""" A FinancialModellingPrep API wrapper. """ def __init__(self): self.requester = self.Requester() self._attach_endpoints() def _attach_endpoints(self): """ Generate and attach endpoints """ for name, endpoint in inspect.getmembers(self): if (inspec...
""" fmpclient --------- An API wrapper for FinancialModellingPrep. :copyright: (c) 2019 by Iain Wong. :license: MIT< see LICENSE for details. """ __title__ = 'fmpclient' __version__ = '0.1.3' __author__ = 'Iain Wong' __license__ = 'MIT' __copyright__ = 'Copyright 2019 Iain Wong' from urllib.parse import urljoin imp...
113
256
2,444
6
106
iainwo/fmpclient
fmpclient/__init__.py
Python
FMPClient
FMPClient
22
304
22
22
321d719a47fab74392b18e8551a57779936ead94
bigcode/the-stack
train
66f1ba4c4536a55fd835e17c
train
function
@cli.command() def set_backup(): """Choose a backup to use""" if backups_folder_exists(): mypath = os.path.abspath("pash/backups") file_list = [f for f in os.listdir(mypath) if os.path.isfile(os.path.join(mypath, f)) and ".json" in f ] if len(file_list) > 0: file_selected = f...
@cli.command() def set_backup():
"""Choose a backup to use""" if backups_folder_exists(): mypath = os.path.abspath("pash/backups") file_list = [f for f in os.listdir(mypath) if os.path.isfile(os.path.join(mypath, f)) and ".json" in f ] if len(file_list) > 0: file_selected = files_list_question(file_list, "se...
cho("Backup deleted", fg = "green") except: click.secho("error deleting file", fg="red") else: click.secho("Canceled", fg="yellow") else: click.secho("No backups found", fg ="yellow") @cli.command() def set_backup():
64
64
165
8
56
simon8889/PASH
pash/commands/cmd_backup.py
Python
set_backup
set_backup
74
86
74
75
5bd5191da0e3c8d3a202273da39bf9794af1cf1d
bigcode/the-stack
train
7b81608c819bf3b63f11f9bb
train
function
@cli.command() def delete_backup(): """Delete a backup file""" if backups_folder_exists(): mypath = os.path.abspath("pash/backups") file_list = [f for f in os.listdir(mypath) if os.path.isfile(os.path.join(mypath, f)) and ".json" in f ] if len(file_list) > 0: file_selected = ...
@cli.command() def delete_backup():
"""Delete a backup file""" if backups_folder_exists(): mypath = os.path.abspath("pash/backups") file_list = [f for f in os.listdir(mypath) if os.path.isfile(os.path.join(mypath, f)) and ".json" in f ] if len(file_list) > 0: file_selected = files_list_question(file_list, "sele...
.seek(0) data = {"backup": backup} json.dump(data, f, indent=4) click.secho("Backup file name:",fg ="blue") click.secho(file_name) click.secho("Backup made", fg = "green") @cli.command() def delete_backup():
64
64
180
8
56
simon8889/PASH
pash/commands/cmd_backup.py
Python
delete_backup
delete_backup
55
72
55
56
7979c4da6ddfe5ca5609c43f640f1836d996dbfc
bigcode/the-stack
train
b1767d1308c25e24ba0391c9
train
function
@click.group() def cli(): """Perform or access backups""" pass
@click.group() def cli():
"""Perform or access backups""" pass
click from pash.actions.backups import Backups from pash.cli_utils.backup_utils import backups_folder_exists import json from json.decoder import JSONDecodeError import time import colorama from pash.cli_utils.questions import files_list_question colorama.init() @click.group() def cli():
64
64
16
6
58
simon8889/PASH
pash/commands/cmd_backup.py
Python
cli
cli
13
16
13
14
bde112745a8cf4724836cdae2734a4adce0a76a6
bigcode/the-stack
train
a74c9d3bd80a09baaf98f822
train
function
@cli.command() def do_backup(): """Save a backup""" if backups_folder_exists(): timestr = time.strftime("%Y%m%d-%H%M%S") file_name = f"{timestr}.json" backup_file = os.path.abspath(f"pash/backups/{file_name}") backup = Backups().get_backup() if backup: with op...
@cli.command() def do_backup():
"""Save a backup""" if backups_folder_exists(): timestr = time.strftime("%Y%m%d-%H%M%S") file_name = f"{timestr}.json" backup_file = os.path.abspath(f"pash/backups/{file_name}") backup = Backups().get_backup() if backup: with open(backup_file, "a+") as f: ...
r+") as f: click.secho("Backup content:", fg = "blue") click.secho(f.read()) else: click.secho("Canceled", fg="yellow") else: click.secho("No backups found", fg ="yellow") @cli.command() def do_backup():
63
64
149
8
55
simon8889/PASH
pash/commands/cmd_backup.py
Python
do_backup
do_backup
37
52
37
38
698fc9721cad6cdb3ee5462881994dc939e35cbc
bigcode/the-stack
train
53a74350cd2b186bf4fdba16
train
function
@cli.command() def see_backup(): """Get all available backups and see the content""" if backups_folder_exists(): mypath = os.path.abspath("pash/backups") file_list = [f for f in os.listdir(mypath) if os.path.isfile(os.path.join(mypath, f)) and ".json" in f ] if len(file_list) > 0: ...
@cli.command() def see_backup():
"""Get all available backups and see the content""" if backups_folder_exists(): mypath = os.path.abspath("pash/backups") file_list = [f for f in os.listdir(mypath) if os.path.isfile(os.path.join(mypath, f)) and ".json" in f ] if len(file_list) > 0: file_selected = files_list_...
up_utils import backups_folder_exists import json from json.decoder import JSONDecodeError import time import colorama from pash.cli_utils.questions import files_list_question colorama.init() @click.group() def cli(): """Perform or access backups""" pass @cli.command() def see_backup():
64
64
178
8
55
simon8889/PASH
pash/commands/cmd_backup.py
Python
see_backup
see_backup
18
33
18
19
5675a21d050dc2c396bc4f2125af9671c62363b4
bigcode/the-stack
train
3fb35674b1513b31856fe066
train
function
def main(test=0): # add all the objects in a list objectList = [S, M, E, SS] # set the length of the experiment maxSimTime = 20.0 # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime) # calculate metrics working_ratio = (M.to...
def main(test=0): # add all the objects in a list
objectList = [S, M, E, SS] # set the length of the experiment maxSimTime = 20.0 # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime) # calculate metrics working_ratio = (M.totalWorkingTime / maxSimTime) * 100 off_shift_ratio ...
endUnfinished=True) # define predecessors and successors for the objects S.defineRouting(successorList=[M]) M.defineRouting(predecessorList=[S], successorList=[E]) E.defineRouting(predecessorList=[M]) def main(test=0): # add all the objects in a list
64
64
206
16
48
datarevenue-berlin/manpy
manpy/simulation/Examples/ServerWithShift3.py
Python
main
main
19
39
19
21
9b3df09e2a0f70a8136bbce0538986743ab575a7
bigcode/the-stack
train
c853851ece8ddb3ffcca2ca4
train
function
def compute_gb_honda(accel, speed): creep_brake = 0.0 creep_speed = 2.3 creep_brake_value = 0.15 if speed < creep_speed: creep_brake = (creep_speed - speed) / creep_speed * creep_brake_value return float(accel) / 4.8 - creep_brake
def compute_gb_honda(accel, speed):
creep_brake = 0.0 creep_speed = 2.3 creep_brake_value = 0.15 if speed < creep_speed: creep_brake = (creep_speed - speed) / creep_speed * creep_brake_value return float(accel) / 4.8 - creep_brake
drive.controls.lib.planner import _A_CRUISE_MAX_V_FOLLOWING from selfdrive.car.interfaces import CarInterfaceBase A_ACC_MAX = max(_A_CRUISE_MAX_V_FOLLOWING) ButtonType = car.CarState.ButtonEvent.Type def compute_gb_honda(accel, speed):
64
64
85
11
52
pevdh/openpilot
selfdrive/car/honda/interface.py
Python
compute_gb_honda
compute_gb_honda
18
24
18
18
9a02e3ff0581bd68b06e052eb9404cec1df718a4
bigcode/the-stack
train
0922cd4be717babc3c9af930
train
function
def get_compute_gb_acura(): # generate a function that takes in [desired_accel, current_speed] -> [-1.0, 1.0] # where -1.0 is max brake and 1.0 is max gas # see debug/dump_accel_from_fiber.py to see how those parameters were generated w0 = np.array([[ 1.22056961, -0.39625418, 0.67952657], [ 1....
def get_compute_gb_acura(): # generate a function that takes in [desired_accel, current_speed] -> [-1.0, 1.0] # where -1.0 is max brake and 1.0 is max gas # see debug/dump_accel_from_fiber.py to see how those parameters were generated
w0 = np.array([[ 1.22056961, -0.39625418, 0.67952657], [ 1.03691769, 0.78210306, -0.41343188]]) b0 = np.array([ 0.01536703, -0.14335321, -0.26932889]) w2 = np.array([[-0.59124422, 0.42899439, 0.38660881], [ 0.79973811, 0.13178682, 0.08550351], [-0.15651935,...
selfdrive.car.interfaces import CarInterfaceBase A_ACC_MAX = max(_A_CRUISE_MAX_V_FOLLOWING) ButtonType = car.CarState.ButtonEvent.Type def compute_gb_honda(accel, speed): creep_brake = 0.0 creep_speed = 2.3 creep_brake_value = 0.15 if speed < creep_speed: creep_brake = (creep_speed - speed) / creep_spee...
194
194
647
74
119
pevdh/openpilot
selfdrive/car/honda/interface.py
Python
get_compute_gb_acura
get_compute_gb_acura
27
69
27
30
21203e4ddca09d92a8dc477c13d3d8593c3932ee
bigcode/the-stack
train
8572ef54dceb118a74ff8b91
train
class
class CarInterface(CarInterfaceBase): def __init__(self, CP, CarController, CarState): super().__init__(CP, CarController, CarState) self.last_enable_pressed = 0 self.last_enable_sent = 0 if self.CS.CP.carFingerprint == CAR.ACURA_ILX: self.compute_gb = get_compute_gb_acura() else: se...
class CarInterface(CarInterfaceBase):
def __init__(self, CP, CarController, CarState): super().__init__(CP, CarController, CarState) self.last_enable_pressed = 0 self.last_enable_sent = 0 if self.CS.CP.carFingerprint == CAR.ACURA_ILX: self.compute_gb = get_compute_gb_acura() else: self.compute_gb = compute_gb_honda @s...
2, w4) + b4 return m4 def leakyrelu(x, alpha): return np.maximum(x, alpha * x) def _compute_gb_acura(accel, speed): # linearly extrap below v1 using v1 and v2 data v1 = 5. v2 = 10. dat = np.array([accel, speed]) if speed > 5.: m4 = compute_output(dat, w0, b0, w2, b2, w4, b4) ...
256
256
7,112
7
248
pevdh/openpilot
selfdrive/car/honda/interface.py
Python
CarInterface
CarInterface
72
538
72
72
47bc181bff530ce97c322fa5d0f81f92c11dc30a
bigcode/the-stack
train
0b53eea372d73fe2efa61a1d
train
class
class FilmTopRequest(Request): METHOD: HttpMethod = HttpMethod.GET PATH: str = '/api/v2.2/films/top' RESPONSE: type = FilmTopResponse __top_type: Optional[TopType] __page: int def __init__(self, top_type: TopType = None, page: int = 1) -> None: self.__top_type = top_type self._...
class FilmTopRequest(Request):
METHOD: HttpMethod = HttpMethod.GET PATH: str = '/api/v2.2/films/top' RESPONSE: type = FilmTopResponse __top_type: Optional[TopType] __page: int def __init__(self, top_type: TopType = None, page: int = 1) -> None: self.__top_type = top_type self.__page = page @property ...
opoisk_unofficial.client.http_method import HttpMethod from kinopoisk_unofficial.contract.request import Request from kinopoisk_unofficial.model.dictonary.top_type import TopType from kinopoisk_unofficial.response.films.film_top_response import FilmTopResponse class FilmTopRequest(Request):
64
64
185
6
57
masterWeber/kinopoisk-api-unofficial-client
kinopoisk_unofficial/request/films/film_top_request.py
Python
FilmTopRequest
FilmTopRequest
9
34
9
9
5e96a3e254d8edf8f4d9c4bc3d3e4ef7c034829d
bigcode/the-stack
train
880604c9411aff08402ba531
train
class
class MainHandler(tornado.web.RequestHandler): def initialize(self, db=None): self.db = db @tornado.gen.coroutine def get(self): self.render('../static/index.html') @tornado.gen.coroutine def post(self): self.set_status(403)
class MainHandler(tornado.web.RequestHandler):
def initialize(self, db=None): self.db = db @tornado.gen.coroutine def get(self): self.render('../static/index.html') @tornado.gen.coroutine def post(self): self.set_status(403)
# -*- coding: iso-8859-15 -*- import os import sys import tornado.web import tornado.escape class MainHandler(tornado.web.RequestHandler):
34
64
64
9
24
TiMed-dev/TIMed-backend
web/main_handler.py
Python
MainHandler
MainHandler
8
18
8
8
cca09046b97f455bd13f7c74985516a2ccdc2d3e
bigcode/the-stack
train
1e80650e4ddb68f50dcc93b6
train
class
@dataclass(frozen=True) @streamable class TimestampedPeerInfo(Streamable): host: str port: uint16 timestamp: uint64
@dataclass(frozen=True) @streamable class TimestampedPeerInfo(Streamable):
host: str port: uint16 timestamp: uint64
ipv4 = 0 if ipv4: group = bytes([1]) + ip.packed[:2] else: group = bytes([0]) + ip.packed[:4] return group @dataclass(frozen=True) @streamable class TimestampedPeerInfo(Streamable):
64
64
35
18
45
Tony4467/littlelambocoin-blockchain
littlelambocoin/types/peer_info.py
Python
TimestampedPeerInfo
TimestampedPeerInfo
62
67
62
64
f5b9f423d19d8876c9faf5aced788ed56b1c5718
bigcode/the-stack
train
74f6c9b54b712887a9de77b9
train
class
@dataclass(frozen=True) @streamable class PeerInfo(Streamable): host: str port: uint16 def is_valid(self, allow_private_subnets=False) -> bool: ip: Optional[Union[ipaddress.IPv6Address, ipaddress.IPv4Address]] = None try: ip = ipaddress.IPv6Address(self.host) except Valu...
@dataclass(frozen=True) @streamable class PeerInfo(Streamable):
host: str port: uint16 def is_valid(self, allow_private_subnets=False) -> bool: ip: Optional[Union[ipaddress.IPv6Address, ipaddress.IPv4Address]] = None try: ip = ipaddress.IPv6Address(self.host) except ValueError: ip = None if ip is not None: ...
import ipaddress from dataclasses import dataclass from typing import Optional, Union from littlelambocoin.util.ints import uint16, uint64 from littlelambocoin.util.streamable import Streamable, streamable @dataclass(frozen=True) @streamable class PeerInfo(Streamable):
66
117
393
16
49
Tony4467/littlelambocoin-blockchain
littlelambocoin/types/peer_info.py
Python
PeerInfo
PeerInfo
9
59
9
11
dade3e22e66f24fa12072f69751bd692ce561727
bigcode/the-stack
train
1259a944cbefa4ee75c5c918
train
function
def create_dummy_bone(name, side, start_dummy_joint, end_dummy_joint): # creating parent grp bone_crv_grp = (side + name + 'BoneCurves_grp') # some error checking if not pc.objExists(bone_crv_grp): bone_crv_grp = pc.group(em=True, n=(side + name + 'BoneCurves_grp')) # getting the name of s...
def create_dummy_bone(name, side, start_dummy_joint, end_dummy_joint): # creating parent grp
bone_crv_grp = (side + name + 'BoneCurves_grp') # some error checking if not pc.objExists(bone_crv_grp): bone_crv_grp = pc.group(em=True, n=(side + name + 'BoneCurves_grp')) # getting the name of start and end locators stored in dummy joint loc start_dummy_sp = pc.getAttr(start_dummy_joint...
import pymel.core as pc from Maya_UtilLib import Units from ...Utils import CurveUtilLib as cuLib from ...Utils import CharUtilsLib as charLib def create_dummy_bone(name, side, start_dummy_joint, end_dummy_joint): # creating parent grp
60
256
1,212
23
36
lcremer/Maya-Rigging
Core/Dummy/Util.py
Python
create_dummy_bone
create_dummy_bone
7
88
7
8
b802fde9dcc68c0311be6d6dfffde503dbe27f22
bigcode/the-stack
train
98de685c779fc103aa79ace0
train
function
def create_module_annotation(name, obj): annotation = pc.annotate(obj, tx=name, p=(0, 0, 0)) pc.setAttr((annotation + '.displayArrow'), 0) pc.setAttr((annotation + '.overrideEnabled'), 1) pc.setAttr((annotation + '.overrideDisplayType'), 2) annotation_shape = pc.listRelatives(annotation, p=True) ...
def create_module_annotation(name, obj):
annotation = pc.annotate(obj, tx=name, p=(0, 0, 0)) pc.setAttr((annotation + '.displayArrow'), 0) pc.setAttr((annotation + '.overrideEnabled'), 1) pc.setAttr((annotation + '.overrideDisplayType'), 2) annotation_shape = pc.listRelatives(annotation, p=True) annotation_shape[0] = pc.rename(annotat...
_joints - 1)) pc.setAttr((curve_info + '.parameter'), parameter) temp_joint_pos = pc.getAttr(curve_info + '.position') dummy_joint_pos.append(temp_joint_pos) pc.delete(curve_info) return dummy_joint_pos def create_module_annotation(name, obj):
64
64
123
8
55
lcremer/Maya-Rigging
Core/Dummy/Util.py
Python
create_module_annotation
create_module_annotation
207
217
207
207
93b5c1425059161ba015b6b6f774c2cd42c0f035
bigcode/the-stack
train
3a3c054aaa79f09a55bf5f32
train
function
def linear_dis_dummy_bone_creator(name, side, module_name, num_con, axis, dis, color_index): """Returns a list of dummy bones for given module name and side along given axis""" control = [] bone_list = '' dummy_bone_grp = '' lock = '' split = dis / (num_con - 1) pos = 0 tent_main_pos = c...
def linear_dis_dummy_bone_creator(name, side, module_name, num_con, axis, dis, color_index):
"""Returns a list of dummy bones for given module name and side along given axis""" control = [] bone_list = '' dummy_bone_grp = '' lock = '' split = dis / (num_con - 1) pos = 0 tent_main_pos = cuLib.curveControl('cube1', 'curve') tent_main_pos[0] = pc.rename(tent_main_pos[0], name +...
string') return parent def shape_color_override(n, color_index): # color index # 6 = blue # 13 = red # 14 = green # 17 = yellow # int color_index = 17; sel = [] if n == '': sel = pc.ls(sl=True) else: sel.append(n) for s in sel: shape = pc.listRela...
162
162
540
24
138
lcremer/Maya-Rigging
Core/Dummy/Util.py
Python
linear_dis_dummy_bone_creator
linear_dis_dummy_bone_creator
144
187
144
144
629e321604a14b95763032067af2809cfa559c7d
bigcode/the-stack
train
280a70b199d2a40db518f67c
train
function
def get_dummy_bone_limb_pos(curve, num_joints): """Returns list of Dummy Bone positions""" dummy_joint_pos = [] curve_info = pc.pointOnCurve(curve, constructionHistory=1) pc.setAttr((curve_info + '.turnOnPercentage'), 1) for i in range(num_joints): parameter = i * (1.0 / (num_joints - 1)) ...
def get_dummy_bone_limb_pos(curve, num_joints):
"""Returns list of Dummy Bone positions""" dummy_joint_pos = [] curve_info = pc.pointOnCurve(curve, constructionHistory=1) pc.setAttr((curve_info + '.turnOnPercentage'), 1) for i in range(num_joints): parameter = i * (1.0 / (num_joints - 1)) pc.setAttr((curve_info + '.parameter'), ...
_grp, tent_main_pos[0], r=True) pc.setAttr((tent_main_pos[0] + '.jointPosList'), bone_list, type='string') pc.select(cl=True) return tent_main_pos[0] def get_dummy_bone_limb_pos(curve, num_joints):
64
64
139
15
49
lcremer/Maya-Rigging
Core/Dummy/Util.py
Python
get_dummy_bone_limb_pos
get_dummy_bone_limb_pos
190
204
190
190
44880e3a21fccab23c071a3c206976e6b6d776d9
bigcode/the-stack
train
e2ec0a9730914a9ecf315637
train
function
def shape_color_override(n, color_index): # color index # 6 = blue # 13 = red # 14 = green # 17 = yellow # int color_index = 17; sel = [] if n == '': sel = pc.ls(sl=True) else: sel.append(n) for s in sel: shape = pc.listRelatives(s, f=True, s=True) ...
def shape_color_override(n, color_index): # color index # 6 = blue # 13 = red # 14 = green # 17 = yellow # int color_index = 17;
sel = [] if n == '': sel = pc.ls(sl=True) else: sel.append(n) for s in sel: shape = pc.listRelatives(s, f=True, s=True) for x in shape: pc.setAttr((x + '.overrideEnabled'), 1) pc.setAttr((x + '.overrideColor'), color_index)
end_dis[0], type='string') return parent def shape_color_override(n, color_index): # color index # 6 = blue # 13 = red # 14 = green # 17 = yellow # int color_index = 17;
64
64
132
51
12
lcremer/Maya-Rigging
Core/Dummy/Util.py
Python
shape_color_override
shape_color_override
122
141
122
129
9239f2a822686638b2a663ba0ef1683c8b42414f
bigcode/the-stack
train
0f0d6b95ad273b11ba103ffd
train
function
def create_dummy_joint(color_index): imp_sphere = pc.createNode('implicitSphere') pc.setAttr((imp_sphere + '.rd'), 0.5) parent = pc.listRelatives(imp_sphere, p=True) shape_color_override(parent, color_index) cuLib.shapeRename(parent[0]) start_dis = cuLib.curveControl('loc', 'curve') start...
def create_dummy_joint(color_index):
imp_sphere = pc.createNode('implicitSphere') pc.setAttr((imp_sphere + '.rd'), 0.5) parent = pc.listRelatives(imp_sphere, p=True) shape_color_override(parent, color_index) cuLib.shapeRename(parent[0]) start_dis = cuLib.curveControl('loc', 'curve') start_dis[0] = pc.rename(start_dis[0], par...
pc.parent(pos_b_clusters[1], end_loc1[0]) pc.hide(start_loc1[0], end_loc1[0]) charLib.lockAndHide(start_loc1[0], 'lock', 'trans rot scale vis') charLib.lockAndHide(end_loc1[0], 'lock', 'trans rot scale vis') pc.parent(connect[0], bone_crv_grp) return bone_crv_grp def create_dummy_joint(color_in...
98
98
328
7
90
lcremer/Maya-Rigging
Core/Dummy/Util.py
Python
create_dummy_joint
create_dummy_joint
91
119
91
91
520300b2b582fa80d74e966c203f11c7559d79e7
bigcode/the-stack
train
35a5a4db06b7e82d76e956f0
train
function
def serialize_identifier(identifier): if type(identifier).__name__ in identifier_serialization: options = identifier_serialization[type(identifier).__name__] serialized_id = {'type': options.type} for idx, field in options.fields: serialized_id[field] = ( identifi...
def serialize_identifier(identifier):
if type(identifier).__name__ in identifier_serialization: options = identifier_serialization[type(identifier).__name__] serialized_id = {'type': options.type} for idx, field in options.fields: serialized_id[field] = ( identifier[idx] if not options.recursive[idx] ...
Identifier, False, [False, True] ), 'VideoFrameIdentifier': IdentifierSerializationOptions('video_frame', ['video_id', 'frame'], VideoFrameIdentifier, False, False) } identifier_deserialization = {option.type: option for option in identifier_serialization.values()} def serialize_identifier(identifier):...
63
64
83
5
58
IndiraSalyahova/open_model_zoo
tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py
Python
serialize_identifier
serialize_identifier
99
109
99
99
d92f0868fdda052b29cff5c120a2b5fbb826ed1e
bigcode/the-stack
train
b8c2c84ea98f6ef958ef36e8
train
class
class DataRepresentation: def __init__(self, data, meta=None, identifier=''): self.identifier = identifier self.data = data self.metadata = meta or {} if np.isscalar(data): self.metadata['image_size'] = 1 elif isinstance(data, list) and np.isscalar(data[0]): ...
class DataRepresentation:
def __init__(self, data, meta=None, identifier=''): self.identifier = identifier self.data = data self.metadata = meta or {} if np.isscalar(data): self.metadata['image_size'] = 1 elif isinstance(data, list) and np.isscalar(data[0]): self.metadata['imag...
Field, ConfigValidator, ConfigError, DictField, BoolField, PathField ) REQUIRES_ANNOTATIONS = ['annotation_features_extractor', ] DOES_NOT_REQUIRED_DATA_SOURCE = REQUIRES_ANNOTATIONS + ['ncf_reader'] DATA_SOURCE_IS_FILE = ['opencv_capture'] class DataRepresentation:
64
64
133
4
60
IndiraSalyahova/open_model_zoo
tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py
Python
DataRepresentation
DataRepresentation
37
49
37
37
d116741d6e0f84a09a2f7c6e9a65fd60342daee9
bigcode/the-stack
train
29724f985676a79d9bd1f454
train
function
def create_reader(config): return BaseReader.provide(config.get('type', 'opencv_imread'), config.get('data_source'), config=config)
def create_reader(config):
return BaseReader.provide(config.get('type', 'opencv_imread'), config.get('data_source'), config=config)
(tuple(identifier.input_id), tuple(identifier.frames)) if isinstance(identifier, ParametricImageIdentifier): return ParametricImageIdentifier(identifier.identifier, tuple(identifier.parameters)) if isinstance(identifier, AnnotationDataIdentifier): return AnnotationDataIdentifier(identifier.annot...
64
64
30
5
58
IndiraSalyahova/open_model_zoo
tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py
Python
create_reader
create_reader
160
161
160
160
91dad877be53db065a68da233dab2a80acc68254
bigcode/the-stack
train
a0d6a3415080a1de296e2640
train
function
def create_ann_identifier_key(identifier): if isinstance(identifier, list): return ListIdentifier(tuple(create_ann_identifier_key(elem) for elem in identifier)) if isinstance(identifier, ClipIdentifier): return ClipIdentifier(identifier.video, identifier.clip_id, tuple(identifier.frames)) if...
def create_ann_identifier_key(identifier):
if isinstance(identifier, list): return ListIdentifier(tuple(create_ann_identifier_key(elem) for elem in identifier)) if isinstance(identifier, ClipIdentifier): return ClipIdentifier(identifier.video, identifier.clip_id, tuple(identifier.frames)) if isinstance(identifier, MultiFramesInputIde...
('Field {} required for identifier deserialization'.format(field)) data = identifier[field] if recursive: data = deserialize_identifier(data) if to_tuple: data = tuple(data) fields.append(data) return options.class_id(*fields) ...
64
64
120
7
56
IndiraSalyahova/open_model_zoo
tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py
Python
create_ann_identifier_key
create_ann_identifier_key
132
143
132
132
100a76b6b0c74c3c0f6c53c2efdf834b9f4f614a
bigcode/the-stack
train
9d94535706ce5ea7401b272b
train
class
class DataReaderField(BaseField): def validate(self, entry, field_uri=None, fetch_only=False, validation_scheme=None): errors = super().validate(entry, field_uri) if entry is None: return errors field_uri = field_uri or self.field_uri if isinstance(entry, str): ...
class DataReaderField(BaseField):
def validate(self, entry, field_uri=None, fetch_only=False, validation_scheme=None): errors = super().validate(entry, field_uri) if entry is None: return errors field_uri = field_uri or self.field_uri if isinstance(entry, str): errors.extend( ...
(identifier.identifier, tuple(identifier.parameters)) if isinstance(identifier, AnnotationDataIdentifier): return AnnotationDataIdentifier(identifier.annotation_id, tuple(identifier.data_id)) return identifier def create_reader(config): return BaseReader.provide(config.get('type', 'opencv_imread')...
71
71
238
7
64
IndiraSalyahova/open_model_zoo
tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py
Python
DataReaderField
DataReaderField
164
194
164
164
2c0b596929e767552e4057cefca4eee546d57771
bigcode/the-stack
train
5c95c81cccb05bb408aa015c
train
function
def create_identifier_key(identifier): if isinstance(identifier, list): return ListIdentifier(tuple(create_ann_identifier_key(elem) for elem in identifier)) if isinstance(identifier, ClipIdentifier): return ClipIdentifier(identifier.video, identifier.clip_id, tuple(identifier.frames)) if isi...
def create_identifier_key(identifier):
if isinstance(identifier, list): return ListIdentifier(tuple(create_ann_identifier_key(elem) for elem in identifier)) if isinstance(identifier, ClipIdentifier): return ClipIdentifier(identifier.video, identifier.clip_id, tuple(identifier.frames)) if isinstance(identifier, MultiFramesInputIde...
): return MultiFramesInputIdentifier(tuple(identifier.input_id), tuple(identifier.frames)) if isinstance(identifier, ParametricImageIdentifier): return ParametricImageIdentifier(identifier.identifier, tuple(identifier.parameters)) if isinstance(identifier, AnnotationDataIdentifier): retu...
64
64
127
6
57
IndiraSalyahova/open_model_zoo
tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py
Python
create_identifier_key
create_identifier_key
146
157
146
146
a260c2f75faafab51239187f1b7bd5cb31045263
bigcode/the-stack
train
8e92cdb8997ee53829a6387f
train
class
class BaseReader(ClassProvider): __provider_type__ = 'reader' def __init__(self, data_source, config=None, postpone_data_source=False, **kwargs): self.config = config or {} self._postpone_data_source = postpone_data_source self.data_source = data_source self.read_dispatcher = si...
class BaseReader(ClassProvider):
__provider_type__ = 'reader' def __init__(self, data_source, config=None, postpone_data_source=False, **kwargs): self.config = config or {} self._postpone_data_source = postpone_data_source self.data_source = data_source self.read_dispatcher = singledispatch(self.read) s...
_imread'), config.get('data_source'), config=config) class DataReaderField(BaseField): def validate(self, entry, field_uri=None, fetch_only=False, validation_scheme=None): errors = super().validate(entry, field_uri) if entry is None: return errors field_uri = field_uri or sel...
256
256
1,244
6
249
IndiraSalyahova/open_model_zoo
tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py
Python
BaseReader
BaseReader
197
347
197
197
a5989deff40f1a82f490fab078a84e3f99f7b7e0
bigcode/the-stack
train
321c329abfe1f0fce092802a
train
class
class ReaderCombiner(BaseReader): __provider__ = 'combine_reader' @classmethod def parameters(cls): parameters = super().parameters() parameters.update({ 'scheme': DictField(value_type=DataReaderField(), key_type=StringField(), allow_empty=False, ...
class ReaderCombiner(BaseReader):
__provider__ = 'combine_reader' @classmethod def parameters(cls): parameters = super().parameters() parameters.update({ 'scheme': DictField(value_type=DataReaderField(), key_type=StringField(), allow_empty=False, description='Dictionary for descri...
_scheme(cls, provider=None): if cls.__name__ == BaseReader.__name__: if provider: return cls.resolve(provider).validation_scheme() full_scheme = {} for provider_ in cls.providers: full_scheme[provider_] = cls.resolve(provider_).validation_schem...
77
77
259
7
70
IndiraSalyahova/open_model_zoo
tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py
Python
ReaderCombiner
ReaderCombiner
350
380
350
350
787c0c6a6ee9d0462020bc65eb824448c22cc883
bigcode/the-stack
train
886411e03dd674b125488cf8
train
class
class AnnotationDataIdentifier: def __init__(self, ann_id, data_id): self.annotation_id = ann_id self.data_id = data_id
class AnnotationDataIdentifier:
def __init__(self, ann_id, data_id): self.annotation_id = ann_id self.data_id = data_id
self.metadata['image_size'] = len(data) elif isinstance(data, dict): self.metadata['image_size'] = data.values().next().shape else: self.metadata['image_size'] = data.shape if not isinstance(data, list) else np.shape(data[0]) class AnnotationDataIdentifier:
64
64
34
5
59
IndiraSalyahova/open_model_zoo
tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py
Python
AnnotationDataIdentifier
AnnotationDataIdentifier
52
55
52
52
6d1f41216ee0da7ee0f0fe8f9d4dd8286bfca48b
bigcode/the-stack
train
3e4f94d2b9e6641005ede533
train
function
def deserialize_identifier(identifier): if isinstance(identifier, dict): options = identifier_deserialization.get(identifier.get('type')) if options is None: raise ValueError('Unsupported identifier type: {}'.format(identifier.get('type'))) fields = [] for field, recursiv...
def deserialize_identifier(identifier):
if isinstance(identifier, dict): options = identifier_deserialization.get(identifier.get('type')) if options is None: raise ValueError('Unsupported identifier type: {}'.format(identifier.get('type'))) fields = [] for field, recursive, to_tuple in zip(options.fields, optio...
(identifier).__name__] serialized_id = {'type': options.type} for idx, field in options.fields: serialized_id[field] = ( identifier[idx] if not options.recursive[idx] else serialize_identifier(identifier[idx]) ) return serialized_id return identifier ...
64
64
139
5
58
IndiraSalyahova/open_model_zoo
tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py
Python
deserialize_identifier
deserialize_identifier
112
129
112
112
7c0ff600d73a89b73b6cf89f554e8213e468ce87
bigcode/the-stack
train
83b611ed73f024a69a6bcfcd
train
function
def main(): """ Runs the test """ args = mujoco_arg_parser().parse_args() train(args.env, num_timesteps=args.num_timesteps, seed=args.seed)
def main():
""" Runs the test """ args = mujoco_arg_parser().parse_args() train(args.env, num_timesteps=args.num_timesteps, seed=args.seed)
cg_iters=10, cg_damping=0.1, entcoeff=0.0, gamma=0.99, lam=0.98, vf_iters=5, vf_stepsize=1e-3) model.learn(total_timesteps=num_timesteps) env.close() def main():
64
64
40
3
61
TreeKid/stable-baselines
stable_baselines/trpo_mpi/run_mujoco.py
Python
main
main
36
41
36
36
7917fa514111f3a20ed52cd6822dde2b4a0acda9
bigcode/the-stack
train
59aa936a770b436a32e003cd
train
function
def train(env_id, num_timesteps, seed): """ Train TRPO model for the mujoco environment, for testing purposes :param env_id: (str) Environment ID :param num_timesteps: (int) The total number of samples :param seed: (int) The initial seed for training """ with tf_util.single_threaded_session...
def train(env_id, num_timesteps, seed):
""" Train TRPO model for the mujoco environment, for testing purposes :param env_id: (str) Environment ID :param num_timesteps: (int) The total number of samples :param seed: (int) The initial seed for training """ with tf_util.single_threaded_session(): rank = MPI.COMM_WORLD.Get_ra...
from stable_baselines.common.cmd_util import make_mujoco_env, mujoco_arg_parser from stable_baselines.common.policies import MlpPolicy from stable_baselines import logger from stable_baselines.trpo_mpi import TRPO import stable_baselines.common.tf_util as tf_util def train(env_id, num_timesteps, seed):
72
72
242
11
60
TreeKid/stable-baselines
stable_baselines/trpo_mpi/run_mujoco.py
Python
train
train
12
33
12
12
0c639dedfd9f6852f2503cfada64593ed7be54b3
bigcode/the-stack
train
ce72021daded2cc7f3bd6cea
train
class
class SwatchView(MethodView): """ change the bootswatch theme """ def post(self): current_user.set_swatch(request.form.get('swatch')) return redirect(url_for('admin.index'))
class SwatchView(MethodView):
""" change the bootswatch theme """ def post(self): current_user.set_swatch(request.form.get('swatch')) return redirect(url_for('admin.index'))
#!/usr/bin/env python # -*- coding: utf-8 -*- from flask import redirect, request, url_for from flask.views import MethodView from flask.ext.security import current_user class SwatchView(MethodView):
46
64
45
7
38
yencchen/quokka_epus
quokka/modules/accounts/views.py
Python
SwatchView
SwatchView
9
16
9
9
8ba066e90b672027b8e6d4ac9f7b79ad96945eb8
bigcode/the-stack
train
43e730fe40ebc6e9306dc73c
train
class
class TestInstanceNotificationSampleWithMultipleCompute( notification_sample_base.NotificationSampleTestBase): def setUp(self): self.flags(compute_driver='fake.FakeLiveMigrateDriver') self.flags(use_neutron=True) self.flags(bdms_in_notifications='True', group='notifications') ...
class TestInstanceNotificationSampleWithMultipleCompute( notification_sample_base.NotificationSampleTestBase):
def setUp(self): self.flags(compute_driver='fake.FakeLiveMigrateDriver') self.flags(use_neutron=True) self.flags(bdms_in_notifications='True', group='notifications') super(TestInstanceNotificationSampleWithMultipleCompute, self).setUp() self.neutron = fixtures.NeutronFixture(...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
245
256
2,277
18
226
lixiaoy1/nova
nova/tests/functional/notification_sample_tests/test_instance.py
Python
TestInstanceNotificationSampleWithMultipleCompute
TestInstanceNotificationSampleWithMultipleCompute
31
294
31
33
a67d39c0dc6f83e09e855c6211b5910d31fd17ef
bigcode/the-stack
train
ec6ffeb6969fce3d96acd917
train
class
class TestInstanceNotificationSampleOldAttachFlow( TestInstanceNotificationSample): def setUp(self): self.flags(use_neutron=True) self.flags(bdms_in_notifications='True', group='notifications') super(TestInstanceNotificationSample, self).setUp() self.neutron = fixtures.Neutr...
class TestInstanceNotificationSampleOldAttachFlow( TestInstanceNotificationSample):
def setUp(self): self.flags(use_neutron=True) self.flags(bdms_in_notifications='True', group='notifications') super(TestInstanceNotificationSample, self).setUp() self.neutron = fixtures.NeutronFixture(self) self.useFixture(self.neutron) self.cinder = fixtures.CinderFi...
reservation_id': server['reservation_id'], 'uuid': server['id']}, actual=fake_notifier.VERSIONED_NOTIFICATIONS[0]) self._verify_notification( 'instance-unlock', replacements={ 'reservation_id': server['reservation_id'], 'uuid': ...
92
92
308
15
77
lixiaoy1/nova
nova/tests/functional/notification_sample_tests/test_instance.py
Python
TestInstanceNotificationSampleOldAttachFlow
TestInstanceNotificationSampleOldAttachFlow
1,921
1,955
1,921
1,923
2f993cabe40fb3ce97fa6192ccac2367779dd1b1
bigcode/the-stack
train
ba8789a3382ce521ca7e4c2a
train
class
class TestInstanceNotificationSampleWithMultipleComputeOldAttachFlow( TestInstanceNotificationSampleWithMultipleCompute): def setUp(self): self.flags(compute_driver='fake.FakeLiveMigrateDriver') self.flags(use_neutron=True) self.flags(bdms_in_notifications='True', group='notificatio...
class TestInstanceNotificationSampleWithMultipleComputeOldAttachFlow( TestInstanceNotificationSampleWithMultipleCompute):
def setUp(self): self.flags(compute_driver='fake.FakeLiveMigrateDriver') self.flags(use_neutron=True) self.flags(bdms_in_notifications='True', group='notifications') super(TestInstanceNotificationSampleWithMultipleCompute, self).setUp() self.neutron = fixtures.NeutronFixture(...
instance-live_migration_force_complete-end', replacements={ 'reservation_id': server['reservation_id'], 'uuid': server['id']}, actual=fake_notifier.VERSIONED_NOTIFICATIONS[5]) class TestInstanceNotificationSampleWithMultipleComputeOldAttachFlow( TestInstan...
64
64
173
21
43
lixiaoy1/nova
nova/tests/functional/notification_sample_tests/test_instance.py
Python
TestInstanceNotificationSampleWithMultipleComputeOldAttachFlow
TestInstanceNotificationSampleWithMultipleComputeOldAttachFlow
297
314
297
299
8d1fd6fa16f72832509d2430a9732baff9f491e0
bigcode/the-stack
train
f47f3e8812085f1b208612a3
train
class
class TestInstanceNotificationSample( notification_sample_base.NotificationSampleTestBase): def setUp(self): self.flags(use_neutron=True) self.flags(bdms_in_notifications='True', group='notifications') super(TestInstanceNotificationSample, self).setUp() self.neutron = fixtur...
class TestInstanceNotificationSample( notification_sample_base.NotificationSampleTestBase):
def setUp(self): self.flags(use_neutron=True) self.flags(bdms_in_notifications='True', group='notifications') super(TestInstanceNotificationSample, self).setUp() self.neutron = fixtures.NeutronFixture(self) self.useFixture(self.neutron) self.cinder = fixtures.CinderFi...
['id']}, actual=fake_notifier.VERSIONED_NOTIFICATIONS[4]) self._verify_notification( 'instance-live_migration_force_complete-end', replacements={ 'reservation_id': server['reservation_id'], 'uuid': server['id']}, actual=fake_notifie...
256
256
14,194
15
241
lixiaoy1/nova
nova/tests/functional/notification_sample_tests/test_instance.py
Python
TestInstanceNotificationSample
TestInstanceNotificationSample
317
1,918
317
319
c76b2e0c2350b9fd622ccd499a597c285b7b10f1
bigcode/the-stack
train
740bb27b58c4a1c6528b1d2b
train
class
class Migration(migrations.Migration): dependencies = [ ('core', '0001_initial'), ] operations = [ migrations.CreateModel( name='Tag', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ...
class Migration(migrations.Migration):
dependencies = [ ('core', '0001_initial'), ] operations = [ migrations.CreateModel( name='Tag', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_l...
# Generated by Django 2.1.15 on 2021-05-13 14:57 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
51
64
103
7
43
bflorez03/recipe-app-api
app/core/migrations/0002_tag.py
Python
Migration
Migration
8
23
8
9
b457c9f3c62c1da9cf44712b03eede8dbf0be2c0
bigcode/the-stack
train
31c95bd72f93c68cb8a705e1
train
class
class Location: map: gamemap.GameMap x: int y: int @property def xy(self) -> Tuple[int, int]: return self.x, self.y @xy.setter def xy(self, xy: Tuple[int, int]) -> None: self.x, self.y = xy def distance_to(self, x: int, y: int) -> int: """Return the approximate...
class Location:
map: gamemap.GameMap x: int y: int @property def xy(self) -> Tuple[int, int]: return self.x, self.y @xy.setter def xy(self, xy: Tuple[int, int]) -> None: self.x, self.y = xy def distance_to(self, x: int, y: int) -> int: """Return the approximate number of steps...
from __future__ import annotations from typing import Tuple, TYPE_CHECKING if TYPE_CHECKING: import gamemap class Location:
29
64
160
3
25
HexDecimal/7drl-2020
location.py
Python
Location
Location
9
28
9
9
c645b87d59cd47ee0008c1fe128ade3847beb35b
bigcode/the-stack
train
3527fc5e61d50d177b0453cd
train
function
def generate_tissue_mask(arr, compression=8, otsu=False, threshold=220, connectivity=8, kernel=61, min_object_size=100000, r...
def generate_tissue_mask(arr, compression=8, otsu=False, threshold=220, connectivity=8, kernel=61, min_object_size=100000, r...
img=cv2.resize(arr,None,fx=1/compression,fy=1/compression,interpolation=cv2.INTER_CUBIC) WB, lbl=label_objects(img, otsu=otsu, min_object_size=min_object_size, threshold=threshold, connectivity=connectivity, kernel=kernel,keep_holes=keep_holes,max_hole_size=max_hole_size, gray_before_close=gray_before_close,blu...
def generate_tissue_mask(arr, compression=8, otsu=False, threshold=220, connectivity=8, kernel=61, min_object_size=100000, r...
74
73
245
74
0
nik875/PathPretrain
pathpretrain/utils.py
Python
generate_tissue_mask
generate_tissue_mask
80
99
80
91
ae57fbc84a182c0cb128b437498cc6d8e63ab27b
bigcode/the-stack
train
cabc679435d7798083208937
train
function
def filter_grays(rgb, tolerance=15, output_type="bool"): """ https://github.com/deroneriksson/python-wsi-preprocessing/blob/master/deephistopath/wsi/filter.py Create a mask to filter out pixels where the red, green, and blue channel values are similar. Args: np_img: RGB image as a NumPy array. t...
def filter_grays(rgb, tolerance=15, output_type="bool"):
""" https://github.com/deroneriksson/python-wsi-preprocessing/blob/master/deephistopath/wsi/filter.py Create a mask to filter out pixels where the red, green, and blue channel values are similar. Args: np_img: RGB image as a NumPy array. tolerance: Tolerance value to determine how similar the va...
_transform_edt import scipy.ndimage as ndimage from skimage import morphology as morph from scipy.ndimage.morphology import binary_fill_holes as fill_holes from skimage.filters import threshold_otsu, rank from skimage.morphology import convex_hull_image, remove_small_holes from skimage import measure def filter_grays(r...
87
87
292
15
71
nik875/PathPretrain
pathpretrain/utils.py
Python
filter_grays
filter_grays
24
47
24
24
23c92332c42be41a0718529859e22d318b1cc1db
bigcode/the-stack
train
a7fadcbd794404100fdbe73e
train
function
def deduplicate_images(image_list): image_list=pd.Series(image_list) # if X is a pandas series containing images for individual elements shapes_=np.array([x.shape[:2] for x in image_list]) # get shapes d_mat=(euclidean_distances(shapes_)+np.eye(len(shapes_))) # coarse shape matching first d_mat[np.tril_...
def deduplicate_images(image_list):
image_list=pd.Series(image_list) # if X is a pandas series containing images for individual elements shapes_=np.array([x.shape[:2] for x in image_list]) # get shapes d_mat=(euclidean_distances(shapes_)+np.eye(len(shapes_))) # coarse shape matching first d_mat[np.tril_indices(len(d_mat))]=1 d_mat=d_m...
: for i in range(1,lbl.max()+1): WB=WB+convex_hull_image(lbl==i) WB=WB>0 WB=cv2.resize(WB.astype(np.uint8),arr.shape[:2][::-1],interpolation=cv2.INTER_CUBIC)>0 return WB ###################################### def deduplicate_images(image_list):
80
80
268
7
72
nik875/PathPretrain
pathpretrain/utils.py
Python
deduplicate_images
deduplicate_images
104
121
104
104
b83b92a711fdd190dd643ce2618224cfeebdf799
bigcode/the-stack
train
0abd362c53d8cbb5c576345f
train
function
def load_image(image_file, check_size=False): img_ext=os.path.splitext(image_file) if img_ext[-1]==".npy": image=np.load(image_file) elif img_ext[-1] in [".svs",".tif",".tiff",".png"]: if check_size: import openslide slide=openslide.open_slide(image_file) imag...
def load_image(image_file, check_size=False):
img_ext=os.path.splitext(image_file) if img_ext[-1]==".npy": image=np.load(image_file) elif img_ext[-1] in [".svs",".tif",".tiff",".png"]: if check_size: import openslide slide=openslide.open_slide(image_file) image=tifffile.imread(image_file) if check...
((i,j)) # update information on matching images G=nx.Graph() G.add_edges_from(same) remove=[] for comp in nx.connected_components(G): remove.extend(list(comp)[1:]) return image_list.drop(remove).tolist() def load_image(image_file, check_size=False):
64
64
172
10
54
nik875/PathPretrain
pathpretrain/utils.py
Python
load_image
load_image
123
136
123
123
842264eb42b0f902d1b317651316a527f13b67e1
bigcode/the-stack
train
8cb212945787c37866d7d2bc
train
function
def label_objects(img, otsu=True, min_object_size=100000, threshold=240, connectivity=8, kernel=61, keep_holes=False, max_hole_size=0, gray_before_close=False, ...
def label_objects(img, otsu=True, min_object_size=100000, threshold=240, connectivity=8, kernel=61, keep_holes=False, max_hole_size=0, gray_before_close=False, ...
I=cv2.cvtColor(img,cv2.COLOR_RGB2GRAY) gray_mask=filter_grays(img, output_type="bool") if otsu: threshold = threshold_otsu(I) BW = (I<threshold).astype(bool) if gray_before_close: BW=BW&gray_mask if kernel>0: BW = morph.binary_closing(BW, morph.disk(kernel))#square if not gray_before_close: ...
": pass elif output_type == "float": result = result.astype(float) else: result = result.astype("uint8") * 255 return result def label_objects(img, otsu=True, min_object_size=100000, threshold=240, connectivity=8...
98
98
329
59
38
nik875/PathPretrain
pathpretrain/utils.py
Python
label_objects
label_objects
50
77
50
59
7caf24ffadd5e417d079b0cfdf6f9ceed68eb538
bigcode/the-stack
train
8c804b33fe5c2317fa90c789
train
class
class SimpleAudioService(AudioBackend): """ Simple Audio backend for both mpg123 and the ogg123 player. This one is rather limited and only implements basic usage. """ def __init__(self, config, bus, name='simple'): super().__init__(config, bus) self.config = config ...
class SimpleAudioService(AudioBackend):
""" Simple Audio backend for both mpg123 and the ogg123 player. This one is rather limited and only implements basic usage. """ def __init__(self, config, bus, name='simple'): super().__init__(config, bus) self.config = config self.process = None self.bus = b...
# 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 implied. # See the License for the specific language governing permissions and # limitations under the License. # im...
256
256
1,230
7
249
assistent-cat/mycroft-core
mycroft/audio/services/simple/__init__.py
Python
SimpleAudioService
SimpleAudioService
45
224
45
45
a1958c4395c7c1eb1cf74641c6a3b1e17935ddc9
bigcode/the-stack
train
09a8e6056a0487109ce72826
train
function
def load_service(base_config, bus): backends = base_config.get('backends', []) services = [(b, backends[b]) for b in backends if backends[b]['type'] == 'simple' and backends[b].get('active', True)] instances = [SimpleAudioService(s[1], bus, s[0]) for s in services] return...
def load_service(base_config, bus):
backends = base_config.get('backends', []) services = [(b, backends[b]) for b in backends if backends[b]['type'] == 'simple' and backends[b].get('active', True)] instances = [SimpleAudioService(s[1], bus, s[0]) for s in services] return instances
sleep(0.1) countdown -= 1 if self._is_process_running(): # Failed to shutdown when asked nicely. Force the issue. LOG.debug("Killing currently playing audio...") self.process.kill() self.process = None def load_service...
64
64
87
8
55
assistent-cat/mycroft-core
mycroft/audio/services/simple/__init__.py
Python
load_service
load_service
227
233
227
227
9634b5531bd72ead27979d9adfc8cdb7a9ac6f87
bigcode/the-stack
train
a59cc93b456f60e311d5f998
train
function
def find_mime(path): mime = None if path.startswith('http'): response = Session().head(path, allow_redirects=True) if 200 <= response.status_code < 300: mime = response.headers['content-type'] if not mime: mime = mimetypes.guess_type(path)[0] # Remove any http address...
def find_mime(path):
mime = None if path.startswith('http'): response = Session().head(path, allow_redirects=True) if 200 <= response.status_code < 300: mime = response.headers['content-type'] if not mime: mime = mimetypes.guess_type(path)[0] # Remove any http address arguments if not...
sleep from mycroft.audio.services import AudioBackend from mycroft.messagebus.message import Message from mycroft.util.log import LOG from mycroft.util import play_mp3, play_ogg, play_wav import mimetypes import re from requests import Session def find_mime(path):
64
64
123
6
57
assistent-cat/mycroft-core
mycroft/audio/services/simple/__init__.py
Python
find_mime
find_mime
27
42
27
27
10b0588949f3f91a996d5a50bc83a6a6b3121e1b
bigcode/the-stack
train
6325ae881f5a2c35306cd459
train
function
def foo(): from math import ( sin, cos as cos_ ) return sin(1), cos_(0)
def foo():
from math import ( sin, cos as cos_ ) return sin(1), cos_(0)
import requests from math import sin import datetime as dt BASE_SCENARIO = """ ########## # Accounts """ def foo():
30
64
27
3
27
mgaitan/move-imports
tests/example.py
Python
foo
foo
11
15
11
11
65ccec3bc0b88cabab5eefb2eaefea4f7fda5746
bigcode/the-stack
train
a151ae21fc0ccf9a972a1dde
train
function
def bar(): from math import tan return tan(1)
def bar():
from math import tan return tan(1)
import requests from math import sin import datetime as dt BASE_SCENARIO = """ ########## # Accounts """ def foo(): from math import ( sin, cos as cos_ ) return sin(1), cos_(0) def bar():
57
64
15
3
54
mgaitan/move-imports
tests/example.py
Python
bar
bar
18
20
18
18
965fd77fc5a712de50e1f18e58e4fcf74a6c230e
bigcode/the-stack
train
80353a3c4a54a54de96f6427
train
class
class PowerDnsBaseProvider(BaseProvider): SUPPORTS_GEO = False SUPPORTS_DYNAMIC = False SUPPORTS_ROOT_NS = False SUPPORTS = set(('A', 'AAAA', 'ALIAS', 'CAA', 'CNAME', 'MX', 'NAPTR', 'NS', 'PTR', 'SPF', 'SSHFP', 'SRV', 'TXT')) TIMEOUT = 5 def __init__(self, id, host, api_key,...
class PowerDnsBaseProvider(BaseProvider):
SUPPORTS_GEO = False SUPPORTS_DYNAMIC = False SUPPORTS_ROOT_NS = False SUPPORTS = set(('A', 'AAAA', 'ALIAS', 'CAA', 'CNAME', 'MX', 'NAPTR', 'NS', 'PTR', 'SPF', 'SSHFP', 'SRV', 'TXT')) TIMEOUT = 5 def __init__(self, id, host, api_key, port=8081, scheme="http"...
# # # from __future__ import absolute_import, division, print_function, \ unicode_literals from requests import HTTPError, Session import logging from ..record import Create, Record from .base import BaseProvider class PowerDnsBaseProvider(BaseProvider):
55
256
3,126
8
46
swisstxt/octodns-2
octodns/provider/powerdns.py
Python
PowerDnsBaseProvider
PowerDnsBaseProvider
15
429
15
15
f94baa3d722f8b59abf16cff16e5967ae3bed2d7
bigcode/the-stack
train
13a52c7d7c23caa8119c8ec8
train
class
class PowerDnsProvider(PowerDnsBaseProvider): ''' PowerDNS API v4 Provider powerdns: class: octodns.provider.powerdns.PowerDnsProvider # The host on which PowerDNS api is listening (required) host: fqdn # The api key that grans access (required) api_key: api-key ...
class PowerDnsProvider(PowerDnsBaseProvider):
''' PowerDNS API v4 Provider powerdns: class: octodns.provider.powerdns.PowerDnsProvider # The host on which PowerDNS api is listening (required) host: fqdn # The api key that grans access (required) api_key: api-key # The port on which PowerDNS api is listen...
kind': 'Master', 'masters': [], 'nameservers': [], 'rrsets': mods, 'soa_edit_api': self.soa_edit_api, 'serial': 0, } try: self._post('zones', data) except HTTPError as e: s...
123
123
413
10
113
swisstxt/octodns-2
octodns/provider/powerdns.py
Python
PowerDnsProvider
PowerDnsProvider
432
475
432
432
b864ef847395243a10e8d40a2db7c1a2d7fc911d
bigcode/the-stack
train
b47799a7f317fc16d0fa8eee
train
class
class FpingTestV2(FpingTestV21): controller_cls = fping.FpingController def _get_url(self): return "/v2/1234"
class FpingTestV2(FpingTestV21):
controller_cls = fping.FpingController def _get_url(self): return "/v2/1234"
instance_id='') req = fakes.HTTPRequest.blank(self._get_url() + "os-fping/%s" % FAKE_UUID) self.assertRaises(webob.exc.HTTPNotFound, self.controller.show, req, FAKE_UUID) class FpingTestV2(FpingTestV21):
64
64
38
12
52
mmnelemane/nova_stable_juno
nova/tests/unit/api/openstack/compute/test_fping.py
Python
FpingTestV2
FpingTestV2
114
118
114
114
6a57b938c29465a55ef7ac03ede2c5229cafd4b0
bigcode/the-stack
train
cdcfe446d4b9c4af20906bc3
train
class
class FpingPolicyEnforcementV21(test.NoDBTestCase): def setUp(self): super(FpingPolicyEnforcementV21, self).setUp() self.controller = fping_v21.FpingController() self.req = fakes.HTTPRequest.blank('') def common_policy_check(self, rule, func, *arg, **kwarg): self.policy.set_rul...
class FpingPolicyEnforcementV21(test.NoDBTestCase):
def setUp(self): super(FpingPolicyEnforcementV21, self).setUp() self.controller = fping_v21.FpingController() self.req = fakes.HTTPRequest.blank('') def common_policy_check(self, rule, func, *arg, **kwarg): self.policy.set_rules(rule) exc = self.assertRaises( ...
" % FAKE_UUID) self.assertRaises(webob.exc.HTTPNotFound, self.controller.show, req, FAKE_UUID) class FpingTestV2(FpingTestV21): controller_cls = fping.FpingController def _get_url(self): return "/v2/1234" class FpingPolicyEnforcementV21(test.NoDBTestCase):
80
80
269
14
66
mmnelemane/nova_stable_juno
nova/tests/unit/api/openstack/compute/test_fping.py
Python
FpingPolicyEnforcementV21
FpingPolicyEnforcementV21
121
148
121
122
1aecddab7c680922cddb3a651f733190df07cf19
bigcode/the-stack
train