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
3f7f6e831b3728ebf66bce19
train
class
class AdditiveAAVPackaging(flexs.Landscape): """ An Additive landscape based on data from AAV2 packaging fitness measurements. By additive landscape, we mean that each residue at each position is given a fitness and the fitness of the sequence is the sum of these individual fitnesses. This means th...
class AdditiveAAVPackaging(flexs.Landscape):
""" An Additive landscape based on data from AAV2 packaging fitness measurements. By additive landscape, we mean that each residue at each position is given a fitness and the fitness of the sequence is the sum of these individual fitnesses. This means that the fitness contribution per residue is in...
QYGYLTLNNGSQAVGRSSFYCLEYFPSQMLRTGNNFTFSYTFEDVPF\ HSSYAHSQSLDRLMNPLIDQYLYYLSRTNTPSGTTTQSRLQFSQAGASDIRDQSRNWLPG\ PCYRQQRVSKTSADNNNSEYSWTGATKYHLNGRDSLVNPGPAMASHKDDEEKFFPQSGVL\ IFGKQGSEKTNVDIEKVMITDEEEIRTTNPVATEQYGSVSTNLQRGNRQAATADVNTQGV\ LPGMVWQDRDVYLQGPIWAKIPHTDGHFHPSPLMGGFGLKHPPPQILIKNTPVPANPSTT\ FSAAKFASFITQYSTGQVSVEIE...
222
222
743
13
209
jarridrb/FLEXS
flexs/landscapes/additive_aav_packaging.py
Python
AdditiveAAVPackaging
AdditiveAAVPackaging
24
118
24
24
b5e1ecf256a3cf365560a107da3fdc308eb73456
bigcode/the-stack
train
93a08ddf246fed78a974461d
train
function
def registry(): """ Return a dictionary of problems of the form: ```{ "problem name": { "params": ... }, ... }``` where `flexs.landscapes.AdditiveAAVPackaging(**problem["params"])` instantiates the additive AAV packaging landscape for the given set of paramet...
def registry():
""" Return a dictionary of problems of the form: ```{ "problem name": { "params": ... }, ... }``` where `flexs.landscapes.AdditiveAAVPackaging(**problem["params"])` instantiates the additive AAV packaging landscape for the given set of parameters. Return...
for seq in sequences: normed_fitness = self._get_raw_fitness(seq) / ( self.max_possible * (self.mfm + 1) ) fitness_with_noise = normed_fitness + np.random.normal(scale=self.noise) fitnesses.append(max(0, fitness_with_noise)) return np.arra...
78
78
260
3
75
jarridrb/FLEXS
flexs/landscapes/additive_aav_packaging.py
Python
registry
registry
121
147
121
121
91160d136303377bc5872dbbfd653f90037c3bbe
bigcode/the-stack
train
8764e90ee6025b580201399c
train
class
@dataclass class Variable: """External facing API for hamilton. Having this as a dataclass allows us to hide the internals of the system but expose what the user might need. Furthermore, we can always add attributes and maintain backwards compatibility.""" name: str type: typing.Type
@dataclass class Variable:
"""External facing API for hamilton. Having this as a dataclass allows us to hide the internals of the system but expose what the user might need. Furthermore, we can always add attributes and maintain backwards compatibility.""" name: str type: typing.Type
if we want to run this code stand alone. import typing from dataclasses import dataclass if __name__ == '__main__': import graph import node else: from . import graph from . import node logger = logging.getLogger(__name__) @dataclass class Variable:
64
64
65
6
58
elijahbenizzy/hamilton
hamilton/driver.py
Python
Variable
Variable
23
29
23
24
a7ebda0b9c989e8e8140cf973f23429fd2e28edb
bigcode/the-stack
train
63f6f9a5bae9a0c257131e10
train
class
class Driver(object): """This class orchestrates creating and executing the DAG to create a dataframe.""" def __init__(self, config: Dict[str, Any], *modules: ModuleType): """Constructor: creates a DAG given the configuration & modules to crawl. :param config: This is a dictionary of initial d...
class Driver(object):
"""This class orchestrates creating and executing the DAG to create a dataframe.""" def __init__(self, config: Dict[str, Any], *modules: ModuleType): """Constructor: creates a DAG given the configuration & modules to crawl. :param config: This is a dictionary of initial data & configuration. ...
import logging from datetime import datetime from typing import Dict, Collection, List, Any from types import ModuleType import pandas as pd # required if we want to run this code stand alone. import typing from dataclasses import dataclass if __name__ == '__main__': import graph import node else: from ...
159
235
784
4
154
elijahbenizzy/hamilton
hamilton/driver.py
Python
Driver
Driver
32
114
32
32
49bb9af81a2dc39b8f992ca0f69eced00df12e44
bigcode/the-stack
train
3e67c502929534083a0d34ce
train
class
class vlans(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG from YANG module brocade-xstp-ext - based on the path /brocade_xstp_ext_rpc/get-stp-mst-detail/output/msti/vlans. Each member element of the container is represented as a class variable - with a specific YANG type. ...
class vlans(PybindBase):
""" This class was auto-generated by the PythonClass plugin for PYANG from YANG module brocade-xstp-ext - based on the path /brocade_xstp_ext_rpc/get-stp-mst-detail/output/msti/vlans. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: VLAN...
from operator import attrgetter import pyangbind.lib.xpathhelper as xpathhelper from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType from pyangbind.lib.base import PybindBase from d...
98
256
1,587
7
91
shivharis/pybind
pybind/slxos/v16r_1_00b/brocade_xstp_ext_rpc/get_stp_mst_detail/output/msti/vlans/__init__.py
Python
vlans
vlans
10
122
10
10
782eb4779159e49b349edcdb9671c5d632eb25a1
bigcode/the-stack
train
4928be6d6ddcf179def61d23
train
function
def test_nquads_default_graph(): ds = ConjunctiveGraph() data = """ <http://example.org/s1> <http://example.org/p1> <http://example.org/o1> . <http://example.org/s2> <http://example.org/p2> <http://example.org/o2> . <http://example.org/s3> <http://example.org/p3> <http://example.org/o3> <http://exa...
def test_nquads_default_graph():
ds = ConjunctiveGraph() data = """ <http://example.org/s1> <http://example.org/p1> <http://example.org/o1> . <http://example.org/s2> <http://example.org/p2> <http://example.org/o2> . <http://example.org/s3> <http://example.org/p3> <http://example.org/o3> <http://example.org/g3> . """ publi...
from rdflib import ConjunctiveGraph, URIRef def test_nquads_default_graph():
22
64
191
8
13
ROZBEH/rdflib
test/test_issue535.py
Python
test_nquads_default_graph
test_nquads_default_graph
4
19
4
4
9e56028441d1938acc90a0a05c9c59caf8e7153d
bigcode/the-stack
train
83dd86c8a99b5ae10e9763d6
train
class
class PodMonitor(pulumi.CustomResource): def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, api_version: Optional[pulumi.Input[str]] = None, kind: Optional[pulumi.Input[str]] = None, metadata:...
class PodMonitor(pulumi.CustomResource):
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, api_version: Optional[pulumi.Input[str]] = None, kind: Optional[pulumi.Input[str]] = None, metadata: Optional[pulumi.Input[pulumi.InputType['...
# coding=utf-8 # *** WARNING: this file was generated by crd2pulumi. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from . import outp...
115
256
855
9
106
pulumi/pulumi-kubernetes-crds
operators/prometheus/python/pulumi_pulumi_kubernetes_crds_operators_prometheus/monitoring/v1/PodMonitor.py
Python
PodMonitor
PodMonitor
17
107
17
17
8045176ffa66d2a7011a010488c6605609f322c8
bigcode/the-stack
train
aeffe2d8461e0f07d2c0cf4e
train
class
class _EmbedFieldOptional(TypedDict, total=False): inline: bool
class _EmbedFieldOptional(TypedDict, total=False):
inline: bool
THE SOFTWARE. """ from typing import List, Literal, TypedDict class _EmbedFooterOptional(TypedDict, total=False): icon_url: str proxy_icon_url: str class EmbedFooter(_EmbedFooterOptional): text: str class _EmbedFieldOptional(TypedDict, total=False):
64
64
17
12
51
Ryomen-Sukuna/discord.py
discord/types/embed.py
Python
_EmbedFieldOptional
_EmbedFieldOptional
37
38
37
37
498297e1e309d5338f21b11d7168bd3f50392c55
bigcode/the-stack
train
99d84635a4fe4ae6906d4ea5
train
class
class Embed(TypedDict, total=False): title: str type: EmbedType description: str url: str timestamp: str color: int footer: EmbedFooter image: EmbedImage thumbnail: EmbedThumbnail video: EmbedVideo provider: EmbedProvider author: EmbedAuthor fields: List[EmbedField]
class Embed(TypedDict, total=False):
title: str type: EmbedType description: str url: str timestamp: str color: int footer: EmbedFooter image: EmbedImage thumbnail: EmbedThumbnail video: EmbedVideo provider: EmbedProvider author: EmbedAuthor fields: List[EmbedField]
): url: str icon_url: str proxy_icon_url: str class EmbedAuthor(_EmbedAuthorOptional): name: str EmbedType = Literal['rich', 'image', 'video', 'gifv', 'article', 'link'] class Embed(TypedDict, total=False):
64
64
84
9
55
Ryomen-Sukuna/discord.py
discord/types/embed.py
Python
Embed
Embed
91
104
91
91
e24c36b827af6c0434103153480a0f08ccfac270
bigcode/the-stack
train
03f285d08389a45d5b9044ab
train
class
class EmbedImage(_EmbedImageOptional): url: str
class EmbedImage(_EmbedImageOptional):
url: str
(TypedDict, total=False): url: str proxy_url: str height: int width: int class _EmbedImageOptional(TypedDict, total=False): proxy_url: str height: int width: int class EmbedImage(_EmbedImageOptional):
64
64
13
8
55
Ryomen-Sukuna/discord.py
discord/types/embed.py
Python
EmbedImage
EmbedImage
69
70
69
69
56a39a1c2d8eac847feb7afcc6bd8a7242e49a83
bigcode/the-stack
train
dddcb0f0bc339119adca4649
train
class
class EmbedVideo(TypedDict, total=False): url: str proxy_url: str height: int width: int
class EmbedVideo(TypedDict, total=False):
url: str proxy_url: str height: int width: int
FieldOptional): name: str value: str class _EmbedThumbnailOptional(TypedDict, total=False): proxy_url: str height: int width: int class EmbedThumbnail(_EmbedThumbnailOptional): url: str class EmbedVideo(TypedDict, total=False):
64
64
31
10
53
Ryomen-Sukuna/discord.py
discord/types/embed.py
Python
EmbedVideo
EmbedVideo
56
60
56
56
2f16308ef56f7c8e43474b92dd24d5a452d595e1
bigcode/the-stack
train
5280ea47f1b676c8fa4fdce1
train
class
class EmbedAuthor(_EmbedAuthorOptional): name: str
class EmbedAuthor(_EmbedAuthorOptional):
name: str
): url: str class EmbedProvider(TypedDict, total=False): name: str url: str class _EmbedAuthorOptional(TypedDict, total=False): url: str icon_url: str proxy_icon_url: str class EmbedAuthor(_EmbedAuthorOptional):
64
64
13
8
55
Ryomen-Sukuna/discord.py
discord/types/embed.py
Python
EmbedAuthor
EmbedAuthor
84
85
84
84
0f82c9dc6fce1ea7ae4fde6407c65ac642ddf97e
bigcode/the-stack
train
4d24852f013b15ac8fb5ab66
train
class
class EmbedThumbnail(_EmbedThumbnailOptional): url: str
class EmbedThumbnail(_EmbedThumbnailOptional):
url: str
Dict, total=False): inline: bool class EmbedField(_EmbedFieldOptional): name: str value: str class _EmbedThumbnailOptional(TypedDict, total=False): proxy_url: str height: int width: int class EmbedThumbnail(_EmbedThumbnailOptional):
64
64
13
8
55
Ryomen-Sukuna/discord.py
discord/types/embed.py
Python
EmbedThumbnail
EmbedThumbnail
52
53
52
52
adc6be99f8a7e2a274587dac32e93ddb52e13d5e
bigcode/the-stack
train
93b089cebcf90d7c6067f1fd
train
class
class _EmbedThumbnailOptional(TypedDict, total=False): proxy_url: str height: int width: int
class _EmbedThumbnailOptional(TypedDict, total=False):
proxy_url: str height: int width: int
_url: str class EmbedFooter(_EmbedFooterOptional): text: str class _EmbedFieldOptional(TypedDict, total=False): inline: bool class EmbedField(_EmbedFieldOptional): name: str value: str class _EmbedThumbnailOptional(TypedDict, total=False):
64
64
28
12
51
Ryomen-Sukuna/discord.py
discord/types/embed.py
Python
_EmbedThumbnailOptional
_EmbedThumbnailOptional
46
49
46
46
c700bf566e96a87d0c59e8cc98f045e47f4842d7
bigcode/the-stack
train
bf286b97c8e04c65f3a29e36
train
class
class _EmbedFooterOptional(TypedDict, total=False): icon_url: str proxy_icon_url: str
class _EmbedFooterOptional(TypedDict, total=False):
icon_url: str proxy_icon_url: str
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ from typing import List, Literal, TypedDict class _EmbedFooterOptional(TypedDict, total=False):
64
64
25
12
51
Ryomen-Sukuna/discord.py
discord/types/embed.py
Python
_EmbedFooterOptional
_EmbedFooterOptional
28
30
28
28
651ec66da25646c2aac86055588d49dba806b679
bigcode/the-stack
train
0cd5170a39884ec878015e57
train
class
class _EmbedImageOptional(TypedDict, total=False): proxy_url: str height: int width: int
class _EmbedImageOptional(TypedDict, total=False):
proxy_url: str height: int width: int
: int width: int class EmbedThumbnail(_EmbedThumbnailOptional): url: str class EmbedVideo(TypedDict, total=False): url: str proxy_url: str height: int width: int class _EmbedImageOptional(TypedDict, total=False):
64
64
28
12
51
Ryomen-Sukuna/discord.py
discord/types/embed.py
Python
_EmbedImageOptional
_EmbedImageOptional
63
66
63
63
fe2e72c0dfcdaf8f7c6f1f2f6c9c7440cdad0ac5
bigcode/the-stack
train
049f246dca629fa23fe3bddb
train
class
class EmbedProvider(TypedDict, total=False): name: str url: str
class EmbedProvider(TypedDict, total=False):
name: str url: str
: str height: int width: int class _EmbedImageOptional(TypedDict, total=False): proxy_url: str height: int width: int class EmbedImage(_EmbedImageOptional): url: str class EmbedProvider(TypedDict, total=False):
64
64
20
10
53
Ryomen-Sukuna/discord.py
discord/types/embed.py
Python
EmbedProvider
EmbedProvider
73
75
73
73
9b7c9c996a998304a6dd5efe21fa79d7f27e0510
bigcode/the-stack
train
dfc092a948637e37c2f7ea03
train
class
class EmbedField(_EmbedFieldOptional): name: str value: str
class EmbedField(_EmbedFieldOptional):
name: str value: str
class _EmbedFooterOptional(TypedDict, total=False): icon_url: str proxy_icon_url: str class EmbedFooter(_EmbedFooterOptional): text: str class _EmbedFieldOptional(TypedDict, total=False): inline: bool class EmbedField(_EmbedFieldOptional):
64
64
18
8
55
Ryomen-Sukuna/discord.py
discord/types/embed.py
Python
EmbedField
EmbedField
41
43
41
41
b6683d4f7197b8781959317af5e0286d737ee2d6
bigcode/the-stack
train
4683d2561f8584dda7853aac
train
class
class _EmbedAuthorOptional(TypedDict, total=False): url: str icon_url: str proxy_icon_url: str
class _EmbedAuthorOptional(TypedDict, total=False):
url: str icon_url: str proxy_icon_url: str
total=False): proxy_url: str height: int width: int class EmbedImage(_EmbedImageOptional): url: str class EmbedProvider(TypedDict, total=False): name: str url: str class _EmbedAuthorOptional(TypedDict, total=False):
64
64
30
12
51
Ryomen-Sukuna/discord.py
discord/types/embed.py
Python
_EmbedAuthorOptional
_EmbedAuthorOptional
78
81
78
78
93a0084059201437439f02a07daa9f38b450d2e2
bigcode/the-stack
train
1d0091d10830cbfa083d94f9
train
class
class EmbedFooter(_EmbedFooterOptional): text: str
class EmbedFooter(_EmbedFooterOptional):
text: str
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ from typing import List, Literal, TypedDict class _EmbedFooterOptional(TypedDict, total=False): icon_url: str proxy_icon_url: str class EmbedFooter(_EmbedFooterOptional):
64
64
13
8
55
Ryomen-Sukuna/discord.py
discord/types/embed.py
Python
EmbedFooter
EmbedFooter
33
34
33
33
04f9f8d80aa34cfb371480bd5e43cf7a5202c6a9
bigcode/the-stack
train
b1454152d41699f4a111d5f5
train
class
class NoModelTests(SimpleTestCase): def test_no_models(self): """Test that it's possible to load an app with no models.py file.""" app_config = apps.get_app_config('no_models') self.assertIsNone(app_config.models_module)
class NoModelTests(SimpleTestCase):
def test_no_models(self): """Test that it's possible to load an app with no models.py file.""" app_config = apps.get_app_config('no_models') self.assertIsNone(app_config.models_module)
from django.apps import apps from django.test import SimpleTestCase class NoModelTests(SimpleTestCase):
22
64
53
8
13
MikeAmy/django
tests/no_models/tests.py
Python
NoModelTests
NoModelTests
5
10
5
6
c1cdb10c0bd532d24de10052ae25be3eb95badb0
bigcode/the-stack
train
f821ccec6239e22b37dc3a09
train
function
def macpack(mac): return base64.b16decode(mac.replace(':', '').replace('-', '').encode('ascii'))
def macpack(mac):
return base64.b16decode(mac.replace(':', '').replace('-', '').encode('ascii'))
i: bytes([i >> 8, i & 255]) def macunpack(data): s = base64.b16encode(data) return ':'.join([s[i:i+2].decode('ascii') for i in range(0, 12, 2)]) def macpack(mac):
64
64
24
5
59
CJHouser/piman
dhcp/listener.py
Python
macpack
macpack
39
40
39
39
0a6fee813eb2df9810dafb53d3d5932de56ad0f4
bigcode/the-stack
train
56cc237f23a06ffd32229f9b
train
function
def inet_atonX(ips): return b''.join(map(inet_aton, ips))
def inet_atonX(ips):
return b''.join(map(inet_aton, ips))
see https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol # section DHCP options def inet_ntoaX(data): return ['.'.join(map(str, data[i:i + 4])) for i in range(0, len(data), 4)] def inet_atonX(ips):
64
64
21
8
56
CJHouser/piman
dhcp/listener.py
Python
inet_atonX
inet_atonX
14
15
14
14
4fa464c37cef239f7ba89da5ab5da2d743eefea4
bigcode/the-stack
train
4681287e2a58c55194edadf5
train
function
def macunpack(data): s = base64.b16encode(data) return ':'.join([s[i:i+2].decode('ascii') for i in range(0, 12, 2)])
def macunpack(data):
s = base64.b16encode(data) return ':'.join([s[i:i+2].decode('ascii') for i in range(0, 12, 2)])
v in dhcp_message_types.items(): reversed_dhcp_message_types[v] = i shortunpack = lambda data: (data[0] << 8) + data[1] shortpack = lambda i: bytes([i >> 8, i & 255]) def macunpack(data):
64
64
45
6
58
CJHouser/piman
dhcp/listener.py
Python
macunpack
macunpack
35
37
35
35
b928dc0b5c1166d112e1b8f6b4f5be8b9851c07e
bigcode/the-stack
train
20c563831aa036902c5c2d71
train
class
class ReadBootProtocolPacket(object): for i, o in enumerate(options): locals()[o[0]] = None locals()['option_{0}'.format(i)] = None del i, o def __init__(self, data, address = ('0.0.0.0', 0)): self.data = data self.address = address self.host = address[0] s...
class ReadBootProtocolPacket(object):
for i, o in enumerate(options): locals()[o[0]] = None locals()['option_{0}'.format(i)] = None del i, o def __init__(self, data, address = ('0.0.0.0', 0)): self.data = data self.address = address self.host = address[0] self.port = address[1] # wiresh...
_controller_domain_name_list', None, None), ('bcmcs_controller_ipv4_address', None, None), ('authentication', None, None), ('client_last_transaction_time', None, None), ('associated_ip', None, None), ('client_system', None, None), ('client_ndi', None, None), ('ldap', None, None), ('remov...
222
222
740
7
215
CJHouser/piman
dhcp/listener.py
Python
ReadBootProtocolPacket
ReadBootProtocolPacket
165
243
165
166
59d8de6d80d96dbbf6ce318ad78ecc85d8de9ab1
bigcode/the-stack
train
bb063418aaea787aede43b0f
train
function
def inet_ntoaX(data): return ['.'.join(map(str, data[i:i + 4])) for i in range(0, len(data), 4)]
def inet_ntoaX(data):
return ['.'.join(map(str, data[i:i + 4])) for i in range(0, len(data), 4)]
#!/usr/bin/python3 from socket import * import struct import base64 import select # see https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol # section DHCP options def inet_ntoaX(data):
49
64
35
7
41
CJHouser/piman
dhcp/listener.py
Python
inet_ntoaX
inet_ntoaX
11
12
11
11
7c57d28b06d675ab02fe4741edd94513f7083001
bigcode/the-stack
train
d07748110813d7a6d612b273
train
function
def unpackbool(data): return data[0]
def unpackbool(data):
return data[0]
64.b16encode(data) return ':'.join([s[i:i+2].decode('ascii') for i in range(0, 12, 2)]) def macpack(mac): return base64.b16decode(mac.replace(':', '').replace('-', '').encode('ascii')) def unpackbool(data):
64
64
11
5
59
CJHouser/piman
dhcp/listener.py
Python
unpackbool
unpackbool
42
43
42
42
d404e30d882944771fdb4c44c0c29dc7eba06973
bigcode/the-stack
train
4e71e2d84253c1f242593ee6
train
function
def packbool(bool): return bytes([bool])
def packbool(bool):
return bytes([bool])
([s[i:i+2].decode('ascii') for i in range(0, 12, 2)]) def macpack(mac): return base64.b16decode(mac.replace(':', '').replace('-', '').encode('ascii')) def unpackbool(data): return data[0] def packbool(bool):
64
64
11
5
59
CJHouser/piman
dhcp/listener.py
Python
packbool
packbool
45
46
45
45
efef0930d0449a6b67f5975f1d5e1643ba31f957
bigcode/the-stack
train
0bb9db65c68f928ca20e6146
train
class
class XViewFirstPlaceClsModel(XViewFirstPlaceLocModel): def __init__(self, model_size, models_folder='weights', devices=[0,0,0], dp_mode=False): super(XViewFirstPlaceClsModel, self).__init__(model_size, models_folder=models_folder, ...
class XViewFirstPlaceClsModel(XViewFirstPlaceLocModel):
def __init__(self, model_size, models_folder='weights', devices=[0,0,0], dp_mode=False): super(XViewFirstPlaceClsModel, self).__init__(model_size, models_folder=models_folder, devices...
(pred).mean(axis=0) * 255 msk_out.append(torch.tensor(pred_full.astype('uint8').transpose(1, 2, 0)).squeeze()) msk_out = torch.stack(msk_out) return msk_out class XViewFirstPlaceClsModel(XViewFirstPlaceLocModel):
69
69
230
14
54
fdny-imt/xView2_FDNY
models.py
Python
XViewFirstPlaceClsModel
XViewFirstPlaceClsModel
112
137
112
112
e1f9d3b2a288b29bf3164f1e6cbbc9d0ded7e55d
bigcode/the-stack
train
6747798d9eb001245002087a
train
class
class XViewFirstPlaceLocModel(nn.Module): def __init__(self, model_size, models_folder='weights', devices=[0,0,0], load_models=True, dp_mode=False): super(XViewFirstPlaceLocModel, self).__init__() self.models = [] self.dp_mode = dp_mode self.model_size = model_size ...
class XViewFirstPlaceLocModel(nn.Module):
def __init__(self, model_size, models_folder='weights', devices=[0,0,0], load_models=True, dp_mode=False): super(XViewFirstPlaceLocModel, self).__init__() self.models = [] self.dp_mode = dp_mode self.model_size = model_size self.models_folder = models_folder ...
import torch import torch.nn as nn from torch.backends import cudnn from torch.autograd import Variable from os import path, makedirs, listdir from zoo.models import * import numpy as np np.random.seed(1) import random random.seed(1) class XViewFirstPlaceLocModel(nn.Module):
69
256
956
10
59
fdny-imt/xView2_FDNY
models.py
Python
XViewFirstPlaceLocModel
XViewFirstPlaceLocModel
14
109
14
14
50ec9bc2bd0df79ddfad8f24ea002bfca222685f
bigcode/the-stack
train
aec909406c231a35f4dc550a
train
function
def chronal_coordinates(verbose=False): raw_coordinates = get_input(day=6) coords = {} grid_x, grid_y = 0, 0 for coord in raw_coordinates: x, y = [int(c) for c in coord.split(',')] if grid_x < x: grid_x = x if grid_y < y: grid_y = y coords[(x, y)] = 0 grid_x += 1 ...
def chronal_coordinates(verbose=False):
raw_coordinates = get_input(day=6) coords = {} grid_x, grid_y = 0, 0 for coord in raw_coordinates: x, y = [int(c) for c in coord.split(',')] if grid_x < x: grid_x = x if grid_y < y: grid_y = y coords[(x, y)] = 0 grid_x += 1 grid_y += 1 distances = [[[manhat...
""" Day 06 - Chronal Coordinates --- source: https://adventofcode.com/2018/day/6 """ import argparse import time from utils import get_input, manhatan_dist def chronal_coordinates(verbose=False):
50
113
379
7
42
gosiqueira/advent-of-code-2018
06-chronal-coordinates.py
Python
chronal_coordinates
chronal_coordinates
13
58
13
13
d8e76132079e7c33fb0d37e2071ad9881e06d229
bigcode/the-stack
train
0928848c186ef11a09f1b58a
train
function
def find_intersection(x, tr_bounds, lb, ub): """Find intersection of trust-region bounds and initial bounds. Returns ------- lb_total, ub_total : ndarray with shape of x Lower and upper bounds of the intersection region. orig_l, orig_u : ndarray of bool with shape of x True means th...
def find_intersection(x, tr_bounds, lb, ub):
"""Find intersection of trust-region bounds and initial bounds. Returns ------- lb_total, ub_total : ndarray with shape of x Lower and upper bounds of the intersection region. orig_l, orig_u : ndarray of bool with shape of x True means that an original bound is taken as a correspond...
d) def rmatvec(x): r = d * Jop.rmatvec(x) r[active_set] = 0 return r return LinearOperator((m, n), matvec=matvec, rmatvec=rmatvec, dtype=float) def find_intersection(x, tr_bounds, lb, ub):
73
73
245
13
60
jeremiedbb/scipy
scipy/optimize/_lsq/dogbox.py
Python
find_intersection
find_intersection
80
106
80
80
06d2c0cf5eedee5e32b3030692eb10abbfbd1748
bigcode/the-stack
train
073058a1c55bf7216e787dff
train
function
def dogbox(fun, jac, x0, f0, J0, lb, ub, ftol, xtol, gtol, max_nfev, x_scale, loss_function, tr_solver, tr_options, verbose): f = f0 f_true = f.copy() nfev = 1 J = J0 njev = 1 if loss_function is not None: rho = loss_function(f) cost = 0.5 * np.sum(rho[0]) J,...
def dogbox(fun, jac, x0, f0, J0, lb, ub, ftol, xtol, gtol, max_nfev, x_scale, loss_function, tr_solver, tr_options, verbose):
f = f0 f_true = f.copy() nfev = 1 J = J0 njev = 1 if loss_function is not None: rho = loss_function(f) cost = 0.5 * np.sum(rho[0]) J, f = scale_for_robust_loss_function(J, f, rho) else: cost = 0.5 * np.dot(f, f) g = compute_grad(J, f) jac_scale = i...
algorithm would check if Cauchy step fits into # the bounds, and just return it constrained version if not. But in a # rectangular trust region it makes sense to try to improve constrained # Cauchy step too. Thus, we don't distinguish these two cases. cauchy_step = -minimize_quadratic_1d(a, b, 0, to_b...
256
256
1,448
49
206
jeremiedbb/scipy
scipy/optimize/_lsq/dogbox.py
Python
dogbox
dogbox
152
332
152
153
239a49760ef7507ebeeecaaf2486889eb0680ca3
bigcode/the-stack
train
07d63a65b1e1ed6f829ef7f3
train
function
def dogleg_step(x, newton_step, g, a, b, tr_bounds, lb, ub): """Find dogleg step in a rectangular region. Returns ------- step : ndarray, shape (n,) Computed dogleg step. bound_hits : ndarray of int, shape (n,) Each component shows whether a corresponding variable hits the i...
def dogleg_step(x, newton_step, g, a, b, tr_bounds, lb, ub):
"""Find dogleg step in a rectangular region. Returns ------- step : ndarray, shape (n,) Computed dogleg step. bound_hits : ndarray of int, shape (n,) Each component shows whether a corresponding variable hits the initial bound after the step is taken: * 0 - a va...
x ub_centered = ub - x lb_total = np.maximum(lb_centered, -tr_bounds) ub_total = np.minimum(ub_centered, tr_bounds) orig_l = np.equal(lb_total, lb_centered) orig_u = np.equal(ub_total, ub_centered) tr_l = np.equal(lb_total, -tr_bounds) tr_u = np.equal(ub_total, tr_bounds) return lb_...
135
135
450
23
111
jeremiedbb/scipy
scipy/optimize/_lsq/dogbox.py
Python
dogleg_step
dogleg_step
109
149
109
109
4dfb6e706e378c7b93c842a953f61f7a2a706e3b
bigcode/the-stack
train
e35bb9162b6d21dc7baecadc
train
function
def lsmr_operator(Jop, d, active_set): """Compute LinearOperator to use in LSMR by dogbox algorithm. `active_set` mask is used to excluded active variables from computations of matrix-vector products. """ m, n = Jop.shape def matvec(x): x_free = x.ravel().copy() x_free[active_s...
def lsmr_operator(Jop, d, active_set):
"""Compute LinearOperator to use in LSMR by dogbox algorithm. `active_set` mask is used to excluded active variables from computations of matrix-vector products. """ m, n = Jop.shape def matvec(x): x_free = x.ravel().copy() x_free[active_set] = 0 return Jop.matvec(x * d...
build_quadratic_1d, minimize_quadratic_1d, compute_grad, compute_jac_scale, check_termination, scale_for_robust_loss_function, print_header_nonlinear, print_iteration_nonlinear) def lsmr_operator(Jop, d, active_set):
64
64
156
13
51
jeremiedbb/scipy
scipy/optimize/_lsq/dogbox.py
Python
lsmr_operator
lsmr_operator
59
77
59
59
c8459fe050c27521eb8cdeea4f98c9998dcd57c9
bigcode/the-stack
train
6e6d5996189431a08fb978c7
train
class
class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Item', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('ti...
class Migration(migrations.Migration):
initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Item', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=255)),...
# Generated by Django 3.1.7 on 2021-03-28 22:37 from django.db import migrations, models class Migration(migrations.Migration):
38
64
76
7
30
StefanS97/todo-app-django
todo_app/core/migrations/0001_initial.py
Python
Migration
Migration
6
21
6
7
5f229f74d912f9f18f75560237320bf32cf14ce7
bigcode/the-stack
train
f0e96bbf448730269580e046
train
class
class ResearchSubject(domainresource.DomainResource): """ Physical entity which is the primary unit of interest in the study. A physical entity which is the primary unit of operational and/or administrative interest in a study. """ resource_type = "ResearchSubject" def __init__(self, jsondict...
class ResearchSubject(domainresource.DomainResource):
""" Physical entity which is the primary unit of interest in the study. A physical entity which is the primary unit of operational and/or administrative interest in a study. """ resource_type = "ResearchSubject" def __init__(self, jsondict=None, strict=True, **kwargs): """ Initialize ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ResearchSubject) on 2019-01-25. # 2019, SMART Health IT. ## from . import domainresource class ResearchSubject(domainresource.DomainResource):
84
174
583
8
75
VerdantAI/fhirbug
fhirbug/Fhir/Resources/researchsubject.py
Python
ResearchSubject
ResearchSubject
11
76
11
11
9864da9cf97c9466d5926840c861e8ca7b632795
bigcode/the-stack
train
97ec8d6a61af02e0fb78a43b
train
function
@click.command("show", short_help="Show node information") @click.option( "-p", "--rpc-port", help=( "Set the port where the Full Node is hosting the RPC interface. " "See the rpc_port under full_node in config.yaml" ), type=int, default=None, ) @click.option( "-wp", "--w...
@click.command("show", short_help="Show node information") @click.option( "-p", "--rpc-port", help=( "Set the port where the Full Node is hosting the RPC interface. " "See the rpc_port under full_node in config.yaml" ), type=int, default=None, ) @click.option( "-wp", "--w...
import asyncio asyncio.run( show_async( rpc_port, state, sync_speed, connections, exit_node, add_connection, remove_connection, block_header_hash_by_height, block_by_header_hash, ) )
@click.command("show", short_help="Show node information") @click.option( "-p", "--rpc-port", help=( "Set the port where the Full Node is hosting the RPC interface. " "See the rpc_port under full_node in config.yaml" ), type=int, default=None, ) @click.option( "-wp", "--w...
464
155
519
464
0
WarutaShinken/profit-blockchain
profit/cmds/show.py
Python
show_cmd
show_cmd
479
548
479
533
0ec86db40a7182baf81b774bb9bb6e52dd05c026
bigcode/the-stack
train
5fb274418a452cb4efd27c0d
train
function
async def show_async( rpc_port: Optional[int], state: bool, sync_speed_delay: Optional[int], show_connections: bool, exit_node: bool, add_connection: str, remove_connection: str, block_header_hash_by_height: str, block_by_header_hash: str, ) -> None: import aiohttp import tim...
async def show_async( rpc_port: Optional[int], state: bool, sync_speed_delay: Optional[int], show_connections: bool, exit_node: bool, add_connection: str, remove_connection: str, block_header_hash_by_height: str, block_by_header_hash: str, ) -> None:
import aiohttp import time import traceback from time import localtime, struct_time from typing import List, Optional from profit.consensus.block_record import BlockRecord from profit.rpc.full_node_rpc_client import FullNodeRpcClient from profit.server.outbound_message import NodeType ...
from typing import Any, Optional import click async def show_async( rpc_port: Optional[int], state: bool, sync_speed_delay: Optional[int], show_connections: bool, exit_node: bool, add_connection: str, remove_connection: str, block_header_hash_by_height: str, block_by_header_hash: st...
80
256
4,198
70
9
WarutaShinken/profit-blockchain
profit/cmds/show.py
Python
show_async
show_async
6
476
6
16
afa74b2dd5ffe216e31b5777a2f6aee17aa8e288
bigcode/the-stack
train
5a6b5befbe3a7513d9b6d9ba
train
function
@window.event def on_draw(dt): global pingpong width,height = 512,512 pingpong = 1 - pingpong compute["pingpong"] = pingpong render["pingpong"] = pingpong gl.glDisable(gl.GL_BLEND) framebuffer.activate() gl.glViewport(0, 0, width, height) compute.draw(gl.GL_TRIANGLE_STRIP) fr...
@window.event def on_draw(dt):
global pingpong width,height = 512,512 pingpong = 1 - pingpong compute["pingpong"] = pingpong render["pingpong"] = pingpong gl.glDisable(gl.GL_BLEND) framebuffer.activate() gl.glViewport(0, 0, width, height) compute.draw(gl.GL_TRIANGLE_STRIP) framebuffer.deactivate() gl....
gl_FragColor[0] = old_state; } else { gl_FragColor[0] = new_state; gl_FragColor[1] = old_state; } } """ window = app.Window(width=512, height=512) @window.event def on_draw(dt):
64
64
128
9
55
antoineMoPa/glumpy
examples/game-of-life.py
Python
on_draw
on_draw
102
121
102
103
8e5fcbdff26ab90cb2449b31c893e22efa70fe9c
bigcode/the-stack
train
4b09a308f501118291dec1ae
train
class
class PtValidator: def __init__(self, pt_transformer, va_run, va_qrels, config): self.pt_transformer = pt_transformer self.va_run = va_run self.va_qrels = va_qrels self.config = config def validate(self): with _logger.duration('validation'): res = self.pt_tra...
class PtValidator:
def __init__(self, pt_transformer, va_run, va_qrels, config): self.pt_transformer = pt_transformer self.va_run = va_run self.va_qrels = va_qrels self.config = config def validate(self): with _logger.duration('validation'): res = self.pt_transformer.transform(...
import math import io import tempfile import inspect import torch import json import tarfile from collections import namedtuple from typing import Union import pandas as pd import numpy as np import pyterrier import onir _logger = onir.log.easy() class PtValidator:
64
64
125
4
60
Georgetown-IR-Lab/OpenNIR
onir/pt.py
Python
PtValidator
PtValidator
20
32
20
20
2481f00cd4e5580a5f03a376ade164897e29fd90
bigcode/the-stack
train
8f61bf1783dae4a76b5f69b3
train
class
class PtTopicQrelsTrainer(PtPairTrainerBase): def __init__(self, pt_transformer, tr_run, tr_qrels, config): super().__init__(pt_transformer, config) self.topic_lookup = {t.qid: t.query for t in tr_run.itertuples()} self.doc_lookup = {t.docno: t.text for t in tr_run.itertuples()} self...
class PtTopicQrelsTrainer(PtPairTrainerBase):
def __init__(self, pt_transformer, tr_run, tr_qrels, config): super().__init__(pt_transformer, config) self.topic_lookup = {t.qid: t.query for t in tr_run.itertuples()} self.doc_lookup = {t.docno: t.text for t in tr_run.itertuples()} self.tr_qrels = tr_qrels.rename(columns={'docno': ...
, onir.spec.apply_spec_batch(batch, input_spec, device) def _pair_iter(self): raise NotImplementedError() class PtPairTrainer(PtPairTrainerBase): def __init__(self, pt_transformer, tr_pairs, config): super().__init__(pt_transformer, config) self.tr_pairs = tr_pairs self.rng = ...
147
147
492
12
134
Georgetown-IR-Lab/OpenNIR
onir/pt.py
Python
PtTopicQrelsTrainer
PtTopicQrelsTrainer
147
199
147
147
267223cd16503f381be82b99df6b143b275ee63d
bigcode/the-stack
train
3b2965e7c2fb392a7a8c5317
train
class
class OpenNIRPyterrierReRanker(pyterrier.transformer.EstimatorBase): """ Provides an interface for OpenNIR-style ranking models to act as re-rankers in pyterrier pipelines. """ def __init__(self, ranker: Union[str, onir.rankers.Ranker], vocab: Union[str, onir.vocab.Vocab] = None, ...
class OpenNIRPyterrierReRanker(pyterrier.transformer.EstimatorBase):
""" Provides an interface for OpenNIR-style ranking models to act as re-rankers in pyterrier pipelines. """ def __init__(self, ranker: Union[str, onir.rankers.Ranker], vocab: Union[str, onir.vocab.Vocab] = None, ranker_config: dict = None, vocab_config: dict = None, ...
and 1 neg (for now) random=self.rng, inf=True) for records in pair_it: assert records['query_id'][0] == records['query_id'][1] yield TrainPair( records['query_id'][0], records['query_text'][0], records['doc_id'][0],...
255
256
2,468
19
236
Georgetown-IR-Lab/OpenNIR
onir/pt.py
Python
OpenNIRPyterrierReRanker
OpenNIRPyterrierReRanker
207
454
207
207
c3b30fd1fa1030007737a075e79231165cc34623
bigcode/the-stack
train
4ecc8b54650910dbdb4dba6e
train
class
class PtPairTrainerBase: def __init__(self, pt_transformer, config): self.pt_transformer = pt_transformer self.config = config self._batch_iter = None params = self.pt_transformer.ranker.named_parameters() params = [v for k, v in params if v.requires_grad] self.optimi...
class PtPairTrainerBase:
def __init__(self, pt_transformer, config): self.pt_transformer = pt_transformer self.config = config self._batch_iter = None params = self.pt_transformer.ranker.named_parameters() params = [v for k, v in params if v.requires_grad] self.optimizer = torch.optim.Adam(pa...
import os import hashlib import math import io import tempfile import inspect import torch import json import tarfile from collections import namedtuple from typing import Union import pandas as pd import numpy as np import pyterrier import onir _logger = onir.log.easy() class PtValidator: def __init__(self, pt_...
196
256
943
6
189
Georgetown-IR-Lab/OpenNIR
onir/pt.py
Python
PtPairTrainerBase
PtPairTrainerBase
35
131
35
35
3526d850f73884ad72edd924bd883b64d14c6761
bigcode/the-stack
train
b51a7aada628060ce6b04527
train
class
class PtPairTrainer(PtPairTrainerBase): def __init__(self, pt_transformer, tr_pairs, config): super().__init__(pt_transformer, config) self.tr_pairs = tr_pairs self.rng = np.random.RandomState(config['random_seed']) def _pair_iter(self): if isinstance(self.tr_pairs, pd.DataFrame...
class PtPairTrainer(PtPairTrainerBase):
def __init__(self, pt_transformer, tr_pairs, config): super().__init__(pt_transformer, config) self.tr_pairs = tr_pairs self.rng = np.random.RandomState(config['random_seed']) def _pair_iter(self): if isinstance(self.tr_pairs, pd.DataFrame): df = self.tr_pairs.sample...
f: [] for f in fields} batch_count = 0 if batch_count > 0: yield batch_count, onir.spec.apply_spec_batch(batch, input_spec, device) def _pair_iter(self): raise NotImplementedError() class PtPairTrainer(PtPairTrainerBase):
64
64
108
10
54
Georgetown-IR-Lab/OpenNIR
onir/pt.py
Python
PtPairTrainer
PtPairTrainer
134
144
134
134
fa3cb809b1bb88ec7761e205bd3110219c0affe3
bigcode/the-stack
train
758d53b7ef602f77997b1418
train
function
def _inject(cls, context={}): spec = inspect.getargspec(cls.__init__) args = [] for arg in spec.args: if arg == 'self': continue elif arg == 'config': config = onir.config.apply_config(None, context.get('config') or {}, cls) args.append(config) eli...
def _inject(cls, context={}):
spec = inspect.getargspec(cls.__init__) args = [] for arg in spec.args: if arg == 'self': continue elif arg == 'config': config = onir.config.apply_config(None, context.get('config') or {}, cls) args.append(config) elif arg in context: ...
ranker_config[''] vocab_name = vocab_config[''] del ranker_config[''] del vocab_config[''] return OpenNIRPyterrierReRanker(ranker_name, vocab_name, ranker_config, vocab_config, weights, config=config) def _inject(cls, context={}):
64
64
150
8
56
Georgetown-IR-Lab/OpenNIR
onir/pt.py
Python
_inject
_inject
457
474
457
457
e0fda409e73605d8d46a0dd83c61d67bf0aac326
bigcode/the-stack
train
cfc4050f3fd8af44ce51df59
train
class
class Parser(object): def __init__(self, lexer): self.lexer = lexer # set current token to the first token taken from the input self.current_token = self.lexer.get_next_token() def error(self): raise Exception('Invalid syntax') def eat(self, token_type): # compare t...
class Parser(object):
def __init__(self, lexer): self.lexer = lexer # set current token to the first token taken from the input self.current_token = self.lexer.get_next_token() def error(self): raise Exception('Invalid syntax') def eat(self, token_type): # compare the current token type ...
() return Token(DOT, '.') self.error() return Token(EOF, None) ############################################################################### # # # PARSER ...
256
256
886
4
251
Bluebaritone21/M-Interpreter
main.py
Python
Parser
Parser
194
349
194
194
e9a30b76d2ac9ce65ff3d48cc81d4af5d236bcd2
bigcode/the-stack
train
091058eaa56bb37a2e9b2493
train
class
class Interpreter(NodeVisitor): def __init__(self, parser): self.parser = parser GLOBAL_SCOPE = {} def visit_BinOp(self, node): if node.op.type == PLUS: return self.visit(node.left) + self.visit(node.right) elif node.op.type == MINUS: return self.visit(node....
class Interpreter(NodeVisitor):
def __init__(self, parser): self.parser = parser GLOBAL_SCOPE = {} def visit_BinOp(self, node): if node.op.type == PLUS: return self.visit(node.left) + self.visit(node.right) elif node.op.type == MINUS: return self.visit(node.left) - self.visit(node.right) ...
return node ############################################################################### # # # INTERPRETER # # ...
92
93
310
5
87
Bluebaritone21/M-Interpreter
main.py
Python
Interpreter
Interpreter
367
414
367
367
bc8982a5e44ae4a5c79e2b24825a1579702dc78b
bigcode/the-stack
train
a51fe1f53e65b06dc686cd2a
train
class
class Var(AST): """The Var node is constructed out of ID token.""" def __init__(self, token): self.token = token self.value = token.value
class Var(AST):
"""The Var node is constructed out of ID token.""" def __init__(self, token): self.token = token self.value = token.value
.current_char == '.': self.advance() return Token(DOT, '.') self.error() return Token(EOF, None) ############################################################################### # # # PARS...
64
64
38
4
59
Bluebaritone21/M-Interpreter
main.py
Python
Var
Var
160
164
160
160
1b633835dfcc61adc8b512688ef82e6fd4fe73c9
bigcode/the-stack
train
d414155313dc1f4fb05aaabf
train
class
class NoOp(AST): pass
class NoOp(AST):
pass
MI, ';') if self.current_char == '.': self.advance() return Token(DOT, '.') self.error() return Token(EOF, None) ############################################################################### # ...
64
64
8
5
58
Bluebaritone21/M-Interpreter
main.py
Python
NoOp
NoOp
157
158
157
157
147455677acb7192609b222fb89ed86d2d680e2b
bigcode/the-stack
train
1e4e728c079bfafeff912479
train
class
class AST(object): pass
class AST(object):
pass
self.advance() return Token(SEMI, ';') if self.current_char == '.': self.advance() return Token(DOT, '.') self.error() return Token(EOF, None) ############################################################################...
64
64
7
4
60
Bluebaritone21/M-Interpreter
main.py
Python
AST
AST
154
155
154
154
1c844b4d5dbaa9d6b9134b912cefa031093ca47d
bigcode/the-stack
train
a53abbeb566911fea1957dec
train
class
class Assign(AST): def __init__(self, left, op, right): self.left = left self.token = self.op = op self.right = right
class Assign(AST):
def __init__(self, left, op, right): self.left = left self.token = self.op = op self.right = right
# # # ############################################################################### class AST(object): pass class NoOp(AST): pass class Var(AST): """The Var n...
64
64
38
4
59
Bluebaritone21/M-Interpreter
main.py
Python
Assign
Assign
166
170
166
166
b3ef15ba2536b6df04634f73ff4c8a473edc7a60
bigcode/the-stack
train
ece89e1180178b5183d9614a
train
class
class Compound(AST): """Represents a 'BEGIN ... END' block""" def __init__(self): self.children = []
class Compound(AST):
"""Represents a 'BEGIN ... END' block""" def __init__(self): self.children = []
def __init__(self, token): self.token = token self.value = token.value class Assign(AST): def __init__(self, left, op, right): self.left = left self.token = self.op = op self.right = right class Compound(AST):
64
64
28
4
59
Bluebaritone21/M-Interpreter
main.py
Python
Compound
Compound
172
175
172
172
ffb068e2a08328c21a68bbf52a4e3699d76943da
bigcode/the-stack
train
7bae2d2ec06b24278d3eeb22
train
class
class Token(object): def __init__(self, type, value): self.type = type self.value = value def __str__(self): """String representation of the class instance. Examples: Token(INTEGER, 3) Token(PLUS, '+') Token(MUL, '*') """ retu...
class Token(object):
def __init__(self, type, value): self.type = type self.value = value def __str__(self): """String representation of the class instance. Examples: Token(INTEGER, 3) Token(PLUS, '+') Token(MUL, '*') """ return 'Token({type}, {va...
, EOF, BEGIN, END, DOT, ASSIGN, SEMI, ID= ( 'INTEGERCONST', 'PLUS', 'MINUS', 'MUL', 'DIV', '(', ')', 'EOF','BEGIN','END','DOT','ASSIGN','SEMI', 'ID' ) class Token(object):
64
64
110
4
60
Bluebaritone21/M-Interpreter
main.py
Python
Token
Token
19
38
19
19
35ac662e78afec6065f41cb18b2cedbeed3d7da0
bigcode/the-stack
train
247bc7c7390e00b48aa5ca37
train
class
class NodeVisitor(object): def visit(self, node): method_name = 'visit_' + type(node).__name__ visitor = getattr(self, method_name, self.generic_visit) return visitor(node) def generic_visit(self, node): raise Exception('No visit_{} method'.format(type(node).__name__))
class NodeVisitor(object):
def visit(self, node): method_name = 'visit_' + type(node).__name__ visitor = getattr(self, method_name, self.generic_visit) return visitor(node) def generic_visit(self, node): raise Exception('No visit_{} method'.format(type(node).__name__))
=node, op=token, right=self.term()) return node def parse(self): node = self.program() if self.current_token.type != EOF: self.error() return node ############################################################################### # ...
64
64
67
5
59
Bluebaritone21/M-Interpreter
main.py
Python
NodeVisitor
NodeVisitor
357
364
357
357
3bbc2bddaa3b2654f944f47f1734a9f67f3690a2
bigcode/the-stack
train
c0b0bba41eca31ed998844a7
train
class
class Num(AST): def __init__(self, token): self.token = token self.value = token.value
class Num(AST):
def __init__(self, token): self.token = token self.value = token.value
self, left, op, right): self.left = left self.token = self.op = op self.right = right class UnaryOp(AST): def __init__(self, op, expr): self.token = self.op = op self.expr = expr class Num(AST):
64
64
26
4
59
Bluebaritone21/M-Interpreter
main.py
Python
Num
Num
188
191
188
188
664cb240454772d57e4d633848060e0b835d0474
bigcode/the-stack
train
425e73dbaa0c6323e2d85bf9
train
class
class BinOp(AST): def __init__(self, left, op, right): self.left = left self.token = self.op = op self.right = right
class BinOp(AST):
def __init__(self, left, op, right): self.left = left self.token = self.op = op self.right = right
init__(self, left, op, right): self.left = left self.token = self.op = op self.right = right class Compound(AST): """Represents a 'BEGIN ... END' block""" def __init__(self): self.children = [] class BinOp(AST):
64
64
39
5
59
Bluebaritone21/M-Interpreter
main.py
Python
BinOp
BinOp
177
181
177
177
481bd06210f824b9be1df400d427e16305b8e3dc
bigcode/the-stack
train
38800fdad63486b7aaf6260f
train
class
class UnaryOp(AST): def __init__(self, op, expr): self.token = self.op = op self.expr = expr
class UnaryOp(AST):
def __init__(self, op, expr): self.token = self.op = op self.expr = expr
a 'BEGIN ... END' block""" def __init__(self): self.children = [] class BinOp(AST): def __init__(self, left, op, right): self.left = left self.token = self.op = op self.right = right class UnaryOp(AST):
64
64
31
5
58
Bluebaritone21/M-Interpreter
main.py
Python
UnaryOp
UnaryOp
183
186
183
183
a1a023dca851bd3d88c7e9f9647035f79c9ebfdb
bigcode/the-stack
train
4c0d6a2ee61bd8d1a4b22101
train
function
def main(): import sys text = open(sys.argv[1], 'r').read() lexer = Lexer(text) parser = Parser(lexer) interpreter = Interpreter(parser) result = interpreter.interpret() print(interpreter.GLOBAL_SCOPE)
def main():
import sys text = open(sys.argv[1], 'r').read() lexer = Lexer(text) parser = Parser(lexer) interpreter = Interpreter(parser) result = interpreter.interpret() print(interpreter.GLOBAL_SCOPE)
= self.GLOBAL_SCOPE.get(var_name) if val is None: raise NameError(repr(var_name)) else: return val def visit_NoOp(self, node): pass def interpret(self): tree = self.parser.parse() return self.visit(tree) def main():
64
64
55
3
61
Bluebaritone21/M-Interpreter
main.py
Python
main
main
417
425
417
417
132cad06989e2fea2689db3aa2cd68746c3da74e
bigcode/the-stack
train
7ea374fbbcc08f88d3d02b04
train
class
class Lexer(object): def __init__(self, text): # client string input, e.g. "4 + 2 * 3 - 6 / 2" self.text = text # self.pos is an index into self.text self.pos = 0 self.current_char = self.text[self.pos] RESERVED_KEYWORDS = { 'BEGIN': Token('BEGIN', 'BEGIN'), ...
class Lexer(object):
def __init__(self, text): # client string input, e.g. "4 + 2 * 3 - 6 / 2" self.text = text # self.pos is an index into self.text self.pos = 0 self.current_char = self.text[self.pos] RESERVED_KEYWORDS = { 'BEGIN': Token('BEGIN', 'BEGIN'), 'END': Token('END'...
input left for lexical analysis INTEGER_CONST, PLUS, MINUS, MUL, DIV, LPAREN, RPAREN, EOF, BEGIN, END, DOT, ASSIGN, SEMI, ID= ( 'INTEGERCONST', 'PLUS', 'MINUS', 'MUL', 'DIV', '(', ')', 'EOF','BEGIN','END','DOT','ASSIGN','SEMI', 'ID' ) class Token(object): def __init__(self, type, value): self.type = ...
197
198
660
4
194
Bluebaritone21/M-Interpreter
main.py
Python
Lexer
Lexer
41
145
41
41
5885f4d64168f669f85716cea1f72ffe20b04e36
bigcode/the-stack
train
f7fb3f443b6241a682935a3b
train
function
@stmt.command() @click.option("--species", help="species ID format TAX:<tax_id_number>") @click.option("--version", help="BEL language version") @click.argument("assertion_str") @pass_context def orthologize(ctx, assertion_str, species, version): """Orthologize statement species ID needs to be the NCBI Taxonom...
@stmt.command() @click.option("--species", help="species ID format TAX:<tax_id_number>") @click.option("--version", help="BEL language version") @click.argument("assertion_str") @pass_context def orthologize(ctx, assertion_str, species, version):
"""Orthologize statement species ID needs to be the NCBI Taxonomy ID in this format: TAX:<tax_id_number> You can use the following common names for species id: human, mouse, rat (basically whatever is supported at the api orthologs endpoint) """ print("------------------------------") pr...
print(bo.validation_messages) else: print("No problems found") @stmt.command() @click.option("--species", help="species ID format TAX:<tax_id_number>") @click.option("--version", help="BEL language version") @click.argument("assertion_str") @pass_context def orthologize(ctx, assertion_st...
72
72
243
55
17
belbio/bel
bel/cli/scripts.py
Python
orthologize
orthologize
303
333
303
308
a1a5c86385e466aee0edc5324435b988559fe0aa
bigcode/the-stack
train
907d25677556099faa1295a3
train
function
@stmt.command() @click.option( "--namespace_targets", help='Target namespaces for canonicalizing BEL, e.g. {"HGNC": ["EG", "SP"], "CHEMBL": ["CHEBI"]}', ) @click.option("--version", help="BEL language version") @click.option( "--config_fn", help="BEL Pipeline configuration file - overrides default confi...
@stmt.command() @click.option( "--namespace_targets", help='Target namespaces for canonicalizing BEL, e.g. {"HGNC": ["EG", "SP"], "CHEMBL": ["CHEBI"]}', ) @click.option("--version", help="BEL language version") @click.option( "--config_fn", help="BEL Pipeline configuration file - overrides default confi...
"""Canonicalize statement Target namespaces can be provided in the following manner: bel stmt canonicalize "<BELStmt>" --namespace_targets '{"HGNC": ["EG", "SP"], "CHEMBL": ["CHEBI"]}' the value of target_namespaces must be JSON and embedded in single quotes reserving double qu...
@stmt.command() @click.option( "--namespace_targets", help='Target namespaces for canonicalizing BEL, e.g. {"HGNC": ["EG", "SP"], "CHEMBL": ["CHEBI"]}', ) @click.option("--version", help="BEL language version") @click.option( "--config_fn", help="BEL Pipeline configuration file - overrides default confi...
101
99
331
101
0
belbio/bel
bel/cli/scripts.py
Python
canonicalize
canonicalize
257
300
257
269
28a74212246e718f51ae6298f7aa3ba7d03f1257
bigcode/the-stack
train
a199b009c927c0e12b1ba8cb
train
function
@belc.group() def nanopub(): """Nanopub specific commands""" pass
@belc.group() def nanopub():
"""Nanopub specific commands""" pass
) @click.group(context_settings=CONTEXT_SETTINGS) def belc(): """BEL commands Uses first file found to load in default configuration: ./belbio_conf.yaml ./.belbio_conf ~/.belbio_conf """ pass @belc.group() def nanopub():
64
64
20
9
54
belbio/bel
bel/cli/scripts.py
Python
nanopub
nanopub
52
56
52
53
3c2a33101bffe3f0b5ff568d650b93c2ba765e6c
bigcode/the-stack
train
14e14cb6ec668788e8348301
train
function
@db.command() @click.option("--delete/--no-delete", default=False, help="Remove indexes and re-create them") @click.option( "--index_name", default="terms_blue", help='Use this name for index. Default is "terms_blue"', ) def elasticsearch(delete, index_name): """Setup Elasticsearch namespace indexes ...
@db.command() @click.option("--delete/--no-delete", default=False, help="Remove indexes and re-create them") @click.option( "--index_name", default="terms_blue", help='Use this name for index. Default is "terms_blue"', ) def elasticsearch(delete, index_name):
"""Setup Elasticsearch namespace indexes This will by default only create the indexes and run the namespace index mapping if the indexes don't exist. The --delete option will force removal of the index if it exists. The index_name should be aliased to the index 'terms' when it's ready""" if ...
@db.command() @click.option("--delete/--no-delete", default=False, help="Remove indexes and re-create them") @click.option( "--index_name", default="terms_blue", help='Use this name for index. Default is "terms_blue"', ) def elasticsearch(delete, index_name):
63
64
151
63
0
belbio/bel
bel/cli/scripts.py
Python
elasticsearch
elasticsearch
342
361
342
349
bdfc8bad25ed121af20c7f7412a1c91f15cc9055
bigcode/the-stack
train
d1eed16f78255029db4800b3
train
function
@stmt.command(name="validate", context_settings=CONTEXT_SETTINGS) @click.option("--version", help="BEL language version") @click.option( "--config_fn", help="BEL Pipeline configuration file - overrides default configuration files", ) @click.argument("statement") @pass_context def stmt_validate(ctx, assertion_st...
@stmt.command(name="validate", context_settings=CONTEXT_SETTINGS) @click.option("--version", help="BEL language version") @click.option( "--config_fn", help="BEL Pipeline configuration file - overrides default configuration files", ) @click.argument("statement") @pass_context def stmt_validate(ctx, assertion_st...
"""Parse statement and validate """ version = bel.belspec.crud.check_version(version) print("------------------------------") print(f"BEL version: {version}") print("------------------------------") bo = BEL(assertion_str, version=version) if bo.ast is None: print(bo.original_bel...
@stmt.command(name="validate", context_settings=CONTEXT_SETTINGS) @click.option("--version", help="BEL language version") @click.option( "--config_fn", help="BEL Pipeline configuration file - overrides default configuration files", ) @click.argument("statement") @pass_context def stmt_validate(ctx, assertion_st...
66
64
185
66
0
belbio/bel
bel/cli/scripts.py
Python
stmt_validate
stmt_validate
226
254
226
234
bb4a6d194120ef605ed49da59c13c64893badba5
bigcode/the-stack
train
e9634ccb8ab38eae0fc27803
train
function
@nanopub.command(name="stats", context_settings=CONTEXT_SETTINGS) @click.argument("input_fn") @pass_context def nanopub_stats(ctx, input_fn): """Collect statistics on nanopub file input_fn can be json, jsonl or yaml and additionally gzipped """ counts = { "nanopubs": 0, "assertions": {...
@nanopub.command(name="stats", context_settings=CONTEXT_SETTINGS) @click.argument("input_fn") @pass_context def nanopub_stats(ctx, input_fn):
"""Collect statistics on nanopub file input_fn can be json, jsonl or yaml and additionally gzipped """ counts = { "nanopubs": 0, "assertions": {"total": 0, "subject_only": 0, "nested": 0, "relations": {}}, } for np in bnf.read_nanopubs(input_fn): if "nanopub" in np: ...
h.write("{}\n".format(json.dumps(np))) if yaml_flag: yaml.dump(docs, out_fh) elif json_flag: json.dump(docs, out_fh, indent=4) finally: f.close() out_fh.close() @nanopub.command(name="stats", context_settings=CONTEXT_SETTINGS) @click.argument("input_fn") @p...
93
93
312
35
58
belbio/bel
bel/cli/scripts.py
Python
nanopub_stats
nanopub_stats
184
216
184
187
c31c77005e7dabc0a1b812aabd66c6b973b5de20
bigcode/the-stack
train
28ec0b786e1a9e4fbd70c0c4
train
function
@nanopub.command(name="reformat", context_settings=CONTEXT_SETTINGS) @click.option("--input_fn", "-i") @click.option("--output_fn", "-o") @pass_context def reformat(ctx, input_fn, output_fn): """Reformat between JSON, YAML, JSONLines formats \b input_fn: If input fn has *.gz, will read as a gzip fi...
@nanopub.command(name="reformat", context_settings=CONTEXT_SETTINGS) @click.option("--input_fn", "-i") @click.option("--output_fn", "-o") @pass_context def reformat(ctx, input_fn, output_fn):
"""Reformat between JSON, YAML, JSONLines formats \b input_fn: If input fn has *.gz, will read as a gzip file \b output_fn: If output fn has *.gz, will written as a gzip file If output fn has *.jsonl*, will written as a JSONLines file IF output fn has *.json*, will ...
\n".format(json.dumps(doc))) if yaml_flag: yaml.dump(docs, out_fh) elif json_flag: json.dump(docs, out_fh, indent=4) finally: f.close() out_fh.close() @nanopub.command(name="reformat", context_settings=CONTEXT_SETTINGS) @click.option("--input_fn", "-i") @cl...
104
105
350
50
54
belbio/bel
bel/cli/scripts.py
Python
reformat
reformat
131
181
131
135
790611116f7f28c6f8e2242ddbb3d2f92af35561
bigcode/the-stack
train
3650ce50411c8b970968473d
train
function
@click.group(context_settings=CONTEXT_SETTINGS) def belc(): """BEL commands Uses first file found to load in default configuration: ./belbio_conf.yaml ./.belbio_conf ~/.belbio_conf """ pass
@click.group(context_settings=CONTEXT_SETTINGS) def belc():
"""BEL commands Uses first file found to load in default configuration: ./belbio_conf.yaml ./.belbio_conf ~/.belbio_conf """ pass
# CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"]) # class Context(object): # def __init__(self): # self.config = config # pass_context = click.make_pass_decorator(Context, ensure=True) @click.group(context_settings=CONTEXT_SETTINGS) def belc():
64
64
54
13
51
belbio/bel
bel/cli/scripts.py
Python
belc
belc
39
49
39
40
f8fb796f026a36d903b336725878c54215d1e4f5
bigcode/the-stack
train
2ae6a2441bf27327967ba8b4
train
function
@db.command() @click.argument("db_name", default="belns") @click.option("--delete/--no-delete", default=False, help="Remove indexes and re-create them") def arangodb(delete, db_name): """Setup ArangoDB database db_name: defaults to belns This will create the database, collections and indexes on the collec...
@db.command() @click.argument("db_name", default="belns") @click.option("--delete/--no-delete", default=False, help="Remove indexes and re-create them") def arangodb(delete, db_name):
"""Setup ArangoDB database db_name: defaults to belns This will create the database, collections and indexes on the collection if it doesn't exist. The --delete option will force removal of the database if it exists.""" if delete: arango_client = bel.db.arangodb.get_client() if n...
bel.db.elasticsearch.get_client(delete=True) else: bel.db.elasticsearch.get_client() @db.command() @click.argument("db_name", default="belns") @click.option("--delete/--no-delete", default=False, help="Remove indexes and re-create them") def arangodb(delete, db_name):
64
64
173
45
19
belbio/bel
bel/cli/scripts.py
Python
arangodb
arangodb
364
384
364
367
33fac3a02ccce207d8ef27ab4ce09617223d84a6
bigcode/the-stack
train
9d1ec65ef408962e91c7a43d
train
function
@belc.group() def stmt(): """BEL Statement specific commands""" pass
@belc.group() def stmt():
"""BEL Statement specific commands""" pass
else: counts["assertions"]["relations"][assertion.get("relation")] += 1 counts["assertions"]["relations"] = sorted(counts["assertions"]["relations"]) print("DumpVar:\n", json.dumps(counts, indent=4)) @belc.group() def stmt():
64
64
18
8
56
belbio/bel
bel/cli/scripts.py
Python
stmt
stmt
219
223
219
220
17a69d74cbecd4338b5ff653b547309eb55ae600
bigcode/the-stack
train
076f432025a9931869ed6c61
train
function
@belc.group() def db(): """Database specific commands""" pass
@belc.group() def db():
"""Database specific commands""" pass
print(bo.validation_messages) else: print("ORIGINAL ", bo.original_bel_stmt) print("ORTHOLOGIZED ", bo.ast) if bo.validation_messages: print(bo.validation_messages) else: print("No problems found") @belc.group() def db():
64
64
17
8
56
belbio/bel
bel/cli/scripts.py
Python
db
db
336
339
336
337
6b004de6be3d8a9d6d8d6fed378b435f5d6bc33d
bigcode/the-stack
train
930521b489023582dfb893dc
train
function
@nanopub.command(name="belscript", context_settings=CONTEXT_SETTINGS) @click.option("--input_fn", "-i", default="-") @click.option("--output_fn", "-o", default="-") @pass_context def convert_belscript(ctx, input_fn, output_fn): """Convert belscript to nanopubs_bel format This will convert the OpenBEL BELScript...
@nanopub.command(name="belscript", context_settings=CONTEXT_SETTINGS) @click.option("--input_fn", "-i", default="-") @click.option("--output_fn", "-o", default="-") @pass_context def convert_belscript(ctx, input_fn, output_fn):
"""Convert belscript to nanopubs_bel format This will convert the OpenBEL BELScript file format to nanopub_bel-1.0.0 format. \b input_fn: If input fn has *.gz, will read as a gzip file \b output_fn: If output fn has *.gz, will written as a gzip file If output fn ha...
( "--output_fn", type=click.File("wt"), default="-", help="Validate nanopub", ) @click.argument("input_fn") @pass_context def nanopub_validate(ctx, input_fn, output_fn): """Validate nanopubs""" print("TODO") @nanopub.command(name="belscript", context_settings=CONTEXT_SETTINGS) @click.option("--...
117
117
393
58
59
belbio/bel
bel/cli/scripts.py
Python
convert_belscript
convert_belscript
74
128
74
78
80ffcee68085b8babcd02325daf4330314d93822
bigcode/the-stack
train
e7c25a046b64659e4325f59d
train
function
@nanopub.command(name="validate", context_settings=CONTEXT_SETTINGS) @click.option( "--output_fn", type=click.File("wt"), default="-", help="Validate nanopub", ) @click.argument("input_fn") @pass_context def nanopub_validate(ctx, input_fn, output_fn): """Validate nanopubs""" print("TODO")
@nanopub.command(name="validate", context_settings=CONTEXT_SETTINGS) @click.option( "--output_fn", type=click.File("wt"), default="-", help="Validate nanopub", ) @click.argument("input_fn") @pass_context def nanopub_validate(ctx, input_fn, output_fn):
"""Validate nanopubs""" print("TODO")
@nanopub.command(name="validate", context_settings=CONTEXT_SETTINGS) @click.option( "--output_fn", type=click.File("wt"), default="-", help="Validate nanopub", ) @click.argument("input_fn") @pass_context def nanopub_validate(ctx, input_fn, output_fn):
66
64
77
66
0
belbio/bel
bel/cli/scripts.py
Python
nanopub_validate
nanopub_validate
59
71
59
68
d92005c3052187a97e640a3ca6a5ed0f35c21435
bigcode/the-stack
train
65b3b0982f47d69cc03bd83d
train
class
class ConsoleExceptionMiddleware: def process_exception(self, request, exception): exc_info = sys.exc_info() print("######################## Exception #############################") print(('\n'.join(traceback.format_exception(*(exc_info or sys.exc_info()))))) print("----------------...
class ConsoleExceptionMiddleware:
def process_exception(self, request, exception): exc_info = sys.exc_info() print("######################## Exception #############################") print(('\n'.join(traceback.format_exception(*(exc_info or sys.exc_info()))))) print("--------------------------------------------------...
import traceback import sys import inspect from pprint import pprint class ConsoleExceptionMiddleware:
19
64
132
5
13
Paul3MK/NewsBlur
utils/exception_middleware.py
Python
ConsoleExceptionMiddleware
ConsoleExceptionMiddleware
6
25
6
6
d02e06c732a3587b1e9529751264249050265a31
bigcode/the-stack
train
7c6612d1200995b56df21454
train
function
async def add_twf(conn, row, dataset_id=None, log=None): if dataset_id is None: sql = ''' insert into cdm_twf (enc_id, tsp, %(fid)s, %(fid)s_c) values (%(enc_id)s, '%(tsp)s', %(value)s, %(conf)s) on conflict (enc_id, tsp) do update set %(fid)s = cdm_twf.%(fid)s + Excluded.%(fid)s, cdm_twf.%(fid)s_...
async def add_twf(conn, row, dataset_id=None, log=None):
if dataset_id is None: sql = ''' insert into cdm_twf (enc_id, tsp, %(fid)s, %(fid)s_c) values (%(enc_id)s, '%(tsp)s', %(value)s, %(conf)s) on conflict (enc_id, tsp) do update set %(fid)s = cdm_twf.%(fid)s + Excluded.%(fid)s, cdm_twf.%(fid)s_c = %(fid)s_c | Excluded.%(fid)s_c ''' % { 'enc...
update set %(fid)s = Excluded.%(fid)s, %(fid)s_c = Excluded.%(fid)s_c ''' % { 'dataset_id': dataset_id, 'enc_id': row[0], 'tsp': row[1], 'fid': row[2], 'value': row[3], 'conf': row[4] } await execute_load(conn, sql, log) async def add_twf(conn, row, dataset_id=None, log=None):
105
105
352
16
89
cloud-cds/cds-stack
etl/load/primitives/row/load_row.py
Python
add_twf
add_twf
196
215
196
196
50aa23a39d6c4ea54bfd74bf0c5b6ecabd6c1624
bigcode/the-stack
train
4ff37ad29105074dfcd5c291
train
function
async def upsert_s(conn, row, dataset_id=None, log=None, many=False): def format_value(dataset_id_val, row): return "({dataset_id_val} {enc_id}, '{fid}', '{value}', {confidence})".format( dataset_id_val=dataset_id_val, enc_id=row[0], fid=row[1], value=str(row[2]).replace("'","''"),...
async def upsert_s(conn, row, dataset_id=None, log=None, many=False):
def format_value(dataset_id_val, row): return "({dataset_id_val} {enc_id}, '{fid}', '{value}', {confidence})".format( dataset_id_val=dataset_id_val, enc_id=row[0], fid=row[1], value=str(row[2]).replace("'","''"), confidence=row[3] ) sql = ''' INSERT into cdm_s ...
_key, cdm_t=cdm_t_target) log.info("loading chuck {}".format(i)) await execute_load(conn, sqls, log) log.info("loaded chuck {}".format(i)) else: values = format_value(dataset_id_val, row) sql = sql.format(values=values, dataset_id_key=dataset_id_key, cdm_t=cdm_t_target) await execute_loa...
111
111
371
19
92
cloud-cds/cds-stack
etl/load/primitives/row/load_row.py
Python
upsert_s
upsert_s
103
137
103
103
c610bcfb87a2eac47cfc6430bb2815dc515fb326
bigcode/the-stack
train
7274e21c2be1455ef20a7c4c
train
function
async def execute_load(conn, sql, log, timeout=10, backoff=2, base=2, max_timeout=10*60, max_backoff=3*60): attempts = 0 if timeout: init_timeout = timeout while True: try: attempts += 1 async with conn.transaction(): status = await conn.execute(sql, timeout=timeout) return sta...
async def execute_load(conn, sql, log, timeout=10, backoff=2, base=2, max_timeout=10*60, max_backoff=3*60):
attempts = 0 if timeout: init_timeout = timeout while True: try: attempts += 1 async with conn.transaction(): status = await conn.execute(sql, timeout=timeout) return status except Exception as e: random_secs = random.uniform(0, 1) if timeout: timeout = ...
'value': row[3], 'conf': row[4] } await execute_load(conn, sql, log) async def execute_load(conn, sql, log, timeout=10, backoff=2, base=2, max_timeout=10*60, max_backoff=3*60):
64
64
201
38
26
cloud-cds/cds-stack
etl/load/primitives/row/load_row.py
Python
execute_load
execute_load
217
236
217
217
bbb8e87a2c1f9297f76876a6269958a37a876832
bigcode/the-stack
train
1d771e40ee9476d0f1c7a600
train
function
async def upsert_twf(conn, row, dataset_id=None, log=None): if dataset_id is None: sql = ''' insert into cdm_twf (enc_id, tsp, %(fid)s, %(fid)s_c) values (%(enc_id)s, '%(tsp)s', %(value)s, %(conf)s) on conflict (enc_id, tsp) do update set %(fid)s = Excluded.%(fid)s, %(fid)s_c = Excluded.%(fid)s_c ...
async def upsert_twf(conn, row, dataset_id=None, log=None):
if dataset_id is None: sql = ''' insert into cdm_twf (enc_id, tsp, %(fid)s, %(fid)s_c) values (%(enc_id)s, '%(tsp)s', %(value)s, %(conf)s) on conflict (enc_id, tsp) do update set %(fid)s = Excluded.%(fid)s, %(fid)s_c = Excluded.%(fid)s_c ''' % { 'enc_id': row[0], 'tsp': row[1], 'fid': ro...
=dataset_id_key) log.info("loading chuck {}".format(i)) await execute_load(conn, sqls, log) log.info("loaded chuck {}".format(i)) else: values = format_value(dataset_id_val, row) sql = sql.format(values=values, dataset_id_key=dataset_id_key) await execute_load(conn, sql, log) async def u...
94
94
315
17
77
cloud-cds/cds-stack
etl/load/primitives/row/load_row.py
Python
upsert_twf
upsert_twf
175
194
175
175
4a3e3f42c22a4dd5916d47cb77714813a89c09a0
bigcode/the-stack
train
c76cc6c379b3480ad11ff0e1
train
function
async def add_s(conn, row, dataset_id=None, log=None, many=False): def format_value(dataset_id_val, row): return "({dataset_id_val} {enc_id}, '{fid}', '{value}', {confidence})".format( dataset_id_val=dataset_id_val, enc_id=row[0], fid=row[1], value=str(row[2]).replace("'","''"), ...
async def add_s(conn, row, dataset_id=None, log=None, many=False):
def format_value(dataset_id_val, row): return "({dataset_id_val} {enc_id}, '{fid}', '{value}', {confidence})".format( dataset_id_val=dataset_id_val, enc_id=row[0], fid=row[1], value=str(row[2]).replace("'","''"), confidence=row[3] ) sql = ''' INSERT into cdm_s ...
_value(dataset_id_val, row) sqls += sql.format(values=values, dataset_id_key=dataset_id_key) log.info("loading chuck {}".format(i)) await execute_load(conn, sqls, log) log.info("loaded chuck {}".format(i)) else: values = format_value(dataset_id_val, row) sql = sql.format(values=value...
115
115
385
18
97
cloud-cds/cds-stack
etl/load/primitives/row/load_row.py
Python
add_s
add_s
139
173
139
139
828ead91fb178ecc2918ba7aaf32727333522e05
bigcode/the-stack
train
af55b8e3e1419644f08f5c49
train
function
async def upsert_g(conn, row, dataset_id = None, many=False): sql = ''' INSERT into cdm_g (fid, value, confidence) values {values} on conflict ({dataset_id_key} fid) do update set value = Excluded.value::numeric, confidence = Excluded.confidence; ''' def format_value(dataset_id_val, row): re...
async def upsert_g(conn, row, dataset_id = None, many=False):
sql = ''' INSERT into cdm_g (fid, value, confidence) values {values} on conflict ({dataset_id_key} fid) do update set value = Excluded.value::numeric, confidence = Excluded.confidence; ''' def format_value(dataset_id_val, row): return "({dataset_id_val} {fid}, {value}, {confidence})".format(...
# sql query to load a row into CDM import datetime import traceback import random import asyncio CHUCK_SIZE=5000 async def upsert_g(conn, row, dataset_id = None, many=False):
47
103
344
17
29
cloud-cds/cds-stack
etl/load/primitives/row/load_row.py
Python
upsert_g
upsert_g
8
40
8
8
67b15ceaae560cf58d86e695a02e6a0202d89481
bigcode/the-stack
train
b1036fd4452a83dfcac7ba00
train
function
async def add_t(conn, row, dataset_id=None, log=None, many=False): def format_value(dataset_id_val, row): return "{dataset_id_val} {enc_id}, '{tsp}', '{fid}', '{value}', {confidence}".format( dataset_id_val=dataset_id_val, enc_id=row[0], tsp=row[1], fid=row[2], value=row[3]...
async def add_t(conn, row, dataset_id=None, log=None, many=False):
def format_value(dataset_id_val, row): return "{dataset_id_val} {enc_id}, '{tsp}', '{fid}', '{value}', {confidence}".format( dataset_id_val=dataset_id_val, enc_id=row[0], tsp=row[1], fid=row[2], value=row[3], confidence=row[4] ) dataset_id_key = 'dataset_id,...
await execute_load(conn, sqls, log) log.info("loaded chuck {}".format(i)) else: values = format_value(dataset_id_val, row) sql = sql.format(values=values, dataset_id_key=dataset_id_key) await execute_load(conn, sql, log) async def add_t(conn, row, dataset_id=None, log=None, many=False):
79
79
264
18
61
cloud-cds/cds-stack
etl/load/primitives/row/load_row.py
Python
add_t
add_t
42
63
42
42
644ae97ac417b3c2a38e0a10f41bbf327053968f
bigcode/the-stack
train
d4fa2f7b94a3efb04d123204
train
function
async def upsert_t(conn, row, dataset_id=None, log=None, many=False, cdm_t_target='cdm_t'): def format_value(dataset_id_val, row): return "({dataset_id_val} {enc_id}, '{tsp}', '{fid}', '{value}', {confidence})".format( dataset_id_val=dataset_id_val, enc_id=row[0], tsp=row[1], fid=r...
async def upsert_t(conn, row, dataset_id=None, log=None, many=False, cdm_t_target='cdm_t'):
def format_value(dataset_id_val, row): return "({dataset_id_val} {enc_id}, '{tsp}', '{fid}', '{value}', {confidence})".format( dataset_id_val=dataset_id_val, enc_id=row[0], tsp=row[1], fid=row[2], value=str(row[3]).replace("'","''"), confidence=row[4] ) sql...
(rows): sql = "\n".join(["SELECT add_cdm_t({});".format(format_value(dataset_id_val, item)) for item in row]) log.info("loading chuck {}".format(i)) await execute_load(conn, sql, log) log.info("loaded chuck {}".format(i)) else: sql = "SELECT add_cdm_t({});".format(format_value(dataset_id_k...
124
124
414
28
96
cloud-cds/cds-stack
etl/load/primitives/row/load_row.py
Python
upsert_t
upsert_t
66
101
66
66
4d375a959cd18a20d80de0652ac36d2585fb1ffa
bigcode/the-stack
train
cfc173dda84ea884d7ac30b4
train
function
def create_source(account_id, body, token_info): _validate_account_access(token_info, account_id) with Transaction() as t: source_repo = SourceRepo(t) source_id = str(uuid.uuid4()) name = body["source_name"] source_type = body['source_type'] if source_type == Source.SOU...
def create_source(account_id, body, token_info):
_validate_account_access(token_info, account_id) with Transaction() as t: source_repo = SourceRepo(t) source_id = str(uuid.uuid4()) name = body["source_name"] source_type = body['source_type'] if source_type == Source.SOURCE_TYPE_HUMAN: # TODO: Unfortunately...
_api.repo.transaction import Transaction def read_sources(account_id, token_info, source_type=None): _validate_account_access(token_info, account_id) with Transaction() as t: source_repo = SourceRepo(t) sources = source_repo.get_sources_in_account(account_id, source_type) api_sources ...
109
109
364
11
97
charles-cowart/microsetta-private-api
microsetta_private_api/api/_source.py
Python
create_source
create_source
27
68
27
27
a3006805b53e8ff4ad866f4079beb6bf2b7b7643
bigcode/the-stack
train
06dda26a25b8745a50da6eb1
train
function
def delete_source(account_id, source_id, token_info): _validate_account_access(token_info, account_id) with Transaction() as t: source_repo = SourceRepo(t) survey_answers_repo = SurveyAnswersRepo(t) answers = survey_answers_repo.list_answered_surveys(account_id, ...
def delete_source(account_id, source_id, token_info):
_validate_account_access(token_info, account_id) with Transaction() as t: source_repo = SourceRepo(t) survey_answers_repo = SurveyAnswersRepo(t) answers = survey_answers_repo.list_answered_surveys(account_id, source_id) ...
/update_time # during the insert/update... source = source_repo.get_source(account_id, source_id) t.commit() # TODO: 422? Not sure this can actually happen anymore ... return jsonify(source.to_api()), 200 def delete_source(account_id, source_id, token_info):
64
64
136
12
51
charles-cowart/microsetta-private-api
microsetta_private_api/api/_source.py
Python
delete_source
delete_source
107
124
107
107
af061454066ad4d050009b7cfb985f17027785de
bigcode/the-stack
train
b16207a47000fe3f2df09f20
train
function
def update_source(account_id, source_id, body, token_info): _validate_account_access(token_info, account_id) with Transaction() as t: source_repo = SourceRepo(t) source = source_repo.get_source(account_id, source_id) if source is None: return jsonify(code=404, message=SRC_NO...
def update_source(account_id, source_id, body, token_info):
_validate_account_access(token_info, account_id) with Transaction() as t: source_repo = SourceRepo(t) source = source_repo.get_source(account_id, source_id) if source is None: return jsonify(code=404, message=SRC_NOT_FOUND_MSG), 404 source.name = body["source_name"]...
SourceRepo(t) source = source_repo.get_source(account_id, source_id) if source is None: return jsonify(code=404, message=SRC_NOT_FOUND_MSG), 404 return jsonify(source.to_api()), 200 def update_source(account_id, source_id, body, token_info):
64
64
205
14
49
charles-cowart/microsetta-private-api
microsetta_private_api/api/_source.py
Python
update_source
update_source
82
104
82
82
c2423cd70b17d6a18dc7530755dc248e0e063667
bigcode/the-stack
train
888b21e086a756a0b04e77e0
train
function
def read_source(account_id, source_id, token_info): _validate_account_access(token_info, account_id) with Transaction() as t: source_repo = SourceRepo(t) source = source_repo.get_source(account_id, source_id) if source is None: return jsonify(code=404, message=SRC_NOT_FOUND_...
def read_source(account_id, source_id, token_info):
_validate_account_access(token_info, account_id) with Transaction() as t: source_repo = SourceRepo(t) source = source_repo.get_source(account_id, source_id) if source is None: return jsonify(code=404, message=SRC_NOT_FOUND_MSG), 404 return jsonify(source.to_api()), 2...
) t.commit() response = jsonify(s.to_api()) response.status_code = 201 response.headers['Location'] = '/api/accounts/%s/sources/%s' % \ (account_id, source_id) return response def read_source(account_id, source_id, token_info):
64
64
84
12
51
charles-cowart/microsetta-private-api
microsetta_private_api/api/_source.py
Python
read_source
read_source
71
79
71
71
a83dff9a09bcf23f9747f942d6c8535ec9acfbcf
bigcode/the-stack
train
1bc7d37206c8a740bdd5a942
train
function
def create_human_source_from_consent(account_id, body, token_info): _validate_account_access(token_info, account_id) # Must convert consent form body into object processable by create_source. # Not adding any error handling here because if 'participant_name' isn't # here, we SHOULD be getting an error...
def create_human_source_from_consent(account_id, body, token_info):
_validate_account_access(token_info, account_id) # Must convert consent form body into object processable by create_source. # Not adding any error handling here because if 'participant_name' isn't # here, we SHOULD be getting an error. source = { 'source_type': Source.SOURCE_TYPE_HUMAN, ...
_id in answers: survey_answers_repo.delete_answered_survey(account_id, survey_id) if not source_repo.delete_source(account_id, source_id): return jsonify(code=404, message=SRC_NOT_FOUND_MSG), 404 # TODO: 422? t.commi...
83
83
277
16
66
charles-cowart/microsetta-private-api
microsetta_private_api/api/_source.py
Python
create_human_source_from_consent
create_human_source_from_consent
127
157
127
127
f895f33de05e278e2062903483e6ff0a7ae3b160
bigcode/the-stack
train
71194a7f9677a484d25ec893
train
function
def read_sources(account_id, token_info, source_type=None): _validate_account_access(token_info, account_id) with Transaction() as t: source_repo = SourceRepo(t) sources = source_repo.get_sources_in_account(account_id, source_type) api_sources = [x.to_api() for x in sources] # T...
def read_sources(account_id, token_info, source_type=None):
_validate_account_access(token_info, account_id) with Transaction() as t: source_repo = SourceRepo(t) sources = source_repo.get_sources_in_account(account_id, source_type) api_sources = [x.to_api() for x in sources] # TODO: Also support 404? Or is that not necessary? ret...
.source import Source, HumanInfo, NonHumanInfo from microsetta_private_api.repo.source_repo import SourceRepo from microsetta_private_api.repo.survey_answers_repo import SurveyAnswersRepo from microsetta_private_api.repo.transaction import Transaction def read_sources(account_id, token_info, source_type=None):
64
64
92
13
50
charles-cowart/microsetta-private-api
microsetta_private_api/api/_source.py
Python
read_sources
read_sources
16
24
16
16
9822a0c8062972882e25bd38710a96c8fe5be93c
bigcode/the-stack
train
7ca913a2627c1e6735dae322
train
function
def test_from_line_valid_negative_frame(): Mark.from_line(" -1 0:00.03 video start")
def test_from_line_valid_negative_frame():
Mark.from_line(" -1 0:00.03 video start")
): Mark.from_line(" 1 0.00.03 video start") def test_from_line_invalid_time_one_middle_digit(): with pytest.raises(TypeError): Mark.from_line(" 1 0:0.03 video start") def test_from_line_valid_negative_frame():
64
64
27
8
56
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_valid_negative_frame
test_from_line_valid_negative_frame
59
60
59
59
65a4cea62e35d8fcc6d8a2f26fab3672ed038c77
bigcode/the-stack
train
f79fa54dca462830285d41c7
train
function
def test_from_line_invalid_frame_nonnumeric(): with pytest.raises(TypeError): Mark.from_line(" a1 0:00.03 video start")
def test_from_line_invalid_frame_nonnumeric():
with pytest.raises(TypeError): Mark.from_line(" a1 0:00.03 video start")
def test_from_line_valid_negative_frame(): Mark.from_line(" -1 0:00.03 video start") def test_from_line_valid_time_negative(): Mark.from_line(" 1 -0:00.03 video start") def test_from_line_invalid_frame_nonnumeric():
64
64
36
10
54
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_invalid_frame_nonnumeric
test_from_line_invalid_frame_nonnumeric
67
69
67
67
aa49945a0e470826742c9c9c3a8c6e07ceab106b
bigcode/the-stack
train
40535beca225638fd2a97e1a
train
function
def test_lt_equal(): first = Mark.from_line(" 1 0:00.03 A video starts") second = Mark.from_line(" 1 0:00.03 A video starts") assert first >= second
def test_lt_equal():
first = Mark.from_line(" 1 0:00.03 A video starts") second = Mark.from_line(" 1 0:00.03 A video starts") assert first >= second
def test_lt_name_lexicographic(): first = Mark.from_line(" 1 0:00.03 A video starts") second = Mark.from_line(" 1 0:00.03 video starts") assert first < second def test_lt_equal():
64
64
55
5
58
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_lt_equal
test_lt_equal
253
257
253
253
46d5392d22bfe7109c2b746d4ee868da57dcace3
bigcode/the-stack
train
c1c446d08d5e4ea09298cf04
train
function
def test_from_line_invalid_one_space_after_frame(): with pytest.raises(TypeError): Mark.from_line(" 1 0:00.03 video start")
def test_from_line_invalid_one_space_after_frame():
with pytest.raises(TypeError): Mark.from_line(" 1 0:00.03 video start")
Mark.from_line(" 1 0:00.03 video start") def test_from_line_invalid_one_space_after_time(): with pytest.raises(TypeError): Mark.from_line(" 1 0:00.03 video start") def test_from_line_invalid_one_space_after_frame():
64
64
35
10
54
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_invalid_one_space_after_frame
test_from_line_invalid_one_space_after_frame
39
41
39
39
72696ba945bd7dd735eaa051fa346ba72f40ff46
bigcode/the-stack
train
980fd2bc2b35b465d45c6e63
train
function
def test_from_line_valid_time_negative(): Mark.from_line(" 1 -0:00.03 video start")
def test_from_line_valid_time_negative():
Mark.from_line(" 1 -0:00.03 video start")
_middle_digit(): with pytest.raises(TypeError): Mark.from_line(" 1 0:0.03 video start") def test_from_line_valid_negative_frame(): Mark.from_line(" -1 0:00.03 video start") def test_from_line_valid_time_negative():
64
64
27
8
56
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_valid_time_negative
test_from_line_valid_time_negative
63
64
63
63
02f1a03d3d6604edcd13dc23a9236bbe0fc98592
bigcode/the-stack
train
beb75fe0682bbc2c07abd90c
train
function
def test_to_line_invalid_time_over_1_day(): with pytest.raises(ValueError): mark = Mark(17, timedelta(days=1.05), "weird mark") mark.to_line(" 54001 30:00.03 video end")
def test_to_line_invalid_time_over_1_day():
with pytest.raises(ValueError): mark = Mark(17, timedelta(days=1.05), "weird mark") mark.to_line(" 54001 30:00.03 video end")
") def test_to_line_invalid_template_1_space_after_time(): with pytest.raises(ValueError): mark = Mark(1, timedelta(seconds=1), "mark") mark.to_line(" 1 0:00.03 video start") def test_to_line_invalid_time_over_1_day():
64
64
56
11
53
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_invalid_time_over_1_day
test_to_line_invalid_time_over_1_day
179
182
179
179
d785c9622c830ac4a839148adc39d5dc52e50457
bigcode/the-stack
train
fdcd8bcb8c3328e3338fb480
train
function
def test_from_line_valid_end(): mark = Mark.from_line("54001 30:00.03 video end") assert mark.frame == 54001 assert mark.time == timedelta(seconds=1800.03) assert mark.name == "video end"
def test_from_line_valid_end():
mark = Mark.from_line("54001 30:00.03 video end") assert mark.frame == 54001 assert mark.time == timedelta(seconds=1800.03) assert mark.name == "video end"
def test_from_line_valid_start(): mark = Mark.from_line(" 1 0:00.03 video start") assert mark.frame == 1 assert mark.time == timedelta(seconds=0.03) assert mark.name == "video start" def test_from_line_valid_end():
64
64
58
7
57
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_valid_end
test_from_line_valid_end
22
26
22
22
f7a47bf3bb1c1dad1eb4b6c85c65d79a11157e98
bigcode/the-stack
train
b024a4f93efbabd10b2021ed
train
function
def test_from_line_invalid_time_no_period(): with pytest.raises(TypeError): Mark.from_line(" 1 0:00:03 video start")
def test_from_line_invalid_time_no_period():
with pytest.raises(TypeError): Mark.from_line(" 1 0:00:03 video start")
Error): Mark.from_line(" 1 0:00.03 video start") def test_from_line_invalid_one_space_after_frame(): with pytest.raises(TypeError): Mark.from_line(" 1 0:00.03 video start") def test_from_line_invalid_time_no_period():
64
64
35
9
55
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_invalid_time_no_period
test_from_line_invalid_time_no_period
44
46
44
44
a6c7646446d8c2c22097c85d64ca0234199f74a7
bigcode/the-stack
train
3c1b0a350bb8ded130c85822
train
function
def test_from_line_valid_start(): mark = Mark.from_line(" 1 0:00.03 video start") assert mark.frame == 1 assert mark.time == timedelta(seconds=0.03) assert mark.name == "video start"
def test_from_line_valid_start():
mark = Mark.from_line(" 1 0:00.03 video start") assert mark.frame == 1 assert mark.time == timedelta(seconds=0.03) assert mark.name == "video start"
video # Use of this file is governed by the license in LICENSE.txt. """Unit tests for the :py:class:Mark class """ from datetime import timedelta import pytest from scorevideo_lib.parse_log import Mark # pragma pylint: disable=missing-docstring def test_from_line_valid_start():
64
64
57
7
56
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_valid_start
test_from_line_valid_start
15
19
15
15
5015d4274485008c70feaa0c0bccfc8d039245c0
bigcode/the-stack
train
97fb81de7c781bf6c951a99f
train
function
def test_to_line_valid_hours(): temp = " 54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=3650.05), "weird mark") assert mark.to_line(temp) == " 17 1:00:50.05 weird mark"
def test_to_line_valid_hours():
temp = " 54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=3650.05), "weird mark") assert mark.to_line(temp) == " 17 1:00:50.05 weird mark"
_start_is_template(): start = " 1 0:00.03 video start" end = "54001 30:00.03 video end" mark = Mark.from_line(end) assert mark.to_line(start) == end def test_to_line_valid_hours():
64
64
70
7
56
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_valid_hours
test_to_line_valid_hours
125
128
125
125
aea3ca174bfff74d277adc5202d81558b3dd1a5c
bigcode/the-stack
train
c143133162f7f6507524d1bf
train
function
def test_lt_frame_negative(): first = Mark.from_line(" -2 0:00.03 video start") second = Mark.from_line(" -1 0:00.03 video start") assert first < second
def test_lt_frame_negative():
first = Mark.from_line(" -2 0:00.03 video start") second = Mark.from_line(" -1 0:00.03 video start") assert first < second
weird mark" def test_lt_frame_positive(): first = Mark.from_line(" 1 0:00.03 video start") second = Mark.from_line(" 2 0:00.03 video start") assert first < second def test_lt_frame_negative():
64
64
54
6
57
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_lt_frame_negative
test_lt_frame_negative
204
208
204
204
6742a81f6a50120ba7214c908277e1521a904515
bigcode/the-stack
train
b8cc995f4e746c977c53a75f
train
function
def test_to_line_valid_remove_leading_zero_minutes(): temp = " 54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=61.05), "weird mark") assert mark.to_line(temp) == " 17 1:01.05 weird mark"
def test_to_line_valid_remove_leading_zero_minutes():
temp = " 54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=61.05), "weird mark") assert mark.to_line(temp) == " 17 1:01.05 weird mark"
_line_invalid_time_over_1_day(): with pytest.raises(ValueError): mark = Mark(17, timedelta(days=1.05), "weird mark") mark.to_line(" 54001 30:00.03 video end") def test_to_line_valid_remove_leading_zero_minutes():
64
64
71
11
53
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_valid_remove_leading_zero_minutes
test_to_line_valid_remove_leading_zero_minutes
185
188
185
185
251ed980b2cdf9ed042998daa43fcebe5cd23da0
bigcode/the-stack
train