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
93c0d3ccf4ef9612a8aa48a3
train
function
def generate_code(): short = shortuuid.ShortUUID() return short.uuid()
def generate_code():
short = shortuuid.ShortUUID() return short.uuid()
uuid import datetime from django.db import models from django.utils.translation import ugettext_lazy as _ from django.utils import timezone from django.conf import settings from django.core.validators import validate_slug import shortuuid # makemigrations keeps making new migrations with default=shortuuid.uuid def...
64
64
17
4
59
brettstil/django-bridgekeeper
bridgekeeper/models.py
Python
generate_code
generate_code
14
16
14
14
c8db133230dee37bcce1bdc936fbf45f9e15fdcf
bigcode/the-stack
train
acc774b4f452bdd2a6d83282
train
class
class Invite(models.Model): id = models.UUIDField( _('id'), primary_key=True, default=uuid.uuid4, editable=False) created = models.DateTimeField( _('created'), auto_now_add=True, editable=False) updated = models.DateTimeField( _('updated'), auto_now=True, editable=False) code =...
class Invite(models.Model):
id = models.UUIDField( _('id'), primary_key=True, default=uuid.uuid4, editable=False) created = models.DateTimeField( _('created'), auto_now_add=True, editable=False) updated = models.DateTimeField( _('updated'), auto_now=True, editable=False) code = models.CharField( _(...
import uuid import datetime from django.db import models from django.utils.translation import ugettext_lazy as _ from django.utils import timezone from django.conf import settings from django.core.validators import validate_slug import shortuuid # makemigrations keeps making new migrations with default=shortuuid.uu...
83
96
322
5
78
brettstil/django-bridgekeeper
bridgekeeper/models.py
Python
Invite
Invite
19
67
19
20
551ea39718c2736657564ebc4d174b55ceaa0da7
bigcode/the-stack
train
81be3b271ed368d62b47eee1
train
function
def main() -> None: # Get the most recent tag. with open("CHANGELOG.md", "r") as f: match = RE_BODY.match(f.read()) assert match body = match.groups()[0].strip() # Add Markdown formatting to sections. body = RE_SECTION.sub(r"### \1", body) print(body)
def main() -> None: # Get the most recent tag.
with open("CHANGELOG.md", "r") as f: match = RE_BODY.match(f.read()) assert match body = match.groups()[0].strip() # Add Markdown formatting to sections. body = RE_SECTION.sub(r"### \1", body) print(body)
\d+\n" RE_BODY = re.compile(fr".*?{TAG_BANNER}(.*?){TAG_BANNER}", re.DOTALL) RE_SECTION = re.compile(r"^### (\w+)$", re.MULTILINE) def main() -> None: # Get the most recent tag.
63
64
77
14
49
csb6/libtcod-ada
third_party/libtcod/scripts/get_release_description.py
Python
main
main
11
20
11
12
985079c4a0ee25bc9ff2c76da32436880089a8d7
bigcode/the-stack
train
20ffd0703342564f918e56d9
train
class
class ResourceWithPropsAndAttrs(ResourceWithProps): attributes_schema = {'Bar': attributes.Schema('Something.')}
class ResourceWithPropsAndAttrs(ResourceWithProps):
attributes_schema = {'Bar': attributes.Schema('Something.')}
: return self.properties["a_%s" % name] except KeyError: return None class ResourceWithProps(GenericResource): properties_schema = {'Foo': {'Type': 'String'}, 'FooInt': {'Type': 'Integer'}} class ResourceWithPropsAndAttrs(ResourceWithProps):
63
64
23
10
53
redhat-openstack/heat
heat/tests/generic_resource.py
Python
ResourceWithPropsAndAttrs
ResourceWithPropsAndAttrs
83
84
83
83
e27ddf967df00883e2aeaae8cda97b934351cb2b
bigcode/the-stack
train
1843e16bf948650268a3184c
train
class
class ResourceWithRequiredProps(GenericResource): properties_schema = {'Foo': {'Type': 'String', 'Required': True}}
class ResourceWithRequiredProps(GenericResource):
properties_schema = {'Foo': {'Type': 'String', 'Required': True}}
(self, name): if name == 'list': return self.list if name == 'flat_dict': return self.flat_dict if name == 'nested_dict': return self.nested_dict if name == 'none': return None class ResourceWithRequiredProps(GenericResource):
64
64
27
8
55
redhat-openstack/heat
heat/tests/generic_resource.py
Python
ResourceWithRequiredProps
ResourceWithRequiredProps
126
128
126
126
2b2cde0365b2d96dbdba16dbeaee14198a182cd9
bigcode/the-stack
train
081d5e2bf34d61d8e9feafc5
train
class
class ResourceWithCustomConstraint(GenericResource): properties_schema = \ {'Foo': properties.Schema( properties.Schema.STRING, constraints=[constraints.CustomConstraint('neutron.network')])}
class ResourceWithCustomConstraint(GenericResource):
properties_schema = \ {'Foo': properties.Schema( properties.Schema.STRING, constraints=[constraints.CustomConstraint('neutron.network')])}
return unicode(self._get_signed_url()) class StackUserResource(stack_user.StackUser): properties_schema = {} attributes_schema = {} def handle_create(self): super(StackUserResource, self).handle_create() self.resource_id_set(self._get_user_id()) class ResourceWithCustomConstra...
64
64
38
8
56
redhat-openstack/heat
heat/tests/generic_resource.py
Python
ResourceWithCustomConstraint
ResourceWithCustomConstraint
161
165
161
161
fc90a16ce742278ec7a550af4504d7580d21bbe0
bigcode/the-stack
train
17187c65ba2092947d891bae
train
class
class GenericResource(resource.Resource): ''' Dummy resource for use in tests ''' properties_schema = {} attributes_schema = {'foo': attributes.Schema('A generic attribute'), 'Foo': attributes.Schema('Another generic attribute')} def handle_create(self): LOG.war...
class GenericResource(resource.Resource):
''' Dummy resource for use in tests ''' properties_schema = {} attributes_schema = {'foo': attributes.Schema('A generic attribute'), 'Foo': attributes.Schema('Another generic attribute')} def handle_create(self): LOG.warn(_LW('Creating generic resource (Type "%s...
from heat.engine import attributes from heat.engine import constraints from heat.engine import properties from heat.engine import resource from heat.engine import signal_responder from heat.engine import stack_user from heat.openstack.common import log as logging LOG = logging.getLogger(__name__) class GenericResourc...
64
64
200
6
58
redhat-openstack/heat
heat/tests/generic_resource.py
Python
GenericResource
GenericResource
27
56
27
27
8dec4ad988f8609faac89a64bc90bce8e37263f5
bigcode/the-stack
train
90765569128378d1234ef25f
train
class
class StackUserResource(stack_user.StackUser): properties_schema = {} attributes_schema = {} def handle_create(self): super(StackUserResource, self).handle_create() self.resource_id_set(self._get_user_id())
class StackUserResource(stack_user.StackUser):
properties_schema = {} attributes_schema = {} def handle_create(self): super(StackUserResource, self).handle_create() self.resource_id_set(self._get_user_id())
"%(type)s") %(details)s'), {'type': self.type(), 'details': details}) def _resolve_attribute(self, name): if name == 'AlarmUrl' and self.resource_id is not None: return unicode(self._get_signed_url()) class StackUserResource(stack_user.StackUser):
64
64
47
9
55
redhat-openstack/heat
heat/tests/generic_resource.py
Python
StackUserResource
StackUserResource
152
158
152
152
b31db33d6fafbeb00f521b3c201f9feb2ee218bd
bigcode/the-stack
train
4b8e564b23a02d5e862269c1
train
class
class SignalResource(signal_responder.SignalResponder): properties_schema = {} attributes_schema = {'AlarmUrl': attributes.Schema('Get a signed webhook')} def handle_create(self): super(SignalResource, self).handle_create() self.resource_id_set(self._get_user_id()) def handle_signal(se...
class SignalResource(signal_responder.SignalResponder):
properties_schema = {} attributes_schema = {'AlarmUrl': attributes.Schema('Get a signed webhook')} def handle_create(self): super(SignalResource, self).handle_create() self.resource_id_set(self._get_user_id()) def handle_signal(self, details=None): if self.action in (self.SUSPE...
if name == 'nested_dict': return self.nested_dict if name == 'none': return None class ResourceWithRequiredProps(GenericResource): properties_schema = {'Foo': {'Type': 'String', 'Required': True}} class SignalResource(signal_responder.Signa...
63
64
168
9
54
redhat-openstack/heat
heat/tests/generic_resource.py
Python
SignalResource
SignalResource
131
149
131
131
ba6fec6dac85f7ef518e645c95fd1bc59a4d2510
bigcode/the-stack
train
5b4d697b283604fde92492d3
train
class
class ResourceWithComplexAttributes(GenericResource): attributes_schema = { 'list': attributes.Schema('A list'), 'flat_dict': attributes.Schema('A flat dictionary'), 'nested_dict': attributes.Schema('A nested dictionary'), 'none': attributes.Schema('A None') } list = ['foo',...
class ResourceWithComplexAttributes(GenericResource):
attributes_schema = { 'list': attributes.Schema('A list'), 'flat_dict': attributes.Schema('A flat dictionary'), 'nested_dict': attributes.Schema('A nested dictionary'), 'none': attributes.Schema('A None') } list = ['foo', 'bar'] flat_dict = {'key1': 'val1', 'key2': 'val2...
_create(self): super(ResourceWithResourceID, self).handle_create() self.resource_id_set(self.properties.get('ID')) def handle_delete(self): self.mox_resource_id(self.resource_id) def mox_resource_id(self, resource_id): pass class ResourceWithComplexAttributes(GenericResource):
64
64
202
8
55
redhat-openstack/heat
heat/tests/generic_resource.py
Python
ResourceWithComplexAttributes
ResourceWithComplexAttributes
101
123
101
101
690fd77e92231e358c381b3bc71d9252c7c17ac8
bigcode/the-stack
train
622a2fc305a17b85fcd388bd
train
class
class ResWithComplexPropsAndAttrs(GenericResource): properties_schema = {'a_string': {'Type': 'String'}, 'a_list': {'Type': 'List'}, 'a_map': {'Type': 'Map'}, 'an_int': {'Type': 'Integer'}} attributes_schema = {'list': attributes.Schem...
class ResWithComplexPropsAndAttrs(GenericResource):
properties_schema = {'a_string': {'Type': 'String'}, 'a_list': {'Type': 'List'}, 'a_map': {'Type': 'Map'}, 'an_int': {'Type': 'Integer'}} attributes_schema = {'list': attributes.Schema('A list'), 'map': attribut...
.name def handle_suspend(self): LOG.warn(_LW('Suspending generic resource (Type "%s")'), self.type()) def handle_resume(self): LOG.warn(_LW('Resuming generic resource (Type "%s")'), self.type()) class ResWithComplexPropsAndAttrs(GenericResource):
64
64
134
10
54
redhat-openstack/heat
heat/tests/generic_resource.py
Python
ResWithComplexPropsAndAttrs
ResWithComplexPropsAndAttrs
59
75
59
60
76055ef3ccb184af4ce5f1d6bff3e29abe2e861c
bigcode/the-stack
train
9335f88553e3c6e5b8da5acf
train
class
class ResourceWithResourceID(GenericResource): properties_schema = {'ID': {'Type': 'String'}} def handle_create(self): super(ResourceWithResourceID, self).handle_create() self.resource_id_set(self.properties.get('ID')) def handle_delete(self): self.mox_resource_id(self.resource_id)...
class ResourceWithResourceID(GenericResource):
properties_schema = {'ID': {'Type': 'String'}} def handle_create(self): super(ResourceWithResourceID, self).handle_create() self.resource_id_set(self.properties.get('ID')) def handle_delete(self): self.mox_resource_id(self.resource_id) def mox_resource_id(self, resource_id): ...
class ResourceWithProps(GenericResource): properties_schema = {'Foo': {'Type': 'String'}, 'FooInt': {'Type': 'Integer'}} class ResourceWithPropsAndAttrs(ResourceWithProps): attributes_schema = {'Bar': attributes.Schema('Something.')} class ResourceWithResourceID(GenericResource):
64
64
81
8
56
redhat-openstack/heat
heat/tests/generic_resource.py
Python
ResourceWithResourceID
ResourceWithResourceID
87
98
87
87
90ecba4449ffbc82512fb49402d99abf5e62a87f
bigcode/the-stack
train
84c1e0f0319e22d7b646624e
train
class
class ResourceWithProps(GenericResource): properties_schema = {'Foo': {'Type': 'String'}, 'FooInt': {'Type': 'Integer'}}
class ResourceWithProps(GenericResource):
properties_schema = {'Foo': {'Type': 'String'}, 'FooInt': {'Type': 'Integer'}}
('A map'), 'string': attributes.Schema('A string')} update_allowed_properties = ('an_int',) def _resolve_attribute(self, name): try: return self.properties["a_%s" % name] except KeyError: return None class ResourceWithProps(GenericResource):
64
64
31
7
56
redhat-openstack/heat
heat/tests/generic_resource.py
Python
ResourceWithProps
ResourceWithProps
78
80
78
78
cedbf713fba760494318e901f9d07e3306ee38c7
bigcode/the-stack
train
386c1b3694b625863b3ca543
train
function
def get_window_edges(all_data, test_query_ts, learn_edges, window=-1): """ Get the edges in the data (for rule application) that occur in the specified time window. If window is 0, all edges before the test query timestamp are included. If window is -1, the edges on which the rules are learned are used....
def get_window_edges(all_data, test_query_ts, learn_edges, window=-1):
""" Get the edges in the data (for rule application) that occur in the specified time window. If window is 0, all edges before the test query timestamp are included. If window is -1, the edges on which the rules are learned are used. If window is an integer n > 0, all edges within n timestamps befor...
]: cond = ( (rule["conf"] >= min_conf) and (rule["body_supp"] >= min_body_supp) and (len(rule["body_rels"]) in rule_lengths) ) if cond: new_rules_dict[k].append(rule) return new_rules_dict def get_window_edges(all_d...
83
83
278
18
64
liu-yushan/TLogic
mycode/rule_application.py
Python
get_window_edges
get_window_edges
39
68
39
39
1d39a04450fd78674fc2022b8ca4cfe6fbd53ab1
bigcode/the-stack
train
53a18dfb9c27a260b2be0448
train
function
def get_candidates( rule, rule_walks, test_query_ts, cands_dict, score_func, args, dicts_idx ): """ Get from the walks that follow the rule the answer candidates. Add the confidence of the rule that leads to these candidates. Parameters: rule (dict): rule from rules_dict rule_walks ...
def get_candidates( rule, rule_walks, test_query_ts, cands_dict, score_func, args, dicts_idx ):
""" Get from the walks that follow the rule the answer candidates. Add the confidence of the rule that leads to these candidates. Parameters: rule (dict): rule from rules_dict rule_walks (pd.DataFrame): rule walks (satisfying all constraints from the rule) test_query_ts (int): t...
in var_constraints: for i in range(len(const) - 1): rule_walks = rule_walks[ rule_walks["entity_" + str(const[i])] == rule_walks["entity_" + str(const[i + 1])] ] return rule_walks def get_candidates( rule, rule_walks, test_query_ts, cands_dict, s...
90
90
301
29
60
liu-yushan/TLogic
mycode/rule_application.py
Python
get_candidates
get_candidates
282
316
282
284
584d88b31ea51b914ca303d25f8e3bcc78f599c3
bigcode/the-stack
train
9145e9cc54db0bab0a827b00
train
function
def match_body_relations_complete(rule, edges, test_query_sub): """ Find edges that could constitute walks (starting from the test query subject) that match the rule. First, find edges whose subject match the query subject and the relation matches the first relation in the rule body. Then, find edge...
def match_body_relations_complete(rule, edges, test_query_sub):
""" Find edges that could constitute walks (starting from the test query subject) that match the rule. First, find edges whose subject match the query subject and the relation matches the first relation in the rule body. Then, find edges whose subjects match the current targets and the relation ...
rel_edges[mask] walk_edges.append( np.hstack((new_edges[:, 0:1], new_edges[:, 2:4])) ) # [sub, obj, ts] cur_targets = np.array(list(set(walk_edges[i][:, 1]))) except KeyError: walk_edges.append([]) break ...
102
102
341
14
87
liu-yushan/TLogic
mycode/rule_application.py
Python
match_body_relations_complete
match_body_relations_complete
119
159
119
119
f993e2d773e275c88358f8644505f6d328994680
bigcode/the-stack
train
13adbd830c938c863fa08746
train
function
def save_candidates( rules_file, dir_path, all_candidates, rule_lengths, window, score_func_str ): """ Save the candidates. Parameters: rules_file (str): name of rules file dir_path (str): path to output directory all_candidates (dict): candidates for all test queries ru...
def save_candidates( rules_file, dir_path, all_candidates, rule_lengths, window, score_func_str ):
""" Save the candidates. Parameters: rules_file (str): name of rules file dir_path (str): path to output directory all_candidates (dict): candidates for all test queries rule_lengths (list): rule lengths window (int): time window used for rule application sco...
( np.float32 ) try: cands_dict[s][cand].append(score) except KeyError: cands_dict[s][cand] = [score] return cands_dict def save_candidates( rules_file, dir_path, all_candidates, rule_lengths, window, score_func_str ):
69
69
230
24
44
liu-yushan/TLogic
mycode/rule_application.py
Python
save_candidates
save_candidates
319
345
319
321
d7cd854a36fa6a07bc33f8efd945ca639a8798f0
bigcode/the-stack
train
27e8350395ecf6a9d171c7b7
train
function
def filter_rules(rules_dict, min_conf, min_body_supp, rule_lengths): """ Filter for rules with a minimum confidence, minimum body support, and specified rule lengths. Parameters. rules_dict (dict): rules min_conf (float): minimum confidence value min_body_supp (int): minimum bod...
def filter_rules(rules_dict, min_conf, min_body_supp, rule_lengths):
""" Filter for rules with a minimum confidence, minimum body support, and specified rule lengths. Parameters. rules_dict (dict): rules min_conf (float): minimum confidence value min_body_supp (int): minimum body support value rule_lengths (list): rule lengths Return...
import json import numpy as np import pandas as pd from collections import Counter from temporal_walk import store_edges def filter_rules(rules_dict, min_conf, min_body_supp, rule_lengths):
43
64
192
18
24
liu-yushan/TLogic
mycode/rule_application.py
Python
filter_rules
filter_rules
9
36
9
9
fb53c3b00d7e4b37463a6e705bc94158249b4984
bigcode/the-stack
train
290e865ecf702ea0d6174ba7
train
function
def check_var_constraints(var_constraints, rule_walks): """ Check variable constraints of the rule. Parameters: var_constraints (list): variable constraints from the rule rule_walks (pd.DataFrame): all walks matching the rule Returns: rule_walks (pd.DataFrame): all walks matchi...
def check_var_constraints(var_constraints, rule_walks):
""" Check variable constraints of the rule. Parameters: var_constraints (list): variable constraints from the rule rule_walks (pd.DataFrame): all walks matching the rule Returns: rule_walks (pd.DataFrame): all walks matching the rule including the variable constraints """ ...
_edges[i], on=["entity_" + str(i)]) rule_walks = rule_walks[ rule_walks["timestamp_" + str(i - 1)] <= rule_walks["timestamp_" + str(i)] ] return rule_walks def check_var_constraints(var_constraints, rule_walks):
64
64
139
11
52
liu-yushan/TLogic
mycode/rule_application.py
Python
check_var_constraints
check_var_constraints
260
279
260
260
32e0fd630d6662ab83120f02badd0ab1d25087c9
bigcode/the-stack
train
216774cdd52d074aa9ab1e22
train
function
def get_walks_complete(rule, walk_edges): """ Get complete walks for a given rule. Take the time constraints into account. Parameters: rule (dict): rule from rules_dict walk_edges (list of np.ndarrays): edges from match_body_relations Returns: rule_walks (pd.DataFrame): all wal...
def get_walks_complete(rule, walk_edges):
""" Get complete walks for a given rule. Take the time constraints into account. Parameters: rule (dict): rule from rules_dict walk_edges (list of np.ndarrays): edges from match_body_relations Returns: rule_walks (pd.DataFrame): all walks matching the rule """ df_edges...
timestamp_" + str(i - 1)] <= rule_walks["timestamp_" + str(i)] ] if not rule["var_constraints"]: del rule_walks["entity_" + str(i)] df_edges[i] = df_edges[i][0:0] for i in range(1, len(rule["body_rels"])): del rule_walks["timestamp_" + str(i)] return rule_walks def ...
100
100
335
10
89
liu-yushan/TLogic
mycode/rule_application.py
Python
get_walks_complete
get_walks_complete
212
257
212
212
984794ddf644b3740db3f5dcc378d52363ee5aec
bigcode/the-stack
train
e4f476cca77bacb21c62cbed
train
function
def get_walks(rule, walk_edges): """ Get walks for a given rule. Take the time constraints into account. Memory-efficient implementation. Parameters: rule (dict): rule from rules_dict walk_edges (list of np.ndarrays): edges from match_body_relations Returns: rule_walks (pd....
def get_walks(rule, walk_edges):
""" Get walks for a given rule. Take the time constraints into account. Memory-efficient implementation. Parameters: rule (dict): rule from rules_dict walk_edges (list of np.ndarrays): edges from match_body_relations Returns: rule_walks (pd.DataFrame): all walks matching th...
]))) for i in range(1, len(rels)): # Match current targets and next body relation try: rel_edges = edges[rels[i]] mask = np.any(rel_edges[:, 0] == cur_targets[:, None], axis=0) new_edges = rel_edges[mask] walk_edges.append(...
128
128
429
9
118
liu-yushan/TLogic
mycode/rule_application.py
Python
get_walks
get_walks
162
209
162
162
2a9560fecb22adb3271b37a770af2209a94209ff
bigcode/the-stack
train
ba58ffb89ca2401f9cb5c970
train
function
def verbalize_walk(walk, data): """ Verbalize walk from rule application. Parameters: walk (pandas.core.series.Series): walk that matches the rule body from get_walks data (grapher.Grapher): graph data Returns: walk_str (str): verbalized walk """ l = len(walk) // 3 ...
def verbalize_walk(walk, data):
""" Verbalize walk from rule application. Parameters: walk (pandas.core.series.Series): walk that matches the rule body from get_walks data (grapher.Grapher): graph data Returns: walk_str (str): verbalized walk """ l = len(walk) // 3 walk = walk.values.tolist() ...
format( rules_file[:-11], rule_lengths, window, score_func_str ) filename = filename.replace(" ", "") with open(dir_path + filename, "w", encoding="utf-8") as fout: json.dump(all_candidates, fout) def verbalize_walk(walk, data):
64
64
186
9
55
liu-yushan/TLogic
mycode/rule_application.py
Python
verbalize_walk
verbalize_walk
348
369
348
348
1f08215e869523b7affcacebfed7412b6c411501
bigcode/the-stack
train
adc62db6794e2c8890f579b8
train
function
def match_body_relations(rule, edges, test_query_sub): """ Find edges that could constitute walks (starting from the test query subject) that match the rule. First, find edges whose subject match the query subject and the relation matches the first relation in the rule body. Then, find edges whose s...
def match_body_relations(rule, edges, test_query_sub):
""" Find edges that could constitute walks (starting from the test query subject) that match the rule. First, find edges whose subject match the query subject and the relation matches the first relation in the rule body. Then, find edges whose subjects match the current targets and the relation ...
for rule application """ if window > 0: mask = (all_data[:, 3] < test_query_ts) * ( all_data[:, 3] >= test_query_ts - window ) window_edges = store_edges(all_data[mask]) elif window == 0: mask = all_data[:, 3] < test_query_ts window_edges = store_edges(a...
121
121
404
13
107
liu-yushan/TLogic
mycode/rule_application.py
Python
match_body_relations
match_body_relations
71
116
71
71
531366e68e7fe04f902048d22f425a1e0f7a077e
bigcode/the-stack
train
40b3ce4b5f7e07039beed41f
train
class
class RegComments(db.Model): """Database model for regcomments table.""" __tablename__ = 'regcomments' id = db.Column(db.Integer, primary_key=True) step = db.Column(db.String(20), nullable=False) comment = db.Column(db.Text, nullable=False) user_id = db.Column(db.String(64), nullable=False) ...
class RegComments(db.Model):
"""Database model for regcomments table.""" __tablename__ = 'regcomments' id = db.Column(db.Integer, primary_key=True) step = db.Column(db.String(20), nullable=False) comment = db.Column(db.Text, nullable=False) user_id = db.Column(db.String(64), nullable=False) user_name = db.Column(db.Str...
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTI...
124
124
414
6
117
Muazzama/Device-Registration-Subsystem
app/api/v1/models/regcomments.py
Python
RegComments
RegComments
21
68
21
21
ec85608ceb391d22bd569c5c72d1d59ab9543057
bigcode/the-stack
train
7e848ce3a078218cf23dea99
train
function
def get_dataset_gcs_location(dataset_display_name): datasets = vertex_ai.TabularDataset.list() dataset = None for entry in datasets: if entry.display_name == dataset_display_name: dataset = entry break if not dataset: raise ValueError( f"Dataset with ...
def get_dataset_gcs_location(dataset_display_name):
datasets = vertex_ai.TabularDataset.list() dataset = None for entry in datasets: if entry.display_name == dataset_display_name: dataset = entry break if not dataset: raise ValueError( f"Dataset with display name {dataset_display_name} does not exist!"...
) # parser.add_argument( # "--project", # type=str # ) # parser.add_argument( # "--region", # type=str # ) return parser.parse_args() def get_dataset_gcs_location(dataset_display_name):
64
64
96
10
54
dishamehra/merlin-on-gcp
src/data_preprocessing/task.py
Python
get_dataset_gcs_location
get_dataset_gcs_location
82
95
82
82
c14f88d47649e9fa70174d7c4aba47bde4b76b7d
bigcode/the-stack
train
97ee8281d0dc1c9c06231ddd
train
function
def get_args(): parser = argparse.ArgumentParser() # parser.add_argument( # "--movies-dataset-display-name", # type=str, # ) # parser.add_argument( # "--ratings-dataset-display-name", # type=str, # ) parser.add_argument( ...
def get_args():
parser = argparse.ArgumentParser() # parser.add_argument( # "--movies-dataset-display-name", # type=str, # ) # parser.add_argument( # "--ratings-dataset-display-name", # type=str, # ) parser.add_argument( "--movies-csv-da...
datetime import logging import nvtabular as nvt import tensorflow as tf import argparse # from google.cloud import aiplatform as vertex_ai from src.data_preprocessing import etl from src.common import features, utils LOCAL_TRANSFORM_DIR = "transform_workflow" def get_args():
64
64
207
4
60
dishamehra/merlin-on-gcp
src/data_preprocessing/task.py
Python
get_args
get_args
32
79
32
32
3ebc1d0458677082e02a1b3d343eabe058f9f0c4
bigcode/the-stack
train
a560ee972b82fc0261cf296d
train
function
def main(): args = get_args() # vertex_ai.init( # project=args.project, # location=args.region) # logging.info("Getting GCS data locations...") # movies_csv_data_location = get_dataset_gcs_location(movies_dataset_display_name) # ratings_csv_data_location = g...
def main():
args = get_args() # vertex_ai.init( # project=args.project, # location=args.region) # logging.info("Getting GCS data locations...") # movies_csv_data_location = get_dataset_gcs_location(movies_dataset_display_name) # ratings_csv_data_location = get_dataset_g...
type=str # ) # parser.add_argument( # "--region", # type=str # ) return parser.parse_args() def get_dataset_gcs_location(dataset_display_name): datasets = vertex_ai.TabularDataset.list() dataset = None for entry in datasets: if entry.d...
136
136
456
3
133
dishamehra/merlin-on-gcp
src/data_preprocessing/task.py
Python
main
main
98
158
98
98
005f513133c80c8c2bc634aa96f1c842a59d4b60
bigcode/the-stack
train
c1e55d3a13e75514eb1d4a1d
train
class
class BenchmarkAppStages(Stages): stages = { 'Parsing and validating input arguments': 0.09, 'Loading Inference Engine': 0.09, 'Reading the Intermediate Representation network': 0.09, 'Resizing network to match image sizes and given batch': 0.09, 'Configuring input of the mod...
class BenchmarkAppStages(Stages):
stages = { 'Parsing and validating input arguments': 0.09, 'Loading Inference Engine': 0.09, 'Reading the Intermediate Representation network': 0.09, 'Resizing network to match image sizes and given batch': 0.09, 'Configuring input of the model': 0.09, 'Setting device...
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from wb.main.console_tool_wrapper.stages import Stages class BenchmarkApp...
64
64
160
7
56
apaniukov/workbench
wb/main/console_tool_wrapper/benchmark_app/stages.py
Python
BenchmarkAppStages
BenchmarkAppStages
20
33
20
20
14034b4ae1e1c11f50ee15ce442329bcc817e0bd
bigcode/the-stack
train
7fe71b80d859bcc1a5647e7d
train
class
class TestHMC: def test_mvn(self): @jax.jit def ln_posterior(params): return stats.norm.logpdf(params["x"], 0, 1).sum() n_dims = 5 n_chains = 1000 n_samples = 1000 params = dict(x=jnp.ones(n_dims)) samples = hmc.sample( ln_posterior,...
class TestHMC:
def test_mvn(self): @jax.jit def ln_posterior(params): return stats.norm.logpdf(params["x"], 0, 1).sum() n_dims = 5 n_chains = 1000 n_samples = 1000 params = dict(x=jnp.ones(n_dims)) samples = hmc.sample( ln_posterior, params, n_chai...
import jax import jax.numpy as jnp import jax.scipy.stats as stats from gaul import hmc class TestHMC:
33
67
225
5
27
al-jshen/gaul
tests/test_hmc.py
Python
TestHMC
TestHMC
8
33
8
8
8ceee0f8e4e03dd3fd7d1afb281cb1bb697bdfa7
bigcode/the-stack
train
95eafc21732037fd9bfa5858
train
class
class Tokenizer(ABC): def __init__(self): self.training = True def train(self, mode=True): self.training = mode def eval(self): self.train(False) @abstractmethod def tokenize(self, text: str) -> List[str]: pass
class Tokenizer(ABC):
def __init__(self): self.training = True def train(self, mode=True): self.training = mode def eval(self): self.train(False) @abstractmethod def tokenize(self, text: str) -> List[str]: pass
(name, disable=["tagger", "parser", "ner"]) except OSError: nlp = NO_MODEL_LANGUAGE_LOOKUP[name]() return nlp def has_space(text: str) -> bool: return any(x.isspace() for x in text) class Tokenizer(ABC):
64
64
64
6
58
UncleLiaoNN/nnsplit
train/labeler.py
Python
Tokenizer
Tokenizer
56
68
56
56
88e08608446053f23d5185acb1279effa8a8c5d8
bigcode/the-stack
train
1cac39fc8e874a76db003769
train
class
class SoMaJoWordTokenizer(Tokenizer): def __init__(self, model_name: str): super().__init__() self.tokenizer = SoMaJo(model_name, split_sentences=False) def tokenize(self, text: str) -> List[str]: out_tokens = [] tokens = next(self.tokenizer.tokenize_text([text])) for i...
class SoMaJoWordTokenizer(Tokenizer):
def __init__(self, model_name: str): super().__init__() self.tokenizer = SoMaJo(model_name, split_sentences=False) def tokenize(self, text: str) -> List[str]: out_tokens = [] tokens = next(self.tokenizer.tokenize_text([text])) for i, token in enumerate(tokens): ...
token.extra_info: whitespace = "" else: whitespace = " " text += token.text + whitespace if i == len(sentences) - 1: text = text.rstrip() out_sentences.append(text) return out_sentences class SoM...
64
64
176
9
54
UncleLiaoNN/nnsplit
train/labeler.py
Python
SoMaJoWordTokenizer
SoMaJoWordTokenizer
182
203
182
182
1d130429b76e327eb848495ab5a450554ceed6fb
bigcode/the-stack
train
a09f36eb9c2b890d30589245
train
class
class SECOSCompoundTokenizer(Tokenizer): def __init__(self, secos_path: str): super().__init__() sys.path.append(secos_path) import decompound_server self.decompound = decompound_server.make_decompounder( [ "decompound_server.py", f"{secos...
class SECOSCompoundTokenizer(Tokenizer):
def __init__(self, secos_path: str): super().__init__() sys.path.append(secos_path) import decompound_server self.decompound = decompound_server.make_decompounder( [ "decompound_server.py", f"{secos_path}data/denews70M_trigram__candidates"...
) return [x for x in out_tokens if len(x) > 0] class WhitespaceTokenizer(Tokenizer): def tokenize(self, text: str) -> List[str]: out = None for i in range(len(text))[::-1]: if not text[i].isspace(): out = [text[: i + 1], text[i + 1 :]] break ...
110
110
367
8
101
UncleLiaoNN/nnsplit
train/labeler.py
Python
SECOSCompoundTokenizer
SECOSCompoundTokenizer
221
275
221
221
9f50c53de61cb56364b88792a94980269de5291d
bigcode/the-stack
train
ab3c540bd0b89aff1541381e
train
class
class WhitespaceTokenizer(Tokenizer): def tokenize(self, text: str) -> List[str]: out = None for i in range(len(text))[::-1]: if not text[i].isspace(): out = [text[: i + 1], text[i + 1 :]] break if out is None: out = [text, ""] ...
class WhitespaceTokenizer(Tokenizer):
def tokenize(self, text: str) -> List[str]: out = None for i in range(len(text))[::-1]: if not text[i].isspace(): out = [text[: i + 1], text[i + 1 :]] break if out is None: out = [text, ""] return out
sample more spaces than one space so the model learns to deal with it while random.random() < 0.05: whitespace += " " out_tokens.append(token.text + whitespace) return [x for x in out_tokens if len(x) > 0] class WhitespaceTokenizer(Tokenizer):
64
64
84
7
57
UncleLiaoNN/nnsplit
train/labeler.py
Python
WhitespaceTokenizer
WhitespaceTokenizer
206
218
206
206
a1f69eb79d472ec04c2060557e90643568b8363c
bigcode/the-stack
train
cb5acaebce9b551c70669130
train
function
def noise(text, insert_chance, delete_chance, repeat_chance): assert insert_chance == delete_chance == repeat_chance chances = np.random.random(len(text) * 3) if (chances < insert_chance).all(): return text out = "" for i, char in enumerate(text): if chances[i * 3] >= delete_chanc...
def noise(text, insert_chance, delete_chance, repeat_chance):
assert insert_chance == delete_chance == repeat_chance chances = np.random.random(len(text) * 3) if (chances < insert_chance).all(): return text out = "" for i, char in enumerate(text): if chances[i * 3] >= delete_chance: out += char if chances[(i * 3) + 1] < r...
from spacy.lang.sv import Swedish from spacy.lang.uk import Ukrainian NO_MODEL_LANGUAGE_LOOKUP = { "turkish": Turkish, "swedish": Swedish, "ukrainian": Ukrainian, } def noise(text, insert_chance, delete_chance, repeat_chance):
64
64
145
16
48
UncleLiaoNN/nnsplit
train/labeler.py
Python
noise
noise
23
40
23
23
764ee29222fb6a767495833538138e715d7cad64
bigcode/the-stack
train
efd71750404102a58539f1de
train
class
class SpacySentenceTokenizer(Tokenizer): def __init__( self, model_name: str, lower_start_prob: Fraction, remove_end_punct_prob: Fraction, punctuation: str, ): super().__init__() self.nlp = get_model(model_name) self.nlp.add_pipe(self.nlp.create_pi...
class SpacySentenceTokenizer(Tokenizer):
def __init__( self, model_name: str, lower_start_prob: Fraction, remove_end_punct_prob: Fraction, punctuation: str, ): super().__init__() self.nlp = get_model(model_name) self.nlp.add_pipe(self.nlp.create_pipe("sentencizer")) self.lower_st...
abstractmethod def tokenize(self, text: str) -> List[str]: pass def remove_last_punct(text: str, punctuation) -> str: for i in range(len(text))[::-1]: if text[i] in punctuation: return text[:i] + text[i + 1 :] elif not text[i].isspace(): return text return ...
90
90
303
8
81
UncleLiaoNN/nnsplit
train/labeler.py
Python
SpacySentenceTokenizer
SpacySentenceTokenizer
81
129
81
81
e2b7160b5c64824bc5ab3b85ce9375a1a20b6a02
bigcode/the-stack
train
fce3de25bdbea751d760c63a
train
class
class SoMaJoSentenceTokenizer(Tokenizer): def __init__(self, model_name: str): super().__init__() self.tokenizer = SoMaJo(model_name) def tokenize(self, text: str) -> List[str]: out_sentences = [] sentences = list(self.tokenizer.tokenize_text([text])) for i, sentence in...
class SoMaJoSentenceTokenizer(Tokenizer):
def __init__(self, model_name: str): super().__init__() self.tokenizer = SoMaJo(model_name) def tokenize(self, text: str) -> List[str]: out_sentences = [] sentences = list(self.tokenizer.tokenize_text([text])) for i, sentence in enumerate(sentences): text = ...
if not token.text.isspace(): out_tokens.append(current_token) current_token = "" current_token += token.text + token.whitespace_ out_tokens.append(current_token) return [x for x in out_tokens if len(x) > 0] class SoMaJoSentenceTokenizer(Tokenizer):
64
64
153
9
55
UncleLiaoNN/nnsplit
train/labeler.py
Python
SoMaJoSentenceTokenizer
SoMaJoSentenceTokenizer
154
179
154
154
a44441f25079ab427f48e91a680b70ced92f0896
bigcode/the-stack
train
188dc99839789d746d3ccea7
train
function
def has_space(text: str) -> bool: return any(x.isspace() for x in text)
def has_space(text: str) -> bool:
return any(x.isspace() for x in text)
return out def get_model(name): try: nlp = spacy.load(name, disable=["tagger", "parser", "ner"]) except OSError: nlp = NO_MODEL_LANGUAGE_LOOKUP[name]() return nlp def has_space(text: str) -> bool:
64
64
23
10
53
UncleLiaoNN/nnsplit
train/labeler.py
Python
has_space
has_space
52
53
52
52
5d336d7a9fd61b4d834eb25714c279b893f4a58c
bigcode/the-stack
train
c80ff49ad37e1080451381c3
train
class
class SpacyWordTokenizer(Tokenizer): def __init__(self, model_name: str): super().__init__() self.tokenizer = get_model(model_name).tokenizer def tokenize(self, text: str) -> List[str]: out_tokens = [] current_token = "" for token in self.tokenizer(text): i...
class SpacyWordTokenizer(Tokenizer):
def __init__(self, model_name: str): super().__init__() self.tokenizer = get_model(model_name).tokenizer def tokenize(self, text: str) -> List[str]: out_tokens = [] current_token = "" for token in self.tokenizer(text): if not token.text.isspace(): ...
0 and random.random() < self.lower_start_prob ): text = text.lower() current_sentence += text + whitespace out_sentences.append(current_sentence) return [x for x in out_sentences if len(x) > 0] class SpacyWordTokenizer(Tokenizer):
64
64
126
8
56
UncleLiaoNN/nnsplit
train/labeler.py
Python
SpacyWordTokenizer
SpacyWordTokenizer
132
151
132
132
cbeacef3fb0577d4f678568afbc4605ca00f48c0
bigcode/the-stack
train
7f0b121c29b447f2a0a4fde7
train
function
def remove_last_punct(text: str, punctuation) -> str: for i in range(len(text))[::-1]: if text[i] in punctuation: return text[:i] + text[i + 1 :] elif not text[i].isspace(): return text return text
def remove_last_punct(text: str, punctuation) -> str:
for i in range(len(text))[::-1]: if text[i] in punctuation: return text[:i] + text[i + 1 :] elif not text[i].isspace(): return text return text
self.training = True def train(self, mode=True): self.training = mode def eval(self): self.train(False) @abstractmethod def tokenize(self, text: str) -> List[str]: pass def remove_last_punct(text: str, punctuation) -> str:
64
64
63
14
49
UncleLiaoNN/nnsplit
train/labeler.py
Python
remove_last_punct
remove_last_punct
71
78
71
71
1b55e71abf29e056494f3266bafbb61296924dd7
bigcode/the-stack
train
ceaee7066e2b7ec550855fc3
train
class
class Labeler: def __init__(self, tokenizers): self.tokenizers = tokenizers def _annotate(self, text: str, tok_index=0): if tok_index >= len(self.tokenizers): return [(text, set())] out = [] for token in self.tokenizers[tok_index].tokenize(text): out +=...
class Labeler:
def __init__(self, tokenizers): self.tokenizers = tokenizers def _annotate(self, text: str, tok_index=0): if tok_index >= len(self.tokenizers): return [(text, set())] out = [] for token in self.tokenizers[tok_index].tokenize(text): out += self._annotate...
8") self.disk_cache[text_bytes] = compound_bytes self.cache[text_bytes] = compound_bytes else: compounds = compounds.decode("utf-8") compounds = compounds.split() compounds = [noise(x, 0.001, 0.001, 0.001) for x in compounds] return compounds if len...
104
105
352
4
100
UncleLiaoNN/nnsplit
train/labeler.py
Python
Labeler
Labeler
278
330
278
278
57b9480cba508771b2a5af6f78d9023811423f5e
bigcode/the-stack
train
7004f12a2ff2e7847571c73e
train
function
def get_model(name): try: nlp = spacy.load(name, disable=["tagger", "parser", "ner"]) except OSError: nlp = NO_MODEL_LANGUAGE_LOOKUP[name]() return nlp
def get_model(name):
try: nlp = spacy.load(name, disable=["tagger", "parser", "ner"]) except OSError: nlp = NO_MODEL_LANGUAGE_LOOKUP[name]() return nlp
out += char if chances[(i * 3) + 1] < repeat_chance: out += char if chances[(i * 3) + 2] < insert_chance: out += random.choice(string.ascii_letters) return out def get_model(name):
64
64
50
5
58
UncleLiaoNN/nnsplit
train/labeler.py
Python
get_model
get_model
43
49
43
43
fb36459b09545f2977a64d0c82cd16c36453abbc
bigcode/the-stack
train
08904c38b2ca543dd5b7bb85
train
function
def generate_data_iterator(dataset, seed, num_workers=1, epoch=1., buffer_size=0): # check if dataset is a list: if isinstance(dataset, list): # this is a multidataset # print("[INFO] Generating multi dataset iterator") data_iterator = MultiDataIterator(dataset, seed=seed, num_workers=nu...
def generate_data_iterator(dataset, seed, num_workers=1, epoch=1., buffer_size=0): # check if dataset is a list:
if isinstance(dataset, list): # this is a multidataset # print("[INFO] Generating multi dataset iterator") data_iterator = MultiDataIterator(dataset, seed=seed, num_workers=num_workers, epoch=epoch, buffer_size=buffer_size) else: data_it...
das. """ s = 10000 lambda_ = lambda_lat_dis * float(min(step, s)) / s return lambda_ def generate_data_iterator(dataset, seed, num_workers=1, epoch=1., buffer_size=0): # check if dataset is a list:
63
64
131
31
32
quanpn90/SpeechGAN
onmt/train_utils/trainer.py
Python
generate_data_iterator
generate_data_iterator
47
59
47
48
4cacb272d891d0a66e665ba893d80d88795a0b28
bigcode/the-stack
train
62b97a4da2b6ec7df6561be9
train
function
def get_lambda(lambda_lat_dis, step): """ Compute discriminators' lambdas. """ s = 10000 lambda_ = lambda_lat_dis * float(min(step, s)) / s return lambda_
def get_lambda(lambda_lat_dis, step):
""" Compute discriminators' lambdas. """ s = 10000 lambda_ = lambda_lat_dis * float(min(step, s)) / s return lambda_
pect.currentframe().f_back)[3]: m = re.search(r'\bvarname\s*\(\s*([A-Za-z_][A-Za-z0-9_]*)\s*\)', line) if m: return m.group(1) def get_lambda(lambda_lat_dis, step):
64
64
49
9
55
quanpn90/SpeechGAN
onmt/train_utils/trainer.py
Python
get_lambda
get_lambda
36
44
36
36
7f8fb260a01b445681498e6720d6effa6361fb65
bigcode/the-stack
train
2a975f4f36a550651be08c2f
train
function
def varname(p): for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]: m = re.search(r'\bvarname\s*\(\s*([A-Za-z_][A-Za-z0-9_]*)\s*\)', line) if m: return m.group(1)
def varname(p):
for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]: m = re.search(r'\bvarname\s*\(\s*([A-Za-z_][A-Za-z0-9_]*)\s*\)', line) if m: return m.group(1)
DataIterator from onmt.data.dataset import rewrap from onmt.model_factory import build_model, build_language_model, optimize_model from onmt.model_factory import init_model_parameters from onmt.train_utils.stats import Logger from onmt.utils import checkpoint_paths, normalize_gradients def varname(p):
64
64
69
5
58
quanpn90/SpeechGAN
onmt/train_utils/trainer.py
Python
varname
varname
29
33
29
29
0bb0075cbee3fb8436e4716197f30f81cbd347b8
bigcode/the-stack
train
7327b4faa632e39363b4dc67
train
class
class BaseTrainer(object): def __init__(self, model, loss_function, train_data, valid_data, dicts, opt): self.model = model self.train_data = train_data self.valid_data = valid_data self.dicts = dicts self.opt = opt self.cuda = (len(opt.gpus) >= 1 and opt.gpus[0] >...
class BaseTrainer(object):
def __init__(self, model, loss_function, train_data, valid_data, dicts, opt): self.model = model self.train_data = train_data self.valid_data = valid_data self.dicts = dicts self.opt = opt self.cuda = (len(opt.gpus) >= 1 and opt.gpus[0] >= 0) self.loss_func...
def varname(p): for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]: m = re.search(r'\bvarname\s*\(\s*([A-Za-z_][A-Za-z0-9_]*)\s*\)', line) if m: return m.group(1) def get_lambda(lambda_lat_dis, step): """ Compute discriminators' lambdas. """ s = 10000...
256
256
1,774
5
250
quanpn90/SpeechGAN
onmt/train_utils/trainer.py
Python
BaseTrainer
BaseTrainer
62
290
62
63
1d2054ee194ce0cde6a2d191f1a86d87ce97aad6
bigcode/the-stack
train
66523195e691496e5ee179ac
train
class
class SpeechFNTrainer(object): def __init__(self, model, lat_dis, loss_function, train_data, valid_data, dicts, opt, setup_optimizer=True): self.train_data = train_data self.valid_data = valid_data self.dicts = dicts self.opt = opt self.cuda = (len(opt.gpus) >= 1 and opt.gp...
class SpeechFNTrainer(object):
def __init__(self, model, lat_dis, loss_function, train_data, valid_data, dicts, opt, setup_optimizer=True): self.train_data = train_data self.valid_data = valid_data self.dicts = dicts self.opt = opt self.cuda = (len(opt.gpus) >= 1 and opt.gpus[0] >= 0) self.start...
# # tensor = obj # # numel = tensor. # print(type(obj), obj.type(), obj.size()) # except: # pass # print("Memory profiling complete.") # print(torch.cuda.memory_summa...
256
256
5,050
6
250
quanpn90/SpeechGAN
onmt/train_utils/trainer.py
Python
SpeechFNTrainer
SpeechFNTrainer
293
907
293
293
768f11824c2a8187e4f546b2bb9a012dcb8248dc
bigcode/the-stack
train
d98f8edec6d4c229c1df216a
train
class
class TestFuncAPI(unittest.TestCase): def test_inout_var(self): def func(a, b, c): x = a * b y = b * c return x, y f = (omf.wrap(func) .add_input('a', units='m') .add_input('b', units='inch') .add_input('c', units='ft') ...
class TestFuncAPI(unittest.TestCase):
def test_inout_var(self): def func(a, b, c): x = a * b y = b * c return x, y f = (omf.wrap(func) .add_input('a', units='m') .add_input('b', units='inch') .add_input('c', units='ft') .add_output('x', units='cm') ...
import unittest import numpy as np import openmdao.func_api as omf from openmdao.utils.assert_utils import assert_warning, assert_no_warning class TestFuncAPI(unittest.TestCase):
41
256
4,422
8
32
andrewellis55/OpenMDAO
openmdao/core/tests/test_func_api.py
Python
TestFuncAPI
TestFuncAPI
8
481
8
8
e4e8e5ea989f7ee6484f2ec2e15ed3b4a730ec50
bigcode/the-stack
train
560b02b6275f136f4006cfa3
train
class
class book(models.Model): name = models.CharField(max_length = 500) author = models.CharField(max_length = 100) logo = models.FileField(max_length = 500, null=True) download = models.CharField(max_length = 500, null=True) def __str__(self): return self.name
class book(models.Model):
name = models.CharField(max_length = 500) author = models.CharField(max_length = 100) logo = models.FileField(max_length = 500, null=True) download = models.CharField(max_length = 500, null=True) def __str__(self): return self.name
from django.db import models class book(models.Model):
11
64
68
5
5
AjithRamachandran/Program-Stack
Books/models.py
Python
book
book
3
10
3
3
08b2a8fdd69a5126dfbdbe4dfe144516466b799b
bigcode/the-stack
train
6b34c528b806a3e81503fe10
train
function
def main(): A = [int(input()) for _ in range(3)] time = [check_time(i, A) for i in range(3)] print(min(time))
def main():
A = [int(input()) for _ in range(3)] time = [check_time(i, A) for i in range(3)] print(min(time))
ms 해결 날짜: 2020년 9월 20일 """ def check_time(floor, people): time = 0 for i in range(3): time += abs(floor - i) * people[i] * 2 return time def main():
64
64
39
3
60
youngdaLee/Baekjoon
src/15/15051.py
Python
main
main
19
23
19
19
be9781a2daea76aed980519a25ea5ce0208f5e8d
bigcode/the-stack
train
06a280a81a14cf0039e7b85a
train
function
def check_time(floor, people): time = 0 for i in range(3): time += abs(floor - i) * people[i] * 2 return time
def check_time(floor, people):
time = 0 for i in range(3): time += abs(floor - i) * people[i] * 2 return time
51. Máquina de café 작성자: xCrypt0r 언어: Python 3 사용 메모리: 29,380 KB 소요 시간: 64 ms 해결 날짜: 2020년 9월 20일 """ def check_time(floor, people):
64
64
43
8
56
youngdaLee/Baekjoon
src/15/15051.py
Python
check_time
check_time
11
17
11
11
d585aeab52f35ffc51f3e3bd3f80932327c3eb6c
bigcode/the-stack
train
c4bf1da4848b2b5d8622d12f
train
function
def step2(): f.fill(0) for i in range(n): f[i,:] = m[i]*g v0 = np.array([0.7,0.7]) v1 = np.array([1,0]) v2 = np.array([0.7,-0.7]) v3 = np.array([0,1]) v4 = np.array([0,-1]) v5 = np.array([-0.7,0.7]) v6 = np.array([-1,0]) v7 = np.array([-0.7,-0.7]) v[0]+=v0...
def step2():
f.fill(0) for i in range(n): f[i,:] = m[i]*g v0 = np.array([0.7,0.7]) v1 = np.array([1,0]) v2 = np.array([0.7,-0.7]) v3 = np.array([0,1]) v4 = np.array([0,-1]) v5 = np.array([-0.7,0.7]) v6 = np.array([-1,0]) v7 = np.array([-0.7,-0.7]) v[0]+=v0 v[1]+=v1...
[i,:] = m[i]*g # Update velocity of each particle for i in range(n): v[i,:] += f[i,:]/m[i] * dt # Update position of each particle for i in range(n): x[i,:] += v[i,:] * dt def step2():
72
72
242
4
67
NavneelSinghal/PyPhysics
animation.py
Python
step2
step2
35
59
35
35
d17f44ca6a806d78e5ca31dba1f92a130066a02d
bigcode/the-stack
train
181d4ef34c1dc8d7b4862839
train
function
def init(): ax.set_xlim(0,1) ax.set_ylim(0,1) ax.set_aspect('equal') return points,
def init():
ax.set_xlim(0,1) ax.set_ylim(0,1) ax.set_aspect('equal') return points,
[i,:] += f[i,:]/m[i] * dt for i in range(n): x[i,:] += v[i,:] * dt # Drawing code fig, ax = plt.subplots() points, = ax.plot(x[:,0], x[:,1], 'o') def init():
64
64
33
3
61
NavneelSinghal/PyPhysics
animation.py
Python
init
init
66
70
66
66
75c61464c891885d4bcd1f7320612d80469e36a9
bigcode/the-stack
train
c65ad003d4926629f00c84e4
train
function
def step1(): # Accumulate forces on each particle f.fill(0) for i in range(n): f[i,:] = m[i]*g # Update velocity of each particle for i in range(n): v[i,:] += f[i,:]/m[i] * dt # Update position of each particle for i in range(n): x[i,:] += v[i,:] * dt
def step1(): # Accumulate forces on each particle
f.fill(0) for i in range(n): f[i,:] = m[i]*g # Update velocity of each particle for i in range(n): v[i,:] += f[i,:]/m[i] * dt # Update position of each particle for i in range(n): x[i,:] += v[i,:] * dt
): m[i] = 1 x[i,:] = np.array([0,0]) v[i,:] = np.array([1,3.5]) # Time stepping (this is actually "semi-implicit Euler") def step1(): # Accumulate forces on each particle
64
64
96
13
51
NavneelSinghal/PyPhysics
animation.py
Python
step1
step1
22
32
22
23
3654bdde65634e57534c9c86c920cba34c0d4a3c
bigcode/the-stack
train
7cac08b05243603636d1fef5
train
function
def animate(frame): if frame == frames//3: step2() else: step1() points.set_data(x[:,0], x[:,1]) if frame is frames-1: plt.close() return points,
def animate(frame):
if frame == frames//3: step2() else: step1() points.set_data(x[:,0], x[:,1]) if frame is frames-1: plt.close() return points,
# Drawing code fig, ax = plt.subplots() points, = ax.plot(x[:,0], x[:,1], 'o') def init(): ax.set_xlim(0,1) ax.set_ylim(0,1) ax.set_aspect('equal') return points, def animate(frame):
64
64
51
4
60
NavneelSinghal/PyPhysics
animation.py
Python
animate
animate
72
81
72
72
a0b55c37fcaf76f3fb26449722e16dafc7f59e93
bigcode/the-stack
train
0fe4acef943c894fe70f0979
train
class
class ChexpertTest(testing.DatasetBuilderTestCase): DATASET_CLASS = chexpert.Chexpert SPLITS = { "train": 2, "validation": 1, }
class ChexpertTest(testing.DatasetBuilderTestCase):
DATASET_CLASS = chexpert.Chexpert SPLITS = { "train": 2, "validation": 1, }
, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Tests for chexpert dataset module.""" from tensorflow_datasets import testing from tensorflow_datasets.image_classification import chexpert class ChexpertTest(testing.DatasetBuilderTe...
64
64
45
12
51
jvishnuvardhan/datasets
tensorflow_datasets/image_classification/chexpert_test.py
Python
ChexpertTest
ChexpertTest
22
27
22
22
a7af4e76215b44882936e7adee7507754795554a
bigcode/the-stack
train
44d1f0684414a7f2b2558ca1
train
function
def add_detic_config(cfg): _C = cfg _C.WITH_IMAGE_LABELS = False # Turn on co-training with classification data # Open-vocabulary classifier _C.MODEL.ROI_BOX_HEAD.USE_ZEROSHOT_CLS = False # Use fixed classifier for open-vocabulary detection _C.MODEL.ROI_BOX_HEAD.ZEROSHOT_WEIGHT_PATH = '/computervi...
def add_detic_config(cfg):
_C = cfg _C.WITH_IMAGE_LABELS = False # Turn on co-training with classification data # Open-vocabulary classifier _C.MODEL.ROI_BOX_HEAD.USE_ZEROSHOT_CLS = False # Use fixed classifier for open-vocabulary detection _C.MODEL.ROI_BOX_HEAD.ZEROSHOT_WEIGHT_PATH = '/computervisioner/Detic/datasets/metad...
# Copyright (c) Facebook, Inc. and its affiliates. from detectron2.config import CfgNode as CN def add_detic_config(cfg):
32
256
2,012
7
24
AlexanderKozhevin/Detic
detic/config.py
Python
add_detic_config
add_detic_config
4
131
4
4
b91bce151bed77457d0665a554b469d136102842
bigcode/the-stack
train
b927dc994cf2f4e051ab2aa0
train
function
def __showProgress(i, l, verbose=False): if verbose and (i % 5000 == 0 or i == l-1): print(str(round(i * 100 / l, 3)) + "%")
def __showProgress(i, l, verbose=False):
if verbose and (i % 5000 == 0 or i == l-1): print(str(round(i * 100 / l, 3)) + "%")
feature set. feature_set = {} for t in tokens: feature_set[t] = t in preprocesser.corpus labeled_featuresets.append(feature_set) return labeled_featuresets # Displays feedback for the user while featuresets are generated. def __showProgress(i, l, verbose=False):
64
64
48
11
53
LarsChrWiik/Sentiment-Analysis
FeatureSetGenerator.py
Python
__showProgress
__showProgress
54
56
54
54
673e84e795f260a48b2e52f83511f9beb25ca2d0
bigcode/the-stack
train
7cfdda64fba3690e75e0cdc3
train
function
def non_labeled(content, preprocesser, verbose=False): labeled_featuresets = [] l = len(content) for i in range(l): __showProgress(i, l, verbose) tokens = preprocesser.preprocess_sentence(content[i]) # Construct feature set. feature_set = {} for t in tokens: ...
def non_labeled(content, preprocesser, verbose=False):
labeled_featuresets = [] l = len(content) for i in range(l): __showProgress(i, l, verbose) tokens = preprocesser.preprocess_sentence(content[i]) # Construct feature set. feature_set = {} for t in tokens: feature_set[t] = t in preprocesser.corpus l...
set. feature_set = {} for t in tokens: feature_set[t] = t in preprocesser.corpus labeled_featuresets.append((feature_set, labels[i])) return labeled_featuresets # Generate feature set with no labels. def non_labeled(content, preprocesser, verbose=False):
64
64
96
12
52
LarsChrWiik/Sentiment-Analysis
FeatureSetGenerator.py
Python
non_labeled
non_labeled
38
50
38
38
415124ebcaf2b6f5dce6779ee913d51c5df0e620
bigcode/the-stack
train
e5b48ebcf321148da1a19d37
train
function
def labeled(content, labels, preprocesser, verbose=False): labeled_featuresets = [] l = len(content) for i in range(len(content)): __showProgress(i, l, verbose) tokens = preprocesser.preprocess_sentence(content[i]) # Construct feature set. feature_set = {} for t in t...
def labeled(content, labels, preprocesser, verbose=False):
labeled_featuresets = [] l = len(content) for i in range(len(content)): __showProgress(i, l, verbose) tokens = preprocesser.preprocess_sentence(content[i]) # Construct feature set. feature_set = {} for t in tokens: feature_set[t] = t in preprocesser.corpu...
(content[i]) # Construct feature set. feature_set = {} for t in tokens: feature_set[t] = True labeled_featuresets.append((feature_set, labels[i])) return labeled_featuresets # Generate labelled featureset. def labeled(content, labels, preprocesser, verbose=False):
64
64
101
12
52
LarsChrWiik/Sentiment-Analysis
FeatureSetGenerator.py
Python
labeled
labeled
22
34
22
22
a4122cbcc38df7f6d82b9a9c3a5dc4f863d00151
bigcode/the-stack
train
7153d2ae9990009e289266e7
train
function
def baseline(content, labels, verbose=False): labeled_featuresets = [] l = len(content) for i in range(len(content)): __showProgress(i, l, verbose) tokens = word_tokenize(content[i]) # Construct feature set. feature_set = {} for t in tokens: feature_set[t...
def baseline(content, labels, verbose=False):
labeled_featuresets = [] l = len(content) for i in range(len(content)): __showProgress(i, l, verbose) tokens = word_tokenize(content[i]) # Construct feature set. feature_set = {} for t in tokens: feature_set[t] = True labeled_featuresets.append((f...
from nltk.tokenize import word_tokenize # Generate labelled featureset (All labels are true). def baseline(content, labels, verbose=False):
30
64
91
9
21
LarsChrWiik/Sentiment-Analysis
FeatureSetGenerator.py
Python
baseline
baseline
6
18
6
6
cf43be81551e110ff3ca848800a895d8179e1b3f
bigcode/the-stack
train
8f3578f9e305594d227a2ac8
train
function
def parse_args(): p = argparse.ArgumentParser() p.add_argument("-v", "--verbose", action="store_true") p.add_argument("paths", nargs="+") return p.parse_args()
def parse_args():
p = argparse.ArgumentParser() p.add_argument("-v", "--verbose", action="store_true") p.add_argument("paths", nargs="+") return p.parse_args()
from qdsl.queryable import ALL, q, Queryable, to_queryable # noqa from qdsl.boolean import * # noqa urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) Loader = getattr(yaml, "CSafeLoader", yaml.SafeLoader) def parse_args():
64
64
42
4
60
csams/qdsl
qdsl/cli.py
Python
parse_args
parse_args
24
28
24
24
a27c4748e7f6b39d9a1cc4bc5dc64642a6a1b4ab
bigcode/the-stack
train
998cc1e653e18f1902eaa3cd
train
function
def _get_files(path): with os.scandir(path) as it: for ent in it: if ent.is_dir(follow_symlinks=False): for pth in _get_files(ent.path): yield pth elif ent.is_file(follow_symlinks=False): yield ent.path
def _get_files(path):
with os.scandir(path) as it: for ent in it: if ent.is_dir(follow_symlinks=False): for pth in _get_files(ent.path): yield pth elif ent.is_file(follow_symlinks=False): yield ent.path
) Loader = getattr(yaml, "CSafeLoader", yaml.SafeLoader) def parse_args(): p = argparse.ArgumentParser() p.add_argument("-v", "--verbose", action="store_true") p.add_argument("paths", nargs="+") return p.parse_args() def _get_files(path):
64
64
67
6
58
csams/qdsl
qdsl/cli.py
Python
_get_files
_get_files
31
38
31
31
ed1134f95d8eb708a38d8cbd7f94903aeaf0934a
bigcode/the-stack
train
72ab1a2f0a65b2d5a9c04ea3
train
function
def main(): args = parse_args() level = logging.DEBUG if args.verbose else logging.INFO logging.basicConfig(level=level) conf = analyze(args.paths) import IPython from traitlets.config.loader import Config IPython.core.completer.Completer.use_jedi = False c = Config() c.PlainText...
def main():
args = parse_args() level = logging.DEBUG if args.verbose else logging.INFO logging.basicConfig(level=level) conf = analyze(args.paths) import IPython from traitlets.config.loader import Config IPython.core.completer.Completer.use_jedi = False c = Config() c.PlainTextFormatter.ma...
= [paths] if not isinstance(paths, (tuple, list)) else paths for path in paths: if os.path.isdir(path): for p in _get_files(path): load(p) else: load(path) return reduce(operator.add, results, Queryable()) def main():
64
64
125
3
61
csams/qdsl
qdsl/cli.py
Python
main
main
70
88
70
70
f5de2706116123eca55cc16a3c0b05eef44aed2a
bigcode/the-stack
train
efcd38ef9163b682ba33ed72
train
function
def analyze(paths, ignore=".*(log|txt)$"): ignore = re.compile(ignore).search if ignore else lambda _: False results = [] def load(p): if not ignore(p): try: if p.startswith("http"): data = requests.get(p, verify=False).text doc = ...
def analyze(paths, ignore=".*(log|txt)$"):
ignore = re.compile(ignore).search if ignore else lambda _: False results = [] def load(p): if not ignore(p): try: if p.startswith("http"): data = requests.get(p, verify=False).text doc = yaml.load(data, Loader=Loader) ...
for ent in it: if ent.is_dir(follow_symlinks=False): for pth in _get_files(ent.path): yield pth elif ent.is_file(follow_symlinks=False): yield ent.path def analyze(paths, ignore=".*(log|txt)$"):
64
64
188
13
50
csams/qdsl
qdsl/cli.py
Python
analyze
analyze
41
67
41
41
4097834cd3d31d659fd592bb199866710c5c97d3
bigcode/the-stack
train
f768cd8a4bf3991e71fb048e
train
function
def simple_function(arg1, arg2=1): """ Just a simple function. Args: arg1 (str): first argument arg2 (int): second argument Returns: List[str]: first argument repeated second argument types. """ return [arg1] * arg2
def simple_function(arg1, arg2=1):
""" Just a simple function. Args: arg1 (str): first argument arg2 (int): second argument Returns: List[str]: first argument repeated second argument types. """ return [arg1] * arg2
from pdocs import doc from tests import tutils import pdocs def simple_function(arg1, arg2=1):
27
64
66
11
15
KyleKing/pdocs
tests/test_parse_docstring.py
Python
simple_function
simple_function
6
17
6
6
09fc6cd76ca2b8661f3d5585881ef0bea335fe64
bigcode/the-stack
train
f9dcfbef18e6e0a0416064e9
train
function
def test_parse_google_example(): with tutils.tdir(): m = pdocs.extract.extract_module(f"./docstring_parser/example_google.py") assert m.parsed_docstring pd = m.parsed_docstring assert pd.short_description == "Module level docstring." assert not pd.long_description assert "add" in m...
def test_parse_google_example():
with tutils.tdir(): m = pdocs.extract.extract_module(f"./docstring_parser/example_google.py") assert m.parsed_docstring pd = m.parsed_docstring assert pd.short_description == "Module level docstring." assert not pd.long_description assert "add" in m.doc add_pd = m.doc["add"].pa...
If the length of `x` is equal to 0." msg_pd = ex_class.doc["message"].parsed_docstring assert msg_pd.short_description == "Return a message list." n = msg_pd.params[0] assert n.arg_name == "n" assert n.description == "Repetition." assert "readonly_property" in ex_class.doc_init ro_prop_pd = ...
163
163
544
6
157
KyleKing/pdocs
tests/test_parse_docstring.py
Python
test_parse_google_example
test_parse_google_example
139
190
139
139
faa536b3be8330ae77c191e3c520e4d620fcc021
bigcode/the-stack
train
203ea05eec90e701ecf4967d
train
function
def test_numpydocs(): fun_doc = doc.Function("token_to_alias", __name__, token_to_alias) assert fun_doc.parsed_docstring is not None parsed = fun_doc.parsed_docstring assert parsed.short_description == 'Replaces known tokens with their "tag" form.' assert len(parsed.params) == 2 assert len(parse...
def test_numpydocs():
fun_doc = doc.Function("token_to_alias", __name__, token_to_alias) assert fun_doc.parsed_docstring is not None parsed = fun_doc.parsed_docstring assert parsed.short_description == 'Replaces known tokens with their "tag" form.' assert len(parsed.params) == 2 assert len(parsed.raises) == 0 fir...
raw_text: pd.Series contains text with known jargon, slang, etc vocab: pd.DataFrame contains alias' keyed on known slang, jargon, etc. Returns ------- pd.Series new text, with all slang/jargon replaced with unified representations """ pass def test_numpydocs():
73
73
245
7
65
KyleKing/pdocs
tests/test_parse_docstring.py
Python
test_numpydocs
test_numpydocs
58
78
58
58
de0e7ab6664d24ba4081c075a85c4c846d595e0b
bigcode/the-stack
train
e99b6eae0e53c338b86174df
train
function
def test_parse_numpy_example(): with tutils.tdir(): m = pdocs.extract.extract_module(f"./docstring_parser/example_numpy.py") assert m.parsed_docstring pd = m.parsed_docstring assert pd.short_description == "Module level docstring." assert not pd.long_description assert "add" in m.d...
def test_parse_numpy_example():
with tutils.tdir(): m = pdocs.extract.extract_module(f"./docstring_parser/example_numpy.py") assert m.parsed_docstring pd = m.parsed_docstring assert pd.short_description == "Module level docstring." assert not pd.long_description assert "add" in m.doc add_pd = m.doc["add"].par...
) == 0 first_param, second_param = parsed.params assert first_param.arg_name == "raw_text" assert first_param.type_name == "pd.Series" assert first_param.description == "contains text with known jargon, slang, etc" assert first_param.is_optional == False assert second_param.arg_name == "vocab" ...
171
171
570
6
164
KyleKing/pdocs
tests/test_parse_docstring.py
Python
test_parse_numpy_example
test_parse_numpy_example
81
136
81
81
bae9bcaedd53936b77a63c300cf304c63280afec
bigcode/the-stack
train
0c6f9eed16db4d376d8038d0
train
function
def token_to_alias(raw_text, vocab): """ Replaces known tokens with their "tag" form. i.e. the alias' in some known vocabulary list. Parameters ---------- raw_text: pd.Series contains text with known jargon, slang, etc vocab: pd.DataFrame contains alias' keyed on known ...
def token_to_alias(raw_text, vocab):
""" Replaces known tokens with their "tag" form. i.e. the alias' in some known vocabulary list. Parameters ---------- raw_text: pd.Series contains text with known jargon, slang, etc vocab: pd.DataFrame contains alias' keyed on known slang, jargon, etc. Returns ...
_optional == False assert second_param.arg_name == "arg2" assert second_param.type_name == "int" assert second_param.description == "second argument" # assert second_param.is_optional == True # assert second_param.default == 1 def token_to_alias(raw_text, vocab):
64
64
108
9
54
KyleKing/pdocs
tests/test_parse_docstring.py
Python
token_to_alias
token_to_alias
37
55
37
37
88e6f8329c9b4af6cd997c53fec4be0c53f3fa79
bigcode/the-stack
train
fd01b1500b41a86397f5f66c
train
function
def test_parse_docstring(): fun_doc = doc.Function("simple_function", __name__, simple_function) assert fun_doc.parsed_docstring is not None parsed = fun_doc.parsed_docstring assert len(parsed.params) == 2 first_param, second_param = parsed.params assert first_param.arg_name == "arg1" assert...
def test_parse_docstring():
fun_doc = doc.Function("simple_function", __name__, simple_function) assert fun_doc.parsed_docstring is not None parsed = fun_doc.parsed_docstring assert len(parsed.params) == 2 first_param, second_param = parsed.params assert first_param.arg_name == "arg1" assert first_param.type_name == "s...
=1): """ Just a simple function. Args: arg1 (str): first argument arg2 (int): second argument Returns: List[str]: first argument repeated second argument types. """ return [arg1] * arg2 def test_parse_docstring():
64
64
135
6
57
KyleKing/pdocs
tests/test_parse_docstring.py
Python
test_parse_docstring
test_parse_docstring
20
32
20
20
7e10c121f81c9ad1cb1602ad0f8799a6fcff031d
bigcode/the-stack
train
7a4af81a6c80d123e8f4725a
train
class
class TestCSVToOptions: def test_no_header(self, isolated_cli_runner): with open(FILENAME, "w") as f: for line in DATA: f.write(f"{line['value']},{line['label'].split(' ')[1]}\n") result = isolated_cli_runner.invoke( csv_to_options.cli, [FILENAME, "--delimite...
class TestCSVToOptions:
def test_no_header(self, isolated_cli_runner): with open(FILENAME, "w") as f: for line in DATA: f.write(f"{line['value']},{line['label'].split(' ')[1]}\n") result = isolated_cli_runner.invoke( csv_to_options.cli, [FILENAME, "--delimiter", ",", "--add-value"] ...
import json from pathlib import Path from rossum.tools import csv_to_options FILENAME = "some.csv" DATA = [ {"value": "1", "label": "1: abc"}, {"value": "2", "label": "2: cde"}, {"value": "3", "label": "3: fgh"}, ] class TestCSVToOptions:
81
100
335
6
75
tunystom-rossum/rossum
tests/test_csv_to_options.py
Python
TestCSVToOptions
TestCSVToOptions
14
54
14
14
1be118388fb6633706bec97368f9382935db60f8
bigcode/the-stack
train
2039cbc5e19b3bae6af501ab
train
function
@pytest.mark.smoketest def test_can_import_jobs_modules(): from tapis_cli.commands.taccapis.v2.jobs import history from tapis_cli.commands.taccapis.v2.jobs import list from tapis_cli.commands.taccapis.v2.jobs import outputs_download from tapis_cli.commands.taccapis.v2.jobs import outputs_list from t...
@pytest.mark.smoketest def test_can_import_jobs_modules():
from tapis_cli.commands.taccapis.v2.jobs import history from tapis_cli.commands.taccapis.v2.jobs import list from tapis_cli.commands.taccapis.v2.jobs import outputs_download from tapis_cli.commands.taccapis.v2.jobs import outputs_list from tapis_cli.commands.taccapis.v2.jobs import resubmit from...
, isdir, stat, exists) from tapis_cli.commands.taccapis.v2.files.helpers.walk import (listdir, walk) from tapis...
64
64
157
13
50
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_jobs_modules
test_can_import_jobs_modules
73
84
73
74
4cde448111c3aec0f1677042697bc11a506eb888
bigcode/the-stack
train
6745d49238b004371b8b98d4
train
function
@pytest.mark.smoketest def test_can_import_formatmany_subclasses(): from tapis_cli.commands.taccapis.v2.apps.formatters import AppsFormatMany from tapis_cli.commands.taccapis.v2.files.formatters import FilesFormatMany from tapis_cli.commands.taccapis.v2.jobs.formatters import JobsFormatMany from tapis_c...
@pytest.mark.smoketest def test_can_import_formatmany_subclasses():
from tapis_cli.commands.taccapis.v2.apps.formatters import AppsFormatMany from tapis_cli.commands.taccapis.v2.files.formatters import FilesFormatMany from tapis_cli.commands.taccapis.v2.jobs.formatters import JobsFormatMany from tapis_cli.commands.taccapis.v2.metadata.formatters import MetadataFormatMan...
apis.v2.metadata.formatters import MetadataFormatOne from tapis_cli.commands.taccapis.v2.profiles.formatters import ProfilesFormatOne from tapis_cli.commands.taccapis.v2.systems.formatters import SystemsFormatOne @pytest.mark.smoketest def test_can_import_formatmany_subclasses():
64
64
125
15
48
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_formatmany_subclasses
test_can_import_formatmany_subclasses
151
158
151
152
df87e030a2289a893ced085161edd07ebfd6eb6b
bigcode/the-stack
train
0e6ca7427bce352b9fd191d2
train
function
@pytest.mark.smoketest def test_can_import_tapis_cli(): import tapis_cli
@pytest.mark.smoketest def test_can_import_tapis_cli():
import tapis_cli
import pytest @pytest.mark.smoketest def test_can_import_tapis_cli():
17
64
19
14
2
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_tapis_cli
test_can_import_tapis_cli
4
6
4
5
c9c1b8c5fae108ca967cdc3b52e92095ed1a1803
bigcode/the-stack
train
923b55b62853fa79ee38045d
train
function
@pytest.mark.smoketest def test_can_import_apim_modules(): from tapis_cli.commands.taccapis.v2.apim import auth_init from tapis_cli.commands.taccapis.v2.apim import auth_show from tapis_cli.commands.taccapis.v2.apim import token_create from tapis_cli.commands.taccapis.v2.apim import token_refresh fr...
@pytest.mark.smoketest def test_can_import_apim_modules():
from tapis_cli.commands.taccapis.v2.apim import auth_init from tapis_cli.commands.taccapis.v2.apim import auth_show from tapis_cli.commands.taccapis.v2.apim import token_create from tapis_cli.commands.taccapis.v2.apim import token_refresh from tapis_cli.commands.taccapis.v2.apim import formatters ...
import pytest @pytest.mark.smoketest def test_can_import_tapis_cli(): import tapis_cli @pytest.mark.smoketest def test_can_import_actors_modules(): pass @pytest.mark.smoketest def test_can_import_apim_modules():
53
64
109
14
38
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_apim_modules
test_can_import_apim_modules
14
21
14
15
9f12da77f06ff3acfbc277ed4d15e29495b79404
bigcode/the-stack
train
b65b74a16b79677bfcb807e7
train
function
@pytest.mark.smoketest def test_can_import_keys_modules(): pass
@pytest.mark.smoketest def test_can_import_keys_modules():
pass
accapis.v2.jobs import status from tapis_cli.commands.taccapis.v2.jobs import submit from tapis_cli.commands.taccapis.v2.jobs import formatters from tapis_cli.commands.taccapis.v2.jobs import models @pytest.mark.smoketest def test_can_import_keys_modules():
64
64
16
13
50
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_keys_modules
test_can_import_keys_modules
87
89
87
88
a6c4ab293a2921a5cb3bb4f876ffe7e273652859
bigcode/the-stack
train
1bca48251bec397e49264102
train
function
@pytest.mark.smoketest def test_can_import_apps_modules(): from tapis_cli.commands.taccapis.v2.apps import create from tapis_cli.commands.taccapis.v2.apps import disable from tapis_cli.commands.taccapis.v2.apps import enable from tapis_cli.commands.taccapis.v2.apps import history from tapis_cli.comm...
@pytest.mark.smoketest def test_can_import_apps_modules():
from tapis_cli.commands.taccapis.v2.apps import create from tapis_cli.commands.taccapis.v2.apps import disable from tapis_cli.commands.taccapis.v2.apps import enable from tapis_cli.commands.taccapis.v2.apps import history from tapis_cli.commands.taccapis.v2.apps import list from tapis_cli.comman...
tapis_cli.commands.taccapis.v2.apim import token_create from tapis_cli.commands.taccapis.v2.apim import token_refresh from tapis_cli.commands.taccapis.v2.apim import formatters from tapis_cli.commands.taccapis.v2.apim import models @pytest.mark.smoketest def test_can_import_apps_modules():
74
74
249
13
60
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_apps_modules
test_can_import_apps_modules
24
41
24
25
9a07440a1b7eff622642f9c8ffd934f44d1011ae
bigcode/the-stack
train
ceb9696dcde7d16a312654dd
train
function
@pytest.mark.smoketest def test_can_import_profiles_modules(): from tapis_cli.commands.taccapis.v2.profiles import list from tapis_cli.commands.taccapis.v2.profiles import show from tapis_cli.commands.taccapis.v2.profiles import show_self from tapis_cli.commands.taccapis.v2.profiles import formatters ...
@pytest.mark.smoketest def test_can_import_profiles_modules():
from tapis_cli.commands.taccapis.v2.profiles import list from tapis_cli.commands.taccapis.v2.profiles import show from tapis_cli.commands.taccapis.v2.profiles import show_self from tapis_cli.commands.taccapis.v2.profiles import formatters from tapis_cli.commands.taccapis.v2.profiles import models
accapis.v2.metadata import show from tapis_cli.commands.taccapis.v2.metadata import update from tapis_cli.commands.taccapis.v2.metadata import formatters from tapis_cli.commands.taccapis.v2.metadata import models @pytest.mark.smoketest def test_can_import_profiles_modules():
64
64
90
13
50
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_profiles_modules
test_can_import_profiles_modules
104
110
104
105
457165bca40587a2ed686d91ad9a9d4ef4db2187
bigcode/the-stack
train
28ee278cdc27b364fc6e190f
train
function
@pytest.mark.smoketest def test_can_import_systems_modules(): from tapis_cli.commands.taccapis.v2.systems import create from tapis_cli.commands.taccapis.v2.systems import disable from tapis_cli.commands.taccapis.v2.systems import enable from tapis_cli.commands.taccapis.v2.systems import history from...
@pytest.mark.smoketest def test_can_import_systems_modules():
from tapis_cli.commands.taccapis.v2.systems import create from tapis_cli.commands.taccapis.v2.systems import disable from tapis_cli.commands.taccapis.v2.systems import enable from tapis_cli.commands.taccapis.v2.systems import history from tapis_cli.commands.taccapis.v2.systems import list from t...
_cli.commands.taccapis.v2.profiles import list from tapis_cli.commands.taccapis.v2.profiles import show from tapis_cli.commands.taccapis.v2.profiles import show_self from tapis_cli.commands.taccapis.v2.profiles import formatters from tapis_cli.commands.taccapis.v2.profiles import models @pytest.mark.smo...
88
88
294
14
73
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_systems_modules
test_can_import_systems_modules
113
132
113
114
128a386a4faae225fc15c2e3ffebe1d8fe4e156b
bigcode/the-stack
train
8aa1fa0e00bc5942a6ab8aa9
train
function
@pytest.mark.smoketest def test_can_import_metadata_modules(): from tapis_cli.commands.taccapis.v2.metadata import create from tapis_cli.commands.taccapis.v2.metadata import delete from tapis_cli.commands.taccapis.v2.metadata import list from tapis_cli.commands.taccapis.v2.metadata import search fro...
@pytest.mark.smoketest def test_can_import_metadata_modules():
from tapis_cli.commands.taccapis.v2.metadata import create from tapis_cli.commands.taccapis.v2.metadata import delete from tapis_cli.commands.taccapis.v2.metadata import list from tapis_cli.commands.taccapis.v2.metadata import search from tapis_cli.commands.taccapis.v2.metadata import show from ...
.v2.jobs import submit from tapis_cli.commands.taccapis.v2.jobs import formatters from tapis_cli.commands.taccapis.v2.jobs import models @pytest.mark.smoketest def test_can_import_keys_modules(): pass @pytest.mark.smoketest def test_can_import_metadata_modules():
64
64
126
13
50
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_metadata_modules
test_can_import_metadata_modules
92
101
92
93
356494f566688ef679ca76f46d22ce879e6ad054
bigcode/the-stack
train
388db472a6fa15616678738c
train
function
@pytest.mark.smoketest def test_can_import_uuid_modules(): pass
@pytest.mark.smoketest def test_can_import_uuid_modules():
pass
s import status from tapis_cli.commands.taccapis.v2.systems import unpublish from tapis_cli.commands.taccapis.v2.systems import formatters from tapis_cli.commands.taccapis.v2.systems import models @pytest.mark.smoketest def test_can_import_uuid_modules():
64
64
16
13
50
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_uuid_modules
test_can_import_uuid_modules
135
137
135
136
b7d2c5e48e749297ede8d819191268ad22b6ac38
bigcode/the-stack
train
062e548b5be4f82fded961a9
train
function
@pytest.mark.smoketest def test_can_import_actors_modules(): pass
@pytest.mark.smoketest def test_can_import_actors_modules():
pass
import pytest @pytest.mark.smoketest def test_can_import_tapis_cli(): import tapis_cli @pytest.mark.smoketest def test_can_import_actors_modules():
36
64
17
14
21
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_actors_modules
test_can_import_actors_modules
9
11
9
10
ec1e0ecb7bcdee529643d92b4a19f60529cac9ab
bigcode/the-stack
train
477ee4712e2c2cef91f00058
train
function
@pytest.mark.smoketest @pytest.mark.parametrize('attribute,accept_none,expect_exception', [('title', False, False), ('url', False, True)]) def test_about(attribute, accept_none, expect_exception): from tapis_cli import About def test_code(): a = About() val = getattr(a,...
@pytest.mark.smoketest @pytest.mark.parametrize('attribute,accept_none,expect_exception', [('title', False, False), ('url', False, True)]) def test_about(attribute, accept_none, expect_exception):
from tapis_cli import About def test_code(): a = About() val = getattr(a, attribute) if val is None and not accept_none: raise ValueError('{} cannot be None'.format(attribute))
from tapis_cli.commands.taccapis.v2.systems.formatters import SystemsFormatMany @pytest.mark.smoketest @pytest.mark.parametrize('attribute,accept_none,expect_exception', [('title', False, False), ('url', False, True)]) def test_about(attribute, accept_none, expect_exception):
64
64
91
44
19
bpachev/tapis-cli
tests/test_000_import.py
Python
test_about
test_about
161
171
161
164
77346ad9d2dc18a755061dfda184e508a301407f
bigcode/the-stack
train
4e1951b8acb83517bca9a2d3
train
function
@pytest.mark.smoketest def test_can_import_files_helpers(): from tapis_cli.commands.taccapis.v2.files.helpers.upload import upload from tapis_cli.commands.taccapis.v2.files.helpers.sync import download from tapis_cli.commands.taccapis.v2.files.helpers.stat import (isfile, ...
@pytest.mark.smoketest def test_can_import_files_helpers():
from tapis_cli.commands.taccapis.v2.files.helpers.upload import upload from tapis_cli.commands.taccapis.v2.files.helpers.sync import download from tapis_cli.commands.taccapis.v2.files.helpers.stat import (isfile, isdir, stat, ...
accapis.v2.files import upload from tapis_cli.commands.taccapis.v2.files import formatters from tapis_cli.commands.taccapis.v2.files import models from tapis_cli.commands.taccapis.v2.files import helpers @pytest.mark.smoketest def test_can_import_files_helpers():
64
64
113
13
50
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_files_helpers
test_can_import_files_helpers
61
70
61
62
2f51bd9bc84e75afd36861f2ab6192389b3aef9e
bigcode/the-stack
train
297ec7a67a409d5da113fd0a
train
function
@pytest.mark.smoketest def test_can_import_formatone_subclasses(): from tapis_cli.commands.taccapis.v2.apim.formatters import TokenFormatOne from tapis_cli.commands.taccapis.v2.apps.formatters import AppsFormatOne from tapis_cli.commands.taccapis.v2.files.formatters import FilesFormatOne from tapis_cli....
@pytest.mark.smoketest def test_can_import_formatone_subclasses():
from tapis_cli.commands.taccapis.v2.apim.formatters import TokenFormatOne from tapis_cli.commands.taccapis.v2.apps.formatters import AppsFormatOne from tapis_cli.commands.taccapis.v2.files.formatters import FilesFormatOne from tapis_cli.commands.taccapis.v2.jobs.formatters import JobsFormatOne from ...
publish from tapis_cli.commands.taccapis.v2.systems import formatters from tapis_cli.commands.taccapis.v2.systems import models @pytest.mark.smoketest def test_can_import_uuid_modules(): pass @pytest.mark.smoketest def test_can_import_formatone_subclasses():
64
64
144
15
48
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_formatone_subclasses
test_can_import_formatone_subclasses
140
148
140
141
2a2b79da043b3c3e5b9544044a5d10828e87904b
bigcode/the-stack
train
9c5f8a26811e0889d4384fd7
train
function
@pytest.mark.smoketest def test_can_import_files_modules(): from tapis_cli.commands.taccapis.v2.files import delete from tapis_cli.commands.taccapis.v2.files import download from tapis_cli.commands.taccapis.v2.files import history from tapis_cli.commands.taccapis.v2.files import list from tapis_cli....
@pytest.mark.smoketest def test_can_import_files_modules():
from tapis_cli.commands.taccapis.v2.files import delete from tapis_cli.commands.taccapis.v2.files import download from tapis_cli.commands.taccapis.v2.files import history from tapis_cli.commands.taccapis.v2.files import list from tapis_cli.commands.taccapis.v2.files import pems_drop from tapis_c...
apis.v2.apps import unpublish from tapis_cli.commands.taccapis.v2.apps import update from tapis_cli.commands.taccapis.v2.apps import formatters from tapis_cli.commands.taccapis.v2.apps import models @pytest.mark.smoketest def test_can_import_files_modules():
64
64
206
13
50
bpachev/tapis-cli
tests/test_000_import.py
Python
test_can_import_files_modules
test_can_import_files_modules
44
58
44
45
5a5c51c6163c7a0869c5ae3cac16853765caa0a8
bigcode/the-stack
train
617e7c9bbd7b2c34041ad6d4
train
function
@builtinify def locking(fd, mode, nbytes): '''lock or unlock a number of bytes in a file.''' rv = _locking(fd, mode, nbytes) if rv != 0: e = get_errno() raise IOError(e, errno.errorcode[e])
@builtinify def locking(fd, mode, nbytes):
'''lock or unlock a number of bytes in a file.''' rv = _locking(fd, mode, nbytes) if rv != 0: e = get_errno() raise IOError(e, errno.errorcode[e])
LK_RLCK, LK_NBRLCK = range(5) _locking = _c._locking _locking.argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int] _locking.restype = ctypes.c_int @builtinify def locking(fd, mode, nbytes):
64
64
62
13
50
kantai/passe-pypy-taint-tracking
lib_pypy/msvcrt.py
Python
locking
locking
41
47
41
42
2e38c2f3c574b6cdbae7ba5956a646b91e831a49
bigcode/the-stack
train
78ead33c6bcb1b9c39425dd4
train
function
def inner_fct(prior_result, A): return prior_result * A
def inner_fct(prior_result, A):
return prior_result * A
import aesara import aesara.tensor as tt k = tt.iscalar("k") A = tt.vector("A") def inner_fct(prior_result, A):
36
64
17
10
26
abdalazizrashid/Theano-PyMC
doc/crei2013/scan_pow.py
Python
inner_fct
inner_fct
9
10
9
9
ce13f0876b917e27a42f02f16c99672860b42967
bigcode/the-stack
train
de4b193a1e69d4ed85d4b748
train
class
class WalletActionStore: """ WalletActionStore keeps track of all wallet actions that require persistence. Used by Colored coins, Atomic swaps, Rate Limited, and Authorized payee wallets """ db_connection: aiosqlite.Connection cache_size: uint32 db_wrapper: DBWrapper @classmethod a...
class WalletActionStore:
""" WalletActionStore keeps track of all wallet actions that require persistence. Used by Colored coins, Atomic swaps, Rate Limited, and Authorized payee wallets """ db_connection: aiosqlite.Connection cache_size: uint32 db_wrapper: DBWrapper @classmethod async def create(cls, db_w...
from typing import List, Optional import aiosqlite from sector.util.db_wrapper import DBWrapper from sector.util.ints import uint32 from sector.wallet.util.wallet_types import WalletType from sector.wallet.wallet_action import WalletAction class WalletActionStore:
55
256
884
5
49
bithadder/sector-blockchain
sector/wallet/wallet_action_store.py
Python
WalletActionStore
WalletActionStore
11
140
11
11
bcab955afbdb2a31808b6fc5da00080ef0d01bbe
bigcode/the-stack
train
2455303ca9f05e1695cfeaf2
train
function
def test_reading_ndvits_summary_file(): """ test reading in existing ndvits summary timeseries """ sitename = "dukehw" roiname = "DB_1000" ndvi_file = "{}_{}_ndvi_3day.csv".format(sitename, roiname) # set up path to roistats file ndvi_path = os.path.join(SAMPLE_DATA_DIR, sitename, "ROI...
def test_reading_ndvits_summary_file():
""" test reading in existing ndvits summary timeseries """ sitename = "dukehw" roiname = "DB_1000" ndvi_file = "{}_{}_ndvi_3day.csv".format(sitename, roiname) # set up path to roistats file ndvi_path = os.path.join(SAMPLE_DATA_DIR, sitename, "ROI", ndvi_file) ndvits = ndvi_summary...
-8 -*- """ test_ndvisummarytimeseries -------------------------- Tests for `vegindex.ndvi_summary_timeseries` module. """ import os import numpy as np from PIL import Image from pkg_resources import Requirement from pkg_resources import resource_filename from vegindex import config from vegindex import ndvi_summary...
114
114
381
10
103
tmilliman/python-vegindex
tests/test_ndvisummarytimeseries.py
Python
test_reading_ndvits_summary_file
test_reading_ndvits_summary_file
25
61
25
25
c7156ead91eb371b220ad1fe6c54a7abbc1f248f
bigcode/the-stack
train
45c049f8ae64157a583762b8
train
function
def test_get_ndvi_summary_file(): """ test reading in existing ndvits summary timeseries using the helper function. """ sitename = "dukehw" roiname = "DB_1000" ndvits = vi.get_ndvi_summary(sitename, roiname, nday=3) first_row = ndvits.rows[0] last_row = ndvits.rows[-1] # test ...
def test_get_ndvi_summary_file():
""" test reading in existing ndvits summary timeseries using the helper function. """ sitename = "dukehw" roiname = "DB_1000" ndvits = vi.get_ndvi_summary(sitename, roiname, nday=3) first_row = ndvits.rows[0] last_row = ndvits.rows[-1] # test that we're getting header metadata...
_2020_07_15_115405.jpg" ) np.testing.assert_equal(first_row["ndvi_mean"], 0.22027) np.testing.assert_equal(first_row["ndvi_std"], 0.16966) np.testing.assert_equal(first_row["max_solar_elev"], 75.9963) np.testing.assert_equal(len(ndvits.rows), 870) def test_get_ndvi_summary_file():
92
92
308
8
84
tmilliman/python-vegindex
tests/test_ndvisummarytimeseries.py
Python
test_get_ndvi_summary_file
test_get_ndvi_summary_file
64
93
64
64
cf77fa1fef4ad46f84c96108500299cf559824d0
bigcode/the-stack
train
cec22d26dcc25f5487da54fe
train
class
class Title(_BaseTraceHierarchyType): # class properties # -------------------- _parent_path_str = "histogram2dcontour.colorbar" _path_str = "histogram2dcontour.colorbar.title" _valid_props = {"font", "side", "text"} # font # ---- @property def font(self): """ Sets ...
class Title(_BaseTraceHierarchyType): # class properties # --------------------
_parent_path_str = "histogram2dcontour.colorbar" _path_str = "histogram2dcontour.colorbar.title" _valid_props = {"font", "side", "text"} # font # ---- @property def font(self): """ Sets this color bar's title font. Note that the title's font used to be set by the now...
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Title(_BaseTraceHierarchyType): # class properties # --------------------
42
256
1,421
17
24
acrucetta/Chicago_COVI_WebApp
env/lib/python3.8/site-packages/plotly/graph_objs/histogram2dcontour/colorbar/_title.py
Python
Title
Title
5
204
5
8
ca7f8fa07437d9c4b5960dfdb6c2482fd225e18a
bigcode/the-stack
train
667956cc59d54cf991b0a511
train
class
class Character: def __init__(self, name, league, classId, ascendency_class, className, level, exp, last_active): self.name = name self.league = league self.classId = classId self.ascendency_class = ascendency_class self.className = className self.level = level ...
class Character:
def __init__(self, name, league, classId, ascendency_class, className, level, exp, last_active): self.name = name self.league = league self.classId = classId self.ascendency_class = ascendency_class self.className = className self.level = level self.experience...
class Character:
3
64
167
3
0
FWidm/poe-wrapper
src/models/character.py
Python
Character
Character
1
17
1
1
6c343cae79dc943532601cc0950ef31fb419106a
bigcode/the-stack
train
9f90c7eacbfcdeda15291169
train
function
def _daemonize(pid_file: str): """Daemonize the process Parameters ---------- pid_file: str The path to the pid file for the daemon. """ # Check for a pidfile to see if the daemon is already running try: with open(pid_file, 'r') as fptr: pid = int(fptr.read().st...
def _daemonize(pid_file: str):
"""Daemonize the process Parameters ---------- pid_file: str The path to the pid file for the daemon. """ # Check for a pidfile to see if the daemon is already running try: with open(pid_file, 'r') as fptr: pid = int(fptr.read().strip()) except IOError: ...
# daemon.py - daemonizer for the star tracker # by Umair Khan and Ryan Medick, from the Portland State Aerospace Society # Imports (internal) import sys import os from argparse import ArgumentParser # Imports (external) from star_tracker.star_tracker import StarTracker def _daemonize(pid_file: str):
68
97
324
9
58
oresat/oresat-star-tracker-software
star_tracker/main.py
Python
_daemonize
_daemonize
13
60
13
13
70fb922d09e9a0a2533c6c7f2169fc42aab08cd7
bigcode/the-stack
train
cbe0b1b8776ad5f3255d5766
train
function
def main(): pid_file = "/run/oresat-star-trackerd.pid" parser = ArgumentParser() parser.add_argument("-d", "--daemon", action="store_true", help="daemonize the process") args = parser.parse_args() if args.daemon: _daemonize(pid_file) data_dir = "/usr/share/ores...
def main():
pid_file = "/run/oresat-star-trackerd.pid" parser = ArgumentParser() parser.add_argument("-d", "--daemon", action="store_true", help="daemonize the process") args = parser.parse_args() if args.daemon: _daemonize(pid_file) data_dir = "/usr/share/oresat-star-trac...
os.dup2(stdout.fileno(), sys.stdout.fileno()) os.dup2(stderr.fileno(), sys.stderr.fileno()) pid = str(os.getpid()) with open(pid_file, 'w+') as fptr: fptr.write(pid + '\n') # Run script def main():
64
64
132
3
60
oresat/oresat-star-tracker-software
star_tracker/main.py
Python
main
main
64
80
64
64
4f9c9ef08269e3e7e0638c224f11bef911dc0826
bigcode/the-stack
train
894e45e0670e8dc57e03f6e7
train
class
class QosConferenceInfo: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ sensitive_list = [...
class QosConferenceInfo:
""" Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ sensitive_list = [] openapi_types = { ...
# coding: utf-8 import re import six from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization class QosConferenceInfo:
34
256
3,733
6
27
huaweicloud/huaweicloud-sdk-python-v3
huaweicloud-sdk-meeting/huaweicloudsdkmeeting/v1/model/qos_conference_info.py
Python
QosConferenceInfo
QosConferenceInfo
11
519
11
13
623bb67ee65491eb577fb6d250bdac7881bc5dc3
bigcode/the-stack
train
61dce703cdc235d46681ad22
train
class
class LogEntryManager(models.Manager): use_in_migrations = True def log_action(self, user_id, content_type_id, object_id, object_repr, action_flag, change_message=''): e = self.model( None, None, user_id, content_type_id, smart_text(object_id), object_repr[:200], action_flag, ch...
class LogEntryManager(models.Manager):
use_in_migrations = True def log_action(self, user_id, content_type_id, object_id, object_repr, action_flag, change_message=''): e = self.model( None, None, user_id, content_type_id, smart_text(object_id), object_repr[:200], action_flag, change_message ) e.save()...
Match, reverse from django.db import models from django.utils.encoding import python_2_unicode_compatible, smart_text from django.utils.translation import ugettext, ugettext_lazy as _ ADDITION = 1 CHANGE = 2 DELETION = 3 class LogEntryManager(models.Manager):
64
64
82
7
56
jedie/django
django/contrib/admin/models.py
Python
LogEntryManager
LogEntryManager
16
24
16
16
4dcda611c39def4d8e0ba5db0e5bcbdd593c5aed
bigcode/the-stack
train
a7fb539009cd8e3dafb0c7c4
train
class
@python_2_unicode_compatible class LogEntry(models.Model): action_time = models.DateTimeField(_('action time'), auto_now=True) user = models.ForeignKey(settings.AUTH_USER_MODEL) content_type = models.ForeignKey(ContentType, blank=True, null=True) object_id = models.TextField(_('object id'), blank=True, ...
@python_2_unicode_compatible class LogEntry(models.Model):
action_time = models.DateTimeField(_('action time'), auto_now=True) user = models.ForeignKey(settings.AUTH_USER_MODEL) content_type = models.ForeignKey(ContentType, blank=True, null=True) object_id = models.TextField(_('object id'), blank=True, null=True) object_repr = models.CharField(_('object rep...
python_2_unicode_compatible, smart_text from django.utils.translation import ugettext, ugettext_lazy as _ ADDITION = 1 CHANGE = 2 DELETION = 3 class LogEntryManager(models.Manager): use_in_migrations = True def log_action(self, user_id, content_type_id, object_id, object_repr, action_flag, change_message='...
138
138
463
14
124
jedie/django
django/contrib/admin/models.py
Python
LogEntry
LogEntry
27
84
27
28
21acf43c26052d6cb9b6c4e59d132c1ac8de178f
bigcode/the-stack
train
2520929d76d446b8eea842d6
train
class
class Genre(models.Model): title = models.CharField("Название", max_length=200) slug = models.SlugField("Путь", unique=True) description = models.TextField("Описание") def __str__(self): return self.title
class Genre(models.Model):
title = models.CharField("Название", max_length=200) slug = models.SlugField("Путь", unique=True) description = models.TextField("Описание") def __str__(self): return self.title
from django.contrib.auth import get_user_model from django.db import models User = get_user_model() class Genre(models.Model):
26
64
54
5
21
kudinov-prog/music_square
posts/models.py
Python
Genre
Genre
8
15
8
9
6b7ac0dca0b0fdb6035f24e7c594c79d788ad8ac
bigcode/the-stack
train
8fcbfece264630104967edf7
train
class
class Follow(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="follower") author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="following") class Meta: constraints = [ mod...
class Follow(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="follower") author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="following") class Meta: constraints = [ models.UniqueConstraint( ...
Автор комментария") text = models.TextField("Текст комментария") created = models.DateTimeField("Время публикации", auto_now_add=True) def __str__(self): return self.text class Meta: ordering = ["-created"] class Follow(models.Model):
63
64
73
5
58
kudinov-prog/music_square
posts/models.py
Python
Follow
Follow
55
67
55
56
570a5301faad544279fe6b1935cac1d9ee1a937f
bigcode/the-stack
train