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
17677d0f7f1418cdb84d2cac
train
function
def check_extraction_result(before_extraction, extracted): """Checks parsing TFF to TF has constructed an object of correct type.""" py_typecheck.check_type(before_extraction, building_blocks.ComputationBuildingBlock) py_typecheck.check_type(extracted, building_blocks.ComputationBuilding...
def check_extraction_result(before_extraction, extracted):
"""Checks parsing TFF to TF has constructed an object of correct type.""" py_typecheck.check_type(before_extraction, building_blocks.ComputationBuildingBlock) py_typecheck.check_type(extracted, building_blocks.ComputationBuildingBlock) if before_extraction.type_signature.is_function():...
py_typecheck from tensorflow_federated.python.core.impl.compiler import building_blocks from tensorflow_federated.python.core.impl.compiler import intrinsic_defs from tensorflow_federated.python.core.impl.compiler import transformation_utils from tensorflow_federated.python.core.impl.compiler import transformations fr...
129
129
433
11
117
truthiswill/federated
tensorflow_federated/python/core/backends/mapreduce/transformations.py
Python
check_extraction_result
check_extraction_result
82
118
82
82
a637a6ebb46e263769739da96996ad537d166185
bigcode/the-stack
train
7999c4cf31215bca7d871d96
train
class
class ProjectInfo(db.Model): """ Contains all project info localized into supported languages """ __tablename__ = "project_info" project_id = db.Column(db.Integer, db.ForeignKey("projects.id"), primary_key=True) locale = db.Column(db.String(10), primary_key=True) name = db.Column(db.String(512)) ...
class ProjectInfo(db.Model):
""" Contains all project info localized into supported languages """ __tablename__ = "project_info" project_id = db.Column(db.Integer, db.ForeignKey("projects.id"), primary_key=True) locale = db.Column(db.String(10), primary_key=True) name = db.Column(db.String(512)) short_description = db.Col...
from flask import current_app from sqlalchemy.dialects.postgresql import TSVECTOR from typing import List from server import db from server.models.dtos.project_dto import ProjectInfoDTO class ProjectInfo(db.Model):
46
256
1,027
6
39
Guillon88/tasking-manager
server/models/postgis/project_info.py
Python
ProjectInfo
ProjectInfo
8
130
8
8
20e45b8b6f9fa617925ea91a6a070e2522d4a9c2
bigcode/the-stack
train
2d0e70cc265c6661ad5a87a9
train
function
def train(rank, a, h): a.checkpoint_path = a.models_dir.joinpath(a.run_id+'_fregan') a.checkpoint_path.mkdir(exist_ok=True) a.training_epochs = 3100 a.stdout_interval = 5 a.checkpoint_interval = a.backup_every a.summary_interval = 5000 a.validation_interval = 1000 a.fine_tuning = True ...
def train(rank, a, h):
a.checkpoint_path = a.models_dir.joinpath(a.run_id+'_fregan') a.checkpoint_path.mkdir(exist_ok=True) a.training_epochs = 3100 a.stdout_interval = 5 a.checkpoint_interval = a.backup_every a.summary_interval = 5000 a.validation_interval = 1000 a.fine_tuning = True a.input_wavs_dir = a...
import warnings warnings.simplefilter(action='ignore', category=FutureWarning) import itertools import os import time import torch import torch.nn.functional as F from torch.utils.tensorboard import SummaryWriter from torch.utils.data import DistributedSampler, DataLoader from torch.distributed import init_process_gro...
186
256
2,415
8
177
10088/MockingBird
vocoder/fregan/train.py
Python
train
train
23
244
23
24
47cd6ddc62ec8981bd5e33c88345c7124716e729
bigcode/the-stack
train
57b578c5d9b2655dbfecc633
train
class
class Migration(migrations.Migration): dependencies = [ ('portfolio', '0027_auto_20200703_1325'), ] operations = [ migrations.AlterField( model_name='link', name='view', field=models.CharField(choices=[('portfolio:project-detail', 'Project View'), ('port...
class Migration(migrations.Migration):
dependencies = [ ('portfolio', '0027_auto_20200703_1325'), ] operations = [ migrations.AlterField( model_name='link', name='view', field=models.CharField(choices=[('portfolio:project-detail', 'Project View'), ('portfolio:photo-detail', 'Photo View'), ('po...
# Generated by Django 3.0.7 on 2020-07-03 13:28 from django.db import migrations, models class Migration(migrations.Migration):
38
64
104
7
30
FabianVolkers/portfolio
homepage/portfolio/migrations/0028_auto_20200703_1328.py
Python
Migration
Migration
6
18
6
7
31221425cd32996ff240798343ba26efa4907ea2
bigcode/the-stack
train
85ef87e50de740cd258485a5
train
class
class Daemon(DaemonThread): def __init__(self, config, fd, is_gui): DaemonThread.__init__(self) self.config = config if config.get('offline'): self.network = None else: self.network = Network(config) self.network.start() self.fx = FxThread...
class Daemon(DaemonThread):
def __init__(self, config, fd, is_gui): DaemonThread.__init__(self) self.config = config if config.get('offline'): self.network = None else: self.network = Network(config) self.network.start() self.fx = FxThread(config, self.network) ...
get_server]", e) if not create_time or create_time < time.time() - 1.0: return None # Sleep a bit and try again; it might have just been started time.sleep(1.0) def get_rpc_credentials(config): rpc_user = config.get('rpcuser', None) rpc_password = config.get('rpcpassword', ...
256
256
1,586
8
247
zakurai/electrum-xsh3
lib/daemon.py
Python
Daemon
Daemon
120
315
120
121
a24b18bebaae0531b095facbab694f89439c720d
bigcode/the-stack
train
a5a314f258893d2a95077403
train
function
def get_lockfile(config): return os.path.join(config.path, 'daemon')
def get_lockfile(config):
return os.path.join(config.path, 'daemon')
emonThread from .util import print_error, to_string from .wallet import Wallet from .storage import WalletStorage from .commands import known_commands, Commands from .simple_config import SimpleConfig from .exchange_rate import FxThread from .plugins import run_hook def get_lockfile(config):
64
64
17
6
57
zakurai/electrum-xsh3
lib/daemon.py
Python
get_lockfile
get_lockfile
47
48
47
47
94f3762e5cbd2eebfd98de312c567aec395e6acf
bigcode/the-stack
train
ec054af6057003b5cdedd5ce
train
function
def get_server(config): lockfile = get_lockfile(config) while True: create_time = None try: with open(lockfile) as f: (host, port), create_time = ast.literal_eval(f.read()) rpc_user, rpc_password = get_rpc_credentials(config) if rpc_pas...
def get_server(config):
lockfile = get_lockfile(config) while True: create_time = None try: with open(lockfile) as f: (host, port), create_time = ast.literal_eval(f.read()) rpc_user, rpc_password = get_rpc_credentials(config) if rpc_password == '': ...
os.O_WRONLY, 0o644), None except OSError: pass server = get_server(config) if server is not None: return None, server # Couldn't connect; remove lockfile and try again. remove_lockfile(lockfile) def get_server(config):
64
64
213
5
59
zakurai/electrum-xsh3
lib/daemon.py
Python
get_server
get_server
74
97
74
74
5ec48a0eb113874cfbb8709f9e9704899c366c55
bigcode/the-stack
train
82aa52ac6e8d2fa08e9ceaf8
train
function
def remove_lockfile(lockfile): os.unlink(lockfile)
def remove_lockfile(lockfile):
os.unlink(lockfile)
from .storage import WalletStorage from .commands import known_commands, Commands from .simple_config import SimpleConfig from .exchange_rate import FxThread from .plugins import run_hook def get_lockfile(config): return os.path.join(config.path, 'daemon') def remove_lockfile(lockfile):
64
64
13
7
57
zakurai/electrum-xsh3
lib/daemon.py
Python
remove_lockfile
remove_lockfile
51
52
51
51
956f42754bcf750ed19fa3fdd4581c4163627d9b
bigcode/the-stack
train
01d3179dee04f9c5704139f2
train
function
def get_fd_or_server(config): '''Tries to create the lockfile, using O_EXCL to prevent races. If it succeeds it returns the FD. Otherwise try and connect to the server specified in the lockfile. If this succeeds, the server is returned. Otherwise remove the lockfile and try again.''' lockfile ...
def get_fd_or_server(config):
'''Tries to create the lockfile, using O_EXCL to prevent races. If it succeeds it returns the FD. Otherwise try and connect to the server specified in the lockfile. If this succeeds, the server is returned. Otherwise remove the lockfile and try again.''' lockfile = get_lockfile(config) whi...
_commands, Commands from .simple_config import SimpleConfig from .exchange_rate import FxThread from .plugins import run_hook def get_lockfile(config): return os.path.join(config.path, 'daemon') def remove_lockfile(lockfile): os.unlink(lockfile) def get_fd_or_server(config):
64
64
164
7
57
zakurai/electrum-xsh3
lib/daemon.py
Python
get_fd_or_server
get_fd_or_server
55
71
55
55
98d88dafafb878c8fd3419ff66231a938ff269d8
bigcode/the-stack
train
89c4008f838e34b0ac2acf44
train
function
def get_rpc_credentials(config): rpc_user = config.get('rpcuser', None) rpc_password = config.get('rpcpassword', None) if rpc_user is None or rpc_password is None: rpc_user = 'user' import ecdsa, base64 bits = 128 nbytes = bits // 8 + (bits % 8 > 0) pw_int = ecdsa.uti...
def get_rpc_credentials(config):
rpc_user = config.get('rpcuser', None) rpc_password = config.get('rpcpassword', None) if rpc_user is None or rpc_password is None: rpc_user = 'user' import ecdsa, base64 bits = 128 nbytes = bits // 8 + (bits % 8 > 0) pw_int = ecdsa.util.randrange(pow(2, bits)) ...
as e: print_error("[get_server]", e) if not create_time or create_time < time.time() - 1.0: return None # Sleep a bit and try again; it might have just been started time.sleep(1.0) def get_rpc_credentials(config):
64
64
197
6
58
zakurai/electrum-xsh3
lib/daemon.py
Python
get_rpc_credentials
get_rpc_credentials
100
117
100
100
75c6f34a31a1228e7b2e526a592921bc86165849
bigcode/the-stack
train
0a3d06de7226a3d5f7229e06
train
function
def indegree(node): node_nu = latter_node_list.count(node) return node_nu
def indegree(node):
node_nu = latter_node_list.count(node) return node_nu
: latter_node = [latter_node] graph[former_node] = latter_node #print(graph) node_list = list(graph.keys()) latter_node_list = [] for i in graph.values(): latter_node_list.extend(i) #print(node_list) #print(latter_node_list) def indegree(node):
64
64
22
5
59
maqueredkop/Bioinformatics_Specialization_Coursea_Exercise
bioinfo_sec2/week2/No7_maximal_nonbranching_paths.py
Python
indegree
indegree
27
29
27
27
95a29573f5b0d5577552d02358f25553c2acf70e
bigcode/the-stack
train
4d704b169ba57cc1628d7a32
train
function
def maximal_nonbranching_paths(graph): paths = [] for v in node_list: indeg = indegree(v) outdeg = outdegree(v) if not (indeg == outdeg == 1): if len(graph[v]) > 0: for w in graph[v]: nonbranching_path = [v, w] while in...
def maximal_nonbranching_paths(graph):
paths = [] for v in node_list: indeg = indegree(v) outdeg = outdegree(v) if not (indeg == outdeg == 1): if len(graph[v]) > 0: for w in graph[v]: nonbranching_path = [v, w] while indegree(w) == outdegree(w) == 1: ...
= list(graph.keys()) latter_node_list = [] for i in graph.values(): latter_node_list.extend(i) #print(node_list) #print(latter_node_list) def indegree(node): node_nu = latter_node_list.count(node) return node_nu def outdegree(node): node_nu = len(graph.get(node, '')) return node_nu def maximal_n...
87
87
293
8
78
maqueredkop/Bioinformatics_Specialization_Coursea_Exercise
bioinfo_sec2/week2/No7_maximal_nonbranching_paths.py
Python
maximal_nonbranching_paths
maximal_nonbranching_paths
35
77
35
35
f1ace3c123193c4dcba2d11c98d6b68246e7d028
bigcode/the-stack
train
91c431ba30daa8cfac8bb94e
train
function
def outdegree(node): node_nu = len(graph.get(node, '')) return node_nu
def outdegree(node):
node_nu = len(graph.get(node, '')) return node_nu
) node_list = list(graph.keys()) latter_node_list = [] for i in graph.values(): latter_node_list.extend(i) #print(node_list) #print(latter_node_list) def indegree(node): node_nu = latter_node_list.count(node) return node_nu def outdegree(node):
64
64
23
5
58
maqueredkop/Bioinformatics_Specialization_Coursea_Exercise
bioinfo_sec2/week2/No7_maximal_nonbranching_paths.py
Python
outdegree
outdegree
31
33
31
31
4b3987b9a74d7ec54bd8cb05f274cb6bd1ea0e73
bigcode/the-stack
train
964d095184a324eacc3f4b5e
train
class
class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Avaliacao', fields=[ ('id', models.AutoField(auto_created=True, prim...
class Migration(migrations.Migration):
initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Avaliacao', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_n...
# Generated by Django 3.0.5 on 2020-04-21 22:30 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
51
64
143
7
43
evaristofm/pontos_turisticos
avaliacoes/migrations/0001_initial.py
Python
Migration
Migration
8
27
8
9
d60c4ceef2373a8979c30b45cb6e5f54590c820e
bigcode/the-stack
train
0015b66e078dedcd40700615
train
class
class ExtensibleJsonFactory: def __init__(self, plugins): self._plugins = plugins def encoder(self, *args, **kwargs): return ExtensibleJsonEncoder(self._plugins, *args, **kwargs) def decoder(self, *args, **kwargs): return ExtensibleJsonDecoder(self._plugins, *args, **kwargs)
class ExtensibleJsonFactory:
def __init__(self, plugins): self._plugins = plugins def encoder(self, *args, **kwargs): return ExtensibleJsonEncoder(self._plugins, *args, **kwargs) def decoder(self, *args, **kwargs): return ExtensibleJsonDecoder(self._plugins, *args, **kwargs)
= self.object_hook super().__init__(*args, **kwargs) self._plugins = plugins def object_hook(self, dct): for plugin in self._plugins: if plugin.decodeCondition(dct): return plugin.decode(dct) return dct class ExtensibleJsonFactory:
64
64
73
6
57
atzannes/extensible-json
extensible_json/extensible_json.py
Python
ExtensibleJsonFactory
ExtensibleJsonFactory
34
42
34
34
f7580b005f0f19745c5af3265ae488d418916fc6
bigcode/the-stack
train
b9a4a2f63d368a86014eb84d
train
class
class ExtensibleJsonEncoder(json.JSONEncoder): def __init__(self, plugins, *args, **kwargs): super().__init__(*args, **kwargs) self._plugins = plugins def default(self, obj): for plugin in self._plugins: if plugin.encodeCondition(obj): return plugin.encode(obj) # else return json.JSONEncoder.default...
class ExtensibleJsonEncoder(json.JSONEncoder):
def __init__(self, plugins, *args, **kwargs): super().__init__(*args, **kwargs) self._plugins = plugins def default(self, obj): for plugin in self._plugins: if plugin.encodeCondition(obj): return plugin.encode(obj) # else return json.JSONEncoder.default(self, obj)
import json class ExtensibleJsonEncoder(json.JSONEncoder):
12
64
82
9
2
atzannes/extensible-json
extensible_json/extensible_json.py
Python
ExtensibleJsonEncoder
ExtensibleJsonEncoder
4
14
4
4
7effd23c32ce96ec66a508650731a68d62b1995c
bigcode/the-stack
train
3bce2530a046571be5f66ac4
train
class
class ExtensibleJsonDecoder(json.JSONDecoder): def __init__(self, plugins, *args, **kwargs): if 'object_hook' in kwargs: raise Exception( "'object_hook' " ) kwargs['object_hook'] = self.object_hook super().__init__(*args, **kwargs) self._plugins = plugins def object_hook(self, dct): for plugin in...
class ExtensibleJsonDecoder(json.JSONDecoder):
def __init__(self, plugins, *args, **kwargs): if 'object_hook' in kwargs: raise Exception( "'object_hook' " ) kwargs['object_hook'] = self.object_hook super().__init__(*args, **kwargs) self._plugins = plugins def object_hook(self, dct): for plugin in self._plugins: if plugin.decodeCondition(dc...
__(*args, **kwargs) self._plugins = plugins def default(self, obj): for plugin in self._plugins: if plugin.encodeCondition(obj): return plugin.encode(obj) # else return json.JSONEncoder.default(self, obj) class ExtensibleJsonDecoder(json.JSONDecoder):
64
64
111
9
55
atzannes/extensible-json
extensible_json/extensible_json.py
Python
ExtensibleJsonDecoder
ExtensibleJsonDecoder
17
31
17
17
18384629fd746dbcb87510b36f907b25818e4c6a
bigcode/the-stack
train
b489e675310ecaac859d1839
train
class
class ListCommand(PluginCommand, CloudPluginCommand): topics = {"list": "cloud"} def __init__(self, context): self.context = context if self.context.debug: print("init command list") # noinspection PyUnusedLocal @command def do_list(self, args, arguments): """ ...
class ListCommand(PluginCommand, CloudPluginCommand):
topics = {"list": "cloud"} def __init__(self, context): self.context = context if self.context.debug: print("init command list") # noinspection PyUnusedLocal @command def do_list(self, args, arguments): """ :: Usage: list [--...
from __future__ import print_function from cloudmesh_client.cloud.list import List from cloudmesh_client.shell.command import command from cloudmesh_client.shell.console import Console from cloudmesh_client.default import Default from cloudmesh_client.cloud.image import Image from cloudmesh_client.cloud.flavor import...
107
256
869
11
95
izelarabm/client
cloudmesh_client/shell/plugins/ListCommand.py
Python
ListCommand
ListCommand
16
130
16
16
79c9ff66ce02aa62f6bcb02ba1b51b70ea2ee1a0
bigcode/the-stack
train
f8e488f1d015ca19c292f5c1
train
class
class Label(Base): '''Represants an Label that is related to an annoation. Attributes: idx (int): ID in database. dtype (enum): :class:`lost.db.dtype.Result` type of this attribute. label_leaf_id: ID of related :class:`model.LabelLeaf`. img_anno_id (int): two_d_anno_id (...
class Label(Base):
'''Represants an Label that is related to an annoation. Attributes: idx (int): ID in database. dtype (enum): :class:`lost.db.dtype.Result` type of this attribute. label_leaf_id: ID of related :class:`model.LabelLeaf`. img_anno_id (int): two_d_anno_id (int): times...
Returns: dict: ''' return { 'idx': self.idx, 'name': self.name, 'abbreviation': self.abbreviation, 'description': self.description, 'timestamp': self.timestamp, 'external_id': self.external_id, 'is_deleted':...
132
132
440
4
128
WarrenLata/lost
backend/lost/db/model.py
Python
Label
Label
1,440
1,484
1,440
1,440
88bda2846fc7e18751073cb889921b93322ef6b9
bigcode/the-stack
train
ae40264aa91e4b3f85d89c0c
train
class
class Group(Base): __tablename__ = 'group' idx = Column(Integer(), primary_key=True) name = Column(String(50), unique=True) manager_id = Column(Integer(), ForeignKey('user.idx', ondelete='CASCADE')) is_user_default = Column(Boolean(), nullable=False, server_default='0') users = relationship("Use...
class Group(Base):
__tablename__ = 'group' idx = Column(Integer(), primary_key=True) name = Column(String(50), unique=True) manager_id = Column(Integer(), ForeignKey('user.idx', ondelete='CASCADE')) is_user_default = Column(Boolean(), nullable=False, server_default='0') users = relationship("User", secondary="user...
' idx = Column(Integer(), primary_key=True) user_id = Column(Integer(), ForeignKey('user.idx', ondelete='CASCADE')) role_id = Column(Integer(), ForeignKey('role.idx', ondelete='CASCADE')) role = relationship('Role', uselist=False) class Group(Base):
64
64
80
4
60
WarrenLata/lost
backend/lost/db/model.py
Python
Group
Group
96
102
96
96
47c5dd974cc64c8b359be0b80413d13d9d69a9ae
bigcode/the-stack
train
c79d3b9c2e61db9d16492799
train
class
class PipeElement(Base): """One element in a workflow pipeline. A pipeline element can be an algorithm or an anno_task. Attributes: idx (int): ID in database. state (enum): Status of this pipeline element. See :class:`data_model.state.PipeElement` script_id (int): ID of...
class PipeElement(Base):
"""One element in a workflow pipeline. A pipeline element can be an algorithm or an anno_task. Attributes: idx (int): ID in database. state (enum): Status of this pipeline element. See :class:`data_model.state.PipeElement` script_id (int): ID of related script. ...
) def __init__(self, idx=None, name=None, path=None, description=None, arguments=None, envs=None, resources=None): self.idx = idx self.name = name self.path = path self.description = description self.arguments = arguments self.envs = envs sel...
256
256
910
5
250
WarrenLata/lost
backend/lost/db/model.py
Python
PipeElement
PipeElement
1,103
1,190
1,103
1,103
c627dcdc1d5a6274e5ec3ed581e8c1a0fcbf1977
bigcode/the-stack
train
fa98ab78bdc7d2655ea0fb07
train
class
class VisualOutput(Base): '''A VisualOutput will be used by a visulaise PipeElement to display statistics about data. Attributes: idx (int): db id. img_path (str): Path to an image that contains some useful informations. For example a diagram. html_string (str): HTML...
class VisualOutput(Base):
'''A VisualOutput will be used by a visulaise PipeElement to display statistics about data. Attributes: idx (int): db id. img_path (str): Path to an image that contains some useful informations. For example a diagram. html_string (str): HTML that should be presented ...
pipe_element_id = Column(Integer, ForeignKey('pipe_element.idx')) def __init__(self, media_id=None, dtype=None, pipe_element_id=None): self.media_id = media_id self.dtype = dtype self.pipe_element_id = pipe_element_id class VisualOutput(Base):
64
64
214
5
58
WarrenLata/lost
backend/lost/db/model.py
Python
VisualOutput
VisualOutput
1,272
1,295
1,272
1,272
de821c7a2cd4aaa651a13e98567297be2440c0bc
bigcode/the-stack
train
9d98f2512a347defaf5ba875
train
class
class UserRoles(Base): __tablename__ = 'user_roles' idx = Column(Integer(), primary_key=True) user_id = Column(Integer(), ForeignKey('user.idx', ondelete='CASCADE')) role_id = Column(Integer(), ForeignKey('role.idx', ondelete='CASCADE')) role = relationship('Role', uselist=False)
class UserRoles(Base):
__tablename__ = 'user_roles' idx = Column(Integer(), primary_key=True) user_id = Column(Integer(), ForeignKey('user.idx', ondelete='CASCADE')) role_id = Column(Integer(), ForeignKey('role.idx', ondelete='CASCADE')) role = relationship('Role', uselist=False)
return True else: return False # Define the Role data-model class Role(Base): __tablename__ = 'role' idx = Column(Integer(), primary_key=True) name = Column(String(50), unique=True) # Define the UserRoles association table class UserRoles(Base):
64
64
73
5
58
WarrenLata/lost
backend/lost/db/model.py
Python
UserRoles
UserRoles
88
93
88
88
ef522dfe6d70bf2f962841052b05e32330904290
bigcode/the-stack
train
95c6632dfa67e28935150d93
train
class
class AnnoTask(Base): """A object that represents a anno task. Attributes: idx (int): ID of this AnnoTask in database. manager_id (int): ID of the Manager who had distributed this Task group_id (int): ID of the assigned Group (None means: All groups are assigned to this task...
class AnnoTask(Base):
"""A object that represents a anno task. Attributes: idx (int): ID of this AnnoTask in database. manager_id (int): ID of the Manager who had distributed this Task group_id (int): ID of the assigned Group (None means: All groups are assigned to this task !) state (enu...
, y], [x, y],...], [[x, y], [x, y],...]] Example: In the following example all bounding boxes of the image annotation will be returned in list style:: >>> img_anno.anno_vec() [[0.1 , 0.2 , 0.3 , 0.18], [0.25, 0.25, 0.2, 0.4]] ...
180
180
602
6
173
WarrenLata/lost
backend/lost/db/model.py
Python
AnnoTask
AnnoTask
902
962
902
902
febf36e97b72c04de3f479ee12ccbc92e4546db2
bigcode/the-stack
train
314af2bbdd3983b258764ec1
train
class
class Result(Base): """The Result of an Algorithm or AnnoTask Attributes: idx (int): ID in database. timestamp (DateTime): Date and time when this result was created. img_annos (list): A list of related :class:`ImageAnno` objects. visual_outputs (list): A list of related :class:...
class Result(Base):
"""The Result of an Algorithm or AnnoTask Attributes: idx (int): ID in database. timestamp (DateTime): Date and time when this result was created. img_annos (list): A list of related :class:`ImageAnno` objects. visual_outputs (list): A list of related :class:`VisualOutput` objec...
, arguments=None): self.idx = idx self.state = state self.dtype = dtype self.anno_task = anno_task self.pipe_id = pipe_id self.is_debug_mode = is_debug_mode self.error_msg = error_msg self.error_reported = error_reported self.warning_msg = warning_...
122
122
409
4
117
WarrenLata/lost
backend/lost/db/model.py
Python
Result
Result
1,193
1,247
1,193
1,193
a9c387674db255b859b227e72d1d17fdc7bf6c9c
bigcode/the-stack
train
46916c3c9f7104caa27d413f
train
class
class TwoDAnno(Base): """A TwoDAnno represents a 2D annotation/ drawing for an image. A TwoDAnno can be of type point, line, bbox or polygon. Attributes: idx (int): ID of this TwoDAnno in database anno_task_id (int): ID of the anno_task this TwoDAnno belongs to. timesta...
class TwoDAnno(Base):
"""A TwoDAnno represents a 2D annotation/ drawing for an image. A TwoDAnno can be of type point, line, bbox or polygon. Attributes: idx (int): ID of this TwoDAnno in database anno_task_id (int): ID of the anno_task this TwoDAnno belongs to. timestamp (DateTime): Timesta...
(), primary_key=True) name = Column(String(50), unique=True) # Define the UserRoles association table class UserRoles(Base): __tablename__ = 'user_roles' idx = Column(Integer(), primary_key=True) user_id = Column(Integer(), ForeignKey('user.idx', ondelete='CASCADE')) role_id = Column(Integer(), F...
256
256
3,532
6
250
WarrenLata/lost
backend/lost/db/model.py
Python
TwoDAnno
TwoDAnno
113
504
113
113
538161666f79b3cfe92b085f64979be49ca54497
bigcode/the-stack
train
321f8352527ab5f3e48302f2
train
class
class ImageAnno(Base): """An ImageAnno represents an image annotation. Multiple labels as well as 2d annotations (e.g. points, lines, boxes, polygons) can be assigned to an image. Attributes: labels (list): The related :class:`Label` object. twod_annos (list): A list of :class:`T...
class ImageAnno(Base):
"""An ImageAnno represents an image annotation. Multiple labels as well as 2d annotations (e.g. points, lines, boxes, polygons) can be assigned to an image. Attributes: labels (list): The related :class:`Label` object. twod_annos (list): A list of :class:`TwoDAnno` objects. ...
label name # >>> twod_anno.get_lbl_vec('name') # ['cow'] # ''' # if which == 'id': # return [lbl.label_leaf.idx for lbl in self.labels] # elif which == 'external_id': # return [lbl.label_leaf.external_id for lbl in self.labels] # elif whi...
256
256
3,186
5
251
WarrenLata/lost
backend/lost/db/model.py
Python
ImageAnno
ImageAnno
572
899
572
572
02f368bfeff84a370ed39144eaebbb0e4a5ab730
bigcode/the-stack
train
525ae3e5e8b73c1195f3ee3a
train
class
class Role(Base): __tablename__ = 'role' idx = Column(Integer(), primary_key=True) name = Column(String(50), unique=True)
class Role(Base):
__tablename__ = 'role' idx = Column(Integer(), primary_key=True) name = Column(String(50), unique=True)
check_password_hash(self.password, password) def has_role(self, role): role_names = [] for r in self.roles: role_names.append(r.name) if role in role_names: return True else: return False # Define the Role data-model class Role(Base):
64
64
33
4
59
WarrenLata/lost
backend/lost/db/model.py
Python
Role
Role
80
83
80
80
226032ce44c782ddf51ecb4593397cf99561911a
bigcode/the-stack
train
8c8833979e8ea44820f1f7d3
train
class
class UserGroups(Base): __tablename__ = 'user_groups' idx = Column(Integer(), primary_key=True) user_id = Column(Integer(), ForeignKey('user.idx', ondelete='CASCADE')) group_id = Column(Integer(), ForeignKey('group.idx', ondelete='CASCADE')) group = relationship('Group', uselist=False)
class UserGroups(Base):
__tablename__ = 'user_groups' idx = Column(Integer(), primary_key=True) user_id = Column(Integer(), ForeignKey('user.idx', ondelete='CASCADE')) group_id = Column(Integer(), ForeignKey('group.idx', ondelete='CASCADE')) group = relationship('Group', uselist=False)
) name = Column(String(50), unique=True) manager_id = Column(Integer(), ForeignKey('user.idx', ondelete='CASCADE')) is_user_default = Column(Boolean(), nullable=False, server_default='0') users = relationship("User", secondary="user_groups") class UserGroups(Base):
64
64
73
5
59
WarrenLata/lost
backend/lost/db/model.py
Python
UserGroups
UserGroups
105
110
105
105
8424ff4897b47e1df4811898ed6bfead55f6315a
bigcode/the-stack
train
6a3c7db06cd5adb8130f3e3c
train
class
class Pipe(Base): """A general pipe (task) that defines how a video/dataset (Media) will be processed. Attributes: idx (int): Id of Pipe in database. name (str): Pipe Name manager_id : If of user who started this pipe state (enum): Status of this pipe. See :class:`data_model.sta...
class Pipe(Base):
"""A general pipe (task) that defines how a video/dataset (Media) will be processed. Attributes: idx (int): Id of Pipe in database. name (str): Pipe Name manager_id : If of user who started this pipe state (enum): Status of this pipe. See :class:`data_model.state.Pipe` p...
_element_id', uselist=False) def __init__(self, idx=None, manager_id=None, group_id=None, state=None, progress=None, dtype=None, pipe_element_id=None, timestamp=None, name=None, instructions=None, configuration=None, last_activity=None, last_annotator=None): ...
162
162
540
4
157
WarrenLata/lost
backend/lost/db/model.py
Python
Pipe
Pipe
965
1,018
965
965
ff9d7d43593d1ce5d4e782ba81ca87446dc1d233
bigcode/the-stack
train
2fe545b3633f381d2b427291
train
class
class ChoosenAnnoTask(Base): """Linking Table which connects Anno Tasks to Groups Attributes: idx (int): ID in database. user_id (int): ID of user who has choosen that anno task anno_task_id (int): ID of the anno task which is connected to the user """ __tablename__ = "choosen_a...
class ChoosenAnnoTask(Base):
"""Linking Table which connects Anno Tasks to Groups Attributes: idx (int): ID in database. user_id (int): ID of user who has choosen that anno task anno_task_id (int): ID of the anno task which is connected to the user """ __tablename__ = "choosen_anno_task" idx = Column(In...
=None, arguments=None, envs=None, resources=None): self.idx = idx self.name = name self.path = path self.description = description self.arguments = arguments self.envs = envs self.resources = resources class ChoosenAnnoTask(Base):
64
64
176
7
56
WarrenLata/lost
backend/lost/db/model.py
Python
ChoosenAnnoTask
ChoosenAnnoTask
1,083
1,100
1,083
1,083
711592363a997e52992a2e0c3f3b2dece61858b8
bigcode/the-stack
train
1aa5926194e7482d61bdb3c0
train
class
class ResultLink(Base): '''Links :class:`Result` objects to :class:`PipelineElement` objects Attributes: idx (int): db id. result_id (int): Id of the realated :class:`Result`. pe_n (int): Id of the :class:`PipelineElement` that has pe_out as output. pe_out (int): Id of the :clas...
class ResultLink(Base):
'''Links :class:`Result` objects to :class:`PipelineElement` objects Attributes: idx (int): db id. result_id (int): Id of the realated :class:`Result`. pe_n (int): Id of the :class:`PipelineElement` that has pe_out as output. pe_out (int): Id of the :class:`PipelineElement` that...
iteration = Column(Integer) def __init__(self, img_path=None, html_string=None, result_id=None, iteration=0): self.img_path = img_path self.html_string = html_string self.result_id = result_id self.iteration = iteration class ResultLink(Base):
64
64
214
5
58
WarrenLata/lost
backend/lost/db/model.py
Python
ResultLink
ResultLink
1,298
1,318
1,298
1,298
a0ea32e6c80fd1d0a04ba1e004bd5f6813e8e4b2
bigcode/the-stack
train
6fd921921c7c661dd1250bd6
train
class
class RequiredLabelLeaf(Base): '''A RequiredLabelLeaf Attributes: idx (int): ID in database. anno_task_id (int): label_leaf_id (int): max_labels (int): Max count of labels that can be assinged for a specific :class:`AnnoTask` max_depth (int): Maximal depth in...
class RequiredLabelLeaf(Base):
'''A RequiredLabelLeaf Attributes: idx (int): ID in database. anno_task_id (int): label_leaf_id (int): max_labels (int): Max count of labels that can be assinged for a specific :class:`AnnoTask` max_depth (int): Maximal depth in a tree beginning from that Lab...
= track_n self.anno_task_id = anno_task_id self.name = name self.timestamp = timestamp self.user_id = user_id self.iteration = iteration self.confidence = confidence self.anno_time = anno_time class RequiredLabelLeaf(Base):
64
64
216
6
57
WarrenLata/lost
backend/lost/db/model.py
Python
RequiredLabelLeaf
RequiredLabelLeaf
1,532
1,554
1,532
1,532
7b42ea6724599d5e1952ae8aee568040da8ff4cb
bigcode/the-stack
train
095a487a65e777168e666227
train
class
class DataExport(Base): '''A DatatExport represents an arbitrary file that is the result of a pipeline. Attributes: idx (str): ID in database. file_path (str): Path to the result file. result_id (int): ID of the releated :class:`Result`. iteration (int): Loop iteration when this...
class DataExport(Base):
'''A DatatExport represents an arbitrary file that is the result of a pipeline. Attributes: idx (str): ID in database. file_path (str): Path to the result file. result_id (int): ID of the releated :class:`Result`. iteration (int): Loop iteration when this DataExport was created....
('pipe_element.idx')) result = relationship("Result", uselist=False) def __init__(self, pe_n=None, pe_out=None, result_id=None): self.pe_n = pe_n self.pe_out = pe_out self.result_id = result_id class DataExport(Base):
64
64
169
5
58
WarrenLata/lost
backend/lost/db/model.py
Python
DataExport
DataExport
1,321
1,339
1,321
1,321
32cff87716b2580e713f12a5de6e92901fe7817d
bigcode/the-stack
train
91dbe9e18d7319861172148a
train
class
class PipeTemplate(Base): """A template of an pipeline that need to be copyed by Pipe. A PipeTemplate Object contains a sequence of PipeElement objects. This sequence will be instantiated when a Pipe is created that uses this PipeTemplate. Each Pipe will then work on his own sequence of PipeElement...
class PipeTemplate(Base):
"""A template of an pipeline that need to be copyed by Pipe. A PipeTemplate Object contains a sequence of PipeElement objects. This sequence will be instantiated when a Pipe is created that uses this PipeTemplate. Each Pipe will then work on his own sequence of PipeElements. Attributes: ...
_id self.timestamp = timestamp self.timestamp_finished = timestamp_finished self.description = description self.is_locked = is_locked self.group_id = group_id self.is_debug_mode = is_debug_mode self.start_definition = start_definition self.logfile_path = l...
70
70
236
5
64
WarrenLata/lost
backend/lost/db/model.py
Python
PipeTemplate
PipeTemplate
1,021
1,046
1,021
1,021
5b7a43141fcd36c2390ed69db90bb74a46df8133
bigcode/the-stack
train
7abe9322413dd0327e5993f9
train
class
class Track(Base): '''Represents a track. Multiple TwoDAnnos are assigned to one track. Attributes: idx (int): ID in database. track_n (int): Track number that identifies this track inside of an annotation session. anno_task_id (int): ID of the related annotation task ...
class Track(Base):
'''Represents a track. Multiple TwoDAnnos are assigned to one track. Attributes: idx (int): ID in database. track_n (int): Track number that identifies this track inside of an annotation session. anno_task_id (int): ID of the related annotation task name (str): A hum...
, annotator_id=None, timestamp_lock=None, timestamp=None, confidence=None, anno_time=None): self.idx = idx self.dtype = dtype self.label_leaf_id = label_leaf_id self.img_anno_id = img_anno_id self.two_d_anno_id = two_d_anno_id self.annota...
114
114
382
4
109
WarrenLata/lost
backend/lost/db/model.py
Python
Track
Track
1,487
1,529
1,487
1,487
5abe97ebb1475cefaf41f2ea5294c34f25585f42
bigcode/the-stack
train
19c8b577f2d4ca08df66c79e
train
class
class User(Base, UserMixin): __tablename__ = 'user' idx = Column(Integer, primary_key=True) is_active = Column('is_active', Boolean(), nullable=False, server_default='1') user_name = Column(String(100), nullable=False, unique=True) email = Column(String(255), unique=True) ...
class User(Base, UserMixin):
__tablename__ = 'user' idx = Column(Integer, primary_key=True) is_active = Column('is_active', Boolean(), nullable=False, server_default='1') user_name = Column(String(100), nullable=False, unique=True) email = Column(String(255), unique=True) email_confirmed_at = Column(...
_name)s_%(column_0_name)s", # "ck": "ck_%(table_name)s_%(constraint_name)s", "fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s", "pk": "pk_%(table_name)s" } metadata = MetaData(naming_convention=convention) Base = declarative_base(metadata=metadata) # Define the User data-model. # NB: Make...
114
115
385
7
107
WarrenLata/lost
backend/lost/db/model.py
Python
User
User
30
76
30
30
28f0b5792550ce8e5fa0ab8b5bea79b19a28d895
bigcode/the-stack
train
b4e4c83e139187bcf433f1f8
train
class
class Worker(Base): '''Represents a container with related celery worker that executes scripts. Attributes: idx (int): ID in database. env_name (str): Name that indicates the environment that is installed in this worker. Each env is realted to a queue in celery. ...
class Worker(Base):
'''Represents a container with related celery worker that executes scripts. Attributes: idx (int): ID in database. env_name (str): Name that indicates the environment that is installed in this worker. Each env is realted to a queue in celery. worker_name (str): U...
Column(Integer, ForeignKey('label_leaf.idx')) max_labels = Column(Integer) # type: lost.db.model.LabelLeaf label_leaf = relationship("LabelLeaf", uselist=False) def __init__(self, anno_task_id=None, label_leaf_id=None, max_labels=None): self.anno_task_id = anno_task_id self.label_leaf_...
94
94
316
4
89
WarrenLata/lost
backend/lost/db/model.py
Python
Worker
Worker
1,557
1,592
1,557
1,557
7e464111581fc932ed4a269bb3a1973b5ad1c4b0
bigcode/the-stack
train
9bac67573c53c5a6c9b04990
train
class
class LabelLeaf(Base): '''A LabelLeaf Attributes: idx (int): ID in database. name (str): Name of the LabelName. abbreviation (str): description (str): timestamp (DateTime): external_id (str): Id of an external semantic label system (for e.g. synsetid of wordnet) ...
class LabelLeaf(Base):
'''A LabelLeaf Attributes: idx (int): ID in database. name (str): Name of the LabelName. abbreviation (str): description (str): timestamp (DateTime): external_id (str): Id of an external semantic label system (for e.g. synsetid of wordnet) is_deleted (Boo...
(Integer) iteration = Column(Integer) pe_jump_id = Column(Integer, ForeignKey('pipe_element.idx')) break_loop = Column(Boolean) pe_jump = relationship("PipeElement", foreign_keys='Loop.pe_jump_id', uselist=False) pipe_element_id = Column(Integer, ForeignKey('pipe_element.i...
145
145
485
5
139
WarrenLata/lost
backend/lost/db/model.py
Python
LabelLeaf
LabelLeaf
1,373
1,437
1,373
1,373
ea81f0234d531e799f2c2742905ba7613c8a37e7
bigcode/the-stack
train
76267bbcbf756e7d468fdd15
train
class
class Loop(Base): '''Defines a Loop element in a pipeline. Attributes: idx (int): ID in database. max_iteration (int): Number of iteration when loop will break. iteration (int): Current iteration of the loop. pe_jump_id (int): ID of the :class:`PipeElement` where this loop shoul...
class Loop(Base):
'''Defines a Loop element in a pipeline. Attributes: idx (int): ID in database. max_iteration (int): Number of iteration when loop will break. iteration (int): Current iteration of the loop. pe_jump_id (int): ID of the :class:`PipeElement` where this loop should jump to. ...
idx = Column(Integer, primary_key=True) file_path = Column(String(4096)) result_id = Column(Integer, ForeignKey('result.idx')) iteration = Column(Integer) def __init__(self, file_path=None, result_id=None, iteration=0): self.file_path = file_path self.result_id = result_id s...
85
85
285
4
80
WarrenLata/lost
backend/lost/db/model.py
Python
Loop
Loop
1,342
1,370
1,342
1,342
ab346e8dfa2f2387d6ae141c5b99bd1b99454d7a
bigcode/the-stack
train
8815bb4486a8454848d2e86b
train
class
class Script(Base): """A script that can be executed in a pipeline. Attributes: idx (int): ID in database. name (str): Name of the algorithm used in this script. path (str): Path to a script that will execute a algorithm on data in database. description (str): Descri...
class Script(Base):
"""A script that can be executed in a pipeline. Attributes: idx (int): ID in database. name (str): Name of the algorithm used in this script. path (str): Path to a script that will execute a algorithm on data in database. description (str): Description of this algori...
(Text) timestamp = Column(DATETIME(fsp=6)) is_debug_mode = Column(Boolean) def __init__(self, idx=None, json_template=None, timestamp=None, is_debug_mode=None): self.idx = idx self.json_template = json_template self.timestamp = timestamp self.debug_mode = is...
78
78
263
4
73
WarrenLata/lost
backend/lost/db/model.py
Python
Script
Script
1,049
1,080
1,049
1,049
0cc78c50cd9daa8851874d6a99b8b715496a58e1
bigcode/the-stack
train
677992bf20cc5cb3a1d71719
train
class
class Datasource(Base): '''Datasource Attributes: idx (int): Id in databse. raw_file_id (int): Link to RawFile. dtype (enum): see :class:`data_model.dtype.Datasource` pipe_element_id: The PipeElement this Datasource belongs to. ''' __tablename__ = "datasource" idx = ...
class Datasource(Base):
'''Datasource Attributes: idx (int): Id in databse. raw_file_id (int): Link to RawFile. dtype (enum): see :class:`data_model.dtype.Datasource` pipe_element_id: The PipeElement this Datasource belongs to. ''' __tablename__ = "datasource" idx = Column(Integer, primary_...
img_anno.bbox_annos: yield bb_anno def iter_visual_outputs(self): '''Iterate over all :class:`VisualOutput` objects in this Result. Returns: Iterator: :class:`VisualOutput`. ''' return iter(self.visual_outputs) class Datasource(Base):
64
64
161
5
59
WarrenLata/lost
backend/lost/db/model.py
Python
Datasource
Datasource
1,250
1,269
1,250
1,250
b706b9df6e5b12a0a4491b650190757245131760
bigcode/the-stack
train
2c04d4063941cf9838e40535
train
function
def test_thumbnail_reference_file_is_browse(test_data_folder): reference_file = test_data_folder / 'rtc.png' encoded_string = create.get_thumbnail_encoded_string(reference_file) assert len(encoded_string) == 844
def test_thumbnail_reference_file_is_browse(test_data_folder):
reference_file = test_data_folder / 'rtc.png' encoded_string = create.get_thumbnail_encoded_string(reference_file) assert len(encoded_string) == 844
] for f in files: assert f.exists() def test_thumbnail_no_such_reference_file(test_data_folder): reference_file = test_data_folder / 'no_such_file' assert create.get_thumbnail_encoded_string(reference_file) == '' def test_thumbnail_reference_file_is_browse(test_data_folder):
63
64
46
12
51
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_thumbnail_reference_file_is_browse
test_thumbnail_reference_file_is_browse
172
175
172
172
207abadc59d4df12874f719bb389b0011c123a3b
bigcode/the-stack
train
ece3f0a53e95344c720d2e72
train
function
def test_rtc_gamma_ls_map(product_dir): payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%S...
def test_rtc_gamma_ls_map(product_dir):
payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%S%z'), looks=1, plugin_na...
= create.create_inc_map_xml(payload) assert output_file == product_dir / 'S1A_IW_20150621T120220_DVP_RTC10_G_saufem_F8E2_inc_map.tif.xml' assert output_file.exists() def test_rtc_gamma_ls_map(product_dir):
64
64
214
10
54
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_rtc_gamma_ls_map
test_rtc_gamma_ls_map
122
137
122
122
65322aae275da2e56cb3864e0a91d370731cc9be
bigcode/the-stack
train
a9ccd6014897f89ee42f5ca1
train
function
def test_create_dem_xml(product_dir): payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%S%z...
def test_create_dem_xml(product_dir):
payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%S%z'), looks=1, plugin_na...
if.xml', product_dir / 'S1A_IW_20150621T120220_DVP_RTC10_G_saufem_F8E2_VH.tif.xml', ] for output_file in output_file_list: assert output_file.exists() def test_create_dem_xml(product_dir):
64
64
210
8
56
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_create_dem_xml
test_create_dem_xml
46
61
46
46
d8a257a28100085e1279bb19671d1dd61c5e814c
bigcode/the-stack
train
1ac524016c6055c7a49723c7
train
function
def test_create_rtc_gamma_readme(product_dir): payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%...
def test_create_rtc_gamma_readme(product_dir):
payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%S%z'), looks=1, plugin_na...
from datetime import datetime from hyp3_metadata import create def test_create_rtc_gamma_readme(product_dir):
23
64
213
11
11
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_create_rtc_gamma_readme
test_create_rtc_gamma_readme
6
21
6
6
ebd4a79f8b51e54136bb7ca1d3c05a92cf5542b7
bigcode/the-stack
train
45b528ab3f1ccaf683889495
train
function
def test_rtc_gamma_area(product_dir): payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%S%z...
def test_rtc_gamma_area(product_dir):
payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%S%z'), looks=1, plugin_na...
_F8E2.png.xml', product_dir / 'S1A_IW_20150621T120220_DVP_RTC10_G_saufem_F8E2_rgb.png.xml', ] for file in output_files: assert file.exists() def test_rtc_gamma_area(product_dir):
64
64
211
9
55
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_rtc_gamma_area
test_rtc_gamma_area
86
101
86
86
9b34143bb573043465eb526ce487aef387a6404f
bigcode/the-stack
train
dbfb32a3b0d860967a1148b9
train
function
def test_rtc_gamma_product(product_dir): payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%...
def test_rtc_gamma_product(product_dir):
payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%S%z'), looks=1, plugin_na...
='GAMMA', processor_version='20191203', ) output_file = create.create_readme(payload) assert output_file == product_dir / 'S1A_IW_20150621T120220_DVP_RTC10_G_saufem_F8E2.README.md.txt' assert output_file.exists() def test_rtc_gamma_product(product_dir):
79
79
264
9
70
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_rtc_gamma_product
test_rtc_gamma_product
24
43
24
24
305f75f1261ed7b27204e13dc6e56a56bbccbc12
bigcode/the-stack
train
16e5ee58546458e555b8bd89
train
function
def test_decode_product(): name = 'S1A_IW_20150621T120220_SVP_RTC10_G_sauned_F8E2' assert create.decode_product(name) == { 'resolution': 10, 'radiometry': 'sigma-0', 'scale': 'amplitude', 'masked': False, 'filter_applied': False, 'clipped': False, 'matchin...
def test_decode_product():
name = 'S1A_IW_20150621T120220_SVP_RTC10_G_sauned_F8E2' assert create.decode_product(name) == { 'resolution': 10, 'radiometry': 'sigma-0', 'scale': 'amplitude', 'masked': False, 'filter_applied': False, 'clipped': False, 'matching': False, 'polariz...
_file) assert len(encoded_string) == 844 def test_thumbnail_reference_file_is_dem(test_data_folder): reference_file = test_data_folder / 'rtc_dem.tif' encoded_string = create.get_thumbnail_encoded_string(reference_file) assert len(encoded_string) == 844 def test_decode_product():
64
64
210
5
58
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_decode_product
test_decode_product
194
217
194
194
ffb86a8afbe3fc001471b42107adb2e567a0e429
bigcode/the-stack
train
df3a811af358560dc24a7846
train
function
def test_create_metadata_no_such_reference_file(test_data_folder): assert create.create_metadata_file( payload={}, template=test_data_folder / 'rtc_dem.tif', reference_file=test_data_folder / 'does_not_exist.tif', ) is None
def test_create_metadata_no_such_reference_file(test_data_folder):
assert create.create_metadata_file( payload={}, template=test_data_folder / 'rtc_dem.tif', reference_file=test_data_folder / 'does_not_exist.tif', ) is None
gamma-0', 'scale': 'power', 'masked': True, 'filter_applied': True, 'clipped': True, 'matching': True, 'polarizations': ('HH', 'HV'), } def test_create_metadata_no_such_reference_file(test_data_folder):
64
64
55
13
51
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_create_metadata_no_such_reference_file
test_create_metadata_no_such_reference_file
220
225
220
220
ccef06b2c21a210ced5932fd6c04c8b0e21b2409
bigcode/the-stack
train
1c3b53d253f3f4da0b73f548
train
function
def test_thumbnail_reference_file_is_dem(test_data_folder): reference_file = test_data_folder / 'rtc_dem.tif' encoded_string = create.get_thumbnail_encoded_string(reference_file) assert len(encoded_string) == 844
def test_thumbnail_reference_file_is_dem(test_data_folder):
reference_file = test_data_folder / 'rtc_dem.tif' encoded_string = create.get_thumbnail_encoded_string(reference_file) assert len(encoded_string) == 844
.get_thumbnail_encoded_string(reference_file) assert len(encoded_string) == 844 reference_file = test_data_folder / 'rtc_VH.png' encoded_string = create.get_thumbnail_encoded_string(reference_file) assert len(encoded_string) == 844 def test_thumbnail_reference_file_is_dem(test_data_folder):
64
64
47
11
52
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_thumbnail_reference_file_is_dem
test_thumbnail_reference_file_is_dem
188
191
188
188
a20e77828d89d53974a52b2dfcd1d646280a7a9d
bigcode/the-stack
train
c96e8f6c5e7c8ef1d4a57d54
train
function
def test_create_browse_xmls(product_dir): payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:...
def test_create_browse_xmls(product_dir):
payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%S%z'), looks=1, plugin_na...
', processor_version='20191203', ) output_file = create.create_dem_xml(payload) assert output_file == product_dir / 'S1A_IW_20150621T120220_DVP_RTC10_G_saufem_F8E2_dem.tif.xml' assert output_file.exists() def test_create_browse_xmls(product_dir):
76
76
256
10
66
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_create_browse_xmls
test_create_browse_xmls
64
83
64
64
ba3eeacade5753c3f9f205d336d5a997c8fced19
bigcode/the-stack
train
469ced60d1c9ae2a13779c05
train
function
def test_rtc_gamma_inc_map(product_dir): payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%...
def test_rtc_gamma_inc_map(product_dir):
payload = create.marshal_metadata( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%S%z'), looks=1, plugin_na...
output_file = create.create_area_xml(payload) assert output_file == product_dir / 'S1A_IW_20150621T120220_DVP_RTC10_G_saufem_F8E2_area.tif.xml' assert output_file.exists() def test_rtc_gamma_inc_map(product_dir):
64
64
214
10
54
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_rtc_gamma_inc_map
test_rtc_gamma_inc_map
104
119
104
104
5f8290291f1ecaca07638b62773dedbb520b7b81
bigcode/the-stack
train
35374c5716c0755961b0833a
train
function
def test_rtc_gamma_all_files(product_dir): files = create.create_metadata_file_set( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%d...
def test_rtc_gamma_all_files(product_dir):
files = create.create_metadata_file_set( product_dir=product_dir, granule_name='S1A_IW_SLC__1SSV_20150621T120220_20150621T120232_006471_008934_72D8', dem_name='SRTMGL1', processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%S%z'), looks=1, plu...
processing_date=datetime.strptime('2020-01-01T00:00:00+0000', '%Y-%m-%dT%H:%M:%S%z'), looks=1, plugin_name='hyp3_rtc_gamma', plugin_version='2.3.0', processor_name='GAMMA', processor_version='20191203', ) output_file = create.create_ls_map_xml(payload) assert output...
147
147
492
10
137
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_rtc_gamma_all_files
test_rtc_gamma_all_files
140
164
140
140
f212a89acf103a93874ca240f4aac0eb1bae0464
bigcode/the-stack
train
edf6137541ce836a56781546
train
function
def test_thumbnail_no_such_reference_file(test_data_folder): reference_file = test_data_folder / 'no_such_file' assert create.get_thumbnail_encoded_string(reference_file) == ''
def test_thumbnail_no_such_reference_file(test_data_folder):
reference_file = test_data_folder / 'no_such_file' assert create.get_thumbnail_encoded_string(reference_file) == ''
.tif.xml', product_dir / 'S1A_IW_20150621T120220_DVP_RTC10_G_saufem_F8E2_area.tif.xml', ] for f in files: assert f.exists() def test_thumbnail_no_such_reference_file(test_data_folder):
64
64
38
12
52
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_thumbnail_no_such_reference_file
test_thumbnail_no_such_reference_file
167
169
167
167
d3dc24d08484479777b02d493ab688bb86a47950
bigcode/the-stack
train
b62162ecdd2c1ddc0af94716
train
function
def test_thumbnail_reference_file_is_pol(test_data_folder): reference_file = test_data_folder / 'rtc_VV.png' encoded_string = create.get_thumbnail_encoded_string(reference_file) assert len(encoded_string) == 844 reference_file = test_data_folder / 'rtc_VH.png' encoded_string = create.get_thumbnail_...
def test_thumbnail_reference_file_is_pol(test_data_folder):
reference_file = test_data_folder / 'rtc_VV.png' encoded_string = create.get_thumbnail_encoded_string(reference_file) assert len(encoded_string) == 844 reference_file = test_data_folder / 'rtc_VH.png' encoded_string = create.get_thumbnail_encoded_string(reference_file) assert len(encoded_string...
_string(reference_file) == '' def test_thumbnail_reference_file_is_browse(test_data_folder): reference_file = test_data_folder / 'rtc.png' encoded_string = create.get_thumbnail_encoded_string(reference_file) assert len(encoded_string) == 844 def test_thumbnail_reference_file_is_pol(test_data_folder):
64
64
83
11
52
washreve/hyp3-metadata-templates
tests/test_rtc_gamma.py
Python
test_thumbnail_reference_file_is_pol
test_thumbnail_reference_file_is_pol
178
185
178
178
25552d87a1d27373233314d3deeb2b71bc23df4c
bigcode/the-stack
train
ff6fe2b659a779ca5c18c3b0
train
class
class AsynchronousLoader: """Class for asynchronously loading from CPU memory to device memory with DataLoader. Note that this only works for single GPU training, multiGPU uses PyTorch's DataParallel or DistributedDataParallel which uses its own code for transferring data across GPUs. This could just b...
class AsynchronousLoader:
"""Class for asynchronously loading from CPU memory to device memory with DataLoader. Note that this only works for single GPU training, multiGPU uses PyTorch's DataParallel or DistributedDataParallel which uses its own code for transferring data across GPUs. This could just break or make things slower...
import collections.abc as container_abcs import re from queue import Queue from threading import Thread from typing import Any, Optional, Union import torch from torch import Tensor from torch._six import string_classes from torch.utils.data import DataLoader, Dataset class AsynchronousLoader:
62
256
996
5
56
lavoiems/lightning-bolts
pl_bolts/datamodules/async_dataloader.py
Python
AsynchronousLoader
AsynchronousLoader
13
118
13
13
614ff0ea646bc5eb7202a5920fcd940b48578ff1
bigcode/the-stack
train
98fdc6511057c4f2abff4b35
train
function
def parse_cmdline(): parser = ArgumentParser(description=__doc__, formatter_class=RawTextHelpFormatter) parser.add_argument( "dsn", help="database connection string\n\n" "For cockroach demo, use postgresql://<username>:<password>@<hostname>:<port>virtualt...
def parse_cmdline():
parser = ArgumentParser(description=__doc__, formatter_class=RawTextHelpFormatter) parser.add_argument( "dsn", help="database connection string\n\n" "For cockroach demo, use postgresql://<username>:<password>@<hostname>:<port>virtualtours?sslmode=require,...
should handle this error # and any others thrown by the database interaction. logging.debug("run_transaction(conn, op) failed: %s", ve) pass print_balances(conn) delete_accounts(conn) # Close communication with the database. conn.close() def parse_cmdline():
64
64
148
5
59
Shehryar21/htn
storage/coackroach_db.py
Python
parse_cmdline
parse_cmdline
151
166
151
151
fbd47e9771cf1d9f637a2fbda014509423e41c51
bigcode/the-stack
train
c89ac8f975786fb2bc17e113
train
function
def run_transaction(conn, op, max_retries=3): """ Execute the operation *op(conn)* retrying serialization failure. If the database returns an error asking to retry the transaction, retry it *max_retries* times before giving up (and propagate it). """ # leaving this block the transaction will co...
def run_transaction(conn, op, max_retries=3):
""" Execute the operation *op(conn)* retrying serialization failure. If the database returns an error asking to retry the transaction, retry it *max_retries* times before giving up (and propagate it). """ # leaving this block the transaction will commit or rollback # (if leaving with an exc...
transfer. cur.execute( "UPDATE accounts SET balance = balance - %s WHERE id = %s", (amount, frm) ) cur.execute( "UPDATE accounts SET balance = balance + %s WHERE id = %s", (amount, to) ) conn.commit() logging.debug("transfer_funds(): status message: %s",...
93
93
312
13
80
Shehryar21/htn
storage/coackroach_db.py
Python
run_transaction
run_transaction
66
100
66
66
33b4179bacc79380b73b5fd7fdd04b156cb4ae35
bigcode/the-stack
train
60d886b0935279201094c201
train
function
def print_balances(conn): with conn.cursor() as cur: cur.execute("SELECT id, balance FROM accounts") logging.debug("print_balances(): status message: %s", cur.statusmessage) rows = cur.fetchall() conn.commit() print(f"Balances at {time.asctime()}:") for row in rows: ...
def print_balances(conn):
with conn.cursor() as cur: cur.execute("SELECT id, balance FROM accounts") logging.debug("print_balances(): status message: %s", cur.statusmessage) rows = cur.fetchall() conn.commit() print(f"Balances at {time.asctime()}:") for row in rows: print(row)
message: %s", cur.statusmessage) conn.commit() def delete_accounts(conn): with conn.cursor() as cur: cur.execute("DELETE FROM virtualtours.accounts") logging.debug("delete_accounts(): status message: %s", cur.statusmessage) conn.commit() def print_balances(conn):
64
64
76
6
58
Shehryar21/htn
storage/coackroach_db.py
Python
print_balances
print_balances
32
40
32
32
2de0d0ddb81ccffd77a9de584542ce888ae94cbd
bigcode/the-stack
train
7070a781341adef91d1caa49
train
function
def test_retry_loop(conn): """ Cause a seralization error in the connection. This function can be used to test retry logic. """ with conn.cursor() as cur: # The first statement in a transaction can be retried transparently on # the server, so we need to add a dummy statement so that...
def test_retry_loop(conn):
""" Cause a seralization error in the connection. This function can be used to test retry logic. """ with conn.cursor() as cur: # The first statement in a transaction can be retried transparently on # the server, so we need to add a dummy statement so that our # force_retry(...
except psycopg2.Error as e: logging.debug("got error: %s", e) logging.debug("EXECUTE NON-SERIALIZATION_FAILURE BRANCH") raise e raise ValueError(f"Transaction did not succeed after {max_retries} retries") def test_retry_loop(conn):
64
64
128
6
58
Shehryar21/htn
storage/coackroach_db.py
Python
test_retry_loop
test_retry_loop
103
115
103
103
72853593e7a0c6cd4aea61845bcadf5852fb66e7
bigcode/the-stack
train
1e1bb9da611f23a8a97a0c7c
train
function
def main(): opt = parse_cmdline() logging.basicConfig(level=logging.DEBUG if opt.verbose else logging.INFO) conn = psycopg2.connect(opt.dsn) create_accounts(conn) print_balances(conn) amount = 100 fromId = 1 toId = 2 try: run_transaction(conn, lambda conn: transfer_funds(c...
def main():
opt = parse_cmdline() logging.basicConfig(level=logging.DEBUG if opt.verbose else logging.INFO) conn = psycopg2.connect(opt.dsn) create_accounts(conn) print_balances(conn) amount = 100 fromId = 1 toId = 2 try: run_transaction(conn, lambda conn: transfer_funds(conn, fromId,...
to add a dummy statement so that our # force_retry() statement isn't the first one. cur.execute("SELECT now()") cur.execute("SELECT crdb_internal.force_retry('1s'::INTERVAL)") logging.debug("test_retry_loop(): status message: %s", cur.statusmessage) def main():
67
67
226
3
64
Shehryar21/htn
storage/coackroach_db.py
Python
main
main
118
148
118
118
16a03f5fdfb2b163bf4aab4645165fdae61d03b7
bigcode/the-stack
train
fcd5a7de94f466e0607b6f12
train
function
def create_accounts(conn): with conn.cursor() as cur: cur.execute( "CREATE TABLE IF NOT EXISTS accounts (id INT PRIMARY KEY, balance INT)" ) cur.execute("UPSERT INTO accounts (id, balance) VALUES (1, 1000), (2, 250)") logging.debug("create_accounts(): status message: %s",...
def create_accounts(conn):
with conn.cursor() as cur: cur.execute( "CREATE TABLE IF NOT EXISTS accounts (id INT PRIMARY KEY, balance INT)" ) cur.execute("UPSERT INTO accounts (id, balance) VALUES (1, 1000), (2, 250)") logging.debug("create_accounts(): status message: %s", cur.statusmessage) con...
#!/usr/bin/env python3 """ Test psycopg with CockroachDB. """ import time import random import logging from argparse import ArgumentParser, RawTextHelpFormatter import psycopg2 from psycopg2.errors import SerializationFailure def create_accounts(conn):
59
64
84
5
53
Shehryar21/htn
storage/coackroach_db.py
Python
create_accounts
create_accounts
15
22
15
15
1a8dc80e1cb2d7a7947476e9cddf1a93966c3ed9
bigcode/the-stack
train
ea4de251658e90766b3f116a
train
function
def transfer_funds(conn, frm, to, amount): with conn.cursor() as cur: # Check the current balance. cur.execute("SELECT balance FROM accounts WHERE id = %s", (frm,)) from_balance = cur.fetchone()[0] if from_balance < amount: raise RuntimeError( f"Insuffici...
def transfer_funds(conn, frm, to, amount):
with conn.cursor() as cur: # Check the current balance. cur.execute("SELECT balance FROM accounts WHERE id = %s", (frm,)) from_balance = cur.fetchone()[0] if from_balance < amount: raise RuntimeError( f"Insufficient funds in {frm}: have {from_balance}, ne...
") logging.debug("print_balances(): status message: %s", cur.statusmessage) rows = cur.fetchall() conn.commit() print(f"Balances at {time.asctime()}:") for row in rows: print(row) def transfer_funds(conn, frm, to, amount):
64
64
170
12
52
Shehryar21/htn
storage/coackroach_db.py
Python
transfer_funds
transfer_funds
43
63
43
43
b4f7caa16c8e08bcd6cd2ddbbf7e5f615b6f42a2
bigcode/the-stack
train
76b7ef683625e33b786844ff
train
function
def delete_accounts(conn): with conn.cursor() as cur: cur.execute("DELETE FROM virtualtours.accounts") logging.debug("delete_accounts(): status message: %s", cur.statusmessage) conn.commit()
def delete_accounts(conn):
with conn.cursor() as cur: cur.execute("DELETE FROM virtualtours.accounts") logging.debug("delete_accounts(): status message: %s", cur.statusmessage) conn.commit()
(id INT PRIMARY KEY, balance INT)" ) cur.execute("UPSERT INTO accounts (id, balance) VALUES (1, 1000), (2, 250)") logging.debug("create_accounts(): status message: %s", cur.statusmessage) conn.commit() def delete_accounts(conn):
64
64
45
5
59
Shehryar21/htn
storage/coackroach_db.py
Python
delete_accounts
delete_accounts
25
29
25
25
3cf460011bca18ad37d858a868109f215ba8d815
bigcode/the-stack
train
83873d9b68cee1b4b38fb4af
train
class
class V1NodeSelectorRequirement(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attrib...
class V1NodeSelectorRequirement(object):
"""NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The...
# coding: utf-8 """ Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 OpenAPI spec version: v1.15.7 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six class V1NodeSelect...
87
256
1,255
8
78
itholic/python
kubernetes/client/models/v1_node_selector_requirement.py
Python
V1NodeSelectorRequirement
V1NodeSelectorRequirement
19
172
19
19
24ac66b3a294dc5956d2793b4006d73e2850d93d
bigcode/the-stack
train
4135911c8069eaa265d0ec07
train
class
class RoughnessValidator(_plotly_utils.basevalidators.NumberValidator): def __init__( self, plotly_name="roughness", parent_name="volume.lighting", **kwargs ): super(RoughnessValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_typ...
class RoughnessValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__( self, plotly_name="roughness", parent_name="volume.lighting", **kwargs ): super(RoughnessValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_type=kwargs.pop("edit_type", "calc"), max=kwargs.pop("max", 1),...
import _plotly_utils.basevalidators class RoughnessValidator(_plotly_utils.basevalidators.NumberValidator):
21
64
108
13
7
mastermind88/plotly.py
packages/python/plotly/plotly/validators/volume/lighting/_roughness.py
Python
RoughnessValidator
RoughnessValidator
4
15
4
4
1929350c8cc4b9cbb07a8963915dc0ec84429c1a
bigcode/the-stack
train
eebee69f065d8281a7c42637
train
class
class FFDNet(nn.Module): def __init__(self, in_nc=1, out_nc=1, nc=64, nb=15, act_mode='R'): """ # ------------------------------------ in_nc: channel number of input out_nc: channel number of output nc: channel number nb: total number of conv layers act_mode: ...
class FFDNet(nn.Module):
def __init__(self, in_nc=1, out_nc=1, nc=64, nb=15, act_mode='R'): """ # ------------------------------------ in_nc: channel number of input out_nc: channel number of output nc: channel number nb: total number of conv layers act_mode: batch norm + activation f...
as nn import models.basicblock as B import torch """ # -------------------------------------------- # FFDNet (15 or 12 conv layers) # -------------------------------------------- Reference: @article{zhang2018ffdnet, title={FFDNet: Toward a fast and flexible solution for CNN-based image denoising}, author={Zhang, ...
142
142
476
7
135
WestCityInstitute/KAIR
models/network_ffdnet.py
Python
FFDNet
FFDNet
27
69
27
27
154f24a7c8e6353f72727b3278c65d4c5d4abe4b
bigcode/the-stack
train
c4977020caa107d8319a0f98
train
class
class Head_touch(Data): def __init__(self): Data.__init__(self) def get_keys(self): global _KEYS return _KEYS.values() def get(self): global _KEYS data = Data.get(self) if data is None: return None data,time_s...
class Head_touch(Data):
def __init__(self): Data.__init__(self) def get_keys(self): global _KEYS return _KEYS.values() def get(self): global _KEYS data = Data.get(self) if data is None: return None data,time_stamp = data r = {...
{ "front":"Device/SubDeviceList/Head/Touch/Front/Sensor/Value", "rear":"Device/SubDeviceList/Head/Touch/Rear/Sensor/Value", "middle":"Device/SubDeviceList/Head/Touch/Middle/Sensor/Value" } class Head_touch(Data):
64
64
109
6
58
MPI-IS/reactive_pepper
scripts/pepper_interface/sensors/head_touch.py
Python
Head_touch
Head_touch
9
38
9
11
d88fa5e75927b87aaed06036cb6af190f10cd9b4
bigcode/the-stack
train
5385865e6195dca24bca0fed
train
class
class commandLineTest(unittest.TestCase): def test_algorithm_group(self): self.assertEqual(cli.parse_args(["--sha1","-c","6","hash"]).sha1,True) def test_character_group(self): self.assertEqual(cli.parse_args(["--sha1","-c","6","hash"]).chars,6) def test_no_algorithm_group(self): ...
class commandLineTest(unittest.TestCase):
def test_algorithm_group(self): self.assertEqual(cli.parse_args(["--sha1","-c","6","hash"]).sha1,True) def test_character_group(self): self.assertEqual(cli.parse_args(["--sha1","-c","6","hash"]).chars,6) def test_no_algorithm_group(self): try: self.assertRaises(cli...
__author__ = 'girish' import unittest import cli class commandLineTest(unittest.TestCase):
23
64
120
9
13
security-geeks/hacking-tools
pyhashcat/tests/test_command_line.py
Python
commandLineTest
commandLineTest
6
24
6
8
f05c1b4ade90f2833eaa710d3a6af745d2f81517
bigcode/the-stack
train
aa4ceff515ccb79838d19ed9
train
class
class Migration(migrations.Migration): dependencies = [ ('core', '0002_tag'), ] operations = [ migrations.CreateModel( name='Ingredient', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ...
class Migration(migrations.Migration):
dependencies = [ ('core', '0002_tag'), ] operations = [ migrations.CreateModel( name='Ingredient', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(ma...
# Generated by Django 3.0.5 on 2020-04-20 13:54 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
51
64
103
7
43
tahmadvand/recipe_app_api
app/core/migrations/0003_ingredient.py
Python
Migration
Migration
8
23
8
9
b604dc7b3b148d47c88091d2254e4e7111112386
bigcode/the-stack
train
37f4079bda7f935e31a4ff52
train
function
def create_logger(output_path,comment,timestamp): # archive_name = "{}_{}.tgz".format(cfg_name, time.strftime('%Y-%m-%d-%H-%M')) # archive_path = os.path.join(os.path.join(final_output_path, archive_name)) # pack_experiment(".",archive_path) log_file = '{}_{}.log'.format(timestamp,comment) head =...
def create_logger(output_path,comment,timestamp): # archive_name = "{}_{}.tgz".format(cfg_name, time.strftime('%Y-%m-%d-%H-%M')) # archive_path = os.path.join(os.path.join(final_output_path, archive_name)) # pack_experiment(".",archive_path)
log_file = '{}_{}.log'.format(timestamp,comment) head = '%(levelname)s %(asctime)-15s %(message)s' logging.basicConfig(filename=os.path.join(output_path, log_file), format=head) logger = logging.getLogger() logger.addHandler(logging.StreamHandler()) logger.setLevel(logging.INFO) return log...
def create_logger(output_path,comment,timestamp): # archive_name = "{}_{}.tgz".format(cfg_name, time.strftime('%Y-%m-%d-%H-%M')) # archive_path = os.path.join(os.path.join(final_output_path, archive_name)) # pack_experiment(".",archive_path)
65
64
140
65
0
151232summerday/Tencent_Ads_Algo_2018
src/lib/logger.py
Python
create_logger
create_logger
12
26
12
17
27553807c17e428723f05c1b436149059b6e2035
bigcode/the-stack
train
9317295f307e2fa6514ad98a
train
function
def getClosedIntermediateValue(xi, xs, fxi, fxs, is_false_rule): return xi - fxi*(xs-xi)/(fxs-fxi) if is_false_rule else (xi+xs)/2
def getClosedIntermediateValue(xi, xs, fxi, fxs, is_false_rule):
return xi - fxi*(xs-xi)/(fxs-fxi) if is_false_rule else (xi+xs)/2
INTEGRATION_TRAPEZE': 'integrationTrapeze', 'INTEGRATION_SIMPSON13': 'simpson13', 'INTEGRATION_SIMPSON38': 'simpson38' } def getClosedIntermediateValue(xi, xs, fxi, fxs, is_false_rule):
64
64
48
20
44
jestra52/supor-numerical-analysis-api
src/shared/util.py
Python
getClosedIntermediateValue
getClosedIntermediateValue
35
36
35
35
e49982f7c74879a13f9a3b6e160276e127209846
bigcode/the-stack
train
23a57860d200814d8e4d85ff
train
function
def parse_float_matrix(matrix): for i in range(0, len(matrix)): for j in range(0, len(matrix[i])): matrix[i][j] = np.float64(matrix[i][j]) return matrix
def parse_float_matrix(matrix):
for i in range(0, len(matrix)): for j in range(0, len(matrix[i])): matrix[i][j] = np.float64(matrix[i][j]) return matrix
][upper_column] A[i][upper_column] = aux return A def change_marks(marks, upper_column, k): aux = marks[upper_column] marks[upper_column] = marks[k] marks[k] = aux return marks def parse_float_matrix(matrix):
64
64
48
6
57
jestra52/supor-numerical-analysis-api
src/shared/util.py
Python
parse_float_matrix
parse_float_matrix
120
125
120
120
9654aa26e768424310d80d38acf0a29b291839f0
bigcode/the-stack
train
2628609b3f14e153b3ee4e3a
train
function
def parse_float_array(array): for i in range(0, len(array)): array[i] = np.float64(array[i]) return array
def parse_float_array(array):
for i in range(0, len(array)): array[i] = np.float64(array[i]) return array
marks[k] = aux return marks def parse_float_matrix(matrix): for i in range(0, len(matrix)): for j in range(0, len(matrix[i])): matrix[i][j] = np.float64(matrix[i][j]) return matrix def parse_float_array(array):
64
64
32
6
57
jestra52/supor-numerical-analysis-api
src/shared/util.py
Python
parse_float_array
parse_float_array
127
131
127
127
591a18dff8cb45057049c72ce1bcdecee4fa6db2
bigcode/the-stack
train
c3f5dc95f1b796f033414d60
train
function
def split_system(Ab): b = [] for i in range(0, len(Ab)): b.append(Ab[i][len(Ab)]) Ab[i].pop() return (Ab, b)
def split_system(Ab):
b = [] for i in range(0, len(Ab)): b.append(Ab[i][len(Ab)]) Ab[i].pop() return (Ab, b)
= np.float64((b[i-1] - incr) / A[i-1][i-1]) return x def augmented_matrix(A, b): for i in range(0, len(A)): A[i].append(b[i]) return A def split_system(Ab):
64
64
46
6
57
jestra52/supor-numerical-analysis-api
src/shared/util.py
Python
split_system
split_system
88
95
88
88
c631b1b76c9ad4fbe2ece2615ed0144161f37db2
bigcode/the-stack
train
861088d2364ce460aaab18d7
train
function
def regressive_substitution(A, b): n = len(A) x = np.zeros(n) for i in range(n, 0, -1): if np.isnan(b[i-1]) or A[i-1][i-1] == 0: raise ZeroDivisionError incr = 0 for p in range(i + 1, n + 1, 1): if np.isnan(A[i-1][p-1]): raise ZeroDivisionEr...
def regressive_substitution(A, b):
n = len(A) x = np.zeros(n) for i in range(n, 0, -1): if np.isnan(b[i-1]) or A[i-1][i-1] == 0: raise ZeroDivisionError incr = 0 for p in range(i + 1, n + 1, 1): if np.isnan(A[i-1][p-1]): raise ZeroDivisionError incr += np.float64...
incr+=(xnew[i]-xold[i])**2 den+=xnew[i]**2 if den == 0: raise ZeroDivisionError error = mt.sqrt(incr) / mt.sqrt(den) return error def regressive_substitution(A, b):
64
64
162
9
54
jestra52/supor-numerical-analysis-api
src/shared/util.py
Python
regressive_substitution
regressive_substitution
62
80
62
62
d051f7c332e924455bb7520c62c5a6105f6b5f34
bigcode/the-stack
train
01aa51c6378fbed986c24816
train
function
def change_rows(A, upperRow, k): for i in range(len(A[0])): aux = A[k][i] A[k][i] = A[upperRow][i] A[upperRow][i] = aux return A
def change_rows(A, upperRow, k):
for i in range(len(A[0])): aux = A[k][i] A[k][i] = A[upperRow][i] A[upperRow][i] = aux return A
append(b[i]) return A def split_system(Ab): b = [] for i in range(0, len(Ab)): b.append(Ab[i][len(Ab)]) Ab[i].pop() return (Ab, b) def change_rows(A, upperRow, k):
64
64
57
10
54
jestra52/supor-numerical-analysis-api
src/shared/util.py
Python
change_rows
change_rows
97
103
97
97
42ace099f6e119484821f1f605a08a613861e5e5
bigcode/the-stack
train
a25deebedd5e425d9c170238
train
function
def change_columns(A, upper_column, k): for i in range(len(A[0])-1): aux = A[i][k] A[i][k] = A[i][upper_column] A[i][upper_column] = aux return A
def change_columns(A, upper_column, k):
for i in range(len(A[0])-1): aux = A[i][k] A[i][k] = A[i][upper_column] A[i][upper_column] = aux return A
(A, upperRow, k): for i in range(len(A[0])): aux = A[k][i] A[k][i] = A[upperRow][i] A[upperRow][i] = aux return A def change_columns(A, upper_column, k):
64
64
57
10
53
jestra52/supor-numerical-analysis-api
src/shared/util.py
Python
change_columns
change_columns
105
111
105
105
5b4daf1c84a1e658fe1ea973e1d2ae4a4f46c344
bigcode/the-stack
train
9e9b1195c47ed991c9804579
train
function
def change_marks(marks, upper_column, k): aux = marks[upper_column] marks[upper_column] = marks[k] marks[k] = aux return marks
def change_marks(marks, upper_column, k):
aux = marks[upper_column] marks[upper_column] = marks[k] marks[k] = aux return marks
, upper_column, k): for i in range(len(A[0])-1): aux = A[i][k] A[i][k] = A[i][upper_column] A[i][upper_column] = aux return A def change_marks(marks, upper_column, k):
64
64
40
11
52
jestra52/supor-numerical-analysis-api
src/shared/util.py
Python
change_marks
change_marks
113
118
113
113
e6c16820e153b0ca3e8ccc656cbd46357b37a552
bigcode/the-stack
train
8f94cebd436ae0445fc27d13
train
function
def getMatrixError(is_relative_error, xold, xnew): incr = 0 if not is_relative_error: for i in range(len(xold)): incr += (xnew[i]-xold[i])**2 error = mt.sqrt(incr) else: den = 0 for i in range(len(xold)): incr+=(x...
def getMatrixError(is_relative_error, xold, xnew):
incr = 0 if not is_relative_error: for i in range(len(xold)): incr += (xnew[i]-xold[i])**2 error = mt.sqrt(incr) else: den = 0 for i in range(len(xold)): incr+=(xnew[i]-xold[i])**2 den+=xnew[i]**2 ...
if is_false_rule else (xi+xs)/2 def getError(current_x, prev_x, is_relative_error): return np.abs((current_x-prev_x)/current_x) if is_relative_error else np.abs(current_x-prev_x) def getMatrixError(is_relative_error, xold, xnew):
64
64
132
14
50
jestra52/supor-numerical-analysis-api
src/shared/util.py
Python
getMatrixError
getMatrixError
41
60
41
41
fe7118bdacaf6b9705068639edad841dada4b672
bigcode/the-stack
train
ae79efd604c1635348e84696
train
function
def augmented_matrix(A, b): for i in range(0, len(A)): A[i].append(b[i]) return A
def augmented_matrix(A, b):
for i in range(0, len(A)): A[i].append(b[i]) return A
Error incr += np.float64(A[i-1][p-1] * x[p-1]) x[i-1] = np.float64((b[i-1] - incr) / A[i-1][i-1]) return x def augmented_matrix(A, b):
64
64
30
7
56
jestra52/supor-numerical-analysis-api
src/shared/util.py
Python
augmented_matrix
augmented_matrix
82
86
82
82
0c19c2b80d28a44f6733f34a3df2aa9b2531c8e4
bigcode/the-stack
train
c8975697af5a1aaedd40aa8a
train
function
def getError(current_x, prev_x, is_relative_error): return np.abs((current_x-prev_x)/current_x) if is_relative_error else np.abs(current_x-prev_x)
def getError(current_x, prev_x, is_relative_error):
return np.abs((current_x-prev_x)/current_x) if is_relative_error else np.abs(current_x-prev_x)
38' } def getClosedIntermediateValue(xi, xs, fxi, fxs, is_false_rule): return xi - fxi*(xs-xi)/(fxs-fxi) if is_false_rule else (xi+xs)/2 def getError(current_x, prev_x, is_relative_error):
64
64
38
13
50
jestra52/supor-numerical-analysis-api
src/shared/util.py
Python
getError
getError
38
39
38
38
00b91d405378c83de813a0dec207908001e03fa4
bigcode/the-stack
train
5221c391d53acd3f2d451cf9
train
class
class TenantWorkflowNotifier: def __init__(self, db: AsyncSession, *args, **kwargs) -> None: self._db: AsyncSession = db @property def db(self) -> AsyncSession: """Accessor for db session instance.""" return self._db async def issuer_workflow_connection_active( self, te...
class TenantWorkflowNotifier:
def __init__(self, db: AsyncSession, *args, **kwargs) -> None: self._db: AsyncSession = db @property def db(self) -> AsyncSession: """Accessor for db session instance.""" return self._db async def issuer_workflow_connection_active( self, tenant_conn: TenantConnectionRea...
import logging from sqlalchemy.ext.asyncio import AsyncSession from api.core.profile import Profile from api.db.models.tenant_connection import TenantConnectionRead from api.db.models.tenant_issuer import TenantIssuerRead from api.db.models.tenant_schema import TenantSchemaRead from api.db.models.present_credential i...
118
256
1,143
5
113
Open-Earth-Foundation/traction
services/traction/api/services/tenant_workflow_notifier.py
Python
TenantWorkflowNotifier
TenantWorkflowNotifier
21
152
21
21
7c274a2faf1978cf0fcc444f20b1e808b73437dd
bigcode/the-stack
train
7aedefdd9290c5988072a205
train
class
class TestUpgrades(base.BaseTestCase): def test_upgraded_data_exists(self): # There is an upgraded namespace called 'upgrade' if 'upgrade' not in self.system_client.get_namespaces(): self.skip('There is no upgrade namespace') # Collect networks and check networks_by_name...
class TestUpgrades(base.BaseTestCase):
def test_upgraded_data_exists(self): # There is an upgraded namespace called 'upgrade' if 'upgrade' not in self.system_client.get_namespaces(): self.skip('There is no upgrade namespace') # Collect networks and check networks_by_name = {} networks_by_uuid = {} ...
import sys from shakenfist_ci import base class TestUpgrades(base.BaseTestCase):
20
172
575
9
10
shakenfist/shakenfist
deploy/shakenfist_ci/tests/test_upgrades.py
Python
TestUpgrades
TestUpgrades
6
68
6
6
093c64a72689a7a7169cab0611d72c9f3395dfc7
bigcode/the-stack
train
8b1ecd8d0984da79423c5e3a
train
function
def get_container_place(input_pk): # Функция строит цепочку контейнеров, в котором расподожен искомый. вход - pk искомого контейнера, выход - список контейнеров цепочки def_output=[] recycle_flag=True while recycle_flag==True: recycle_flag=False if input_pk: recycle_flag=True...
def get_container_place(input_pk): # Функция строит цепочку контейнеров, в котором расподожен искомый. вход - pk искомого контейнера, выход - список контейнеров цепочки
def_output=[] recycle_flag=True while recycle_flag==True: recycle_flag=False if input_pk: recycle_flag=True parrent_container=Container.objects.get(pk=input_pk) def_output.append((parrent_container.pk,parrent_container.title)) if parrent_conta...
li equipment'): def_output.append('</UL>') return def_output def get_container_place(input_pk): # Функция строит цепочку контейнеров, в котором расподожен искомый. вход - pk искомого контейнера, выход - список контейнеров цепочки
64
64
140
48
15
hadmiru/mdb
mechdb_core/my_defs.py
Python
get_container_place
get_container_place
94
108
94
95
a30473410a6e74a8ec00a639294fc0a90540b641
bigcode/the-stack
train
3bbbd60db48d5f584d8296b2
train
function
def parse_objects_tree_to_dict(input_pk, params, user): if input_pk==0: daughters = Container.objects.filter(owner=user, in_container__isnull=True).order_by('title') equipments = Equipment.objects.filter(owner=user, in_container__isnull=True).order_by('sizename') else: daughters = Contai...
def parse_objects_tree_to_dict(input_pk, params, user):
if input_pk==0: daughters = Container.objects.filter(owner=user, in_container__isnull=True).order_by('title') equipments = Equipment.objects.filter(owner=user, in_container__isnull=True).order_by('sizename') else: daughters = Container.objects.filter(owner=user, in_container=input_pk).or...
from .models import Container, Equipment from django.shortcuts import get_object_or_404 from django.utils.html import escape def parse_objects_tree_to_dict(input_pk, params, user):
38
78
262
13
24
hadmiru/mdb
mechdb_core/my_defs.py
Python
parse_objects_tree_to_dict
parse_objects_tree_to_dict
5
34
5
5
eef1f49b1bd1513d49e4c409ca53cff66241c103
bigcode/the-stack
train
2b2ea81402b19abd116ed1fc
train
function
def tree_parse(input_pk, tree_format, user, need_zero_level=True, tree_level=-1): # функция парсинга древа контейнеров в заданном формате # формат "li" - выводит в виде html - списка # формат "li equipment" - аналогично плюс оборудование в контейнерах # формат "choice" - кортеж для ChoiceField формы ...
def tree_parse(input_pk, tree_format, user, need_zero_level=True, tree_level=-1): # функция парсинга древа контейнеров в заданном формате # формат "li" - выводит в виде html - списка # формат "li equipment" - аналогично плюс оборудование в контейнерах # формат "choice" - кортеж для ChoiceField формы ...
if input_pk==0: containers = Container.objects.filter(owner=user, in_container__isnull=True).order_by('title') equipments = Equipment.objects.filter(owner=user, in_container__isnull=True).order_by('sizename') else: containers = Container.objects.filter(owner=user, in_container=input_pk)....
izename.title, 'serial_number': z.serial_number }) def_response['daughters'] = [] if daughters: for y in daughters: def_response['daughters'].append(parse_objects_tree_to_dict(y.pk, params, user)) return def_response def tree_parse(input_pk, tree_format,...
167
167
557
108
58
hadmiru/mdb
mechdb_core/my_defs.py
Python
tree_parse
tree_parse
41
92
41
47
fc6ab8439f8781b02d8c64909ef2c4fc16c4590b
bigcode/the-stack
train
61db5a473ce679dc350d49c2
train
function
def dword(d): return struct.pack("=l", d)
def dword(d):
return struct.pack("=l", d)
import struct import math import numpy as np from PIL import Image def char(c): return struct.pack("=c", c.encode('ascii')) def word(w): return struct.pack("=h", w) def dword(d):
52
64
15
5
47
ciborg245/bmp_render
Proyecto1/bitmap.py
Python
dword
dword
12
13
12
12
532fe5c8f5c0e751d5ffd1e005e7e0331caad9d5
bigcode/the-stack
train
3456273a6cb4289074b9af60
train
function
def color(r, g, b): return bytes([b, g, r])
def color(r, g, b):
return bytes([b, g, r])
import numpy as np from PIL import Image def char(c): return struct.pack("=c", c.encode('ascii')) def word(w): return struct.pack("=h", w) def dword(d): return struct.pack("=l", d) def color(r, g, b):
64
64
18
8
56
ciborg245/bmp_render
Proyecto1/bitmap.py
Python
color
color
15
16
15
15
bc5f8538ca7d7fec3f979d73d11567c383c10398
bigcode/the-stack
train
53a1cb1d7d95c5cb3ef7d432
train
function
def word(w): return struct.pack("=h", w)
def word(w):
return struct.pack("=h", w)
import struct import math import numpy as np from PIL import Image def char(c): return struct.pack("=c", c.encode('ascii')) def word(w):
37
64
14
4
33
ciborg245/bmp_render
Proyecto1/bitmap.py
Python
word
word
9
10
9
9
fce269758e60c418ee7b253f72c2e103e0f0731b
bigcode/the-stack
train
28566e7ad4f8aeb9e70317a1
train
function
def char(c): return struct.pack("=c", c.encode('ascii'))
def char(c):
return struct.pack("=c", c.encode('ascii'))
import struct import math import numpy as np from PIL import Image def char(c):
20
64
17
4
15
ciborg245/bmp_render
Proyecto1/bitmap.py
Python
char
char
6
7
6
6
3512e28c6e594c6f7307981a2a218b1c1defe021
bigcode/the-stack
train
92e6ddafd25c8f0a14089cbe
train
class
class Bitmap(object): def __init__(self, width, height): self.width = width self.height = height self.pixels = [] self.zbuffer = [] self.clear() def clear(self): file = Image.open("models/beach.bmp") bg = np.array(file) self.pixels = [ ...
class Bitmap(object):
def __init__(self, width, height): self.width = width self.height = height self.pixels = [] self.zbuffer = [] self.clear() def clear(self): file = Image.open("models/beach.bmp") bg = np.array(file) self.pixels = [ [color(bg[-y-100][x]...
import struct import math import numpy as np from PIL import Image def char(c): return struct.pack("=c", c.encode('ascii')) def word(w): return struct.pack("=h", w) def dword(d): return struct.pack("=l", d) def color(r, g, b): return bytes([b, g, r]) class Bitmap(object):
84
126
422
4
80
ciborg245/bmp_render
Proyecto1/bitmap.py
Python
Bitmap
Bitmap
18
77
18
18
76e948d8a5838b71858ab35b55804f5ce67547e2
bigcode/the-stack
train
ca7c2ba1e319dcbf2867978b
train
class
class TestTrainingAndEvaluation(unittest.TestCase): @classmethod def setUpClass(cls): cls.env = gym.make("gym_factored:cliff_walking_cost-v0", num_rows=3, num_cols=4) cls.agent = OptimisticLinearProgrammingPlanner.from_discrete_env(cls.env, cost_bound=None, horizon=20) np.random.seed(42)...
class TestTrainingAndEvaluation(unittest.TestCase): @classmethod
def setUpClass(cls): cls.env = gym.make("gym_factored:cliff_walking_cost-v0", num_rows=3, num_cols=4) cls.agent = OptimisticLinearProgrammingPlanner.from_discrete_env(cls.env, cost_bound=None, horizon=20) np.random.seed(42) cls.agent.solve() @classmethod def tearDownClass(cl...
import unittest import gym import numpy as np import matplotlib.pyplot as plt from os import path from planners import OptimisticLinearProgrammingPlanner from util.mdp import monte_carlo_evaluation from util.training import run_training_episodes from util.training import save_and_plot from util.training import train_...
79
256
926
13
65
AlgTUDelft/AlwaysSafe
tests/test_training.py
Python
TestTrainingAndEvaluation
TestTrainingAndEvaluation
15
89
15
16
92ba83a395730f7464749138704c03c86e8b8226
bigcode/the-stack
train
cfe0ded8a4cc5a86c94396ea
train
class
class Periodic(Node): """Node that sends events at a regular interval. This node sends regular events after the first time the update method is called. If the update method is called at time `t`, and this node has a interval `ti` and phase `ts`, then the first event will be at `t + ts`. Then there ...
class Periodic(Node):
"""Node that sends events at a regular interval. This node sends regular events after the first time the update method is called. If the update method is called at time `t`, and this node has a interval `ti` and phase `ts`, then the first event will be at `t + ts`. Then there will be one event at `...
self._items_min = items_min self._items_max = items_max random.seed(seed) def random_string(self, length): return "".join(random.choice(string.ascii_letters) for m in range(length)) def update(self): rows = [] for i in range(random.randint(self._rows_min, self....
203
204
682
5
198
HerySon/timeflux
timeflux/nodes/events.py
Python
Periodic
Periodic
58
149
58
58
7931ad6636c892fb31f202ed04bce38e9e6a0d7f
bigcode/the-stack
train
28a7c23fbed7143c55fb2be3
train
class
class Events(Node): def __init__( self, rows_min=1, rows_max=10, string_min=3, string_max=12, items_min=0, items_max=5, seed=None, ): """Return random integers from value_min to value_max (inclusive)""" self._rows_min = rows_min ...
class Events(Node):
def __init__( self, rows_min=1, rows_max=10, string_min=3, string_max=12, items_min=0, items_max=5, seed=None, ): """Return random integers from value_min to value_max (inclusive)""" self._rows_min = rows_min self._rows_max ...
"""Generate random events""" import copy import datetime import json import random import string import numpy as np from timeflux.core.node import Node class Events(Node):
37
90
302
4
32
HerySon/timeflux
timeflux/nodes/events.py
Python
Events
Events
14
55
14
14
eb65e5759a1d6067d664a46e024e943a50e42533
bigcode/the-stack
train
8681345e36126655b2695abc
train
class
class FomConfig(StudyConfigModule): '''FOM (File Organization Model) configuration module for StudyConfig Note: FomConfig needs BrainVISAConfig to be part of StudyConfig modules. ''' dependencies = ['BrainVISAConfig', 'SPMConfig', 'AttributesConfig'] def __init__(self, study_config, configuration...
class FomConfig(StudyConfigModule):
'''FOM (File Organization Model) configuration module for StudyConfig Note: FomConfig needs BrainVISAConfig to be part of StudyConfig modules. ''' dependencies = ['BrainVISAConfig', 'SPMConfig', 'AttributesConfig'] def __init__(self, study_config, configuration): super(FomConfig, self).__...
########################################################################## # CAPSUL - Copyright (C) CEA, 2013 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # for details. ########...
137
239
797
9
127
Dralehcab/capsul
capsul/study_config/config_modules/fom_config.py
Python
FomConfig
FomConfig
17
104
17
17
92d7ebfb3baefd3db8e4d8a59f2ed6af2e525238
bigcode/the-stack
train
0719955f4df975d8fa8d879d
train
class
class PostSerializer(serializers.ModelSerializer): url = serializers.HyperlinkedIdentityField( view_name='posts-api:detail', lookup_field='slug' ) user = UserPublicSerializer(read_only=True) publish ...
class PostSerializer(serializers.ModelSerializer):
url = serializers.HyperlinkedIdentityField( view_name='posts-api:detail', lookup_field='slug' ) user = UserPublicSerializer(read_only=True) publish = serializers.DateField(default=timezone.now(...
() class UserPublicSerializer(serializers.ModelSerializer): username = serializers.CharField(required=False, allow_blank=True, read_only=True) class Meta: model = User fields = [ 'username', 'first_name', 'last_name', ] class PostSerializer(ser...
63
64
169
7
56
manuelbatres/reactify2
src/posts/serializers.py
Python
PostSerializer
PostSerializer
24
53
24
24
8904a3d0e127b6977492137c642f9b507d298fca
bigcode/the-stack
train
01341456401c6d9d97e418ad
train
class
class UserPublicSerializer(serializers.ModelSerializer): username = serializers.CharField(required=False, allow_blank=True, read_only=True) class Meta: model = User fields = [ 'username', 'first_name', 'last_name', ]
class UserPublicSerializer(serializers.ModelSerializer):
username = serializers.CharField(required=False, allow_blank=True, read_only=True) class Meta: model = User fields = [ 'username', 'first_name', 'last_name', ]
from django.contrib.auth import get_user_model, authenticate, login, logout from django.db.models import Q from django.urls import reverse from django.utils import timezone from rest_framework import serializers from .models import Post User = get_user_model() class UserPublicSerializer(serializers.ModelSerializer):...
60
64
55
8
52
manuelbatres/reactify2
src/posts/serializers.py
Python
UserPublicSerializer
UserPublicSerializer
13
21
13
13
be8d58db46a2329e3aceba4c1dabebe600677463
bigcode/the-stack
train
fe4bbcef0a5c67d6c1eaa3cc
train
function
def create_tf_record(output_filename, txt_path, num_shards, label_map_dict, image_dir): objects, imgs = [], [] valid_imgs = 0 max_faces = 0 with open(txt_path, 'r') as f: line = f.readline() while line: imgs.append...
def create_tf_record(output_filename, txt_path, num_shards, label_map_dict, image_dir):
objects, imgs = [], [] valid_imgs = 0 max_faces = 0 with open(txt_path, 'r') as f: line = f.readline() while line: imgs.append(line.strip(' \n')) n_obj = int(f.readline().strip(' \n')) # print('read n_obj', n_obj) if n_obj == 0: ...
image/object/class/text': dataset_util.bytes_list_feature(classes_text), 'image/object/class/label': dataset_util.int64_list_feature(classes), # 'image/object/difficult': dataset_util.int64_list_feature(difficult_obj), # 'image/object/truncated': dataset_util.int64_list_feature(truncated), ...
127
127
426
26
100
vuamitom/models
research/object_detection/dataset_tools/create_widerface_tf_record.py
Python
create_tf_record
create_tf_record
82
125
82
85
b747707f9e61e1730eaee387c285a18909ec38b5
bigcode/the-stack
train