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
0a60355c3b8e62b3e99056fa
train
function
def testCantDeserializeStringThatDoesntStartWithBracket(data): with pytest.raises(SlimSyntaxError): deserialize('hello')
def testCantDeserializeStringThatDoesntStartWithBracket(data):
with pytest.raises(SlimSyntaxError): deserialize('hello')
assert data == deserialized def testCantDeseriailzeNullString(data): with pytest.raises(SlimSyntaxError): deserialize(None) def testCantDeserializeEmptyString(data): with pytest.raises(SlimSyntaxError): deserialize('') def testCantDeserializeStringThatDoesntStartWithBracket(data):
63
64
27
13
51
BernardNotarianni/slimer
test/test_list_deserializer.py
Python
testCantDeserializeStringThatDoesntStartWithBracket
testCantDeserializeStringThatDoesntStartWithBracket
28
30
28
28
649780246b0390fbbe0cc0cfb5033da6429a1926
bigcode/the-stack
train
13c8305bc5d7d6820c688b37
train
function
def check(data): serialized = serialize(data) deserialized = deserialize(serialized) assert data == deserialized
def check(data):
serialized = serialize(data) deserialized = deserialize(serialized) assert data == deserialized
import pytest from slimer.list_serializer import serialize from slimer.list_deserializer import deserialize from slimer.list_deserializer import SlimSyntaxError @pytest.fixture def data(): return [] def check(data):
44
64
25
4
40
BernardNotarianni/slimer
test/test_list_deserializer.py
Python
check
check
12
15
12
12
9af3e664157a1a1671d779af3bdf6e6fc29a4f75
bigcode/the-stack
train
291dcbecadb2cdf84397ac42
train
function
@pytest.fixture def data(): return []
@pytest.fixture def data():
return []
import pytest from slimer.list_serializer import serialize from slimer.list_deserializer import deserialize from slimer.list_deserializer import SlimSyntaxError @pytest.fixture def data():
37
64
9
6
30
BernardNotarianni/slimer
test/test_list_deserializer.py
Python
data
data
8
10
8
9
b0308ed432f71c553bb87eda0109480bc985db60
bigcode/the-stack
train
a362a898757c95e417271718
train
function
def testCantDeseriailzeNullString(data): with pytest.raises(SlimSyntaxError): deserialize(None)
def testCantDeseriailzeNullString(data):
with pytest.raises(SlimSyntaxError): deserialize(None)
slimer.list_deserializer import deserialize from slimer.list_deserializer import SlimSyntaxError @pytest.fixture def data(): return [] def check(data): serialized = serialize(data) deserialized = deserialize(serialized) assert data == deserialized def testCantDeseriailzeNullString(data):
64
64
24
11
52
BernardNotarianni/slimer
test/test_list_deserializer.py
Python
testCantDeseriailzeNullString
testCantDeseriailzeNullString
18
20
18
18
1e6100cf419fa04f7f972a568e7d9ea6a61bbd33
bigcode/the-stack
train
80ec023b0be7341e510a7897
train
function
def testEmptyList(data): check(data)
def testEmptyList(data):
check(data)
('') def testCantDeserializeStringThatDoesntStartWithBracket(data): with pytest.raises(SlimSyntaxError): deserialize('hello') def testCantDeserializeStringThatDoesntEndWithBracket(data): with pytest.raises(SlimSyntaxError): deserialize('[000000:') def testEmptyList(data):
63
64
10
6
58
BernardNotarianni/slimer
test/test_list_deserializer.py
Python
testEmptyList
testEmptyList
38
39
38
38
f4a1e23ab62b21965fdfbc8e9b2ca3f822594b84
bigcode/the-stack
train
14a5295ca54cd4ca66a87d4b
train
function
def testCantDeserializeEmptyString(data): with pytest.raises(SlimSyntaxError): deserialize('')
def testCantDeserializeEmptyString(data):
with pytest.raises(SlimSyntaxError): deserialize('')
def data(): return [] def check(data): serialized = serialize(data) deserialized = deserialize(serialized) assert data == deserialized def testCantDeseriailzeNullString(data): with pytest.raises(SlimSyntaxError): deserialize(None) def testCantDeserializeEmptyString(data):
64
64
20
8
56
BernardNotarianni/slimer
test/test_list_deserializer.py
Python
testCantDeserializeEmptyString
testCantDeserializeEmptyString
23
25
23
23
8d39311dbd4312b547cdb1992e5ee1bc524e5a50
bigcode/the-stack
train
e2267335e86472f98267f394
train
function
def testListWithOneElement(data): data.append("hello") check(data)
def testListWithOneElement(data):
data.append("hello") check(data)
Bracket(data): with pytest.raises(SlimSyntaxError): deserialize('hello') def testCantDeserializeStringThatDoesntEndWithBracket(data): with pytest.raises(SlimSyntaxError): deserialize('[000000:') def testEmptyList(data): check(data) def testListWithOneElement(data):
64
64
18
8
56
BernardNotarianni/slimer
test/test_list_deserializer.py
Python
testListWithOneElement
testListWithOneElement
42
44
42
42
81e14885a7f477e861e47ffe12cf3ce17b1951f1
bigcode/the-stack
train
3e4f4b89415b576fe9208500
train
function
def testListWithTwoElements(data): data.append("hello") data.append("world") check(data)
def testListWithTwoElements(data):
data.append("hello") data.append("world") check(data)
testCantDeserializeStringThatDoesntEndWithBracket(data): with pytest.raises(SlimSyntaxError): deserialize('[000000:') def testEmptyList(data): check(data) def testListWithOneElement(data): data.append("hello") check(data) def testListWithTwoElements(data):
64
64
24
8
56
BernardNotarianni/slimer
test/test_list_deserializer.py
Python
testListWithTwoElements
testListWithTwoElements
47
50
47
47
b7915c3c2f3c6e84c77e6f351ae01cd237d50163
bigcode/the-stack
train
2536bc1bb8d780b244d1ce42
train
function
def testListWithSubList(data): sublist = [] sublist.append("hello") sublist.append("world") data.append(sublist) data.append("single") check(data)
def testListWithSubList(data):
sublist = [] sublist.append("hello") sublist.append("world") data.append(sublist) data.append("single") check(data)
000000:') def testEmptyList(data): check(data) def testListWithOneElement(data): data.append("hello") check(data) def testListWithTwoElements(data): data.append("hello") data.append("world") check(data) def testListWithSubList(data):
64
64
43
8
56
BernardNotarianni/slimer
test/test_list_deserializer.py
Python
testListWithSubList
testListWithSubList
53
59
53
53
a93e153fe286cda0e05129ef207b79f7985bcefc
bigcode/the-stack
train
bf58953ac4966a6a4fd3d956
train
function
def split_tsvline(hunline, index): expanded = hunline.split("\t") if len(expanded) != 3 and len(expanded) != 2: raise ValueError( f"Unexpected line format\n {index}\t{hunline} - {len(expanded)} columns found") return expanded
def split_tsvline(hunline, index):
expanded = hunline.split("\t") if len(expanded) != 3 and len(expanded) != 2: raise ValueError( f"Unexpected line format\n {index}\t{hunline} - {len(expanded)} columns found") return expanded
><i><span style="color:gray; font-size: {0.0625*size}em;">{chapter_expanded[1]}</span></i></td></tr>\n """ def paragraph_footer(): return "</table>" def split_tsvline(hunline, index):
63
64
71
11
52
pschonev/biBooks
src/txt_to_html.py
Python
split_tsvline
split_tsvline
29
34
29
29
e9560c59d82b3683ea0270f575145ecf06db966b
bigcode/the-stack
train
078af3425edf4c19c1b4d71d
train
function
def paragraph_footer(): return "</table>"
def paragraph_footer():
return "</table>"
th}\n <tr><td></td>\n <td><i><span style="color:gray; font-size: {0.0625*size}em;">{chapter_expanded[1]}</span></i></td></tr>\n """ def paragraph_footer():
63
64
9
4
59
pschonev/biBooks
src/txt_to_html.py
Python
paragraph_footer
paragraph_footer
25
26
25
25
0ecdc1491cea236159714c8938fa7b5aca3af935
bigcode/the-stack
train
b47c6687c74f82b3e6753d4f
train
function
def tsv2html_bar(paragraph, size, chapter_regex): if not paragraph.strip(): return '' lines = paragraph.strip('\n').split('\n') par_text = [] for index, line in enumerate(lines): if index == 0: par_text.append(paragraph_header(line, size)) elif re.search(chapter_regex...
def tsv2html_bar(paragraph, size, chapter_regex):
if not paragraph.strip(): return '' lines = paragraph.strip('\n').split('\n') par_text = [] for index, line in enumerate(lines): if index == 0: par_text.append(paragraph_header(line, size)) elif re.search(chapter_regex, line) and index > 0: par_text.append...
""" else: # blank line -- this codepath can't be hit if called via tsv2html_bar htmlized_line = "" #print >> sys.stderr, index, htmlized_line return htmlized_line def tsv2html_bar(paragraph, size, chapter_regex):
64
64
135
14
49
pschonev/biBooks
src/txt_to_html.py
Python
tsv2html_bar
tsv2html_bar
53
67
53
53
b746d8787eafae6b746a9ee1079bf517878c8b7e
bigcode/the-stack
train
13299f10c428fbe99ac31d0a
train
function
def tsv2html(contents, stylesheet, size=14, chapter_regex=r"NO REGEX GIVEN"): text = [html_header(stylesheet)] text.append(tsv2html_bar(contents, size, chapter_regex)) text.append(html_footer()) return '\n'.join(text)
def tsv2html(contents, stylesheet, size=14, chapter_regex=r"NO REGEX GIVEN"):
text = [html_header(stylesheet)] text.append(tsv2html_bar(contents, size, chapter_regex)) text.append(html_footer()) return '\n'.join(text)
_text.append(paragraph_header(line, size)) else: par_text.append(tsv2html_line(line, size, index)) par_text.append(paragraph_footer()) return ''.join(par_text) def tsv2html(contents, stylesheet, size=14, chapter_regex=r"NO REGEX GIVEN"):
64
64
60
22
42
pschonev/biBooks
src/txt_to_html.py
Python
tsv2html
tsv2html
70
74
70
70
3cfab82b1be40b19c83bbe90cb3fbd4a7fb02e22
bigcode/the-stack
train
affc2f43c063a552c079b077
train
function
def paragraph_header(chapter_title, size): chapter_expanded = chapter_title.split("\t") th = '<th class="lr2th"></th>' return f""" <h1 class=chapter>{chapter_expanded[0]}</h1>\n<hr class="lrhr">\n<table class="lrtext">{th}{th}\n <tr><td></td>\n <td><i><span style="color:g...
def paragraph_header(chapter_title, size):
chapter_expanded = chapter_title.split("\t") th = '<th class="lr2th"></th>' return f""" <h1 class=chapter>{chapter_expanded[0]}</h1>\n<hr class="lrhr">\n<table class="lrtext">{th}{th}\n <tr><td></td>\n <td><i><span style="color:gray; font-size: {0.0625*size}em;">{chapter_...
8\">' style = f'<link rel="stylesheet" href={stylesheet} type="text/css">' return f'<html><head>{meta}\n{style}\n</head><body>' def html_footer(): return "</body></html>" def paragraph_header(chapter_title, size):
63
64
129
9
54
pschonev/biBooks
src/txt_to_html.py
Python
paragraph_header
paragraph_header
15
22
15
15
7ba4663f1b653a7df40af4bea57ca21b016faceb
bigcode/the-stack
train
a43713a3dcd01d2752f6d5a0
train
function
def tsv2html_line(line, size, index): expanded = split_tsvline(line, index) lrclass = "lraltline" if index % 2 else "" # now, is it a content line or just a matching blank? # content: if expanded[0].strip() or expanded[1].strip(): htmlized_line = f""" <tr class={lrclass}><td>{exp...
def tsv2html_line(line, size, index):
expanded = split_tsvline(line, index) lrclass = "lraltline" if index % 2 else "" # now, is it a content line or just a matching blank? # content: if expanded[0].strip() or expanded[1].strip(): htmlized_line = f""" <tr class={lrclass}><td>{expanded[0]}</td>\n <td><i><s...
") if len(expanded) != 3 and len(expanded) != 2: raise ValueError( f"Unexpected line format\n {index}\t{hunline} - {len(expanded)} columns found") return expanded def tsv2html_line(line, size, index):
64
64
189
12
51
pschonev/biBooks
src/txt_to_html.py
Python
tsv2html_line
tsv2html_line
37
50
37
37
acb5c23d1ea9c5d0f2ae4592e411797e0dfc89bd
bigcode/the-stack
train
b3f4a4b8cf158d7386fa8b04
train
function
def html_footer(): return "</body></html>"
def html_footer():
return "</body></html>"
= '<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">' style = f'<link rel="stylesheet" href={stylesheet} type="text/css">' return f'<html><head>{meta}\n{style}\n</head><body>' def html_footer():
63
64
11
4
59
pschonev/biBooks
src/txt_to_html.py
Python
html_footer
html_footer
11
12
11
11
a624f43b394a645811d4c406033872f02c166d37
bigcode/the-stack
train
7e4b07d4f85c9ed2e3fb569b
train
function
def html_header(stylesheet=""): meta = '<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">' style = f'<link rel="stylesheet" href={stylesheet} type="text/css">' return f'<html><head>{meta}\n{style}\n</head><body>'
def html_header(stylesheet=""):
meta = '<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">' style = f'<link rel="stylesheet" href={stylesheet} type="text/css">' return f'<html><head>{meta}\n{style}\n</head><body>'
import regex as re from pathlib import Path def html_header(stylesheet=""):
17
64
68
7
9
pschonev/biBooks
src/txt_to_html.py
Python
html_header
html_header
5
8
5
5
03294eda2f55df88630d606255bf9467957c05e5
bigcode/the-stack
train
5c85b06584b984518f026cd7
train
function
def find_n_pc(u_vec, factor=0.5): """Find number of principal components. This method finds the minimum number of principal components required. Parameters ---------- u_vec : numpy.ndarray Left singular vector of the original data factor : float, optional Factor for testing the...
def find_n_pc(u_vec, factor=0.5):
"""Find number of principal components. This method finds the minimum number of principal components required. Parameters ---------- u_vec : numpy.ndarray Left singular vector of the original data factor : float, optional Factor for testing the auto correlation (default is ``0....
# -*- coding: utf-8 -*- """SVD ROUTINES. This module contains methods for thresholding singular values. :Author: Samuel Farrens <samuel.farrens@cea.fr> """ import numpy as np from scipy.linalg import svd from modopt.base.transform import matrix2cube from modopt.interface.errors import warn from modopt.math.convol...
103
109
365
13
89
chaithyagr/ModOpt
modopt/signal/svd.py
Python
find_n_pc
find_n_pc
20
77
20
20
221e05f95941e36eaaef1d68119d2e52c314811d
bigcode/the-stack
train
07a9086ce570a6eda0b917ff
train
function
def svd_thresh_coef(input_data, operator, threshold, thresh_type='hard'): """Threshold the singular values coefficients. This method thresholds the input data using singular value decomposition Parameters ---------- input_data : numpy.ndarray Input data array, 2D matrix operator : clas...
def svd_thresh_coef(input_data, operator, threshold, thresh_type='hard'):
"""Threshold the singular values coefficients. This method thresholds the input data using singular value decomposition Parameters ---------- input_data : numpy.ndarray Input data array, 2D matrix operator : class Operator class instance threshold : float or numpy.ndarray ...
] # Threshold the singular values. s_new = thresh(s_values, threshold, thresh_type) if np.all(s_new == s_values): warn('No change to singular values.') # Diagonalize the svd s_new = np.diag(s_new) # Return the thresholded data. return np.dot(u_vec, np.dot(s_new, v_vec)) def svd_t...
99
99
331
17
82
chaithyagr/ModOpt
modopt/signal/svd.py
Python
svd_thresh_coef
svd_thresh_coef
203
256
203
203
e508824f1bc7f5666d6a45441130284328e2f581
bigcode/the-stack
train
a880021cc241c548995065c5
train
function
def svd_thresh(input_data, threshold=None, n_pc=None, thresh_type='hard'): """Threshold the singular values. This method thresholds the input data using singular value decomposition. Parameters ---------- input_data : numpy.ndarray Input data array, 2D matrix threshold : float or numpy...
def svd_thresh(input_data, threshold=None, n_pc=None, thresh_type='hard'):
"""Threshold the singular values. This method thresholds the input data using singular value decomposition. Parameters ---------- input_data : numpy.ndarray Input data array, 2D matrix threshold : float or numpy.ndarray, optional Threshold value(s) (default is ``None``) n_p...
2))] ** 2 <= factor * np.sum(u_val ** 2), ) for u_val in u_auto ]) def calculate_svd(input_data): """Calculate Singular Value Decomposition. This method calculates the Singular Value Decomposition (SVD) of the input data using SciPy. Parameters ---------- inpu...
217
217
725
19
198
chaithyagr/ModOpt
modopt/signal/svd.py
Python
svd_thresh
svd_thresh
113
200
113
113
a0b092762b495eec14bfd8bc8605082461c8ccc8
bigcode/the-stack
train
5a80fb479fb66a30439ee792
train
function
def calculate_svd(input_data): """Calculate Singular Value Decomposition. This method calculates the Singular Value Decomposition (SVD) of the input data using SciPy. Parameters ---------- input_data : numpy.ndarray Input data array, 2D matrix Returns ------- tuple ...
def calculate_svd(input_data):
"""Calculate Singular Value Decomposition. This method calculates the Singular Value Decomposition (SVD) of the input data using SciPy. Parameters ---------- input_data : numpy.ndarray Input data array, 2D matrix Returns ------- tuple Left singular vector, singular...
Return the required number of principal components. return np.sum([ ( u_val[tuple(zip(array_shape // 2))] ** 2 <= factor * np.sum(u_val ** 2), ) for u_val in u_auto ]) def calculate_svd(input_data):
63
64
166
7
56
chaithyagr/ModOpt
modopt/signal/svd.py
Python
calculate_svd
calculate_svd
80
110
80
80
be79e46c848bfa5dc370845d54c83af5402a1921
bigcode/the-stack
train
7bad7caab7dbb2bcfe086afb
train
class
@util.export class Plugin(plugin.PluginBase): """Apache ssl plugin.""" def __init__(self, context): super(Plugin, self).__init__(context=context) self._enabled = True self._params = { 'SSLCertificateFile': ( oengcommcons.FileLocations.OVIRT_ENGINE_PKI_APACHE_...
@util.export class Plugin(plugin.PluginBase):
"""Apache ssl plugin.""" def __init__(self, context): super(Plugin, self).__init__(context=context) self._enabled = True self._params = { 'SSLCertificateFile': ( oengcommcons.FileLocations.OVIRT_ENGINE_PKI_APACHE_CERT ), 'SSLCertificat...
import gettext import os from otopi import constants as otopicons from otopi import filetransaction from otopi import plugin from otopi import util from ovirt_engine_setup import constants as osetupcons from ovirt_engine_setup import util as osetuputil from ovirt_engine_setup.engine_common import constants as oeng...
256
256
1,256
10
246
18641315209/ovirt-engine
packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-common/apache/ssl.py
Python
Plugin
Plugin
60
256
60
61
1c93f5a188711004ddbeb9df5f865b5c8159d6e4
bigcode/the-stack
train
51dbfb3ea1083fcdbc620569
train
function
def _apply_logging(lines): result = [] found = False for line in lines: if not found and line.find('ovirt-requests-log') != -1: found = True if not found and line.find('</VirtualHost>') != -1: found = True result.append(_SSL_REQUESTS_LOG_FORMAT) re...
def _apply_logging(lines):
result = [] found = False for line in lines: if not found and line.find('ovirt-requests-log') != -1: found = True if not found and line.find('</VirtualHost>') != -1: found = True result.append(_SSL_REQUESTS_LOG_FORMAT) result.append(line) retur...
_SSL_REQUESTS_LOG_FORMAT = ( 'CustomLog logs/ovirt-requests-log ' ' "%t %h \\"Correlation-Id: %{Correlation-Id}o\\" ' '\\"Duration: %Dus\\" \\"%r\\" %b"' ) def _apply_logging(lines):
64
64
84
6
58
18641315209/ovirt-engine
packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-common/apache/ssl.py
Python
_apply_logging
_apply_logging
43
53
43
43
92de652528616636717452e7a99f8013161417cb
bigcode/the-stack
train
8abe83f259b7ba07863950a6
train
function
def _(m): return gettext.dgettext(message=m, domain='ovirt-engine-setup')
def _(m):
return gettext.dgettext(message=m, domain='ovirt-engine-setup')
found and line.find('ovirt-requests-log') != -1: found = True if not found and line.find('</VirtualHost>') != -1: found = True result.append(_SSL_REQUESTS_LOG_FORMAT) result.append(line) return result def _(m):
64
64
20
4
59
18641315209/ovirt-engine
packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-common/apache/ssl.py
Python
_
_
56
57
56
56
96ecb666e1777cf2c963c9fad615932665181f50
bigcode/the-stack
train
2a0987c0cf52f8411b0f0046
train
function
def initialize(which): if which == 0: df = pd.read_excel('classrooms.xlsx', index_col=None, header=None) if which == 1: df = pd.read_excel('busStations.xlsx', index_col=None, header=None) return df
def initialize(which):
if which == 0: df = pd.read_excel('classrooms.xlsx', index_col=None, header=None) if which == 1: df = pd.read_excel('busStations.xlsx', index_col=None, header=None) return df
{'name': name, 'lat': coorL, 'lon': coorR} # print("The coordinates of \""+search +"\" are "+ str(coorL) + " , "+ str(coorR)) coordinatesList.append(tempDataList) return coordinatesList def initialize(which):
64
64
58
4
59
aflorentia/uniNode
code v1.0/excelProcessing.py
Python
initialize
initialize
47
52
47
47
5436cac9dbf222b15165283419d9cf4659243c5e
bigcode/the-stack
train
6c52bfee475d99fe47f04e49
train
function
def searchingByName(search, df ): coordinatesList = None coorL = None coorR = None for row in range(0, df.shape[0]): if search == df.loc[row][0]: coordinatesList = (df.loc[row][1]).split(',') coorL = float(coordinatesList[0]) coorR = float(coordi...
def searchingByName(search, df ):
coordinatesList = None coorL = None coorR = None for row in range(0, df.shape[0]): if search == df.loc[row][0]: coordinatesList = (df.loc[row][1]).split(',') coorL = float(coordinatesList[0]) coorR = float(coordinatesList[1]) #print("...
import pandas as pd def searchingByName(search, df ):
14
64
170
9
4
aflorentia/uniNode
code v1.0/excelProcessing.py
Python
searchingByName
searchingByName
4
24
4
5
5412f4e3732a2c9ff7235a13b8f9ac52e8c20460
bigcode/the-stack
train
0b02e19cf2db8a29f4f2e224
train
function
def getTheList(df): coordinatesList = [] for row in range(0, df.shape[0]): name = df.loc[row][0] # name = coordinatesListTEMP1 coordinatesListTEMP = (df.loc[row][1]).split(',') coorL = float(coordinatesListTEMP[0]) coorR = float(coordinatesListTEMP[1]) ...
def getTheList(df):
coordinatesList = [] for row in range(0, df.shape[0]): name = df.loc[row][0] # name = coordinatesListTEMP1 coordinatesListTEMP = (df.loc[row][1]).split(',') coorL = float(coordinatesListTEMP[0]) coorR = float(coordinatesListTEMP[1]) tempDataList = {...
, "+ str(coorR)) #print(type(coorL)) return coorL, coorR if coordinatesList is None: print("The Classroom \""+ search +"\" you searched does not exists") return coorL, coorR def getTheList(df):
64
64
149
6
57
aflorentia/uniNode
code v1.0/excelProcessing.py
Python
getTheList
getTheList
27
44
27
28
99b92b164e8f3707d3553652df5eaaa61b0aca99
bigcode/the-stack
train
d3f131cc1a6625a6823f2141
train
class
class MigrationsClientJSON(base.ComputeClient): def list_migrations(self, params=None): """Lists all migrations.""" url = 'os-migrations' if params: url += '?%s' % urllib.urlencode(params) resp, body = self.get(url) body = json.loads(body) self.validate...
class MigrationsClientJSON(base.ComputeClient):
def list_migrations(self, params=None): """Lists all migrations.""" url = 'os-migrations' if params: url += '?%s' % urllib.urlencode(params) resp, body = self.get(url) body = json.loads(body) self.validate_response(schema.list_migrations, resp, body) ...
OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import json import urllib from tempest.api_schema.response.compute import migrations as schema from tempest.services.compute.json import base class MigrationsClientJSON...
64
64
88
9
54
afaheem88/tempest_neutron
tempest/services/compute/json/migrations_client.py
Python
MigrationsClientJSON
MigrationsClientJSON
22
34
22
23
23f3708fab0dc577cc2a8618bc46cd4db6ac848f
bigcode/the-stack
train
8ae06a2b475c60f1003b64cb
train
class
class Command(BaseCommand): help = "Starts a Tornado Web server wrapping Django." def add_arguments(self, parser: CommandParser) -> None: parser.add_argument('addrport', nargs="?", type=str, help='[optional port number or ipaddr:port]\n ' '(u...
class Command(BaseCommand):
help = "Starts a Tornado Web server wrapping Django." def add_arguments(self, parser: CommandParser) -> None: parser.add_argument('addrport', nargs="?", type=str, help='[optional port number or ipaddr:port]\n ' '(use multiple ports to start m...
zerver.tornado.ioloop_logging import instrument_tornado_ioloop settings.RUNNING_INSIDE_TORNADO = True instrument_tornado_ioloop() from zerver.lib.debug import interactive_debug_listen from zerver.tornado.application import create_tornado_application, setup_tornado_rabbitmq from zerver.tornado.autoreload import start...
192
192
640
5
187
lokesh576/zulip
zerver/management/commands/runtornado.py
Python
Command
Command
39
123
39
39
e2fdc20498278d4aabd9c6643c81f03786c587e4
bigcode/the-stack
train
4368d2649b5e306f14cc0861
train
function
def handle_callback_exception(callback: Callable[..., Any]) -> None: logging.exception("Exception in callback") app_log.error("Exception in callback %r", callback, exc_info=True)
def handle_callback_exception(callback: Callable[..., Any]) -> None:
logging.exception("Exception in callback") app_log.error("Exception in callback %r", callback, exc_info=True)
get_wrapped_process_notification, missedmessage_hook, setup_event_queue, ) from zerver.tornado.sharding import notify_tornado_queue_name if settings.USING_RABBITMQ: from zerver.lib.queue import get_queue_client def handle_callback_exception(callback: Callable[..., Any]) -> None:
64
64
38
13
50
lokesh576/zulip
zerver/management/commands/runtornado.py
Python
handle_callback_exception
handle_callback_exception
35
37
35
35
c62715163cbd94b497976cd2683949d2d86091a9
bigcode/the-stack
train
147bbaddc1964753149e47b6
train
class
class Exploratory(object): def __init__(self, df_small, df_med, df_large): self.helpers = Helpers() self.desirable_conditions(df_small, df_med, df_large) self.t_vs_p(df_small, "10") def desirable_conditions(self, df_small, df_med, df_large): """ This function only looks ...
class Exploratory(object):
def __init__(self, df_small, df_med, df_large): self.helpers = Helpers() self.desirable_conditions(df_small, df_med, df_large) self.t_vs_p(df_small, "10") def desirable_conditions(self, df_small, df_med, df_large): """ This function only looks at the most desirable condi...
#!/usr/bin/env python # Name: Ruchella Kock # Student number: 1815458 """ This script perform initial analyses it looks at the most desirable conditions where there is no violation at all. It also analyses patterns to see in which conditions a lot of significant differences are found It also checks when the t-test outp...
113
256
1,554
5
107
rushkock/sim_study_thesis
src/features/python_data_analysis/initial_exploratory_analysis.py
Python
Exploratory
Exploratory
17
156
17
17
cc3c5d88f14dc85d51926137abaa283d78d658dd
bigcode/the-stack
train
97430706a3cdaba6bb633c65
train
function
def solve_fixed_energy_angle(previous_solution_space, phase_space_position, step_num): """ Solves the differential equation for a fixed cosine (trajectory angle) and neutrino energy :param previous_solution_space: solution to previous step of the differential equation across all angles and energies, inc...
def solve_fixed_energy_angle(previous_solution_space, phase_space_position, step_num):
""" Solves the differential equation for a fixed cosine (trajectory angle) and neutrino energy :param previous_solution_space: solution to previous step of the differential equation across all angles and energies, includes phase space values in first 2 columns (ndarray) :param phase_space_position: ...
nu.b_inverted() B_VECTOR = MIXING_ANGLES[0] + 3 ** -0.5 * MIXING_ANGLES[1] def log(step_num, elapsed_time): print(f"[INFO] Finished step {step_num} in {elapsed_time} seconds") def solve_fixed_energy_angle(previous_solution_space, phase_space_position, step_num):
74
74
247
16
58
brainsqueeze/bipolar_osc
src/integrate.py
Python
solve_fixed_energy_angle
solve_fixed_energy_angle
21
48
21
21
6dd163598edd7bf40924a90040762c419f556118
bigcode/the-stack
train
b8264b266051aa77fc028039
train
function
def save(solution_space, step_num): """ Saves each solution + phase space to HDF formatted files :param solution_space: solution of the differential equation at a fixed step, across all angles and energies, includes phase space values in first 2 columns (ndarray) :param step_num: step number in disc...
def save(solution_space, step_num):
""" Saves each solution + phase space to HDF formatted files :param solution_space: solution of the differential equation at a fixed step, across all angles and energies, includes phase space values in first 2 columns (ndarray) :param step_num: step number in discretized radial distance away from th...
_energy_angle( previous_solution_space=previous_solution_space, phase_space_position=phase_space_position, step_num=step_num ) return previous_solution_space[phase_space_position][0], previous_solution_space[phase_space_position][1], euler_solution def save(solution_space, step_num):
64
64
137
8
55
brainsqueeze/bipolar_osc
src/integrate.py
Python
save
save
71
81
71
71
2df2a950b1b3821b2ba264964d8d58ae9d572964
bigcode/the-stack
train
1c8083c04f95a093c9068a80
train
function
def log(step_num, elapsed_time): print(f"[INFO] Finished step {step_num} in {elapsed_time} seconds")
def log(step_num, elapsed_time):
print(f"[INFO] Finished step {step_num} in {elapsed_time} seconds")
ignore") root = os.path.dirname(os.path.abspath(__file__)) nu = Neutrino() MIXING_ANGLES = nu.b_inverted() B_VECTOR = MIXING_ANGLES[0] + 3 ** -0.5 * MIXING_ANGLES[1] def log(step_num, elapsed_time):
64
64
27
8
56
brainsqueeze/bipolar_osc
src/integrate.py
Python
log
log
17
18
17
17
875e69b0942dec0c6f36ba314e7436257466126e
bigcode/the-stack
train
2f9edec8aefed78d9c4614ce
train
function
def solve_step(previous_solution_space, phase_space_position, step_num): """ Solves the differential equation across the full spectrum of trajectory angles and neutrino energies :param previous_solution_space: solution to previous step of the differential equation across all angles and energies, include...
def solve_step(previous_solution_space, phase_space_position, step_num):
""" Solves the differential equation across the full spectrum of trajectory angles and neutrino energies :param previous_solution_space: solution to previous step of the differential equation across all angles and energies, includes phase space values in first 2 columns (ndarray) :param phase_space_...
_step_solution = nu.euler( cosine=cosine, n=step_num, b_orthogonal=B_VECTOR, log_lam=previous_solution, integral=inner_integral ) return euler_step_solution def solve_step(previous_solution_space, phase_space_position, step_num):
64
64
196
14
49
brainsqueeze/bipolar_osc
src/integrate.py
Python
solve_step
solve_step
51
68
51
51
b0dd8f9ebea9c97439646312169e42b26e5ed342
bigcode/the-stack
train
934ed0a3e106d7a9568c082e
train
function
def solve(total_steps=4): """ Solves the differential equation for a fixed cosine (trajectory angle) and neutrino energy :param total_steps: total number of steps in discretized radial distance away from the initial core for which to solve (int) """ assert isinstance(total_steps, int) and total...
def solve(total_steps=4):
""" Solves the differential equation for a fixed cosine (trajectory angle) and neutrino energy :param total_steps: total number of steps in discretized radial distance away from the initial core for which to solve (int) """ assert isinstance(total_steps, int) and total_steps > 1 # initiali...
discretized radial distance away from the initial core (int) """ h5f = h5py.File(root + f"/data/LogLambda_{step_num}_deltaR.h5", "w") h5f.create_dataset("step_solution", data=solution_space, dtype=np.float32) h5f.close() def solve(total_steps=4):
76
76
255
7
69
brainsqueeze/bipolar_osc
src/integrate.py
Python
solve
solve
84
112
84
84
ac524790a8410f7c94119d497a079b0ca09d761d
bigcode/the-stack
train
1b320d0e4459d4de44bf0805
train
class
class V1SELinuxContextStrategyOptions(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ def __init__(self, se_linux_options=None, type=None): """ V1SELinuxContextStrategyOptions - a model defined in Swagger ...
class V1SELinuxContextStrategyOptions(object):
""" NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ def __init__(self, se_linux_options=None, type=None): """ V1SELinuxContextStrategyOptions - a model defined in Swagger :param dict swaggerTypes: The key is attri...
is additive only for any given version - no backwards incompatible changes are allowed without incrementing the apiVersion. The server will return and accept a number of standard responses that share a common schema - for instance, the common error type is 'unversioned.Status' (described below) and will be returned on...
245
245
817
10
234
flaper87/openshift-restclient-python
openshift/client/models/v1_se_linux_context_strategy_options.py
Python
V1SELinuxContextStrategyOptions
V1SELinuxContextStrategyOptions
19
143
19
19
71dedd86308dce841bb583cef187a4c7ac1da5c6
bigcode/the-stack
train
a0a720ce86d45154914a38f4
train
function
def main(args): if args.output==None: outdir = args.input + '_resized' else: outdir = args.output size = eval(args.size) files = glob.glob(args.input+'/**', recursive=True) for file in files: if os.path.isfile(file): img=cv2.imread(file) if not img i...
def main(args):
if args.output==None: outdir = args.input + '_resized' else: outdir = args.output size = eval(args.size) files = glob.glob(args.input+'/**', recursive=True) for file in files: if os.path.isfile(file): img=cv2.imread(file) if not img is None: ...
# -*- coding: utf-8 -*- import os import glob import cv2 import numpy as np import argparse def main(args):
30
103
346
4
25
yas-sim/simple-annotation-toolkiw
resize.py
Python
main
main
9
45
9
9
ed4c7810f4501ee6afc2788b1e395d1e5f6d7587
bigcode/the-stack
train
8afc78d6502246819027b1b6
train
class
class Speedometer(): def __init__(self, speedPID, positionWindow = 3, updatePeriod=0.153): self.recentMeasurements = [] self.prevLocation = (0,0) self.previousSpeed = 0 self.updatePeriod = updatePeriod self.positionWindow = positionWindow self.speedPID = speedPID ...
class Speedometer():
def __init__(self, speedPID, positionWindow = 3, updatePeriod=0.153): self.recentMeasurements = [] self.prevLocation = (0,0) self.previousSpeed = 0 self.updatePeriod = updatePeriod self.positionWindow = positionWindow self.speedPID = speedPID def run(self, currLo...
#!/usr/bin/env python3 """ speedometer.py donkeycar part for calculating speed from GPS data @authors: Max Apodaca """ from numpy import pi, cos, sin, arctan2, sqrt, square, radians import time from datetime import datetime class Speedometer():
64
194
648
4
59
Pumuckl007/ECE148Car
car/wp_parts/speedometer.py
Python
Speedometer
Speedometer
14
94
14
14
b46bfcbc45d8b7196075e2e92940dc593f03dc39
bigcode/the-stack
train
02959b1e9f961805d36b548c
train
function
def check_order_status(func): """Check if order meets preconditions of payment process. Order can not have draft status or be fully paid. Billing address must be provided. If not, redirect to order details page. """ # pylint: disable=cyclic-import from .models import Order @wraps(func)...
def check_order_status(func):
"""Check if order meets preconditions of payment process. Order can not have draft status or be fully paid. Billing address must be provided. If not, redirect to order details page. """ # pylint: disable=cyclic-import from .models import Order @wraps(func) def decorator(*args, **kw...
from ..account.utils import store_user_address from ..core.exceptions import InsufficientStock from ..dashboard.order.utils import get_voucher_discount_for_order from ..order import FulfillmentStatus, OrderStatus from ..product.utils import allocate_stock, deallocate_stock, increase_stock def check_order_status(func):...
64
64
154
6
57
3etechinns/saleor
saleor/order/utils.py
Python
check_order_status
check_order_status
16
35
16
16
019685013b74cb45aabb1bed31e039def1bda0ba
bigcode/the-stack
train
8a35913c9dd3227ca145d3de
train
function
def update_voucher_discount(func): """Recalculate order discount amount based on order voucher.""" @wraps(func) def decorator(*args, **kwargs): if kwargs.pop('update_voucher_discount', True): order = args[0] order.discount_amount = ( get_voucher_discount_for_...
def update_voucher_discount(func):
"""Recalculate order discount amount based on order voucher.""" @wraps(func) def decorator(*args, **kwargs): if kwargs.pop('update_voucher_discount', True): order = args[0] order.discount_amount = ( get_voucher_discount_for_order(order) or Mon...
404(Order.objects.confirmed(), token=token) if not order.billing_address or order.is_fully_paid(): return redirect('order:details', token=order.token) kwargs['order'] = order return func(*args, **kwargs) return decorator def update_voucher_discount(func):
64
64
93
7
56
3etechinns/saleor
saleor/order/utils.py
Python
update_voucher_discount
update_voucher_discount
38
50
38
38
c792c5bb386e568dc40fd8293e16fc6f1c63a2cf
bigcode/the-stack
train
4ca3ad2baa1970a4195f945d
train
function
def update_order_status(order): """Update order status depending on fulfillments.""" quantity_fulfilled = order.quantity_fulfilled total_quantity = order.get_total_quantity() if quantity_fulfilled <= 0: status = OrderStatus.UNFULFILLED elif quantity_fulfilled < total_quantity: statu...
def update_order_status(order):
"""Update order status depending on fulfillments.""" quantity_fulfilled = order.quantity_fulfilled total_quantity = order.get_total_quantity() if quantity_fulfilled <= 0: status = OrderStatus.UNFULFILLED elif quantity_fulfilled < total_quantity: status = OrderStatus.PARTIALLY_FULFIL...
restock: restock_order_lines(order) for fulfillment in order.fulfillments.all(): fulfillment.status = FulfillmentStatus.CANCELED fulfillment.save(update_fields=['status']) order.status = OrderStatus.CANCELED order.save(update_fields=['status']) def update_order_status(order):
63
64
115
6
57
3etechinns/saleor
saleor/order/utils.py
Python
update_order_status
update_order_status
89
103
89
89
862ea30ed36d86e25ea1cea3516e5ed2cf6f9d14
bigcode/the-stack
train
dbe7caf293f5d4cc3d9ddd7b
train
function
def attach_order_to_user(order, user): """Associates existing order with user account.""" order.user = user store_user_address(user, order.billing_address, billing=True) if order.shipping_address: store_user_address(user, order.shipping_address, shipping=True) order.save(update_fields=['user...
def attach_order_to_user(order, user):
"""Associates existing order with user account.""" order.user = user store_user_address(user, order.billing_address, billing=True) if order.shipping_address: store_user_address(user, order.shipping_address, shipping=True) order.save(update_fields=['user'])
line.order_line order_line.quantity_fulfilled -= line.quantity order_line.save(update_fields=['quantity_fulfilled']) fulfillment.status = FulfillmentStatus.CANCELED fulfillment.save(update_fields=['status']) update_order_status(fulfillment.order) def attach_order_to_user(order, user):
64
64
65
9
55
3etechinns/saleor
saleor/order/utils.py
Python
attach_order_to_user
attach_order_to_user
122
128
122
122
a61663368358880dcc0c6f770dec5ff1679e75f4
bigcode/the-stack
train
bc6007e84ad87d67460c0193
train
function
@update_voucher_discount def recalculate_order(order, **kwargs): """Recalculate and assign total price of order. Total price is a sum of items in order and order shipping price minus discount amount. Voucher discount amount is recalculated by default. To avoid this, pass update_voucher_discount ar...
@update_voucher_discount def recalculate_order(order, **kwargs):
"""Recalculate and assign total price of order. Total price is a sum of items in order and order shipping price minus discount amount. Voucher discount amount is recalculated by default. To avoid this, pass update_voucher_discount argument set to False. """ # avoid using prefetched order l...
True): order = args[0] order.discount_amount = ( get_voucher_discount_for_order(order) or Money(0, settings.DEFAULT_CURRENCY)) return func(*args, **kwargs) return decorator @update_voucher_discount def recalculate_order(order, **kwargs):
64
64
172
15
48
3etechinns/saleor
saleor/order/utils.py
Python
recalculate_order
recalculate_order
53
72
53
54
5ffbb5f9863a810c34047efc0e37c04ac95948fe
bigcode/the-stack
train
924072a5e84f6765722b82d2
train
function
def add_variant_to_order( order, variant, total_quantity, discounts=None, add_to_existing=True): """Add total_quantity of variant to order. Raises InsufficientStock exception if quantity could not be fulfilled. By default, first adds variant to existing lines with same variant. It can be disab...
def add_variant_to_order( order, variant, total_quantity, discounts=None, add_to_existing=True):
"""Add total_quantity of variant to order. Raises InsufficientStock exception if quantity could not be fulfilled. By default, first adds variant to existing lines with same variant. It can be disabled with setting add_to_existing to False. Order lines are created by increasing quantity of lines, ...
account.""" order.user = user store_user_address(user, order.billing_address, billing=True) if order.shipping_address: store_user_address(user, order.shipping_address, shipping=True) order.save(update_fields=['user']) def add_variant_to_order( order, variant, total_quantity, discounts=N...
70
71
238
22
48
3etechinns/saleor
saleor/order/utils.py
Python
add_variant_to_order
add_variant_to_order
131
158
131
132
ab221a6716b8c7f4a612089958dea853ba28b172
bigcode/the-stack
train
1c9803d16439d5bc630bb849
train
function
def restock_fulfillment_lines(fulfillment, allocate=True): """Return fulfilled products to corresponding stocks.""" for line in fulfillment: order_line = line.order_line if order_line.variant: increase_stock( line.order_line.variant, line.quantity, allocate=allocate)
def restock_fulfillment_lines(fulfillment, allocate=True):
"""Return fulfilled products to corresponding stocks.""" for line in fulfillment: order_line = line.order_line if order_line.variant: increase_stock( line.order_line.variant, line.quantity, allocate=allocate)
line.quantity_unfulfilled) if line.quantity_fulfilled > 0: increase_stock(line.variant, line.quantity_fulfilled) line.quantity_fulfilled = 0 line.save(update_fields=['quantity_fulfilled']) def restock_fulfillment_lines(fulfillment, allocate=True):
63
64
60
14
49
3etechinns/saleor
saleor/order/utils.py
Python
restock_fulfillment_lines
restock_fulfillment_lines
224
230
224
224
90a2278cdab51ecfba720dd1f2f0c89deb3b9c6f
bigcode/the-stack
train
d1b570cfaf743c123c03fe8c
train
function
def change_order_line_quantity(line, new_quantity): """Change the quantity of ordered items in a order line.""" if new_quantity: line.quantity = new_quantity line.save() else: line.delete()
def change_order_line_quantity(line, new_quantity):
"""Change the quantity of ordered items in a order line.""" if new_quantity: line.quantity = new_quantity line.save() else: line.delete()
ku, variant=line.variant, is_shipping_required=line.is_shipping_required) if lines.count() > 1: line.quantity = sum([line.quantity for line in lines]) line.save(update_fields=['quantity']) lines.exclude(pk=line.pk).delete() def change_order_line_quantity(line, new_quantity):
64
64
46
10
54
3etechinns/saleor
saleor/order/utils.py
Python
change_order_line_quantity
change_order_line_quantity
203
209
203
203
d4a2e8668db6870311b6a74cc188df13cab3405f
bigcode/the-stack
train
ba1dad5ad3872651ec612f3e
train
function
def cancel_fulfillment(fulfillment, restock): """Cancel fulfillment. Return products to corresponding stocks if restock is set to True. """ if restock: restock_fulfillment_lines(fulfillment) for line in fulfillment: order_line = line.order_line order_line.quantity_fulfilled ...
def cancel_fulfillment(fulfillment, restock):
"""Cancel fulfillment. Return products to corresponding stocks if restock is set to True. """ if restock: restock_fulfillment_lines(fulfillment) for line in fulfillment: order_line = line.order_line order_line.quantity_fulfilled -= line.quantity order_line.save(updat...
total_quantity: status = OrderStatus.PARTIALLY_FULFILLED else: status = OrderStatus.FULFILLED if status != order.status: order.status = status order.save(update_fields=['status']) def cancel_fulfillment(fulfillment, restock):
63
64
114
12
51
3etechinns/saleor
saleor/order/utils.py
Python
cancel_fulfillment
cancel_fulfillment
106
119
106
106
ef47f0098efa9ce72376dbecf59103e243d8f168
bigcode/the-stack
train
001a9ae5561554423a24a8f3
train
function
def restock_order_lines(order): """Return ordered products to corresponding stocks.""" for line in order: if line.variant: if line.quantity_unfulfilled > 0: deallocate_stock(line.variant, line.quantity_unfulfilled) if line.quantity_fulfilled > 0: i...
def restock_order_lines(order):
"""Return ordered products to corresponding stocks.""" for line in order: if line.variant: if line.quantity_unfulfilled > 0: deallocate_stock(line.variant, line.quantity_unfulfilled) if line.quantity_fulfilled > 0: increase_stock(line.variant, line...
quantity']) lines.exclude(pk=line.pk).delete() def change_order_line_quantity(line, new_quantity): """Change the quantity of ordered items in a order line.""" if new_quantity: line.quantity = new_quantity line.save() else: line.delete() def restock_order_lines(order):
64
64
93
7
57
3etechinns/saleor
saleor/order/utils.py
Python
restock_order_lines
restock_order_lines
212
221
212
212
d25d6d8c1d6c9be8b4c369c1f075a827528b580d
bigcode/the-stack
train
28663efe04c826c41a3a5251
train
function
def cancel_order(order, restock): """Cancel order and associated fulfillments. Return products to corresponding stocks if restock is set to True. """ if restock: restock_order_lines(order) for fulfillment in order.fulfillments.all(): fulfillment.status = FulfillmentStatus.CANCELED ...
def cancel_order(order, restock):
"""Cancel order and associated fulfillments. Return products to corresponding stocks if restock is set to True. """ if restock: restock_order_lines(order) for fulfillment in order.fulfillments.all(): fulfillment.status = FulfillmentStatus.CANCELED fulfillment.save(update_fie...
sum(prices, order.shipping_price) # discount amount can't be greater than order total order.discount_amount = min(order.discount_amount, total.gross) if order.discount_amount: total -= order.discount_amount order.total = total order.save() def cancel_order(order, restock):
64
64
92
8
56
3etechinns/saleor
saleor/order/utils.py
Python
cancel_order
cancel_order
75
86
75
75
4d7872fd2da22c3423d2cf992c6da225499ce5a1
bigcode/the-stack
train
2dd81cb46a45d897529b2c82
train
function
def merge_duplicates_into_order_line(line): """Merge duplicated lines in order into one (given) line. If there are no duplicates, nothing will happen. """ lines = line.order.lines.filter( product_name=line.product_name, product_sku=line.product_sku, variant=line.variant, is_shipping_req...
def merge_duplicates_into_order_line(line):
"""Merge duplicated lines in order into one (given) line. If there are no duplicates, nothing will happen. """ lines = line.order.lines.filter( product_name=line.product_name, product_sku=line.product_sku, variant=line.variant, is_shipping_required=line.is_shipping_required) if line...
if quantity_left > line.variant.quantity_available else quantity_left) line.quantity += quantity line.save() allocate_stock(line.variant, quantity) quantity_left -= quantity if quantity_left == 0: break return quantity_left def merge_dupli...
64
64
110
8
55
3etechinns/saleor
saleor/order/utils.py
Python
merge_duplicates_into_order_line
merge_duplicates_into_order_line
189
200
189
189
336ea49c492339df7ffc1391ad947c16098a5d40
bigcode/the-stack
train
4b67a0fd9d8577cff301564a
train
function
def add_variant_to_existing_lines(order, variant, total_quantity): """Add variant to existing lines with same variant. Variant is added by increasing quantity of lines with same variant, as long as total_quantity of variant will be added or there is no more lines with same variant. Returns quantit...
def add_variant_to_existing_lines(order, variant, total_quantity):
"""Add variant to existing lines with same variant. Variant is added by increasing quantity of lines with same variant, as long as total_quantity of variant will be added or there is no more lines with same variant. Returns quantity that could not be fulfilled with existing lines. """ # or...
variant.sku, is_shipping_required=( variant.product.product_type.is_shipping_required), quantity=quantity_not_fulfilled, unit_price=price, variant=variant) allocate_stock(variant, quantity_not_fulfilled) def add_variant_to_existing_lines(order, variant, total_quantity):
64
64
193
13
51
3etechinns/saleor
saleor/order/utils.py
Python
add_variant_to_existing_lines
add_variant_to_existing_lines
161
186
161
161
24f23823d7961bc5b3fab9dfb98ed7fbbcdd9d78
bigcode/the-stack
train
ba4cf2bdd00413af75f3204d
train
class
class Request(FlaskRequest): def __init__(self, *args, **kwargs): super(Request, self).__init__(*args, **kwargs) #: Store additionnal data about the request. self.metadata = {}
class Request(FlaskRequest):
def __init__(self, *args, **kwargs): super(Request, self).__init__(*args, **kwargs) #: Store additionnal data about the request. self.metadata = {}
from flask import Request as FlaskRequest class Request(FlaskRequest):
15
64
48
7
7
AdvancedServicesEngineeringFudan2018/group1
src/flask_stupe/request.py
Python
Request
Request
4
10
4
5
800a0783e27815b632c26451106d4a92c7df3d3f
bigcode/the-stack
train
42b472e13eb13b2dae30c55b
train
class
class SignalHandler: def __init__(self, config): self.config = config def sig_file(self, sig): return '{}/.{}.{}'.format(self.config['temp_dir'], self.config['app_name'], sig) def emit(self, sig): if sig not in _valid_signals: raise ValueError('Unknown signal type: {}'.format(sig)) open(s...
class SignalHandler:
def __init__(self, config): self.config = config def sig_file(self, sig): return '{}/.{}.{}'.format(self.config['temp_dir'], self.config['app_name'], sig) def emit(self, sig): if sig not in _valid_signals: raise ValueError('Unknown signal type: {}'.format(sig)) open(self.sig_file(sig), 'a')....
.0 import os SIG_ABORT = 'sig.abort' SIG_PAUSE = 'sig.pause' SIG_PULSE = 'sig.pulse' SIG_REVIVE = 'sig.revive' _valid_signals = (SIG_ABORT, SIG_PAUSE, SIG_PULSE, SIG_REVIVE) class SignalHandler:
64
64
209
5
59
Comcast/python-batch-runner
pyrunner/core/signal.py
Python
SignalHandler
SignalHandler
26
54
26
27
d11bc3d08d015855e3accb8cc9d9eeb6c370aa9e
bigcode/the-stack
train
58cf4449b217419c187271d0
train
function
async def test_head_exc(server): """A head request, fulfilled by a ResponseException.""" async with AsyncClient() as client: resp = await client.head(f"http://localhost:{server}/head/exc") assert resp.status_code == get_status_code(Forbidden)
async def test_head_exc(server):
"""A head request, fulfilled by a ResponseException.""" async with AsyncClient() as client: resp = await client.head(f"http://localhost:{server}/head/exc") assert resp.status_code == get_status_code(Forbidden)
from httpx import AsyncClient from uapi.status import Forbidden, get_status_code async def test_head_exc(server):
25
64
57
7
17
Tinche/uapi
tests/test_head.py
Python
test_head_exc
test_head_exc
6
10
6
6
8d6f096cdb5a5b60145685c860fa17a23fa3a796
bigcode/the-stack
train
47d828c8ec69f6426f65f7e3
train
class
class Vector2d: def __init__(self, x, y): """ Initialize from either (x, y) coordinates or two points x --> y. """ if isinstance(x, Point2d): self.x = y.x - x.x self.y = y.y - x.y else: self.x = x self.y = y ...
class Vector2d:
def __init__(self, x, y): """ Initialize from either (x, y) coordinates or two points x --> y. """ if isinstance(x, Point2d): self.x = y.x - x.x self.y = y.y - x.y else: self.x = x self.y = y def __add__...
.x - other.x, self.y - other.y) def __mul__(self, scale): """ Scale this point.""" return Point2d(self.x * scale, self.y * scale) def __truediv__(self, scale): """ Scale this point.""" return Point2d(self.x / scale, self.y / scale) def __str__(self): ret...
100
100
334
5
95
bqmoreland/EASwift
algs2e_python/Chapter 12/python/boids_classical_people.py
Python
Vector2d
Vector2d
40
85
40
40
56f7e362d0a340e7e54c26e3eb18499bd6803ba7
bigcode/the-stack
train
100f57f64cf54f93233448d2
train
function
def draw_oval(canvas, center, radius, color): """ Draw a filled circle centered at (x, y).""" canvas.create_oval( \ center.x - radius, center.y - radius, \ center.x + radius, center.y + radius, \ fill=color, outline=color)
def draw_oval(canvas, center, radius, color):
""" Draw a filled circle centered at (x, y).""" canvas.create_oval( \ center.x - radius, center.y - radius, \ center.x + radius, center.y + radius, \ fill=color, outline=color)
import tkinter as tk from tkinter import ttk import math import time import random # Yes, I know pygame can do a better job at this than tkinter. def draw_oval(canvas, center, radius, color):
47
64
64
12
35
bqmoreland/EASwift
algs2e_python/Chapter 12/python/boids_classical_people.py
Python
draw_oval
draw_oval
9
14
9
9
821cdc891120c38f1c49223a3cb47fa789541372
bigcode/the-stack
train
df588c6b82fbfb80cb335923
train
class
class Point2d: def __init__(self, x, y): self.x = x self.y = y def __add__(self, other): """ Add this point to a point or a vector.""" return Point2d(self.x + other.x, self.y + other.y) def __sub__(self, other): """ Subtract two points to get a vector."""...
class Point2d:
def __init__(self, x, y): self.x = x self.y = y def __add__(self, other): """ Add this point to a point or a vector.""" return Point2d(self.x + other.x, self.y + other.y) def __sub__(self, other): """ Subtract two points to get a vector.""" return...
, center, radius, color): """ Draw a filled circle centered at (x, y).""" canvas.create_oval( \ center.x - radius, center.y - radius, \ center.x + radius, center.y + radius, \ fill=color, outline=color) class Point2d:
64
64
190
5
59
bqmoreland/EASwift
algs2e_python/Chapter 12/python/boids_classical_people.py
Python
Point2d
Point2d
16
38
16
16
263f670d07e4a316e9f0ea9cabba33edb078de87
bigcode/the-stack
train
ca084a03f5c5f9d30680cbd7
train
class
class App: def kill_callback(self): self.window.destroy() def __init__(self): self.mouse_location = Point2d(0, 0) self.window = tk.Tk() self.window.title("boids_classical_people") self.window.protocol("WM_DELETE_WINDOW", self.kill_callback) self.window...
class App:
def kill_callback(self): self.window.destroy() def __init__(self): self.mouse_location = Point2d(0, 0) self.window = tk.Tk() self.window.title("boids_classical_people") self.window.protocol("WM_DELETE_WINDOW", self.kill_callback) self.window.geometry("5...
) for person in people: if self.distance_to_point(person) < self.neighborhood_dist: num_people += 1 person_vector += (self.position - person) if num_people > 0: person_vector /= num_people # Adjust this Boid. self.velocity...
255
256
1,836
3
252
bqmoreland/EASwift
algs2e_python/Chapter 12/python/boids_classical_people.py
Python
App
App
178
358
178
178
066094fa76a80c2fd2008c3bfc4e7b76807995dd
bigcode/the-stack
train
eb78573d4876b7af17cc3033
train
class
class Boid: def __init__(self, position, velocity, max_speed, neighborhood_dist): self.position = position self.velocity = velocity self.max_speed = max_speed self.neighborhood_dist = neighborhood_dist def move(self, boids, people, target, delta_time, separation_wgt, \ ...
class Boid:
def __init__(self, position, velocity, max_speed, neighborhood_dist): self.position = position self.velocity = velocity self.max_speed = max_speed self.neighborhood_dist = neighborhood_dist def move(self, boids, people, target, delta_time, separation_wgt, \ alignm...
self.y - other.y) def __neg__(self): """ Return the negation of this vector.""" return Vector2d(-self.x, -self.y) def __mul__(self, scale): """ Scale this vector.""" return Vector2d(self.x * scale, self.y * scale) def __truediv__(self, scale): """ Scale...
194
195
652
4
190
bqmoreland/EASwift
algs2e_python/Chapter 12/python/boids_classical_people.py
Python
Boid
Boid
88
175
88
88
1ddd4b0ab75457050e77c308fdfa6d6d965534df
bigcode/the-stack
train
42718d6fa449007450c82f65
train
class
class Knowledge(Base): __tablename__ = 'sport' sport_id = Column(Integer, primary_key=True) topic = Column(String) year = Column(Integer) rating = Column(Integer) finished_lab = Column(Boolean) pass def __repr__(self): return ("topic Name: {}\n" "sport Year: {} \n" "Has Finished Lab: {}").format( sel...
class Knowledge(Base):
__tablename__ = 'sport' sport_id = Column(Integer, primary_key=True) topic = Column(String) year = Column(Integer) rating = Column(Integer) finished_lab = Column(Boolean) pass def __repr__(self): return ("topic Name: {}\n" "sport Year: {} \n" "Has Finished Lab: {}").format( self.topic, self.year, sel...
from sqlalchemy import Column, Integer, String, Boolean from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship, sessionmaker from sqlalchemy import create_engine Base = declarative_base() class Knowledge(Base):
47
64
97
4
43
wael20-meet/y2s19-databases
knowledge_model.py
Python
Knowledge
Knowledge
8
20
8
8
a4df1d198c3d7428f63a1dca2be0e9effe7f9b59
bigcode/the-stack
train
9448ea23f8186e8df695b070
train
class
class NameAvailabilityRequest(Model): """A resource type and proposed name. :param name: The proposed resource name :type name: str :param type: The resource type chain (e.g. virtualMachines/extensions) :type type: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, ...
class NameAvailabilityRequest(Model):
"""A resource type and proposed name. :param name: The proposed resource name :type name: str :param type: The resource type chain (e.g. virtualMachines/extensions) :type type: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type'...
MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.serial...
64
64
143
6
57
mayank88mahajan/azure-cli-extensions
src/dms-preview/azext_dms/vendored_sdks/datamigration/models/name_availability_request.py
Python
NameAvailabilityRequest
NameAvailabilityRequest
15
32
15
15
b34ccb344d8c11edab2c8f3a75dfd39e292fb279
bigcode/the-stack
train
14fddabd1492c7a9b458f40b
train
class
class YumRequirement(PlatformRequirement): """ This class is a subclass of ``PlatformRequirement``. It specifies the proper type for ``Yum`` packages and provide a function to check for the requirement. """ REQUIREMENTS = {ExecutableRequirement('yum')} CHECKER_COMMAND = 'rpm -qa | grep "^{}...
class YumRequirement(PlatformRequirement):
""" This class is a subclass of ``PlatformRequirement``. It specifies the proper type for ``Yum`` packages and provide a function to check for the requirement. """ REQUIREMENTS = {ExecutableRequirement('yum')} CHECKER_COMMAND = 'rpm -qa | grep "^{}"' VERSION_COMMAND = 'rpm -q --qf "%{{V...
from dependency_management.requirements.ExecutableRequirement import ( ExecutableRequirement) from dependency_management.requirements.PlatformRequirement import ( PlatformRequirement) from dependency_management.requirements.Command import ( Command) class YumRequirement(PlatformRequirement):
46
74
247
7
39
yzgyyang/dependency_management
dependency_management/requirements/YumRequirement.py
Python
YumRequirement
YumRequirement
9
41
9
9
086137d647b4bfaa1bb981281105f4ca5eabebf5
bigcode/the-stack
train
ef2c37a6b492ee46f5028d8e
train
function
def main(): time_start = time.time() test_Superpixels() time_end = time.time() print("<%s> Finished without errors in %.4fs." % (__file__, time_end - time_start,))
def main():
time_start = time.time() test_Superpixels() time_end = time.time() print("<%s> Finished without errors in %.4fs." % (__file__, time_end - time_start,))
') # fix execution of tests involving matplotlib on travis import numpy as np import six.moves as sm from imgaug import augmenters as iaa from imgaug import parameters as iap from imgaug.augmenters import meta from imgaug.testutils import reseed def main():
64
64
47
3
60
joybanerjee08/imgaug
test/augmenters/test_segmentation.py
Python
main
main
16
22
16
16
41515b3b895a0507f7414d900be3e7ce857d4ce6
bigcode/the-stack
train
d8587b4e99e964baef1a4dd9
train
function
def test_Superpixels(): reseed() def _array_equals_tolerant(a, b, tolerance): diff = np.abs(a.astype(np.int32) - b.astype(np.int32)) return np.all(diff <= tolerance) base_img = [ [255, 255, 255, 0, 0, 0], [255, 235, 255, 0, 20, 0], [250, 250, 250, 5, 5, 5] ] ...
def test_Superpixels():
reseed() def _array_equals_tolerant(a, b, tolerance): diff = np.abs(a.astype(np.int32) - b.astype(np.int32)) return np.all(diff <= tolerance) base_img = [ [255, 255, 255, 0, 0, 0], [255, 235, 255, 0, 20, 0], [250, 250, 250, 5, 5, 5] ] base_img = np.tile(np.a...
from __future__ import print_function, division, absolute_import import time import matplotlib matplotlib.use('Agg') # fix execution of tests involving matplotlib on travis import numpy as np import six.moves as sm from imgaug import augmenters as iaa from imgaug import parameters as iap from imgaug.augmenters impo...
138
256
1,838
6
133
joybanerjee08/imgaug
test/augmenters/test_segmentation.py
Python
test_Superpixels
test_Superpixels
25
194
25
25
287e531232619159cb3998efa4bbc1811eb3a0a6
bigcode/the-stack
train
1ce31add321e3ae8cd2c8042
train
function
def create_arg_parser(): """"Creates and returns the ArgumentParser object.""" parser = argparse.ArgumentParser(description='Converts Dataturks output JSON file for Image bounding box to Pascal VOC format.') parser.add_argument('dataturks_JSON_FilePath', help='Path to the JSON file down...
def create_arg_parser():
""""Creates and returns the ArgumentParser object.""" parser = argparse.ArgumentParser(description='Converts Dataturks output JSON file for Image bounding box to Pascal VOC format.') parser.add_argument('dataturks_JSON_FilePath', help='Path to the JSON file downloaded from Dataturks.') ...
(str(count) + " items done ...") logging.info("Completed: " + str(success) + " items done, " + str(len(lines) - success) + " items ignored due to errors or for being skipped items.") generate_txt() # Generating txt files def create_arg_parser():
64
64
131
5
58
KunalK27/Automatic-License-Plate-Recognition
src/data/generate_pascalvoc.py
Python
create_arg_parser
create_arg_parser
203
213
203
203
ec27742e91a87eb42d363befd33d0e17b669705f
bigcode/the-stack
train
6364e7b2eb7910f80f08c149
train
function
def generate_txt(): with open('data/3_processed/VOC/ImageSets/Main/trainval.txt', 'w') as f: for name in config.trainval: f.write("%s\n" % name) with open('data/3_processed/VOC/ImageSets/Main/train.txt', 'w') as f: for name in config.train: f.write("%s\n" % name) w...
def generate_txt():
with open('data/3_processed/VOC/ImageSets/Main/trainval.txt', 'w') as f: for name in config.trainval: f.write("%s\n" % name) with open('data/3_processed/VOC/ImageSets/Main/train.txt', 'w') as f: for name in config.train: f.write("%s\n" % name) with open('data/3_proc...
import os import json import logging import requests from PIL import Image ################### INSTALLATION NOTE ####################### ############################################################## ## pip install requests ## pip install pillow ############################################################### ######...
64
64
124
4
60
KunalK27/Automatic-License-Plate-Recognition
src/data/generate_pascalvoc.py
Python
generate_txt
generate_txt
24
36
24
25
3e5f2fff832eb7b18cdab51ab2dc4cda7e7d27f3
bigcode/the-stack
train
8ce1cf14725e340dde0830c9
train
function
def main(): #make sure everything is setup. if (not os.path.isdir(image_download_dir)): logging.exception("Please specify a valid directory path to download images, " + image_download_dir + " doesn't exist") return if (not os.path.isdir(pascal_voc_xml_dir)): logging.exception("Please...
def main(): #make sure everything is setup.
if (not os.path.isdir(image_download_dir)): logging.exception("Please specify a valid directory path to download images, " + image_download_dir + " doesn't exist") return if (not os.path.isdir(pascal_voc_xml_dir)): logging.exception("Please specify a valid directory path to write Pascal ...
xml = xml + "</annotation>" #output to a file. xmlFilePath = os.path.join(xml_out_dir, fileName + ".xml") with open(xmlFilePath, 'w') as f: f.write(xml) return True except Exception as e: logging.exception("Unable to process item " + dataturks_labeled_item + "\n...
106
106
356
11
94
KunalK27/Automatic-License-Plate-Recognition
src/data/generate_pascalvoc.py
Python
main
main
166
201
166
167
add5a02ffa9466f570ecc99079bce8d6a996c616
bigcode/the-stack
train
33ec77f84dfdb8e35e65fca3
train
function
def convert_to_PascalVOC(dataturks_labeled_item, image_dir, xml_out_dir, counter): """Convert a dataturks labeled item to pascalVOCXML string. Args: dataturks_labeled_item: JSON of one labeled image from dataturks. image_dir: Path to directory to downloaded images (or a directory already hav...
def convert_to_PascalVOC(dataturks_labeled_item, image_dir, xml_out_dir, counter):
"""Convert a dataturks labeled item to pascalVOCXML string. Args: dataturks_labeled_item: JSON of one labeled image from dataturks. image_dir: Path to directory to downloaded images (or a directory already having the images downloaded). xml_out_dir: Path to the dir where the xml needs...
0 xml = xml + "\t<occluded>0</occluded>\n" # Changed from Unspecified to 0 xml = xml + "\t<bndbox>\n" xml = xml + "\t\t<xmin>" + str(xmin) + "</xmin>\n" xml = xml + "\t\t<xmax>" + str(xmax) + "</xmax>\n" xml = xml + "\t\t<ymin>" + str(ymin) + "</ymin>\n" xml = xml + "\t\t<ymax>"...
191
191
637
23
167
KunalK27/Automatic-License-Plate-Recognition
src/data/generate_pascalvoc.py
Python
convert_to_PascalVOC
convert_to_PascalVOC
98
164
98
99
00f8adc37689999f79966111a64af482c687c4d9
bigcode/the-stack
train
565133bf104fe6578218a199
train
function
def maybe_download(image_url, image_dir, counter): """Download the image if not already exist, return the location path""" # extension = image_url.split(".")[-1] filePath = os.path.join(image_dir, str(counter)+'.'+'jpg') if (os.path.exists(filePath)): return filePath #else download the imag...
def maybe_download(image_url, image_dir, counter):
"""Download the image if not already exist, return the location path""" # extension = image_url.split(".")[-1] filePath = os.path.join(image_dir, str(counter)+'.'+'jpg') if (os.path.exists(filePath)): return filePath #else download the image try: response = requests.get(image_ur...
config.train: f.write("%s\n" % name) with open('data/3_processed/VOC/ImageSets/Main/val.txt', 'w') as f: for name in config.val: f.write("%s\n" % name) def maybe_download(image_url, image_dir, counter):
64
64
174
11
53
KunalK27/Automatic-License-Plate-Recognition
src/data/generate_pascalvoc.py
Python
maybe_download
maybe_download
40
58
40
40
eee60a9a985407542659721488c15e78dfd351e3
bigcode/the-stack
train
7b884e1825053a391675743a
train
function
def get_xml_for_bbx(bbx_label, bbx_data, width, height): if len(bbx_data['points']) == 4: #Regular BBX has 4 points of the rectangle. xmin = width*min(bbx_data['points'][0][0], bbx_data['points'][1][0], bbx_data['points'][2][0], bbx_data['points'][3][0]) ymin = height * min(bbx_data['points...
def get_xml_for_bbx(bbx_label, bbx_data, width, height):
if len(bbx_data['points']) == 4: #Regular BBX has 4 points of the rectangle. xmin = width*min(bbx_data['points'][0][0], bbx_data['points'][1][0], bbx_data['points'][2][0], bbx_data['points'][3][0]) ymin = height * min(bbx_data['points'][0][1], bbx_data['points'][1][1], bbx_data['points'][2][...
"""Download the image if not already exist, return the location path""" # extension = image_url.split(".")[-1] filePath = os.path.join(image_dir, str(counter)+'.'+'jpg') if (os.path.exists(filePath)): return filePath #else download the image try: response = requests.get(image_url) ...
180
180
601
18
161
KunalK27/Automatic-License-Plate-Recognition
src/data/generate_pascalvoc.py
Python
get_xml_for_bbx
get_xml_for_bbx
61
95
61
62
c9ff8480b548e9c6fef4c924e2a117f8222a9335
bigcode/the-stack
train
481ef434de7a9641df19159a
train
function
def random_uniform(shape, dtype, seed): """Generates a sample from uniform distribution over [0., 1).""" return random.uniform(shape=tuple(shape), dtype=dtype, key=seed)
def random_uniform(shape, dtype, seed):
"""Generates a sample from uniform distribution over [0., 1).""" return random.uniform(shape=tuple(shape), dtype=dtype, key=seed)
, args, has_aux=True) grad = vjp_fn(np.ones_like(output))[0] return output, extra, grad def split_seed(seed, count): """Splits a seed into `count` seeds.""" return random.split(seed, count) def random_uniform(shape, dtype, seed):
64
64
43
9
55
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
random_uniform
random_uniform
129
131
129
129
c01195e02d3924b33084a03a2d244adbf85245b2
bigcode/the-stack
train
7c20489955c000a2106024b2
train
function
def unflatten_tree(tree, xs): """Inverse operation of `flatten_tree`.""" tree = _replace_nones(tree) return jax.tree_util.tree_unflatten(jax.tree_util.tree_structure(tree), xs)
def unflatten_tree(tree, xs):
"""Inverse operation of `flatten_tree`.""" tree = _replace_nones(tree) return jax.tree_util.tree_unflatten(jax.tree_util.tree_structure(tree), xs)
(_wrapper, *rest) def flatten_tree(tree): """Flattens a nested structure to a list.""" tree = _replace_nones(tree) ret = jax.tree_util.tree_flatten(tree)[0] return _replace_none_sentinels(ret) def unflatten_tree(tree, xs):
64
64
46
8
56
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
unflatten_tree
unflatten_tree
85
89
85
85
f3dae0d8796c18016e9ef4161c0a0b0ff441e676
bigcode/the-stack
train
f7dadca648b7b5862f938e71
train
function
def _replace_none_sentinels(a_list): return [None if r is _None else r for r in a_list]
def _replace_none_sentinels(a_list):
return [None if r is _None else r for r in a_list]
. We at times need to detect their presense, so we need # to sanitize `None`s before giving them to JAX. class _NoneSentinel(object): pass _None = _NoneSentinel() # pylint: disable=invalid-name def _replace_none_sentinels(a_list):
64
64
27
10
53
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
_replace_none_sentinels
_replace_none_sentinels
50
51
50
50
a4430ec9a65b5d97682bf9b4ab1e9c64d9082a0c
bigcode/the-stack
train
099bf982c3344ef80eb2e800
train
function
def make_dynamic_array(dtype, size, element_shape): """Creates an array that can be written to dynamically.""" return np.empty((size,) + element_shape, dtype=dtype)
def make_dynamic_array(dtype, size, element_shape):
"""Creates an array that can be written to dynamically.""" return np.empty((size,) + element_shape, dtype=dtype)
with recursion depth defined by depth of `shallow`.""" shallow = _replace_nones(shallow) def wrapper(_, *rest): return fn(*rest) return jax.tree_util.tree_multimap(wrapper, shallow, tree, *rest) def make_dynamic_array(dtype, size, element_shape):
64
64
38
11
53
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
make_dynamic_array
make_dynamic_array
102
104
102
102
3c1818a19a25d7438c39472c6ba7b1c294c1369f
bigcode/the-stack
train
e265f0b0e35ad2f6bd775740
train
function
def _replace_nones(tree): if tree is None: return _None node_type = jax.tree_util._get_node_type(tree) # pylint: disable=protected-access if node_type: children, node_spec = node_type.to_iterable(tree) new_children = [_replace_nones(child) for child in children] return node_type.from_iterable(nod...
def _replace_nones(tree):
if tree is None: return _None node_type = jax.tree_util._get_node_type(tree) # pylint: disable=protected-access if node_type: children, node_spec = node_type.to_iterable(tree) new_children = [_replace_nones(child) for child in children] return node_type.from_iterable(node_spec, new_children) el...
to JAX. class _NoneSentinel(object): pass _None = _NoneSentinel() # pylint: disable=invalid-name def _replace_none_sentinels(a_list): return [None if r is _None else r for r in a_list] def _replace_nones(tree):
64
64
94
7
57
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
_replace_nones
_replace_nones
54
63
54
54
2796a94d93c5e401d60137c0c4e558c69af44eda
bigcode/the-stack
train
ca47e0e5dd151ef818ed5549
train
function
def snapshot_dynamic_array(array): """Converts a dynamic array back to a static array.""" return array
def snapshot_dynamic_array(array):
"""Converts a dynamic array back to a static array.""" return array
an array that can be written to dynamically.""" return np.empty((size,) + element_shape, dtype=dtype) def write_dynamic_array(array, i, e): """Writes to an index in a dynamic array.""" return jax.ops.index_update(array, i, e) def snapshot_dynamic_array(array):
64
64
23
6
58
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
snapshot_dynamic_array
snapshot_dynamic_array
112
114
112
112
bb6821ba0f6e0c2ed6e4c1dab97d8bd2de3fb82d
bigcode/the-stack
train
7da487341b1c27bdbad3a330
train
function
def flatten_tree(tree): """Flattens a nested structure to a list.""" tree = _replace_nones(tree) ret = jax.tree_util.tree_flatten(tree)[0] return _replace_none_sentinels(ret)
def flatten_tree(tree):
"""Flattens a nested structure to a list.""" tree = _replace_nones(tree) ret = jax.tree_util.tree_flatten(tree)[0] return _replace_none_sentinels(ret)
structure.""" rest = (tree,) + rest rest = [_replace_nones(r) for r in rest] def _wrapper(*args): return fn(*_replace_none_sentinels(args)) return jax.tree_util.tree_multimap(_wrapper, *rest) def flatten_tree(tree):
64
64
50
5
59
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
flatten_tree
flatten_tree
77
82
77
77
5133d356d53027adc6b07af842384ed278d0911e
bigcode/the-stack
train
5b135ea9a65cd3a4aa1a6d03
train
function
def split_seed(seed, count): """Splits a seed into `count` seeds.""" return random.split(seed, count)
def split_seed(seed, count):
"""Splits a seed into `count` seeds.""" return random.split(seed, count)
args) -> out, extra`, returns `dout/dargs`.""" output, vjp_fn, extra = jax.vjp(fn, args, has_aux=True) grad = vjp_fn(np.ones_like(output))[0] return output, extra, grad def split_seed(seed, count):
64
64
27
7
56
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
split_seed
split_seed
124
126
124
124
62c4f9875932401ed3c28d2ca5da3da39bb6a206
bigcode/the-stack
train
f2ae5806029cd1d3cccc40e3
train
function
def random_normal(shape, dtype, seed): """Generates a sample from a standard normal distribution.""" return random.normal(shape=tuple(shape), dtype=dtype, key=seed)
def random_normal(shape, dtype, seed):
"""Generates a sample from a standard normal distribution.""" return random.normal(shape=tuple(shape), dtype=dtype, key=seed)
count` seeds.""" return random.split(seed, count) def random_uniform(shape, dtype, seed): """Generates a sample from uniform distribution over [0., 1).""" return random.uniform(shape=tuple(shape), dtype=dtype, key=seed) def random_normal(shape, dtype, seed):
64
64
38
9
55
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
random_normal
random_normal
134
136
134
134
5d5b07c790687819cad2ae96160385a2c2cc4d55
bigcode/the-stack
train
53f9edc38cc63a8916fee07e
train
function
def map_tree(fn, tree, *rest): """Maps `fn` over the leaves of a nested structure.""" rest = (tree,) + rest rest = [_replace_nones(r) for r in rest] def _wrapper(*args): return fn(*_replace_none_sentinels(args)) return jax.tree_util.tree_multimap(_wrapper, *rest)
def map_tree(fn, tree, *rest):
"""Maps `fn` over the leaves of a nested structure.""" rest = (tree,) + rest rest = [_replace_nones(r) for r in rest] def _wrapper(*args): return fn(*_replace_none_sentinels(args)) return jax.tree_util.tree_multimap(_wrapper, *rest)
if node_type: children, node_spec = node_type.to_iterable(tree) new_children = [_replace_nones(child) for child in children] return node_type.from_iterable(node_spec, new_children) else: return tree def map_tree(fn, tree, *rest):
64
64
81
10
53
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
map_tree
map_tree
66
74
66
66
5e66ba607506edafa1c745b44fc780c08198a36c
bigcode/the-stack
train
e81e0e00bd026990f07ca712
train
function
def value_and_grad(fn, args): """Given `fn: (args) -> out, extra`, returns `dout/dargs`.""" output, vjp_fn, extra = jax.vjp(fn, args, has_aux=True) grad = vjp_fn(np.ones_like(output))[0] return output, extra, grad
def value_and_grad(fn, args):
"""Given `fn: (args) -> out, extra`, returns `dout/dargs`.""" output, vjp_fn, extra = jax.vjp(fn, args, has_aux=True) grad = vjp_fn(np.ones_like(output))[0] return output, extra, grad
write_dynamic_array(array, i, e): """Writes to an index in a dynamic array.""" return jax.ops.index_update(array, i, e) def snapshot_dynamic_array(array): """Converts a dynamic array back to a static array.""" return array def value_and_grad(fn, args):
64
64
72
8
55
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
value_and_grad
value_and_grad
117
121
117
117
0ec395f5634f0d7b63dbd8e67eb568dca01c6126
bigcode/the-stack
train
310161249d3e424c49c616e9
train
function
def write_dynamic_array(array, i, e): """Writes to an index in a dynamic array.""" return jax.ops.index_update(array, i, e)
def write_dynamic_array(array, i, e):
"""Writes to an index in a dynamic array.""" return jax.ops.index_update(array, i, e)
jax.tree_util.tree_multimap(wrapper, shallow, tree, *rest) def make_dynamic_array(dtype, size, element_shape): """Creates an array that can be written to dynamically.""" return np.empty((size,) + element_shape, dtype=dtype) def write_dynamic_array(array, i, e):
64
64
34
10
54
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
write_dynamic_array
write_dynamic_array
107
109
107
107
88902667c40d68d827eb82a9768e903195a91847
bigcode/the-stack
train
d4f6130edf41e8a3c3f3a833
train
function
def map_tree_up_to(shallow, fn, tree, *rest): """`map_tree` with recursion depth defined by depth of `shallow`.""" shallow = _replace_nones(shallow) def wrapper(_, *rest): return fn(*rest) return jax.tree_util.tree_multimap(wrapper, shallow, tree, *rest)
def map_tree_up_to(shallow, fn, tree, *rest):
"""`map_tree` with recursion depth defined by depth of `shallow`.""" shallow = _replace_nones(shallow) def wrapper(_, *rest): return fn(*rest) return jax.tree_util.tree_multimap(wrapper, shallow, tree, *rest)
els(ret) def unflatten_tree(tree, xs): """Inverse operation of `flatten_tree`.""" tree = _replace_nones(tree) return jax.tree_util.tree_unflatten(jax.tree_util.tree_structure(tree), xs) def map_tree_up_to(shallow, fn, tree, *rest):
64
64
74
15
49
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
map_tree_up_to
map_tree_up_to
92
99
92
92
1433804be929a2e3268ea9bfe3654391f083b671
bigcode/the-stack
train
6bcaa9a5d6f5780b63882794
train
class
class _NoneSentinel(object): pass
class _NoneSentinel(object):
pass
', 'write_dynamic_array', ] # JAX has an annoying default where it entirely skips running functions on # `None`s in structures. We at times need to detect their presense, so we need # to sanitize `None`s before giving them to JAX. class _NoneSentinel(object):
64
64
10
7
57
trainorpj/probability
discussion/fun_mcmc/util_jax.py
Python
_NoneSentinel
_NoneSentinel
43
44
43
43
6f0718a7b4a45dae508059857a9efb4f80fbb8f4
bigcode/the-stack
train
e477dcb13f4fa599cbd248e9
train
class
class Complex: def __init__(self, real = 0, img = 0): self.real = real self.img = img def add(self, num1, num2): self.real = num1.real + num2.real self.img = num1.img + num2.img return self def sub(self, num1, num2): self.real = num1.real - num2.real ...
class Complex:
def __init__(self, real = 0, img = 0): self.real = real self.img = img def add(self, num1, num2): self.real = num1.real + num2.real self.img = num1.img + num2.img return self def sub(self, num1, num2): self.real = num1.real - num2.real self.img = num...
# create a class complex and adds, subs two complex numbers class Complex:
16
64
127
3
12
nsudhanva/mca-code
Sem3/Python/oops/complex.py
Python
Complex
Complex
3
20
3
4
85a4976b9047ad9657cf0adbeffc3ff48efba228
bigcode/the-stack
train
f2e97bb88adaa41159454b08
train
class
class UnsplashImageSpider(scrapy.Spider): # 定义Spider的名称 name = 'unsplash_image' allowed_domains = ['unsplash.com'] # 定义起始页面 start_urls = ['https://unsplash.com/napi/photos?page=1&per_page=12&order_by=latest'] def __init__ (self): self.page_index = 1 def parse(self, response): ...
class UnsplashImageSpider(scrapy.Spider): # 定义Spider的名称
name = 'unsplash_image' allowed_domains = ['unsplash.com'] # 定义起始页面 start_urls = ['https://unsplash.com/napi/photos?page=1&per_page=12&order_by=latest'] def __init__ (self): self.page_index = 1 def parse(self, response): # 解析服务器响应的JSON字符串 photo_list = json.loads(resp...
ee # # # # This program is protected by copyright laws. # # # # Program Name: ...
71
71
237
18
52
silence0201/Learn-Python
Others/Source/20/UnsplashImageSpider/UnsplashImageSpider/spiders/unsplash_image.py
Python
UnsplashImageSpider
UnsplashImageSpider
19
43
19
20
5a44fb870ca1724f1295815bec4eaef8a5ab4780
bigcode/the-stack
train
60f78c58435a65f9c2e761fe
train
class
class PubsubV1(base_api.BaseApiClient): """Generated client library for service pubsub version v1.""" MESSAGES_MODULE = messages BASE_URL = u'https://pubsub.googleapis.com/' _PACKAGE = u'pubsub' _SCOPES = [u'https://www.googleapis.com/auth/cloud-platform', u'https://www.googleapis.com/auth/pubsub'] _VERSI...
class PubsubV1(base_api.BaseApiClient):
"""Generated client library for service pubsub version v1.""" MESSAGES_MODULE = messages BASE_URL = u'https://pubsub.googleapis.com/' _PACKAGE = u'pubsub' _SCOPES = [u'https://www.googleapis.com/auth/cloud-platform', u'https://www.googleapis.com/auth/pubsub'] _VERSION = u'v1' _CLIENT_ID = '1042881264118...
"""Generated client library for pubsub version v1.""" # NOTE: This file is autogenerated and should not be edited by hand. from apitools.base.py import base_api from googlecloudsdk.third_party.apis.pubsub.v1 import pubsub_v1_messages as messages class PubsubV1(base_api.BaseApiClient):
68
256
9,507
11
56
kustodian/google-cloud-sdk
lib/googlecloudsdk/third_party/apis/pubsub/v1/pubsub_v1_client.py
Python
PubsubV1
PubsubV1
7
1,088
7
7
1fc0768b69de5584b1cb44c62cd34990a93f8930
bigcode/the-stack
train
d5a08bead9ed06a5b4e007d2
train
class
class Store(models.Model): """ All items in stock are in here """ created_on = models.DateTimeField(default=timezone.now) name = models.CharField(max_length=100) total_items = models.IntegerField(default=0) @consistency_validator def validate_total_items(self): assert self.tot...
class Store(models.Model):
""" All items in stock are in here """ created_on = models.DateTimeField(default=timezone.now) name = models.CharField(max_length=100) total_items = models.IntegerField(default=0) @consistency_validator def validate_total_items(self): assert self.total_items >= 0, "can't be ne...
from django.db import models from django.utils import timezone from consistency_model import consistency_validator class Store(models.Model):
24
64
80
5
18
occipital/django-consistency-model
tests/subapp/models.py
Python
Store
Store
7
19
7
7
e6ed850f33bf4e1a35916ca9b3e9e2d072261954
bigcode/the-stack
train
3cfedb0b3226cd6d9e776cdd
train
class
class ReplReader: def __init__(self, codeblock: Codeblock, *, _globals: dict = (), **flags: Any): if isinstance(_globals, tuple): _globals = {} self.iterator = ReplParser(**flags).__aiter__() self.codeblock = codeblock self.counter = flags.get("counter") self.exec...
class ReplReader:
def __init__(self, codeblock: Codeblock, *, _globals: dict = (), **flags: Any): if isinstance(_globals, tuple): _globals = {} self.iterator = ReplParser(**flags).__aiter__() self.codeblock = codeblock self.counter = flags.get("counter") self.exec_timer = flags.get...
None indentor = Indentor(self.space, "", func) self.meet_collon.append(indentor) if match := re.match(self.FUNC_INNER_REGEX, line): self.inside_function_statement(no, line, indentor, match) self.indicator_mode = False ...
256
256
1,425
5
250
MaskDuck/stella_bot
utils/parser.py
Python
ReplReader
ReplReader
356
513
356
356
1c23a195337191539bb6d5232ef105c505e48486
bigcode/the-stack
train
d58abae431e70bf48d3d462e
train
function
def get_import(d: re.Match) -> str: return d['import'][:-1]
def get_import(d: re.Match) -> str:
return d['import'][:-1]
Indentor = namedtuple("Indentor", "space part func") IMPORT_REGEX = re.compile(r"(?P<import>\w+!)((?=(?:(?:[^\"']*(\"|')){2})*[^\"']*$))") def get_import(d: re.Match) -> str:
64
64
20
11
53
MaskDuck/stella_bot
utils/parser.py
Python
get_import
get_import
22
23
22
22
1816e1aa9f3a6872c1141da0aceaec9adfe445cf
bigcode/the-stack
train
70497cc740d359768af943a3
train
function
def repl_wrap(code: str, context: Dict[str, Any], **flags) -> str: parser = inspect.getsource(ReplParser) reader = inspect.getsource(ReplReader) complete = IMPORTANT_PARTS + parser + reader return complete + RUNNER.format(code, flags, context)
def repl_wrap(code: str, context: Dict[str, Any], **flags) -> str:
parser = inspect.getsource(ReplParser) reader = inspect.getsource(ReplReader) complete = IMPORTANT_PARTS + parser + reader return complete + RUNNER.format(code, flags, context)
('python', to_run) async for output in ReplReader(code, _globals=global_stuff, **flags): print(output) await asyncio.sleep(0) asyncio.run(runner()) """ def repl_wrap(code: str, context: Dict[str, Any], **flags) -> str:
64
64
64
20
44
MaskDuck/stella_bot
utils/parser.py
Python
repl_wrap
repl_wrap
924
928
924
924
a222f7358cdb5264365e265f56c0d0bf55178049
bigcode/the-stack
train
4c58c1b4bfe19dac240aa4bf
train
class
class ReplParser: def __init__(self, **kwargs: Any): self.inner_func_check = kwargs.pop('inner_func_check', True) self.continue_parsing = 0 self.combining_parse = [] self.previous_line = "" self.previous_space = 0 self.space = 0 self.expecting_combo = [] ...
class ReplParser:
def __init__(self, **kwargs: Any): self.inner_func_check = kwargs.pop('inner_func_check', True) self.continue_parsing = 0 self.combining_parse = [] self.previous_line = "" self.previous_space = 0 self.space = 0 self.expecting_combo = [] self.meet_collo...
import contextlib import re import traceback import itertools import io import textwrap import warnings import inspect import time from typing import Any, List, Callable, Iterable, Optional, Union, Tuple, Generator, Dict, AsyncGenerator from collections import namedtuple, deque from jishaku.codeblocks import Codeblock ...
177
256
3,701
5
172
MaskDuck/stella_bot
utils/parser.py
Python
ReplParser
ReplParser
26
353
26
26
659788241c0c7ad2650ea7e4e7cbe032279162c0
bigcode/the-stack
train
3b004f65fd54491c311f41d6
train
class
class PrepareBatches: """ Class that prepares the input datasets for training in Keras deep models. The class needs a dictionary with the features, the number of classes and the name of the band assigned to the labels. When the prepare_batches() function is called, it outputs tensorflow batch datase...
class PrepareBatches:
""" Class that prepares the input datasets for training in Keras deep models. The class needs a dictionary with the features, the number of classes and the name of the band assigned to the labels. When the prepare_batches() function is called, it outputs tensorflow batch datasets. Parameters ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This script contains a class that prepares the input Tensorflow Records # to be fed into Keras deep models. # # The TFRecords are first parsed using a dictionary of Features for each # of the bands that need to be inlcluded in the model (the dictionary # needs to be prep...
240
256
1,152
5
235
davidelomeo/mangroves_deep_learning
custom_packages/eeCustomDeepTools/eeCustomDeepTools/prepare_batches.py
Python
PrepareBatches
PrepareBatches
25
173
25
25
08bfb9b3586238f1479c27f6541ebf1f366fd88a
bigcode/the-stack
train
3f3e40b460ef466a7c035f4f
train
class
class NBP: cache = {} def __init__(self, cache_file: str = ".cache"): self.cache_file = cache_file def save_cache(self): try: with open(self.cache_file, "w") as f: json.dump(self.cache, f) except OSError: # pragma: no cover pass def loa...
class NBP:
cache = {} def __init__(self, cache_file: str = ".cache"): self.cache_file = cache_file def save_cache(self): try: with open(self.cache_file, "w") as f: json.dump(self.cache, f) except OSError: # pragma: no cover pass def load_cache(sel...
from datetime import datetime, timedelta from decimal import Decimal import requests import simplejson as json from engine.utils import ExchangeRateNotFound class NBP:
34
93
310
4
29
rysiok/ExanteTaxPL
engine/NBP.py
Python
NBP
NBP
10
48
10
10
bac151a75182c2de0e5c7dbec113771007fad7d1
bigcode/the-stack
train
7161b787f58c4b3f11f8574d
train
class
class TestEzsignfoldersignerassociationCreateObjectV1Response(unittest.TestCase): """EzsignfoldersignerassociationCreateObjectV1Response unit test stubs""" def setUp(self): pass def tearDown(self): pass def testEzsignfoldersignerassociationCreateObjectV1Response(self): """Test...
class TestEzsignfoldersignerassociationCreateObjectV1Response(unittest.TestCase):
"""EzsignfoldersignerassociationCreateObjectV1Response unit test stubs""" def setUp(self): pass def tearDown(self): pass def testEzsignfoldersignerassociationCreateObjectV1Response(self): """Test EzsignfoldersignerassociationCreateObjectV1Response""" # FIXME: construct...
1ResponseMPayload'] = EzsignfoldersignerassociationCreateObjectV1ResponseMPayload from eZmaxApi.model.ezsignfoldersignerassociation_create_object_v1_response import EzsignfoldersignerassociationCreateObjectV1Response class TestEzsignfoldersignerassociationCreateObjectV1Response(unittest.TestCase):
64
64
118
16
47
eZmaxinc/eZmax-SDK-python
test/test_ezsignfoldersignerassociation_create_object_v1_response.py
Python
TestEzsignfoldersignerassociationCreateObjectV1Response
TestEzsignfoldersignerassociationCreateObjectV1Response
29
42
29
29
98ed3aea35c2c10a6dde77045cbd3a0e715d492d
bigcode/the-stack
train
41dca31a8942e0ce957c6669
train
function
def CreateTrackObject(url, title, time, include_container=False): track = TrackObject( key = Callback(CreateTrackObject, url=url, title=title, time=time, include_container=True), title = title, rating_key = url, artist=time, items = [ MediaObject( ...
def CreateTrackObject(url, title, time, include_container=False):
track = TrackObject( key = Callback(CreateTrackObject, url=url, title=title, time=time, include_container=True), title = title, rating_key = url, artist=time, items = [ MediaObject( container=Container.MP3, bitrate=128, ...
feed = oe1feed(url) for idx, item in enumerate(feed['list'], start=1): oc.add(CreateTrackObject(url=item['url_stream'], title=item['title'], time=item['time'])) return oc def CreateTrackObject(url, title, time, include_container=False):
64
64
146
14
49
vikingmedia/OE1.bundle
Contents/Code/__init__.py
Python
CreateTrackObject
CreateTrackObject
87
109
87
87
9407ca99324a0d6bc38c58ea2a44aeb1b7e3d1d3
bigcode/the-stack
train
619fda336fb5515ae7a7b3d5
train
function
def oe1feed(url): return json.loads(urllib2.urlopen(url).read())
def oe1feed(url):
return json.loads(urllib2.urlopen(url).read())
# -*- coding: utf-8 -*- import json import urllib2 TITLE = u'\xd61 Webradio' PREFIX = '/music/oe1' BASE_URL = 'http://oe1.orf.at' ICON = 'icon-default.png' ART = 'art-default.jpg' def oe1feed(url):
64
64
18
6
58
vikingmedia/OE1.bundle
Contents/Code/__init__.py
Python
oe1feed
oe1feed
14
15
14
14
81f0cf7bec5099b36ee6b676e40fecd22904d691
bigcode/the-stack
train
6889222f7abc5d6975a48b56
train
function
@route(PREFIX + '/catchup/day', allow_sync=True) def Day(title, url): Log('Day(%s, %s)', title, url) oc = ObjectContainer(title2=title) feed = oe1feed(url) for idx, item in enumerate(feed['list'], start=1): oc.add(CreateTrackObject(url=item['url_stream'], title=item['title'], time=item...
@route(PREFIX + '/catchup/day', allow_sync=True) def Day(title, url):
Log('Day(%s, %s)', title, url) oc = ObjectContainer(title2=title) feed = oe1feed(url) for idx, item in enumerate(feed['list'], start=1): oc.add(CreateTrackObject(url=item['url_stream'], title=item['title'], time=item['time'])) return oc
DirectoryObject( key = Callback(Day, title=nav['day_label'], url=BASE_URL + nav['url']), title = nav['day_label'] ) ) return oc @route(PREFIX + '/catchup/day', allow_sync=True) def Day(title, url):
64
64
96
20
43
vikingmedia/OE1.bundle
Contents/Code/__init__.py
Python
Day
Day
73
83
73
74
710c1c7e7ef79c9844e50176046f7de4b04ffa79
bigcode/the-stack
train
f74a0b2d4e96f743bb2798d3
train
function
@route(PREFIX + '/catchup', allow_sync=True) def Catchup(title): Log('Catchup()') oc = ObjectContainer(title2=title) feed = oe1feed(BASE_URL + '/programm/konsole/heute') for nav in feed['nav']: oc.add( DirectoryObject( key = Callback(Day, title=nav['day...
@route(PREFIX + '/catchup', allow_sync=True) def Catchup(title):
Log('Catchup()') oc = ObjectContainer(title2=title) feed = oe1feed(BASE_URL + '/programm/konsole/heute') for nav in feed['nav']: oc.add( DirectoryObject( key = Callback(Day, title=nav['day_label'], url=BASE_URL + nav['url']), title = nav['da...
title='CAMPUS', time='')) return oc @route(PREFIX + '/live') def Live(title): Log('Live()') oc = ObjectContainer(title2=title) return oc @route(PREFIX + '/catchup', allow_sync=True) def Catchup(title):
64
64
112
19
44
vikingmedia/OE1.bundle
Contents/Code/__init__.py
Python
Catchup
Catchup
56
71
56
57
13ac28e2da270f5c69f96ce144ce37d0813ac158
bigcode/the-stack
train