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
a6ab958990e39fdf97b3c420
train
class
class Configurator(object): """ Singleton class for user configuration data """ __instance = None __cfg_path = None def __new__(cls, cfg_path): if Configurator.__instance is None: Configurator.__instance = object.__new__(EnvironmentConfigParser) Configurator.__in...
class Configurator(object):
""" Singleton class for user configuration data """ __instance = None __cfg_path = None def __new__(cls, cfg_path): if Configurator.__instance is None: Configurator.__instance = object.__new__(EnvironmentConfigParser) Configurator.__instance.__init__(interpolatio...
cls): if PrivateConfigurator.__instance is None: PrivateConfigurator.__instance = object.__new__(EnvironmentConfigParser) PrivateConfigurator.__instance.__init__(interpolation=configparser.ExtendedInterpolation()) PrivateConfigurator.__instance.read(get_private_config_path())...
64
64
95
5
58
BHAR-HumanActivity/B-HAR
b_har/utility/configurator.py
Python
Configurator
Configurator
25
37
25
25
3c51d997f8bfe8cbed54bf4be6169f828d6f86d3
bigcode/the-stack
train
a1e8ce556aac69b1d33b9cb2
train
class
class PrivateConfigurator(object): """ Singleton class for private configuration data """ __instance = None def __new__(cls): if PrivateConfigurator.__instance is None: PrivateConfigurator.__instance = object.__new__(EnvironmentConfigParser) PrivateConfigurator.__ins...
class PrivateConfigurator(object):
""" Singleton class for private configuration data """ __instance = None def __new__(cls): if PrivateConfigurator.__instance is None: PrivateConfigurator.__instance = object.__new__(EnvironmentConfigParser) PrivateConfigurator.__instance.__init__(interpolation=config...
from __future__ import absolute_import, division import configparser from os import environ from os.path import abspath, dirname, join def to_environ_key(key): return key.upper() class PrivateConfigurator(object):
47
64
87
5
42
BHAR-HumanActivity/B-HAR
b_har/utility/configurator.py
Python
PrivateConfigurator
PrivateConfigurator
11
22
11
11
532ff03d95b7257b763f233c2ab86df06176f8a6
bigcode/the-stack
train
f5e6ccbcce4ab40605578058
train
function
def get_private_config_path(): """ Get absolute path to the private config file """ current_path = abspath(dirname(__file__)) conf_path = join(current_path, 'private_config.cfg') if conf_path: return conf_path print("Private config file not found")
def get_private_config_path():
""" Get absolute path to the private config file """ current_path = abspath(dirname(__file__)) conf_path = join(current_path, 'private_config.cfg') if conf_path: return conf_path print("Private config file not found")
""" Read config files and return ConfigParser object @param cfgfile: filename or array of filenames @return: ConfigParser object """ parser = EnvironmentConfigParser( interpolation=configparser.ExtendedInterpolation()) parser.read(cfgfile) return parser def get_private_config_path(...
64
64
62
6
57
BHAR-HumanActivity/B-HAR
b_har/utility/configurator.py
Python
get_private_config_path
get_private_config_path
69
79
69
69
41922d5dd6be4cddbf11101ef37a72477a181155
bigcode/the-stack
train
d8c0e7735868c607830266c6
train
class
class Memory(LoggingMixIn, Operations): 'Example memory filesystem. Supports only one level of files.' def __init__(self): self.files = {} self.data = defaultdict(bytes) self.fd = 0 now = time() self.files['/'] = dict(st_mode=(S_IFDIR | 0o777), st_ctime=now, ...
class Memory(LoggingMixIn, Operations):
'Example memory filesystem. Supports only one level of files.' def __init__(self): self.files = {} self.data = defaultdict(bytes) self.fd = 0 now = time() self.files['/'] = dict(st_mode=(S_IFDIR | 0o777), st_ctime=now, st_mtime=now, st_atim...
# Based on memory.py example: https://raw.githubusercontent.com/terencehonles/fusepy/master/examples/memory.py #!/usr/bin/env python from __future__ import print_function, absolute_import, division import logging from collections import defaultdict from errno import ENOENT from stat import S_IFDIR, S_IFLNK, S_IFREG ...
134
256
1,034
9
124
FingerLeakers/uxss-db
other/ppapithing/foofuse.py
Python
Memory
Memory
21
144
21
21
bc7106d1fa08228540c507448c0cff0e5473d39c
bigcode/the-stack
train
f53a30d258394d405c097d85
train
function
@capture_dauphin_error def get_stats(graphene_info, run_id): stats = graphene_info.context.instance.get_run_stats(run_id) return graphene_info.schema.type_named('PipelineRunStatsSnapshot')(stats)
@capture_dauphin_error def get_stats(graphene_info, run_id):
stats = graphene_info.context.instance.get_run_stats(run_id) return graphene_info.schema.type_named('PipelineRunStatsSnapshot')(stats)
return graphene_info.schema.type_named('ExecutionPlan')( dauphin_pipeline, create_execution_plan( dauphin_pipeline.get_dagster_pipeline(), environment_dict, RunConfig(mode=mode) ), ) @capture_dauphin_error def get_stats(graphene_info, run_id):
64
64
46
18
46
Ramshackle-Jamathon/dagster
python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py
Python
get_stats
get_stats
105
108
105
106
9c410beed644fa87df0c2e588b3dc9be4e20b5ad
bigcode/the-stack
train
d8f77a675cd14fdef3fe0793
train
function
def get_runs(graphene_info, filters, cursor=None, limit=None): check.opt_inst_param(filters, 'filters', PipelineRunsFilter) check.opt_str_param(cursor, 'cursor') check.opt_int_param(limit, 'limit') instance = graphene_info.context.instance runs = [] if filters and filters.run_id: run =...
def get_runs(graphene_info, filters, cursor=None, limit=None):
check.opt_inst_param(filters, 'filters', PipelineRunsFilter) check.opt_str_param(cursor, 'cursor') check.opt_int_param(limit, 'limit') instance = graphene_info.context.instance runs = [] if filters and filters.run_id: run = instance.get_run_by_id(filters.run_id) if run: ...
(graphene_info): instance = graphene_info.context.instance return [ graphene_info.schema.type_named('PipelineTagAndValues')(key=key, values=values) for key, values in instance.get_run_tags() ] def get_runs(graphene_info, filters, cursor=None, limit=None):
63
64
155
15
48
Ramshackle-Jamathon/dagster
python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py
Python
get_runs
get_runs
58
75
58
58
a2a41b732a042f2cef87f81a8b91f4e432f4a936
bigcode/the-stack
train
af39a3b884d081bdc0cd95c3
train
function
def get_run(graphene_info, run_id): instance = graphene_info.context.instance run = instance.get_run_by_id(run_id) if not run: return graphene_info.schema.type_named('PipelineRunNotFoundError')(run_id) else: return graphene_info.schema.type_named('PipelineRun')(run)
def get_run(graphene_info, run_id):
instance = graphene_info.context.instance run = instance.get_run_by_id(run_id) if not run: return graphene_info.schema.type_named('PipelineRunNotFoundError')(run_id) else: return graphene_info.schema.type_named('PipelineRun')(run)
auphin_pipeline, errors=[ graphene_info.schema.type_named( 'PipelineConfigValidationError' ).from_dagster_error(graphene_info, err) for err in validated_config.errors ], ) ) retur...
64
64
67
10
53
Ramshackle-Jamathon/dagster
python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py
Python
get_run
get_run
41
47
41
41
2e534619786ea97a383a8e9cf4e1b2cfad61dc53
bigcode/the-stack
train
4a224d5a40000ea35654f5b6
train
function
@capture_dauphin_error def validate_pipeline_config(graphene_info, selector, environment_dict, mode): check.inst_param(graphene_info, 'graphene_info', ResolveInfo) check.inst_param(selector, 'selector', ExecutionSelector) check.opt_str_param(mode, 'mode') dauphin_pipeline = get_dauphin_pipeline_from_se...
@capture_dauphin_error def validate_pipeline_config(graphene_info, selector, environment_dict, mode):
check.inst_param(graphene_info, 'graphene_info', ResolveInfo) check.inst_param(selector, 'selector', ExecutionSelector) check.opt_str_param(mode, 'mode') dauphin_pipeline = get_dauphin_pipeline_from_selector_or_raise(graphene_info, selector) get_validated_config(graphene_info, dauphin_pipeline, env...
cursor, limit) else: runs = instance.get_runs(cursor=cursor, limit=limit) return [graphene_info.schema.type_named('PipelineRun')(run) for run in runs] @capture_dauphin_error def validate_pipeline_config(graphene_info, selector, environment_dict, mode):
64
64
121
23
41
Ramshackle-Jamathon/dagster
python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py
Python
validate_pipeline_config
validate_pipeline_config
78
86
78
79
4cd202c2b5d13adb1e28f0ad3a5736201e3a2678
bigcode/the-stack
train
5efa447c5bb7b62781725e8c
train
function
@capture_dauphin_error def get_execution_plan(graphene_info, selector, environment_dict, mode): check.inst_param(graphene_info, 'graphene_info', ResolveInfo) check.inst_param(selector, 'selector', ExecutionSelector) check.opt_str_param(mode, 'mode') dauphin_pipeline = get_dauphin_pipeline_reference_fro...
@capture_dauphin_error def get_execution_plan(graphene_info, selector, environment_dict, mode):
check.inst_param(graphene_info, 'graphene_info', ResolveInfo) check.inst_param(selector, 'selector', ExecutionSelector) check.opt_str_param(mode, 'mode') dauphin_pipeline = get_dauphin_pipeline_reference_from_selector(graphene_info, selector) get_validated_config(graphene_info, dauphin_pipeline, en...
, selector) get_validated_config(graphene_info, dauphin_pipeline, environment_dict, mode) return graphene_info.schema.type_named('PipelineConfigValidationValid')(dauphin_pipeline) @capture_dauphin_error def get_execution_plan(graphene_info, selector, environment_dict, mode):
64
64
148
23
41
Ramshackle-Jamathon/dagster
python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py
Python
get_execution_plan
get_execution_plan
89
102
89
90
0e77738ae6ba21fa0d5cb7c412150840022d3735
bigcode/the-stack
train
3c214486bb8e4011c3cd294c
train
function
def get_run_tags(graphene_info): instance = graphene_info.context.instance return [ graphene_info.schema.type_named('PipelineTagAndValues')(key=key, values=values) for key, values in instance.get_run_tags() ]
def get_run_tags(graphene_info):
instance = graphene_info.context.instance return [ graphene_info.schema.type_named('PipelineTagAndValues')(key=key, values=values) for key, values in instance.get_run_tags() ]
instance = graphene_info.context.instance run = instance.get_run_by_id(run_id) if not run: return graphene_info.schema.type_named('PipelineRunNotFoundError')(run_id) else: return graphene_info.schema.type_named('PipelineRun')(run) def get_run_tags(graphene_info):
64
64
52
8
56
Ramshackle-Jamathon/dagster
python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py
Python
get_run_tags
get_run_tags
50
55
50
50
83d54ff9552d4a1ab77e39a4ac52208308e13a6c
bigcode/the-stack
train
5af5d5edc2b59ee3ff24c89c
train
function
def get_validated_config(graphene_info, dauphin_pipeline, environment_dict, mode): check.str_param(mode, 'mode') pipeline = dauphin_pipeline.get_dagster_pipeline() environment_schema = create_environment_schema(pipeline, mode) validated_config = validate_config(environment_schema.environment_type, en...
def get_validated_config(graphene_info, dauphin_pipeline, environment_dict, mode):
check.str_param(mode, 'mode') pipeline = dauphin_pipeline.get_dagster_pipeline() environment_schema = create_environment_schema(pipeline, mode) validated_config = validate_config(environment_schema.environment_type, environment_dict) if not validated_config.success: raise UserFacingGraph...
_pipelines import ( get_dauphin_pipeline_from_selector_or_raise, get_dauphin_pipeline_reference_from_selector, ) from .utils import UserFacingGraphQLError, capture_dauphin_error def get_validated_config(graphene_info, dauphin_pipeline, environment_dict, mode):
64
64
152
19
44
Ramshackle-Jamathon/dagster
python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py
Python
get_validated_config
get_validated_config
16
38
16
16
ad7d2ff2df46197484e28c44ce17db877201d6fa
bigcode/the-stack
train
9a81ba06708bd1bed2fdfaf3
train
function
def draw_network (filename, scripts): ''' Draw statistics network using HTML support. Parameters ---------- filename : string Filename of the statistics dumped by Scorer object scripts : string Filename of sources c++ scripts in which read the statistics dependencies ''' ...
def draw_network (filename, scripts):
''' Draw statistics network using HTML support. Parameters ---------- filename : string Filename of the statistics dumped by Scorer object scripts : string Filename of sources c++ scripts in which read the statistics dependencies ''' data = pd.read_csv(filename, sep=',...
} td { background-color: #cccccc; } table, th, td { font-family:Arial, Helvetica, sans-serif; border: 1px solid black; text-align: right; } g.mpld3-xaxis, g.mpld3-xaxis { display: none; } g.mpld3-yax...
115
116
389
8
107
Nico-Curti/scorer
utils/view_stats.py
Python
draw_network
draw_network
48
98
48
48
cbd5616e74430ba52f2afc52be1276b1827e517a
bigcode/the-stack
train
021fb353f5e3aed53f5deefd
train
class
class LightModel: def __init__(self, manufacturer: str, model: str, custom_model_directory: str): self._manufacturer = manufacturer self._model = model self._custom_model_directory = custom_model_directory self._json_data = self.load_model_manifest() def load_model_manifest(self...
class LightModel:
def __init__(self, manufacturer: str, model: str, custom_model_directory: str): self._manufacturer = manufacturer self._model = model self._custom_model_directory = custom_model_directory self._json_data = self.load_model_manifest() def load_model_manifest(self) -> dict: ...
import json import os from typing import Optional from .const import ( MANUFACTURER_DIRECTORY_MAPPING, MODE_FIXED, MODE_LINEAR, MODEL_DIRECTORY_MAPPING, ) from .errors import ModelNotSupported, UnsupportedMode class LightModel:
52
159
532
4
47
magnusoverli/homeassistant-powercalc
custom_components/powercalc/light_model.py
Python
LightModel
LightModel
14
89
14
14
c435c25c59d83ff0504c43be6f5031b90b4d98fa
bigcode/the-stack
train
0beacb6be09f70f9a9c2e601
train
class
class Migration(migrations.Migration): dependencies = [ ('isisdata', '0040_auto_20160701_1946'), ] operations = [ migrations.AlterField( model_name='aarelation', name='record_status_value', field=models.CharField(default=b'Active', max_length=255, null=T...
class Migration(migrations.Migration):
dependencies = [ ('isisdata', '0040_auto_20160701_1946'), ] operations = [ migrations.AlterField( model_name='aarelation', name='record_status_value', field=models.CharField(default=b'Active', max_length=255, null=True, blank=True, choices=[(b'Active', b'...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration):
31
256
1,482
7
23
bgopalachary/IsisCB
isiscb/isisdata/migrations/0041_auto_20160712_1656.py
Python
Migration
Migration
7
104
7
8
f7f35f798a1df389deaae23b335b82a533ae6de2
bigcode/the-stack
train
e4ce31d8223a3cdaf9e0ce09
train
function
def list_files(suffix=""): """ Returns a list of all files in pylearn2 with the given suffix. Parameters ---------- suffix : str Returns ------- file_list : list A list of all files in pylearn2 whose filepath ends with `suffix` """ cleverhans_path, = cleverhans.__path...
def list_files(suffix=""):
""" Returns a list of all files in pylearn2 with the given suffix. Parameters ---------- suffix : str Returns ------- file_list : list A list of all files in pylearn2 whose filepath ends with `suffix` """ cleverhans_path, = cleverhans.__path__ file_list = _list_f...
Universite de Montreal" __credits__ = ["Ian Goodfellow"] __license__ = "3-clause BSD" __maintainer__ = "LISA Lab" __email__ = "pylearn-dev@googlegroups" logger = logging.getLogger(__name__) def list_files(suffix=""):
64
64
101
7
57
yoheikikuta/robust_physical_perturbations
lisa-cnn-attack/cleverhans/devtools/list_files.py
Python
list_files
list_files
15
34
15
15
272d7557e877cb5e26d95c7b92f28d9dc9064cb8
bigcode/the-stack
train
bf1092630d5425f2851b34e6
train
function
def _list_files(path, suffix=""): """ .. todo:: WRITEME Parameters ---------- path : str a filepath suffix : str Returns ------- l : list A list of all files ending in `suffix` contained within `path`. (If `path` is a file rather than a directory, i...
def _list_files(path, suffix=""):
""" .. todo:: WRITEME Parameters ---------- path : str a filepath suffix : str Returns ------- l : list A list of all files ending in `suffix` contained within `path`. (If `path` is a file rather than a directory, it is considered to "contai...
list A list of all files in pylearn2 whose filepath ends with `suffix` """ cleverhans_path, = cleverhans.__path__ file_list = _list_files(cleverhans_path, suffix) return file_list def _list_files(path, suffix=""):
64
64
200
9
54
yoheikikuta/robust_physical_perturbations
lisa-cnn-attack/cleverhans/devtools/list_files.py
Python
_list_files
_list_files
37
69
37
37
df3556254ba0b6dad0258b5d5cf4abb45cc29d47
bigcode/the-stack
train
65f32cfe1070a8004ee7c0b4
train
class
class CodecDFS: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode """ if not root: return None rootNode = TreeNode(root.val) if len(root.children) > 0: firstChild = root.children[0] ...
class CodecDFS:
def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode """ if not root: return None rootNode = TreeNode(root.val) if len(root.children) > 0: firstChild = root.children[0] rootNo...
a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None """ """ solution reference: https://en.wikipedia.org/wiki/M-ary_tree#Convert_a_m-ary_tree_to_binary_tree """ class CodecDFS:
69
69
233
4
65
liaison/LeetCode
python/431_encode_n-ary-tree_to_binary_tree.py
Python
CodecDFS
CodecDFS
24
65
24
25
9b565a79e6309fe69c64e47c18165f4cc7411fbc
bigcode/the-stack
train
70877043835d4dc1687829cc
train
class
class CodecBFS: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode """ if not root: return None rootNode = TreeNode(root.val) queue = deque([(rootNode, root)]) while queue: pa...
class CodecBFS:
def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode """ if not root: return None rootNode = TreeNode(root.val) queue = deque([(rootNode, root)]) while queue: parent, curr = queu...
= curr.right return rootNode def decode(self, data): """Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node """ if not data: return None rootNode = Node(data.val, []) curr = data.left while curr: ...
104
104
348
5
98
liaison/LeetCode
python/431_encode_n-ary-tree_to_binary_tree.py
Python
CodecBFS
CodecBFS
71
131
71
72
dee13ad03c82d97ad49b24c247ff309516f1a88b
bigcode/the-stack
train
b80b384e1f1c6be44d9adc35
train
class
class SourceNameConnection(relay.Connection): class Meta: node = typeahead.SourceName
class SourceNameConnection(relay.Connection):
class Meta: node = typeahead.SourceName
class CodeConnection(relay.Connection): class Meta: node = typeahead.Code class PathConnection(relay.Connection): class Meta: node = typeahead.Path class CallableConnection(relay.Connection): class Meta: node = typeahead.Callable class SourceNameConnection(relay.Connection):
64
64
20
8
55
arpancodes/sapp
sapp/ui/schema.py
Python
SourceNameConnection
SourceNameConnection
67
69
67
67
67724db60e3b61b1586ffef907ad2c13a4011893
bigcode/the-stack
train
13afeda4dfdbc11ea811550d
train
class
class FeatureConnection(relay.Connection): class Meta: node = typeahead.Feature
class FeatureConnection(relay.Connection):
class Meta: node = typeahead.Feature
Connection(relay.Connection): class Meta: node = typeahead.SinkName class SinkKindConnection(relay.Connection): class Meta: node = typeahead.SinkKind class StatusConnection(relay.Connection): class Meta: node = typeahead.Status class FeatureConnection(relay.Connection):
64
64
18
7
56
arpancodes/sapp
sapp/ui/schema.py
Python
FeatureConnection
FeatureConnection
92
94
92
92
2705ed316aa15d09eba390e735f06ed4a625c68c
bigcode/the-stack
train
c22d2452a8e44823ac40b126
train
class
class CallableConnection(relay.Connection): class Meta: node = typeahead.Callable
class CallableConnection(relay.Connection):
class Meta: node = typeahead.Callable
_link = graphene.String() class FileConnection(relay.Connection): class Meta: node = File class CodeConnection(relay.Connection): class Meta: node = typeahead.Code class PathConnection(relay.Connection): class Meta: node = typeahead.Path class CallableConnection(relay.Connectio...
64
64
19
7
56
arpancodes/sapp
sapp/ui/schema.py
Python
CallableConnection
CallableConnection
62
64
62
62
807e3ca812b8a04cefe6b92bd9b3d3c64e544023
bigcode/the-stack
train
e1b8785cceb92fe7bf0db347
train
class
class MatchesIsField(graphene.InputObjectType): operation = graphene.String() value = graphene.List(graphene.String)
class MatchesIsField(graphene.InputObjectType):
operation = graphene.String() value = graphene.List(graphene.String)
): class Meta: node = typeahead.Feature class FilterConnection(relay.Connection): class Meta: node = filters_module.Filter class FeatureCondition(graphene.InputObjectType): mode = graphene.String() features = graphene.List(graphene.String) class MatchesIsField(graphene.InputObjectTyp...
64
64
25
10
54
arpancodes/sapp
sapp/ui/schema.py
Python
MatchesIsField
MatchesIsField
107
109
107
107
792ed7ff56081e723de81d07923f58254d39e597
bigcode/the-stack
train
8cd3007bccbb4975c836335e
train
class
class File(graphene.ObjectType): class Meta: interfaces = (relay.Node,) path = graphene.String() contents = graphene.String() editor_link = graphene.String()
class File(graphene.ObjectType):
class Meta: interfaces = (relay.Node,) path = graphene.String() contents = graphene.String() editor_link = graphene.String()
class RunConnection(relay.Connection): class Meta: node = run.Run class IssueConnection(relay.Connection): class Meta: node = IssueQueryResultType class TraceFrameConnection(relay.Connection): class Meta: node = TraceFrameQueryResultType class File(graphene.ObjectType):
64
64
38
7
56
arpancodes/sapp
sapp/ui/schema.py
Python
File
File
38
44
38
38
c95cf260ddedd7afbadb0435ef0ea526777943ee
bigcode/the-stack
train
5125d506735b9b8386cc2d86
train
class
class FeatureCondition(graphene.InputObjectType): mode = graphene.String() features = graphene.List(graphene.String)
class FeatureCondition(graphene.InputObjectType):
mode = graphene.String() features = graphene.List(graphene.String)
class StatusConnection(relay.Connection): class Meta: node = typeahead.Status class FeatureConnection(relay.Connection): class Meta: node = typeahead.Feature class FilterConnection(relay.Connection): class Meta: node = filters_module.Filter class FeatureCondition(graphene.Inpu...
64
64
24
9
54
arpancodes/sapp
sapp/ui/schema.py
Python
FeatureCondition
FeatureCondition
102
104
102
102
8e451b100c334f2d78f0b93e1f637fe6f8510e43
bigcode/the-stack
train
5e90727c7a13cd95c92eb0ac
train
class
class CodeConnection(relay.Connection): class Meta: node = typeahead.Code
class CodeConnection(relay.Connection):
class Meta: node = typeahead.Code
ResultType class File(graphene.ObjectType): class Meta: interfaces = (relay.Node,) path = graphene.String() contents = graphene.String() editor_link = graphene.String() class FileConnection(relay.Connection): class Meta: node = File class CodeConnection(relay.Connection):
64
64
18
7
56
arpancodes/sapp
sapp/ui/schema.py
Python
CodeConnection
CodeConnection
52
54
52
52
565ab211b8ddba43ebe7a761e538d20ced2e5fd0
bigcode/the-stack
train
4e887e961dfa221227437c68
train
class
class RunConnection(relay.Connection): class Meta: node = run.Run
class RunConnection(relay.Connection):
class Meta: node = run.Run
, TraceKind from . import filters as filters_module from . import issues, run, trace, typeahead from .issues import Instance, IssueQueryResult, IssueQueryResultType, update_status from .trace import TraceFrameQueryResult, TraceFrameQueryResultType class RunConnection(relay.Connection):
64
64
17
7
56
arpancodes/sapp
sapp/ui/schema.py
Python
RunConnection
RunConnection
23
25
23
23
d4753aaf1777286c214845f7188bbac51654adfd
bigcode/the-stack
train
16c13d2a8cb18da4c1517ff1
train
class
class Mutation(graphene.ObjectType): # pyre-fixme[4]: Attribute must be annotated. save_filter = SaveFilterMutation.Field() # pyre-fixme[4]: Attribute must be annotated. delete_filter = DeleteFilterMutation.Field() delete_run: DeleteRunMutation = DeleteRunMutation.Field() update_status: UpdateSt...
class Mutation(graphene.ObjectType): # pyre-fixme[4]: Attribute must be annotated.
save_filter = SaveFilterMutation.Field() # pyre-fixme[4]: Attribute must be annotated. delete_filter = DeleteFilterMutation.Field() delete_run: DeleteRunMutation = DeleteRunMutation.Field() update_status: UpdateStatusMutation = UpdateStatusMutation.Field()
, **kwargs: Any ) -> "UpdateStatusMutation": session = info.context.get("session") update_status(session, kwargs["id"], kwargs["status"]) return UpdateStatusMutation() class Mutation(graphene.ObjectType): # pyre-fixme[4]: Attribute must be annotated.
64
64
81
22
42
arpancodes/sapp
sapp/ui/schema.py
Python
Mutation
Mutation
359
365
359
360
016a11eb3bbfa1783024e68efaea1cd8e8fda549
bigcode/the-stack
train
24b4f93a16a213a5c3b88fff
train
class
class SinkKindConnection(relay.Connection): class Meta: node = typeahead.SinkKind
class SinkKindConnection(relay.Connection):
class Meta: node = typeahead.SinkKind
ay.Connection): class Meta: node = typeahead.SourceName class SourceKindConnection(relay.Connection): class Meta: node = typeahead.SourceKind class SinkNameConnection(relay.Connection): class Meta: node = typeahead.SinkName class SinkKindConnection(relay.Connection):
64
64
21
8
55
arpancodes/sapp
sapp/ui/schema.py
Python
SinkKindConnection
SinkKindConnection
82
84
82
82
c32e50835de94ae32f74490fe6cc8695f2de1ff3
bigcode/the-stack
train
5e29c0a20b471523200a6aeb
train
class
class FileConnection(relay.Connection): class Meta: node = File
class FileConnection(relay.Connection):
class Meta: node = File
FrameConnection(relay.Connection): class Meta: node = TraceFrameQueryResultType class File(graphene.ObjectType): class Meta: interfaces = (relay.Node,) path = graphene.String() contents = graphene.String() editor_link = graphene.String() class FileConnection(relay.Connection):
64
64
16
7
57
arpancodes/sapp
sapp/ui/schema.py
Python
FileConnection
FileConnection
47
49
47
47
d9550a36492598a531a60492613f42e7d9e5c6d3
bigcode/the-stack
train
977a2e675ebb610d9f042ed8
train
class
class SourceKindConnection(relay.Connection): class Meta: node = typeahead.SourceKind
class SourceKindConnection(relay.Connection):
class Meta: node = typeahead.SourceKind
PathConnection(relay.Connection): class Meta: node = typeahead.Path class CallableConnection(relay.Connection): class Meta: node = typeahead.Callable class SourceNameConnection(relay.Connection): class Meta: node = typeahead.SourceName class SourceKindConnection(relay.Connection...
64
64
20
8
55
arpancodes/sapp
sapp/ui/schema.py
Python
SourceKindConnection
SourceKindConnection
72
74
72
72
0cb36ef5c6e3fa06e4287ef9bbfda003d5e2acd2
bigcode/the-stack
train
fdfc950d71ac00c4063df6d3
train
class
class UpdateStatusMutation(relay.ClientIDMutation): class Input: id = graphene.ID(required=True) status = graphene.String(required=True) def mutate_and_get_payload( self, info: ResolveInfo, **kwargs: Any ) -> "UpdateStatusMutation": session = info.context.get("session") ...
class UpdateStatusMutation(relay.ClientIDMutation):
class Input: id = graphene.ID(required=True) status = graphene.String(required=True) def mutate_and_get_payload( self, info: ResolveInfo, **kwargs: Any ) -> "UpdateStatusMutation": session = info.context.get("session") update_status(session, kwargs["id"], kwargs["sta...
) def mutate_and_get_payload( self, info: ResolveInfo, **kwargs: Any ) -> "DeleteRunMutation": session = info.context.get("session") run.delete_run(session, kwargs["id"]) return DeleteRunMutation() class UpdateStatusMutation(relay.ClientIDMutation):
64
64
86
10
54
arpancodes/sapp
sapp/ui/schema.py
Python
UpdateStatusMutation
UpdateStatusMutation
346
356
346
346
2598db08d16b333b2d569f2803fb89de3198ff17
bigcode/the-stack
train
959c5eaa4128a6e81907a791
train
class
class DeleteRunMutation(relay.ClientIDMutation): class Input: id = graphene.ID(required=True) def mutate_and_get_payload( self, info: ResolveInfo, **kwargs: Any ) -> "DeleteRunMutation": session = info.context.get("session") run.delete_run(session, kwargs["id"]) retu...
class DeleteRunMutation(relay.ClientIDMutation):
class Input: id = graphene.ID(required=True) def mutate_and_get_payload( self, info: ResolveInfo, **kwargs: Any ) -> "DeleteRunMutation": session = info.context.get("session") run.delete_run(session, kwargs["id"]) return DeleteRunMutation()
def mutate_and_get_payload( self, info: ResolveInfo, **kwargs: Any ) -> "DeleteFilterMutation": session = info.context.get("session") filters_module.delete_filter(session, kwargs["name"]) return DeleteFilterMutation() class DeleteRunMutation(relay.ClientIDMutation):
64
64
75
10
54
arpancodes/sapp
sapp/ui/schema.py
Python
DeleteRunMutation
DeleteRunMutation
334
343
334
334
93fa1b8183be9d0cb89444e699850f75493afa22
bigcode/the-stack
train
2e41b5cc440c9c28712927d3
train
class
class Query(graphene.ObjectType): # pyre-fixme[4]: Attribute must be annotated. node = relay.Node.Field() runs = relay.ConnectionField( RunConnection, ) issues = relay.ConnectionField( IssueConnection, run_id=graphene.Int(required=True), codes=graphene.List(graphene...
class Query(graphene.ObjectType): # pyre-fixme[4]: Attribute must be annotated.
node = relay.Node.Field() runs = relay.ConnectionField( RunConnection, ) issues = relay.ConnectionField( IssueConnection, run_id=graphene.Int(required=True), codes=graphene.List(graphene.Int, default_value=["%"]), paths=graphene.List(graphene.String, default_val...
): class Meta: node = typeahead.Code class PathConnection(relay.Connection): class Meta: node = typeahead.Path class CallableConnection(relay.Connection): class Meta: node = typeahead.Callable class SourceNameConnection(relay.Connection): class Meta: node = typeahea...
256
256
1,562
22
234
arpancodes/sapp
sapp/ui/schema.py
Python
Query
Query
112
302
112
113
555d3fbcd7fa5b994cc72e17029886c2e4050ad3
bigcode/the-stack
train
9ff3d605dd229574cd34e65e
train
class
class SinkNameConnection(relay.Connection): class Meta: node = typeahead.SinkName
class SinkNameConnection(relay.Connection):
class Meta: node = typeahead.SinkName
(relay.Connection): class Meta: node = typeahead.Callable class SourceNameConnection(relay.Connection): class Meta: node = typeahead.SourceName class SourceKindConnection(relay.Connection): class Meta: node = typeahead.SourceKind class SinkNameConnection(relay.Connection):
64
64
21
8
55
arpancodes/sapp
sapp/ui/schema.py
Python
SinkNameConnection
SinkNameConnection
77
79
77
77
b900633caf99303895e5289401844c64578cefa3
bigcode/the-stack
train
e1f82ff5c6b7360a252107c6
train
class
class TraceFrameConnection(relay.Connection): class Meta: node = TraceFrameQueryResultType
class TraceFrameConnection(relay.Connection):
class Meta: node = TraceFrameQueryResultType
Type, update_status from .trace import TraceFrameQueryResult, TraceFrameQueryResultType class RunConnection(relay.Connection): class Meta: node = run.Run class IssueConnection(relay.Connection): class Meta: node = IssueQueryResultType class TraceFrameConnection(relay.Connection):
64
64
21
8
55
arpancodes/sapp
sapp/ui/schema.py
Python
TraceFrameConnection
TraceFrameConnection
33
35
33
33
50519ac10591acfe4881441be5857da2582a56b6
bigcode/the-stack
train
2682bd5d7b917b2929e8239b
train
class
class StatusConnection(relay.Connection): class Meta: node = typeahead.Status
class StatusConnection(relay.Connection):
class Meta: node = typeahead.Status
ay.Connection): class Meta: node = typeahead.SourceKind class SinkNameConnection(relay.Connection): class Meta: node = typeahead.SinkName class SinkKindConnection(relay.Connection): class Meta: node = typeahead.SinkKind class StatusConnection(relay.Connection):
64
64
18
7
56
arpancodes/sapp
sapp/ui/schema.py
Python
StatusConnection
StatusConnection
87
89
87
87
ac9fc1ec9d4bf59a5537955799c0222fd2241984
bigcode/the-stack
train
317158fb7658abdd230e1ee9
train
class
class FilterConnection(relay.Connection): class Meta: node = filters_module.Filter
class FilterConnection(relay.Connection):
class Meta: node = filters_module.Filter
class SinkKindConnection(relay.Connection): class Meta: node = typeahead.SinkKind class StatusConnection(relay.Connection): class Meta: node = typeahead.Status class FeatureConnection(relay.Connection): class Meta: node = typeahead.Feature class FilterConnection(relay.Connection)...
64
64
18
7
56
arpancodes/sapp
sapp/ui/schema.py
Python
FilterConnection
FilterConnection
97
99
97
97
82936cda99a7b520bd51e4d81b9a9fac9a77e2a9
bigcode/the-stack
train
6783e83447c38f316df7d6ce
train
class
class SaveFilterMutation(relay.ClientIDMutation): node = graphene.Field(filters_module.Filter) class Input: name = graphene.String(required=True) description = graphene.String() json = graphene.String() def mutate_and_get_payload( self, info: ResolveInfo, **kwargs: Any ...
class SaveFilterMutation(relay.ClientIDMutation):
node = graphene.Field(filters_module.Filter) class Input: name = graphene.String(required=True) description = graphene.String() json = graphene.String() def mutate_and_get_payload( self, info: ResolveInfo, **kwargs: Any ) -> "SaveFilterMutation": session = info....
)}" return [File(path=path, contents=contents, editor_link=editor_link)] def resolve_filters(self, info: ResolveInfo) -> List[filters_module.Filter]: session = info.context["session"] return filters_module.all_filters(session) class SaveFilterMutation(relay.ClientIDMutation):
64
64
107
10
54
arpancodes/sapp
sapp/ui/schema.py
Python
SaveFilterMutation
SaveFilterMutation
305
319
305
305
b0fc38df03becd157ed954c74a85e3f9d01ecd14
bigcode/the-stack
train
f5c8184cf45e685b6add85e1
train
class
class DeleteFilterMutation(relay.ClientIDMutation): class Input: name = graphene.String(required=True) def mutate_and_get_payload( self, info: ResolveInfo, **kwargs: Any ) -> "DeleteFilterMutation": session = info.context.get("session") filters_module.delete_filter(session, ...
class DeleteFilterMutation(relay.ClientIDMutation):
class Input: name = graphene.String(required=True) def mutate_and_get_payload( self, info: ResolveInfo, **kwargs: Any ) -> "DeleteFilterMutation": session = info.context.get("session") filters_module.delete_filter(session, kwargs["name"]) return DeleteFilterMutation(...
info: ResolveInfo, **kwargs: Any ) -> "SaveFilterMutation": session = info.context.get("session") filter = filters_module.Filter(**kwargs) filters_module.save_filter(session, filter) return SaveFilterMutation(node=filter) class DeleteFilterMutation(relay.ClientIDMutation):
64
64
76
10
54
arpancodes/sapp
sapp/ui/schema.py
Python
DeleteFilterMutation
DeleteFilterMutation
322
331
322
322
1fa240dec752a64ab9640faac0e1c9a173c64d06
bigcode/the-stack
train
0e80aab17589c8f04694c93d
train
class
class PathConnection(relay.Connection): class Meta: node = typeahead.Path
class PathConnection(relay.Connection):
class Meta: node = typeahead.Path
relay.Node,) path = graphene.String() contents = graphene.String() editor_link = graphene.String() class FileConnection(relay.Connection): class Meta: node = File class CodeConnection(relay.Connection): class Meta: node = typeahead.Code class PathConnection(relay.Connection):
64
64
18
7
56
arpancodes/sapp
sapp/ui/schema.py
Python
PathConnection
PathConnection
57
59
57
57
90c8009b77e821926d76290837fa3bf15686fd63
bigcode/the-stack
train
d5c4ea1eff90317f12f8afb8
train
class
class IssueConnection(relay.Connection): class Meta: node = IssueQueryResultType
class IssueConnection(relay.Connection):
class Meta: node = IssueQueryResultType
run, trace, typeahead from .issues import Instance, IssueQueryResult, IssueQueryResultType, update_status from .trace import TraceFrameQueryResult, TraceFrameQueryResultType class RunConnection(relay.Connection): class Meta: node = run.Run class IssueConnection(relay.Connection):
64
64
19
7
56
arpancodes/sapp
sapp/ui/schema.py
Python
IssueConnection
IssueConnection
28
30
28
28
ff412d1dadd024af69b119c8cb2bac3f9b56fd76
bigcode/the-stack
train
d45a16e1173025eea2c3611e
train
class
class Migration(migrations.Migration): dependencies = [ ('tutoring', '0001_initial'), ] operations = [ migrations.AlterField( model_name='timeslot', name='day', field=models.IntegerField(choices=[(1, 'Mon'), (3, 'Wed'), (5, 'Fri')]), ), m...
class Migration(migrations.Migration):
dependencies = [ ('tutoring', '0001_initial'), ] operations = [ migrations.AlterField( model_name='timeslot', name='day', field=models.IntegerField(choices=[(1, 'Mon'), (3, 'Wed'), (5, 'Fri')]), ), migrations.AlterField( model_...
# Generated by Django 2.2.8 on 2021-01-22 08:02 from django.db import migrations, models class Migration(migrations.Migration):
38
64
185
7
30
alvin-xu-5745/hknweb
hknweb/tutoring/migrations/0002_auto_20210122_0002.py
Python
Migration
Migration
6
28
6
7
7bdbbfa9733aceb06e48a9193adf65eca34c9688
bigcode/the-stack
train
c29e0b28ed045098a1e6cd2c
train
function
def test_schedule_should_start_emitter_if_running(observer): observer.start() observer.schedule(None, '') (emitter,) = observer.emitters assert emitter.is_alive()
def test_schedule_should_start_emitter_if_running(observer):
observer.start() observer.schedule(None, '') (emitter,) = observer.emitters assert emitter.is_alive()
.api import EventEmitter, BaseObserver @pytest.fixture() def observer(request): observer = BaseObserver(EventEmitter) def finalizer(): try: observer.stop() except: pass request.addfinalizer(finalizer) return observer def test_schedule_should_start_emitter_if_run...
64
64
37
11
52
yotabits/python-watchdog
tests/test_observer.py
Python
test_schedule_should_start_emitter_if_running
test_schedule_should_start_emitter_if_running
37
41
37
37
f497d82875624c3a11d15e3509d86a99bdee8e82
bigcode/the-stack
train
ea4963ff20a745a614c30b0c
train
function
@pytest.fixture() def observer(request): observer = BaseObserver(EventEmitter) def finalizer(): try: observer.stop() except: pass request.addfinalizer(finalizer) return observer
@pytest.fixture() def observer(request):
observer = BaseObserver(EventEmitter) def finalizer(): try: observer.stop() except: pass request.addfinalizer(finalizer) return observer
for the specific language governing permissions and # limitations under the License. from __future__ import unicode_literals import pytest from watchdog.events import FileSystemEventHandler, FileModifiedEvent from watchdog.utils.compat import Event from watchdog.observers.api import EventEmitter, BaseObserver @pytes...
64
64
45
7
56
yotabits/python-watchdog
tests/test_observer.py
Python
observer
observer
25
34
25
26
a16c2b819982f5a71f9b87cd6279aea38c6ea491
bigcode/the-stack
train
b13a0f7d0784f0e69108b6a8
train
function
def test_stop_should_stop_emitter(observer): observer.schedule(None, '') observer.start() (emitter,) = observer.emitters assert emitter.is_alive() observer.stop() observer.join() assert not observer.is_alive() assert not emitter.is_alive()
def test_stop_should_stop_emitter(observer):
observer.schedule(None, '') observer.start() (emitter,) = observer.emitters assert emitter.is_alive() observer.stop() observer.join() assert not observer.is_alive() assert not emitter.is_alive()
(None, '') (emitter,) = observer.emitters assert not emitter.is_alive() def test_start_should_start_emitter(observer): observer.schedule(None, '') observer.start() (emitter,) = observer.emitters assert emitter.is_alive() def test_stop_should_stop_emitter(observer):
64
64
57
9
55
yotabits/python-watchdog
tests/test_observer.py
Python
test_stop_should_stop_emitter
test_stop_should_stop_emitter
57
65
57
57
18260283dd1010f169c8a19382d425a1c8c4e157
bigcode/the-stack
train
4026fc16059cdca064263d09
train
function
def test_start_should_start_emitter(observer): observer.schedule(None, '') observer.start() (emitter,) = observer.emitters assert emitter.is_alive()
def test_start_should_start_emitter(observer):
observer.schedule(None, '') observer.start() (emitter,) = observer.emitters assert emitter.is_alive()
(None, '') (emitter,) = observer.emitters assert emitter.is_alive() def test_schedule_should_not_start_emitter_if_not_running(observer): observer.schedule(None, '') (emitter,) = observer.emitters assert not emitter.is_alive() def test_start_should_start_emitter(observer):
64
64
35
9
55
yotabits/python-watchdog
tests/test_observer.py
Python
test_start_should_start_emitter
test_start_should_start_emitter
50
54
50
50
5d58c646b53b6730dfbaf726b9c5d48924f66f18
bigcode/the-stack
train
974fe91433903518ccddd26a
train
function
def test_schedule_should_not_start_emitter_if_not_running(observer): observer.schedule(None, '') (emitter,) = observer.emitters assert not emitter.is_alive()
def test_schedule_should_not_start_emitter_if_not_running(observer):
observer.schedule(None, '') (emitter,) = observer.emitters assert not emitter.is_alive()
pass request.addfinalizer(finalizer) return observer def test_schedule_should_start_emitter_if_running(observer): observer.start() observer.schedule(None, '') (emitter,) = observer.emitters assert emitter.is_alive() def test_schedule_should_not_start_emitter_if_not_running(observer):
64
64
36
13
51
yotabits/python-watchdog
tests/test_observer.py
Python
test_schedule_should_not_start_emitter_if_not_running
test_schedule_should_not_start_emitter_if_not_running
44
47
44
44
dca71c8e791fd9bb29bfa3113ea09f8f7dda5ca6
bigcode/the-stack
train
2d8a8d155085b2d07bb7fa6a
train
function
def test_unschedule_self(observer): """ Tests that unscheduling a watch from within an event handler correctly correctly unregisters emitter and handler without deadlocking. """ class EventHandler(FileSystemEventHandler): def on_modified(self, event): observer.unschedule(watch) ...
def test_unschedule_self(observer):
""" Tests that unscheduling a watch from within an event handler correctly correctly unregisters emitter and handler without deadlocking. """ class EventHandler(FileSystemEventHandler): def on_modified(self, event): observer.unschedule(watch) unschedule_finished.set()...
def test_stop_should_stop_emitter(observer): observer.schedule(None, '') observer.start() (emitter,) = observer.emitters assert emitter.is_alive() observer.stop() observer.join() assert not observer.is_alive() assert not emitter.is_alive() def test_unschedule_self(observer):
64
64
123
7
57
yotabits/python-watchdog
tests/test_observer.py
Python
test_unschedule_self
test_unschedule_self
68
86
68
68
1e4e8731b14d04d3d28cd0f28c12650c37958235
bigcode/the-stack
train
58df16e0f0256f8c3cd034ef
train
class
class X(object): pass
class X(object):
pass
from CircularInheritance import Foo class X(object):
10
64
7
4
5
truthiswill/intellij-community
python/testData/codeInsight/classMRO/CircularInheritance2.py
Python
X
X
4
5
4
4
9d5d393a37b5f1ec0aec0081d0b9f853f7cff3c6
bigcode/the-stack
train
e10053b7be2f7b2c401bc95d
train
class
class B(X, Foo): pass
class B(X, Foo):
pass
from CircularInheritance import Foo class X(object): pass class B(X, Foo):
19
64
9
6
12
truthiswill/intellij-community
python/testData/codeInsight/classMRO/CircularInheritance2.py
Python
B
B
8
9
8
8
bc9baf11f214640510959e12f11188792c365adf
bigcode/the-stack
train
84c791d29b2e1d37e4860819
train
class
class YOLO: def __init__(self, obj_threshold, nms_threshold): """Init. # Arguments obj_threshold: Integer, threshold for object. nms_threshold: Integer, threshold for box. """ self.obj_threshold = obj_threshold self.nms_threshold = nms_threshold ...
class YOLO:
def __init__(self, obj_threshold, nms_threshold): """Init. # Arguments obj_threshold: Integer, threshold for object. nms_threshold: Integer, threshold for box. """ self.obj_threshold = obj_threshold self.nms_threshold = nms_threshold self._yol...
"""YOLO v3 output """ import numpy as np import keras.backend as K from keras.models import load_model class YOLO:
30
256
1,655
4
25
dennistang742/YOLOv3
model/yolo_model.py
Python
YOLO
YOLO
8
214
8
8
e4e45f5edd6e8c0a1356b8044cdfd4efa7540945
bigcode/the-stack
train
0b457231daa80d9b117b98a9
train
function
def add_path(path): if path not in sys.path: sys.path.insert(0, path)
def add_path(path):
if path not in sys.path: sys.path.insert(0, path)
import os import sys def add_path(path):
11
64
22
5
5
KGMSFT/integral-human-pose
pytorch_projects/integral_human_pose/_init_paths.py
Python
add_path
add_path
4
6
4
4
234c29c2ab4afcf713b374aef29c3132a007f9d6
bigcode/the-stack
train
5272f9b5feca024095911672
train
class
class PerceptualTVReconstructor(Reconstructor): def __init__(self, name, angles): super(PerceptualTVReconstructor, self).__init__(name, angles) def calc(self, projs): return iradon(projs, theta=self.angles)
class PerceptualTVReconstructor(Reconstructor):
def __init__(self, name, angles): super(PerceptualTVReconstructor, self).__init__(name, angles) def calc(self, projs): return iradon(projs, theta=self.angles)
from skimage.transform import iradon, iradon_sart from .base import Reconstructor class PerceptualTVReconstructor(Reconstructor):
31
64
59
10
20
mozanunal/SparseCT
sparse_ct/reconstructor_2d/perceptual_tv.py
Python
PerceptualTVReconstructor
PerceptualTVReconstructor
9
14
9
9
32c5550f309747e0f3ab509fe2e07526cf069083
bigcode/the-stack
train
74b93baf3c70c49c2fe46cb6
train
function
def check(attempt, context): if attempt.answer == flags[attempt.participant.id % len(flags)]: return Checked(True) if attempt.answer in flags: return CheckedPlagiarist(False, flags.index(attempt.answer)) return Checked(False)
def check(attempt, context):
if attempt.answer == flags[attempt.participant.id % len(flags)]: return Checked(True) if attempt.answer in flags: return CheckedPlagiarist(False, flags.index(attempt.answer)) return Checked(False)
}', 'QCTF{h3re_is_y0ur_R4ng3d_st4Sh_PgRQaAih}', 'QCTF{h3re_is_y0ur_R4ng3d_st4Sh_4umDmoUq}'] def check(attempt, context):
64
64
55
7
57
chankruze/qctf-school-2018
tasks-deploy/stash/check.py
Python
check
check
3
8
3
3
d4cd3004a21f4a47ffe5daf5159800e69d1ac82d
bigcode/the-stack
train
6c1d420b91bfc1fc7a3d6793
train
function
def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gos.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PY...
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gos.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH env...
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main():
26
64
92
3
22
Netromnik/python
django/privat_gos_sait/manage.py
Python
main
main
7
17
7
7
b1c542460e4d8101b08b4e25d5c4ddfa846b5e24
bigcode/the-stack
train
5c1d525802e3db2254b45e49
train
class
class invader_type(): def __init__(self, bot_self, sub_command, arg1): self.sc = sub_command self.bot_self = bot_self self.type = arg1 self.i_name = self.invader_search(arg1) self.i_obj = self.get_sql_obj() self.i_embed = self.get_i_embed() # Connect to the local...
class invader_type():
def __init__(self, bot_self, sub_command, arg1): self.sc = sub_command self.bot_self = bot_self self.type = arg1 self.i_name = self.invader_search(arg1) self.i_obj = self.get_sql_obj() self.i_embed = self.get_i_embed() # Connect to the local sqlite database `rocb...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sqlite3 import discord.ext.commands from discord.ext import commands from discord.utils import get from res.common import customemoji from rapidfuzz import process class invader_type():
55
256
996
5
49
ewong18/Roc-Bot-1
res/invaders.py
Python
invader_type
invader_type
10
115
10
10
cb65ea2b5b7f4886ed0776670ea36d3295794b44
bigcode/the-stack
train
8f96f6f72ffcf052785a36e8
train
class
class Quiz: """Creates and runs quiz with 10 questions. Run .take_quiz() to start after init""" questions = [] # Store and hold on to all the questions answers = [] # holds if they got questions right or wrong # Note: calling a attribute within class requires self.attribute def __init__(self...
class Quiz:
"""Creates and runs quiz with 10 questions. Run .take_quiz() to start after init""" questions = [] # Store and hold on to all the questions answers = [] # holds if they got questions right or wrong # Note: calling a attribute within class requires self.attribute def __init__(self, num_of_que...
import datetime import random # the single space to to create visual seperation # so, that I know which are built into the standard library (datetime, random) # and which are my own custom ones. from questions import Add, Multiply class Quiz:
54
256
1,310
3
50
tesla809/command-line-quiz-python3
quiz.py
Python
Quiz
Quiz
10
166
10
10
584bb12d5cb824f85145c88e41668bc0df4d6686
bigcode/the-stack
train
4b199ae15fbe1717b4363e17
train
class
@testing.parameterize(*testing.product({ 'use_cudnn': [True, False], # TODO(bkvogel): Check float16 support again in next cuDNN version. 'dtype': [numpy.float32, numpy.float64], })) @attr.cudnn class TestBatchNormalizationCudnnCall(unittest.TestCase): def setUp(self): ndim = 0 self.gamm...
@testing.parameterize(*testing.product({ 'use_cudnn': [True, False], # TODO(bkvogel): Check float16 support again in next cuDNN version. 'dtype': [numpy.float32, numpy.float64], })) @attr.cudnn class TestBatchNormalizationCudnnCall(unittest.TestCase):
def setUp(self): ndim = 0 self.gamma = cuda.cupy.random.uniform(.5, 1, (3,)).astype(self.dtype) self.beta = cuda.cupy.random.uniform(-1, 1, (3,)).astype(self.dtype) self.eps = 2e-5 shape = (7, 3) + (2,) * ndim self.x = cuda.cupy.random.uniform(-1, 1, shape).astype(sel...
) def test_backward_cpu(self): self.check_backward(self.args, self.gy) @attr.gpu @condition.retry(3) def test_backward_gpu(self): self.check_backward( [cuda.to_gpu(i) for i in self.args], cuda.to_gpu(self.gy)) @testing.parameterize(*testing.product({ 'use_cudnn': [True, ...
135
135
452
71
64
PhysicsTeacher13/CHAINER
tests/chainer_tests/functions_tests/normalization_tests/test_batch_normalization.py
Python
TestBatchNormalizationCudnnCall
TestBatchNormalizationCudnnCall
173
213
173
180
a5f3500d086adca5ffdb66eb8a524f9687c6233e
bigcode/the-stack
train
0bfac125469de21ef714f6cd
train
class
@testing.parameterize(*testing.product({ 'ndim': [0, 1, 2, 3], 'dtype': [numpy.float16, numpy.float32, numpy.float64], })) class TestBatchNormalization(unittest.TestCase): def setUp(self): self.expander = (None, Ellipsis) + (None,) * self.ndim self.aggr_axes = (0,) + tuple(six.moves.range(2...
@testing.parameterize(*testing.product({ 'ndim': [0, 1, 2, 3], 'dtype': [numpy.float16, numpy.float32, numpy.float64], })) class TestBatchNormalization(unittest.TestCase):
def setUp(self): self.expander = (None, Ellipsis) + (None,) * self.ndim self.aggr_axes = (0,) + tuple(six.moves.range(2, self.ndim + 2)) self.eps = 2e-5 self.decay = 0.9 self.gamma = numpy.random.uniform(.5, 1, (3,)).astype(self.dtype) self.beta = numpy.random.unifor...
import unittest import mock import numpy import six import chainer from chainer import cuda from chainer import functions from chainer.functions.normalization import batch_normalization from chainer import gradient_check from chainer import testing from chainer.testing import attr from chainer.testing import conditio...
182
220
734
51
130
PhysicsTeacher13/CHAINER
tests/chainer_tests/functions_tests/normalization_tests/test_batch_normalization.py
Python
TestBatchNormalization
TestBatchNormalization
24
96
24
29
e26635ab005ed4d5b4051d6be346202e69860294
bigcode/the-stack
train
0842067db18fec3e1ae95ecd
train
function
def _batch_normalization(expander, gamma, beta, x, mean, var): mean = mean[expander] std = numpy.sqrt(var)[expander] y_expect = (gamma[expander] * (x - mean) / std + beta[expander]) return y_expect
def _batch_normalization(expander, gamma, beta, x, mean, var):
mean = mean[expander] std = numpy.sqrt(var)[expander] y_expect = (gamma[expander] * (x - mean) / std + beta[expander]) return y_expect
cuda from chainer import functions from chainer.functions.normalization import batch_normalization from chainer import gradient_check from chainer import testing from chainer.testing import attr from chainer.testing import condition def _batch_normalization(expander, gamma, beta, x, mean, var):
64
64
65
18
45
PhysicsTeacher13/CHAINER
tests/chainer_tests/functions_tests/normalization_tests/test_batch_normalization.py
Python
_batch_normalization
_batch_normalization
17
21
17
17
89b68e2b189c2dcfefe77d70d04e117121cfb4ed
bigcode/the-stack
train
3bdd9e301d97efeb21023d6e
train
class
@testing.parameterize(*testing.product({ 'ndim': [0, 1, 2, 3], 'dtype': [numpy.float16, numpy.float32, numpy.float64], })) class TestFixedBatchNormalization(unittest.TestCase): def setUp(self): self.gamma = numpy.random.uniform(.5, 1, (3,)).astype(self.dtype) self.beta = numpy.random.unifor...
@testing.parameterize(*testing.product({ 'ndim': [0, 1, 2, 3], 'dtype': [numpy.float16, numpy.float32, numpy.float64], })) class TestFixedBatchNormalization(unittest.TestCase):
def setUp(self): self.gamma = numpy.random.uniform(.5, 1, (3,)).astype(self.dtype) self.beta = numpy.random.uniform(-1, 1, (3,)).astype(self.dtype) self.expander = (None, Ellipsis) + (None,) * self.ndim shape = (5, 3) + (2,) * self.ndim self.x = numpy.random.uniform(-1, 1, s...
@attr.gpu @condition.retry(3) def test_forward_gpu_no_cudnn(self): self.check_forward([cuda.to_gpu(i) for i in self.args], False) def check_backward(self, args, y_grad): gradient_check.check_backward( batch_normalization.BatchNormalizationFunction( mean=None,...
223
223
744
52
171
PhysicsTeacher13/CHAINER
tests/chainer_tests/functions_tests/normalization_tests/test_batch_normalization.py
Python
TestFixedBatchNormalization
TestFixedBatchNormalization
99
170
99
104
98ca8b408b61c3d8edcf9fafc26ea45ed0578ab8
bigcode/the-stack
train
40ee952d6fb903fb4f42df2b
train
function
def load(filename): """Load a geometric dataset from a file Parameters ---------- filename : string Name of the input filename Returns ------- dataset : object Loaded dataset, either a mesh or point cloud Notes ----- The method reads all the information from th...
def load(filename):
"""Load a geometric dataset from a file Parameters ---------- filename : string Name of the input filename Returns ------- dataset : object Loaded dataset, either a mesh or point cloud Notes ----- The method reads all the information from the file and deter...
on copyright licenses. # """This module contains functions for loading geometric datasets of the GeomProc geometry processing library. """ import numpy as np import copy import math import random from .mesh import * from .pcloud import * #### Functions for loading geometric datasets # Create a model by loading i...
72
72
240
4
67
WorleyD/Manifold-Model-Mesh-Shape
geomproc/loading.py
Python
load
load
26
66
26
26
78f8a44db0efb5ee69a3495fc1aec63646d63c5c
bigcode/the-stack
train
f998b4634db57ef4766bb1f5
train
function
def load_tri(filename): triangles = str(filename) vertices = filename.split(".")[0] + ".vert" tf = open(triangles, "r") vf = open(vertices, "r") vertex = [] face = [] for line in vf: line = line.strip().split() vertex.append([float(x) for x in line]) for line in tf: ...
def load_tri(filename):
triangles = str(filename) vertices = filename.split(".")[0] + ".vert" tf = open(triangles, "r") vf = open(vertices, "r") vertex = [] face = [] for line in vf: line = line.strip().split() vertex.append([float(x) for x in line]) for line in tf: line = line.strip()...
_obj(filename) elif part[-1].lower() == 'off': return load_off(filename) elif part[-1].lower() == "tri": return load_tri(filename) else: raise RuntimeError('file format "'+part[-1]+'" not supported') def load_tri(filename):
64
64
142
5
59
WorleyD/Manifold-Model-Mesh-Shape
geomproc/loading.py
Python
load_tri
load_tri
68
88
68
68
23b2c10299f00328acd26f0ff85b8ef5be4686ee
bigcode/the-stack
train
a48b11092b5d2cd999bbdd09
train
function
def load_obj(filename): # Parse a vertex description of the form <vid>/<tid>/<nid> def get_parts(st): # Split vertex description into parts arr = st.split('/') # Initialize all parts with default values vid = None tid = None nid = None # Parse vertex desc...
def load_obj(filename): # Parse a vertex description of the form <vid>/<tid>/<nid>
def get_parts(st): # Split vertex description into parts arr = st.split('/') # Initialize all parts with default values vid = None tid = None nid = None # Parse vertex description based on number of parts if len(arr) == 3: vid = arr[0] ...
= filename.split('.') if part[-1].lower() == 'obj': return load_obj(filename) elif part[-1].lower() == 'off': return load_off(filename) elif part[-1].lower() == "tri": return load_tri(filename) else: raise RuntimeError('file format "'+part[-1]+'" not supported') def loa...
256
256
1,339
21
234
WorleyD/Manifold-Model-Mesh-Shape
geomproc/loading.py
Python
load_obj
load_obj
92
238
92
94
c57e449d83c962966f94d3add98685a3b4c86ade
bigcode/the-stack
train
bd88fe1401e3443fbfd46d5a
train
function
def load_off(filename): # Temporary lists to store the mesh data # Basic mesh: faces and vertices vertex = [] face = [] # Open the file with open(filename, 'r') as f: # Read header # Read file identifier line = f.readline() line = line.strip() if line[0:3...
def load_off(filename): # Temporary lists to store the mesh data # Basic mesh: faces and vertices
vertex = [] face = [] # Open the file with open(filename, 'r') as f: # Read header # Read file identifier line = f.readline() line = line.strip() if line[0:3] != 'OFF': raise RuntimeError("file does not have the 'OFF' identifier") # Read numbe...
v: temp_uv = [[uv[te[0]][0], uv[te[0]][1]], [uv[te[1]][0], uv[te[1]][1]], [uv[te[2]][0], uv[te[2]][1]]] temp.append(temp_uv) output.cuv = np.array(temp) else: # Create a point cloud object output = pclo...
197
197
658
24
172
WorleyD/Manifold-Model-Mesh-Shape
geomproc/loading.py
Python
load_off
load_off
242
324
242
244
f8ec48f5a4eb8e9664e6d1db3019bd4a585e8c54
bigcode/the-stack
train
39a2f13e9c2cc9b544daee36
train
class
class ImportAddedPlugin(BeetsPlugin): def __init__(self): super(ImportAddedPlugin, self).__init__() self.config.add({ 'preserve_mtimes': False, }) # item.id for new items that were reimported self.reimported_item_ids = None # album.path for old albums tha...
class ImportAddedPlugin(BeetsPlugin):
def __init__(self): super(ImportAddedPlugin, self).__init__() self.config.add({ 'preserve_mtimes': False, }) # item.id for new items that were reimported self.reimported_item_ids = None # album.path for old albums that were replaced by a reimported album ...
"""Populate an item's `added` and `mtime` fields by using the file modification time (mtime) of the item's source file before import. Reimported albums and items are skipped. """ from __future__ import (unicode_literals, absolute_import, print_function, division) import os from beets import u...
91
256
1,048
8
82
amishb/beets
beetsplug/importadded.py
Python
ImportAddedPlugin
ImportAddedPlugin
16
126
16
16
659854c5772814298903e7a573f7c0dfdd305bf2
bigcode/the-stack
train
0d06a7286b9213f2f422cb96
train
class
class ActionTimer(utils.Timer): """A class to measure the duration of atomic operations This would simplify the way measure atomic operation duration in certain cases. For example, if we want to get the duration for each operation which runs in an iteration for i in range(repetitions): with...
class ActionTimer(utils.Timer):
"""A class to measure the duration of atomic operations This would simplify the way measure atomic operation duration in certain cases. For example, if we want to get the duration for each operation which runs in an iteration for i in range(repetitions): with atomic.ActionTimer(instance_of_...
or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections import functools from rally.common import logging from rally.common import utils LOG = logging.getLogger(__name__) class ActionTimerMixin(object): def __init__(self): ...
99
99
331
6
92
sergeygalkin/rally
rally/task/atomic.py
Python
ActionTimer
ActionTimer
35
74
35
35
f213e058b4a9f7f60d1302e05f36eb5923aeab27
bigcode/the-stack
train
49e8e9996b1291efff98db82
train
function
def action_timer(name): """Provide measure of execution time. Decorates methods of the Scenario class. This provides duration in seconds of each atomic action. """ def wrap(func): @functools.wraps(func) def func_atomic_actions(self, *args, **kwargs): with ActionTimer(sel...
def action_timer(name):
"""Provide measure of execution time. Decorates methods of the Scenario class. This provides duration in seconds of each atomic action. """ def wrap(func): @functools.wraps(func) def func_atomic_actions(self, *args, **kwargs): with ActionTimer(self, name): ...
= self.start def __exit__(self, type_, value, tb): super(ActionTimer, self).__exit__(type_, value, tb) self.atomic_action["finished_at"] = self.finish if type_: self.atomic_action["failed"] = True def action_timer(name):
64
64
96
5
58
sergeygalkin/rally
rally/task/atomic.py
Python
action_timer
action_timer
77
90
77
77
514bd2ec9f2f15386371b7e5a86a81d8b8e34d7a
bigcode/the-stack
train
de7ea4f9090559159fd67e46
train
function
def merge_atomic_actions(atomic_actions, root=None, depth=0, depth_of_processing=2): """Merge duplicates of atomic actions into one atomic action. :param atomic_actions: a list with atomic action :param root: an ordered dict to save atomics to (leave it with a default value...
def merge_atomic_actions(atomic_actions, root=None, depth=0, depth_of_processing=2):
"""Merge duplicates of atomic actions into one atomic action. :param atomic_actions: a list with atomic action :param root: an ordered dict to save atomics to (leave it with a default value, since the primary use case of that parameter is processing inner atomic actions) :param depth: c...
not need to explicitly close " "original action.") if kwargs.pop(argument_name, default): with ActionTimer(self, name): f = func(self, *args, **kwargs) else: f = func(self, *args, **kwargs) return f ...
91
91
305
22
68
sergeygalkin/rally
rally/task/atomic.py
Python
merge_atomic_actions
merge_atomic_actions
130
160
130
131
c5c8661f130ba7c8658f1f8c795d98dae1ee3864
bigcode/the-stack
train
d664933b4b85b333b2ce088b
train
function
def optional_action_timer(name, argument_name="atomic_action", default=True): """Optionally provide measure of execution time. Decorates methods of the Scenario class. This provides duration in seconds of each atomic action. When the decorated function is called, this inspects the kwarg named by ``argu...
def optional_action_timer(name, argument_name="atomic_action", default=True):
"""Optionally provide measure of execution time. Decorates methods of the Scenario class. This provides duration in seconds of each atomic action. When the decorated function is called, this inspects the kwarg named by ``argument_name`` and optionally sets an ActionTimer around the function call. ...
of the Scenario class. This provides duration in seconds of each atomic action. """ def wrap(func): @functools.wraps(func) def func_atomic_actions(self, *args, **kwargs): with ActionTimer(self, name): f = func(self, *args, **kwargs) return f r...
94
94
315
15
78
sergeygalkin/rally
rally/task/atomic.py
Python
optional_action_timer
optional_action_timer
93
127
93
93
473dccb08d1ddfa02156c7b65ad439386d749cfa
bigcode/the-stack
train
40873af5b5448ecb116a1795
train
class
class ActionTimerMixin(object): def __init__(self): self._atomic_actions = [] def atomic_actions(self): """Returns the content of each atomic action.""" return self._atomic_actions
class ActionTimerMixin(object):
def __init__(self): self._atomic_actions = [] def atomic_actions(self): """Returns the content of each atomic action.""" return self._atomic_actions
OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections import functools from rally.common import logging from rally.common import utils LOG = logging.getLogger(__name__) class ActionTimerMi...
64
64
43
6
58
sergeygalkin/rally
rally/task/atomic.py
Python
ActionTimerMixin
ActionTimerMixin
25
32
25
26
b2f9e9440934d5d2b51313fb7672a28bf254c488
bigcode/the-stack
train
f856985b9356098b15d1b4af
train
function
def do_it_different(): s = paramiko.SSHClient() s.load_host_keys(os.path.expanduser('/home/ubuntu/.ssh/known_hosts')) s.load_system_host_keys() s.connect(hostname, iport, username) command = 'tail -n 500 ~/data/testjson.json' (stdin, stdout, stderr) = s.exec_command(command) lines = stdout.r...
def do_it_different():
s = paramiko.SSHClient() s.load_host_keys(os.path.expanduser('/home/ubuntu/.ssh/known_hosts')) s.load_system_host_keys() s.connect(hostname, iport, username) command = 'tail -n 500 ~/data/testjson.json' (stdin, stdout, stderr) = s.exec_command(command) lines = stdout.readlines() s.close(...
name, iport, username, password) command = 'tail -n 500 ~/data/testjson.json' (stdin, stdout, stderr) = s.exec_command(command) lines = stdout.readlines() s.close() print(lines[-1]) return lines def do_it_different():
64
64
101
6
57
cyclogenesis-au/opaware
scripts/display_temperature_s.py
Python
do_it_different
do_it_different
28
38
28
28
f33759d4173b6ac313bec10a940e83cec3e8f683
bigcode/the-stack
train
b0f4b8a9282669c17b6eefbd
train
function
def do_it(): s = paramiko.SSHClient() #client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) #s.load_host_keys(os.path.expanduser('~/.ssh/known_hosts')) s.load_system_host_keys() s.set_missing_host_key_policy(paramiko.AutoAddPolicy()) s.connect(hostname, iport, username, password) com...
def do_it():
s = paramiko.SSHClient() #client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) #s.load_host_keys(os.path.expanduser('~/.ssh/known_hosts')) s.load_system_host_keys() s.set_missing_host_key_policy(paramiko.AutoAddPolicy()) s.connect(hostname, iport, username, password) command = 'tail ...
import subprocess import opaware from rgbmatrix import graphics, RGBMatrix, RGBMatrixOptions import time import getpass import paramiko import os hostname = 'flashpi' iport = 22 username = 'pi' password = '' def do_it():
58
64
127
4
54
cyclogenesis-au/opaware
scripts/display_temperature_s.py
Python
do_it
do_it
14
26
14
14
9b26c99895c1f4943d78292bcb03fbb53b5953b8
bigcode/the-stack
train
37ae7fea09d847d1a5560e41
train
function
def test_task_without_dag(): """ Test that if a task doesn't have a DAG when it's being set as the relative of another task which has a DAG, the task should be added to the root TaskGroup of the other task's DAG. """ dag = DAG(dag_id='test_task_without_dag', start_date=pendulum.parse("20200101")) ...
def test_task_without_dag():
""" Test that if a task doesn't have a DAG when it's being set as the relative of another task which has a DAG, the task should be added to the root TaskGroup of the other task's DAG. """ dag = DAG(dag_id='test_task_without_dag', start_date=pendulum.parse("20200101")) op1 = DummyOperator(task_id...
'group1.upstream_join_id' .*"): with DAG("test_duplicate_group_id", start_date=execution_date): _ = DummyOperator(task_id="task1") with TaskGroup("group1"): _ = DummyOperator(task_id="upstream_join_id") def test_task_without_dag():
64
64
186
7
57
Real-Currents/airflow
tests/utils/test_task_group.py
Python
test_task_without_dag
test_task_without_dag
564
578
564
564
760147d0f6ef339d1860c4ea9d9062e18cb6175c
bigcode/the-stack
train
e758726247572a268dec809c
train
function
def test_dag_edges(): execution_date = pendulum.parse("20200101") with DAG("test_dag_edges", start_date=execution_date) as dag: task1 = DummyOperator(task_id="task1") with TaskGroup("group_a") as group_a: with TaskGroup("group_b") as group_b: task2 = DummyOperator(tas...
def test_dag_edges():
execution_date = pendulum.parse("20200101") with DAG("test_dag_edges", start_date=execution_date) as dag: task1 = DummyOperator(task_id="task1") with TaskGroup("group_a") as group_a: with TaskGroup("group_b") as group_b: task2 = DummyOperator(task_id="task2") ...
('group234.upstream_join_id', 'group234.group34.task3'), ('group234.upstream_join_id', 'group234.group34.task4'), ('task1', 'group234.upstream_join_id'), ] subdag_task_groups = subdag.task_group.get_task_group_dict() assert subdag_task_groups.keys() == {None, "group234", "group234.g...
256
256
949
6
250
Real-Currents/airflow
tests/utils/test_task_group.py
Python
test_dag_edges
test_dag_edges
419
525
419
419
1b5c368f60370c31f1c4e8676fc55f13117172b0
bigcode/the-stack
train
6813d87cb7b5c94dcbd7dbd5
train
function
def test_build_task_group_context_manager(): execution_date = pendulum.parse("20200101") with DAG("test_build_task_group_context_manager", start_date=execution_date) as dag: task1 = DummyOperator(task_id="task1") with TaskGroup("group234") as group234: _ = DummyOperator(task_id="task...
def test_build_task_group_context_manager():
execution_date = pendulum.parse("20200101") with DAG("test_build_task_group_context_manager", start_date=execution_date) as dag: task1 = DummyOperator(task_id="task1") with TaskGroup("group234") as group234: _ = DummyOperator(task_id="task2") with TaskGroup("group34") as...
': 5, }, }, { 'id': 'task5', 'value': { 'label': 'task5', 'labelStyle': 'fill:#000;', 'style': 'fill:#e8f7e4;', 'rx': 5, 'ry': 5, }, }, ], } def test_build_task_gro...
84
84
280
8
76
Real-Currents/airflow
tests/utils/test_task_group.py
Python
test_build_task_group_context_manager
test_build_task_group_context_manager
139
169
139
139
b72963005af6195ea0e5d0d8026b8b4f72984528
bigcode/the-stack
train
037bbb812ff0c3d42a0694dc
train
function
def test_build_task_group_with_task_decorator(): """ Test that TaskGroup can be used with the @task decorator. """ from airflow.decorators import task @task def task_1(): print("task_1") @task def task_2(): return "task_2" @task def task_3(): return "ta...
def test_build_task_group_with_task_decorator():
""" Test that TaskGroup can be used with the @task decorator. """ from airflow.decorators import task @task def task_1(): print("task_1") @task def task_2(): return "task_2" @task def task_3(): return "task_3" @task def task_4(task_2_output, ta...
34', 'label': 'group34', 'children': [ { 'id': 'group34.group4', 'label': 'group4', 'children': [{'id': 'task4', 'label': 'task4'}], ...
174
174
582
10
164
Real-Currents/airflow
tests/utils/test_task_group.py
Python
test_build_task_group_with_task_decorator
test_build_task_group_with_task_decorator
268
340
268
268
959c42b98e4e796ed1f1706151db60ab71f6fde0
bigcode/the-stack
train
ffe60e4d246b62ccfc7d75ee
train
function
def test_build_task_group_with_prefix(): """ Tests that prefix_group_id turns on/off prefixing of task_id with group_id. """ execution_date = pendulum.parse("20200101") with DAG("test_build_task_group_with_prefix", start_date=execution_date) as dag: task1 = DummyOperator(task_id="task1") ...
def test_build_task_group_with_prefix():
""" Tests that prefix_group_id turns on/off prefixing of task_id with group_id. """ execution_date = pendulum.parse("20200101") with DAG("test_build_task_group_with_prefix", start_date=execution_date) as dag: task1 = DummyOperator(task_id="task1") with TaskGroup("group234", prefix_gr...
_ = DummyOperator(task_id="task4", dag=dag, task_group=group34) task5 = DummyOperator(task_id="task5", dag=dag) task1 >> group234 group34 >> task5 assert task_group_to_dict(dag.task_group) == EXPECTED_JSON def extract_node_id(node, include_label=False): ret = {"id": node["id"]} if includ...
159
159
532
8
150
Real-Currents/airflow
tests/utils/test_task_group.py
Python
test_build_task_group_with_prefix
test_build_task_group_with_prefix
207
265
207
207
9094bdaf381b412d887e44c96fe0a91145ec17c1
bigcode/the-stack
train
b7e8ccd2fdaffaa6096058e6
train
function
def test_build_task_group(): """ This is an alternative syntax to use TaskGroup. It should result in the same TaskGroup as using context manager. """ execution_date = pendulum.parse("20200101") dag = DAG("test_build_task_group", start_date=execution_date) task1 = DummyOperator(task_id="task1...
def test_build_task_group():
""" This is an alternative syntax to use TaskGroup. It should result in the same TaskGroup as using context manager. """ execution_date = pendulum.parse("20200101") dag = DAG("test_build_task_group", start_date=execution_date) task1 = DummyOperator(task_id="task1", dag=dag) group234 = Ta...
assert dag.task_group.is_root assert set(dag.task_group.children.keys()) == {"task1", "group234", "task5"} assert group34.group_id == "group234.group34" assert task_group_to_dict(dag.task_group) == EXPECTED_JSON def test_build_task_group():
66
66
223
6
59
Real-Currents/airflow
tests/utils/test_task_group.py
Python
test_build_task_group
test_build_task_group
172
190
172
172
514ec9c3829eab8fb6ecd250bae95c68f1f4be47
bigcode/the-stack
train
9f925891e919bf7f057fa546
train
function
def test_duplicate_group_id(): from airflow.exceptions import DuplicateTaskIdFound execution_date = pendulum.parse("20200101") with pytest.raises(DuplicateTaskIdFound, match=r".* 'task1' .*"): with DAG("test_duplicate_group_id", start_date=execution_date): _ = DummyOperator(task_id="ta...
def test_duplicate_group_id():
from airflow.exceptions import DuplicateTaskIdFound execution_date = pendulum.parse("20200101") with pytest.raises(DuplicateTaskIdFound, match=r".* 'task1' .*"): with DAG("test_duplicate_group_id", start_date=execution_date): _ = DummyOperator(task_id="task1") with TaskGrou...
group_c.task7', 'group_c.task8'), ('group_c.task8', 'group_c.downstream_join_id'), ('group_c.upstream_join_id', 'group_c.task6'), ('group_c.upstream_join_id', 'group_c.task7'), ('group_d.task11', 'group_d.task12'), ('group_d.upstream_join_id', 'group_d.task11'), ('task1',...
105
106
356
6
99
Real-Currents/airflow
tests/utils/test_task_group.py
Python
test_duplicate_group_id
test_duplicate_group_id
528
561
528
528
adc28cbcd5813fe9563d22c9adfb05b0f454ab5f
bigcode/the-stack
train
da2de6dd58f67b92b4f23700
train
function
def test_sub_dag_task_group(): """ Tests dag.sub_dag() updates task_group correctly. """ execution_date = pendulum.parse("20200101") with DAG("test_test_task_group_sub_dag", start_date=execution_date) as dag: task1 = DummyOperator(task_id="task1") with TaskGroup("group234") as group2...
def test_sub_dag_task_group():
""" Tests dag.sub_dag() updates task_group correctly. """ execution_date = pendulum.parse("20200101") with DAG("test_test_task_group_sub_dag", start_date=execution_date) as dag: task1 = DummyOperator(task_id="task1") with TaskGroup("group234") as group234: _ = DummyOperat...
'}, {'id': 'group234.task_4'}, {'id': 'group234.upstream_join_id'}, {'id': 'group234.downstream_join_id'}, ], }, {'id': 'task_1'}, {'id': 'task_5'}, ], } edges = dag_edges(dag) assert sor...
207
208
696
8
199
Real-Currents/airflow
tests/utils/test_task_group.py
Python
test_sub_dag_task_group
test_sub_dag_task_group
343
416
343
343
0addb106afe81d0b38ecd8f81f5cbeabbbd1ec32
bigcode/the-stack
train
d5355bb4e86ca1c611bc9a01
train
function
def extract_node_id(node, include_label=False): ret = {"id": node["id"]} if include_label: ret["label"] = node["value"]["label"] if "children" in node: children = [] for child in node["children"]: children.append(extract_node_id(child, include_label=include_label)) ...
def extract_node_id(node, include_label=False):
ret = {"id": node["id"]} if include_label: ret["label"] = node["value"]["label"] if "children" in node: children = [] for child in node["children"]: children.append(extract_node_id(child, include_label=include_label)) ret["children"] = children return ret
dag, task_group=group34) task5 = DummyOperator(task_id="task5", dag=dag) task1 >> group234 group34 >> task5 assert task_group_to_dict(dag.task_group) == EXPECTED_JSON def extract_node_id(node, include_label=False):
64
64
84
10
53
Real-Currents/airflow
tests/utils/test_task_group.py
Python
extract_node_id
extract_node_id
193
204
193
193
45199d7acd8cbd2314337a23da7f0fb5cb440191
bigcode/the-stack
train
05430539401cd2a4bdde5baa
train
function
def main(): argument_spec = ovirt_info_full_argument_spec( pattern=dict(default='', required=False), ) module = AnsibleModule(argument_spec) check_sdk(module) try: auth = module.params.pop('auth') connection = create_connection(auth) datacenters_service = connection...
def main():
argument_spec = ovirt_info_full_argument_spec( pattern=dict(default='', required=False), ) module = AnsibleModule(argument_spec) check_sdk(module) try: auth = module.params.pop('auth') connection = create_connection(auth) datacenters_service = connection.system_serv...
. type: list ''' import traceback from ansible.module_utils.basic import AnsibleModule from ansible_collections.ovirt.ovirt_collection.plugins.module_utils.ovirt import ( check_sdk, create_connection, get_dict_of_struct, ovirt_info_full_argument_spec, ) def main():
64
64
199
3
61
bverschueren/ovirt-ansible-collection
plugins/modules/ovirt_datacenter_info.py
Python
main
main
67
94
67
67
5c563cd521662829b65d2c84f51a9faaa80d12a1
bigcode/the-stack
train
38cb4a927bf535cf01c519e7
train
class
class TestDeleteEdges(NebulaTestSuite): @classmethod def prepare(self): resp = self.execute('CREATE SPACE TestDeleteEdges(partition_num=1, replica_factor=1);' 'USE TestDeleteEdges;' 'CREATE TAG person(name string, age int);' ...
class TestDeleteEdges(NebulaTestSuite): @classmethod
def prepare(self): resp = self.execute('CREATE SPACE TestDeleteEdges(partition_num=1, replica_factor=1);' 'USE TestDeleteEdges;' 'CREATE TAG person(name string, age int);' 'CREATE EDGE friend(intimacy int);' ...
# --coding:utf-8-- # # Copyright (c) 2020 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License, # attached with Common Clause Condition 1.0, found in the LICENSES directory. import time from tests.common.nebula_test_suite import NebulaTestSuite class TestDeleteEdges(NebulaTestSui...
89
256
1,138
14
74
nevermore3/nebula-graph
tests/mutate/test_delete_edges.py
Python
TestDeleteEdges
TestDeleteEdges
13
107
13
14
c059d5771e3acaeb78be2ec1b645595408273f98
bigcode/the-stack
train
eaa76eef51cecd519e2244db
train
function
def _configure(app: Sphinx, config: "Config"): """ Validate the provided configuration values. :param app: The Sphinx application. :param config: """ config.source_link_target = str(config.source_link_target).lower().strip() # type: ignore if config.source_link_target not in {"sphinx", "github"}: # this pa...
def _configure(app: Sphinx, config: "Config"):
""" Validate the provided configuration values. :param app: The Sphinx application. :param config: """ config.source_link_target = str(config.source_link_target).lower().strip() # type: ignore if config.source_link_target not in {"sphinx", "github"}: # this package from sphinx_toolbox.config import Inval...
.github_source_url / target), ) nodes_.append(refnode) else: message = inliner.document.reporter.error(f"Unsupported source link target '{config.source_link_target}'.") messages.append(message) return nodes_, messages def _configure(app: Sphinx, config: "Config"):
64
64
106
13
50
arisp99/sphinx-toolbox
sphinx_toolbox/source.py
Python
_configure
_configure
230
244
230
230
4df943b12b1dbe5748baf1c4eeb082343868d3bd
bigcode/the-stack
train
0f7a3efca7f48cbce25f1442
train
function
def _make_viewcode_node( title: str, pagename: str, env: BuildEnvironment, ) -> nodes.Node: """ Construct a node for the :mod:`sphinx.ext.viewcode` link. Handles Sphinx 3.5+ compatibility. """ if _sphinx_version < (3, 5, 0): return addnodes.pending_xref( title, nodes.inline(title, title), r...
def _make_viewcode_node( title: str, pagename: str, env: BuildEnvironment, ) -> nodes.Node:
""" Construct a node for the :mod:`sphinx.ext.viewcode` link. Handles Sphinx 3.5+ compatibility. """ if _sphinx_version < (3, 5, 0): return addnodes.pending_xref( title, nodes.inline(title, title), reftype="viewcode", refdomain="std", refexplicit=False, reftarget=pagename, refid=tit...
", "setup"] # TODO: rawstring: Return it as a problematic node linked to a system message if a problem is encountered. _sphinx_version = sphinx.version_info[:3] def _make_viewcode_node( title: str, pagename: str, env: BuildEnvironment, ) -> nodes.Node:
70
70
234
32
38
arisp99/sphinx-toolbox
sphinx_toolbox/source.py
Python
_make_viewcode_node
_make_viewcode_node
101
138
101
105
35399dbd6ef1ebd4dbd5a0317d9ac8effa38aae1
bigcode/the-stack
train
e33639eb8bcfa6acf4c2c3eb
train
function
@metadata_add_version def setup(app: Sphinx) -> SphinxExtMetadata: """ Setup :mod:`sphinx_toolbox.source`. :param app: The Sphinx application. """ # Link to source code app.add_role("source", source_role) # The target for the source link. One of GitHub or Sphinx (GitLab coming soon™) app.add_config_value("so...
@metadata_add_version def setup(app: Sphinx) -> SphinxExtMetadata:
""" Setup :mod:`sphinx_toolbox.source`. :param app: The Sphinx application. """ # Link to source code app.add_role("source", source_role) # The target for the source link. One of GitHub or Sphinx (GitLab coming soon™) app.add_config_value("source_link_target", "Sphinx", "env", types=[str]) app.connect("conf...
_link_target not in {"sphinx", "github"}: # this package from sphinx_toolbox.config import InvalidOptionError raise InvalidOptionError("Invalid value for 'source_link_target'.") @metadata_add_version def setup(app: Sphinx) -> SphinxExtMetadata:
63
64
129
18
45
arisp99/sphinx-toolbox
sphinx_toolbox/source.py
Python
setup
setup
247
264
247
248
c05895525ca3b82b2846b8c3a340342bbb88a48c
bigcode/the-stack
train
16613e3eaeeaa364627d90cf
train
function
def source_role( name: str, rawtext: str, text: str, lineno: int, inliner: Inliner, options: Dict = {}, content: List[str] = [] ) -> Tuple[Sequence[nodes.Node], List[system_message]]: """ Adds a link to the given Python source file in the documentation or on GitHub. :param name: The local name of th...
def source_role( name: str, rawtext: str, text: str, lineno: int, inliner: Inliner, options: Dict = {}, content: List[str] = [] ) -> Tuple[Sequence[nodes.Node], List[system_message]]:
""" Adds a link to the given Python source file in the documentation or on GitHub. :param name: The local name of the interpreted role, the role name actually used in the document. :param rawtext: A string containing the entire interpreted text input, including the role and markup. :param text: The interpreted te...
return addnodes.pending_xref( title, nodes.inline(title, title), reftype="viewcode", refdomain="std", refexplicit=False, reftarget=pagename, refid=title, refdoc=env.docname, ) else: # 3rd party from sphinx.util.nodes import make_refnode assert env.app.builder is not None ...
219
219
733
64
155
arisp99/sphinx-toolbox
sphinx_toolbox/source.py
Python
source_role
source_role
141
227
141
149
a462ee20f3caf44d8556887b8aa549b1912b4f1e
bigcode/the-stack
train
f988836138a31ab2b0034271
train
function
def get_args() -> Args: """ Get command-line arguments """ parser = argparse.ArgumentParser( description='Find all graphs', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('dir', help='Input directory', metavar='DI...
def get_args() -> Args:
""" Get command-line arguments """ parser = argparse.ArgumentParser( description='Find all graphs', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('dir', help='Input directory', metavar='DIR', ...
ElementTree from pathlib import Path from typing import NamedTuple, TextIO class Args(NamedTuple): """ Command-line arguments """ dirname: str schema: TextIO # class Study(NamedTuple): # """ A Study """ # -------------------------------------------------- def get_args() -> Args:
64
64
116
7
57
criticalpathinstitute/clinicaltrials.gov
scripts/allgraph.py
Python
get_args
get_args
26
48
26
26
a8c0a97e54778cefe9040ac57950a4cca4c2d522
bigcode/the-stack
train
9ac948fd56923d00ca84f8ed
train
class
class Args(NamedTuple): """ Command-line arguments """ dirname: str schema: TextIO
class Args(NamedTuple):
""" Command-line arguments """ dirname: str schema: TextIO
@gmail.com> Date : 2020-12-11 Purpose: Rock the Casbah """ import argparse import xmlschema from pprint import pprint from xml.etree.ElementTree import ElementTree from pathlib import Path from typing import NamedTuple, TextIO class Args(NamedTuple):
64
64
23
6
57
criticalpathinstitute/clinicaltrials.gov
scripts/allgraph.py
Python
Args
Args
16
19
16
16
eaa83bb7f7d928a5f9d048c339a0ab00da122a1b
bigcode/the-stack
train
ce5c5d4e71f18f6b3aadb685
train
function
def main() -> None: """ Make a jazz noise here """ args = get_args() #files = list(Path(args.dirname).rglob('*.xml')) files = ['../xml/NCT0326xxxx/NCT03260985.xml'] schema = xmlschema.XMLSchema(args.schema) for i, file in enumerate(files, start=1): print(f'{i:6}: {file}') d = s...
def main() -> None:
""" Make a jazz noise here """ args = get_args() #files = list(Path(args.dirname).rglob('*.xml')) files = ['../xml/NCT0326xxxx/NCT03260985.xml'] schema = xmlschema.XMLSchema(args.schema) for i, file in enumerate(files, start=1): print(f'{i:6}: {file}') d = schema.to_dict(file) ...
parser.add_argument('-s', '--schema', help='XML schema', metavar='FILE', type=argparse.FileType('rt'), default='public.xsd') args = parser.parse_args() return Args(args.dir, args.schema)...
64
64
138
6
58
criticalpathinstitute/clinicaltrials.gov
scripts/allgraph.py
Python
main
main
52
71
52
52
6a94d05231480439c49d985f748adb176f4dfd90
bigcode/the-stack
train
060a776b203dab057d77b1c8
train
function
def main(): set_settings_module() try: # pylint: disable=import-outside-toplevel from django.core.management import execute_from_command_line except ImportError as exception: raise ImportError("Could not import Django.") from exception execute_from_command_line(sys.argv)
def main():
set_settings_module() try: # pylint: disable=import-outside-toplevel from django.core.management import execute_from_command_line except ImportError as exception: raise ImportError("Could not import Django.") from exception execute_from_command_line(sys.argv)
will directly go with "settings.py". """ local_settings = Path(f"estudio/{LOCAL_SETTINGS}") os.environ.setdefault( "DJANGO_SETTINGS_MODULE", f"estudio.{local_settings.stem}" if local_settings.exists() else "estudio.settings", ) def main():
64
64
62
3
61
naquiroz/estudio
estudio/manage.py
Python
main
main
29
37
29
29
32f96db4f6598ba36fb7caa59261bfc52b6663a7
bigcode/the-stack
train
cd94ad3442cd25efda972cb7
train
function
def set_settings_module(): """ This function will choose a Django settings file to work with. If you have a local file with settings, it will use that file. But if not, stay calm: it will directly go with "settings.py". """ local_settings = Path(f"estudio/{LOCAL_SETTINGS}") os.environ.setde...
def set_settings_module():
""" This function will choose a Django settings file to work with. If you have a local file with settings, it will use that file. But if not, stay calm: it will directly go with "settings.py". """ local_settings = Path(f"estudio/{LOCAL_SETTINGS}") os.environ.setdefault( "DJANGO_SETT...
#!/usr/bin/env python """ Django’s command-line utility for administrative tasks. """ import os import sys from pathlib import Path LOCAL_SETTINGS = "local_settings.py" def set_settings_module():
42
64
106
5
37
naquiroz/estudio
estudio/manage.py
Python
set_settings_module
set_settings_module
13
26
13
13
1a0204c96c42c32557cd16e2818a0d2c9dd97d80
bigcode/the-stack
train
1d293df941fba969e72dd106
train
class
class Action(namedtuple('Action', _action_fields)): """ Action """ def __new__(cls, **kwargs): default = {f: None for f in _action_fields} default.update(kwargs) return super(Action, cls).__new__( cls, **default)
class Action(namedtuple('Action', _action_fields)):
""" Action """ def __new__(cls, **kwargs): default = {f: None for f in _action_fields} default.update(kwargs) return super(Action, cls).__new__( cls, **default)
None for f in _table_fields} default.update(kwargs) return super(Table, cls).__new__( cls, **default) _action_fields = [ 'action_type', 'name', 'text', 'style', 'value', 'options' ] class Action(namedtuple('Action', _action_fields)):
64
64
62
11
53
romaryd/lifoid
lifoid/message/__init__.py
Python
Action
Action
101
109
101
101
0cbfbc9cb201d4d345b405cf1d674d0f05ae0213
bigcode/the-stack
train
25819ec7d75d5fc05d86a0db
train
class
class ButtonAction(Action): """ Specific action to get a button """ def __new__(cls, **kwargs): default = {f: None for f in _action_fields} default.update(kwargs) default['action_type'] = 'button' if default['style'] is None: default['style'] = 'default' ...
class ButtonAction(Action):
""" Specific action to get a button """ def __new__(cls, **kwargs): default = {f: None for f in _action_fields} default.update(kwargs) default['action_type'] = 'button' if default['style'] is None: default['style'] = 'default' if (default['text'] is No...
tuple('Action', _action_fields)): """ Action """ def __new__(cls, **kwargs): default = {f: None for f in _action_fields} default.update(kwargs) return super(Action, cls).__new__( cls, **default) class ButtonAction(Action):
64
64
132
5
59
romaryd/lifoid
lifoid/message/__init__.py
Python
ButtonAction
ButtonAction
112
126
112
112
7ae8a02df9ca3b5d5c5142fbee975414679d36de
bigcode/the-stack
train
71be6c8bc52da47f87d21e0f
train
class
class OptionGroup(namedtuple('Option', _option_group_fields)): """ Group of selection options """ def __new__(cls, **kwargs): default = {f: None for f in _option_group_fields} default.update(kwargs) return super(OptionGroup, cls).__new__( cls, **default)
class OptionGroup(namedtuple('Option', _option_group_fields)):
""" Group of selection options """ def __new__(cls, **kwargs): default = {f: None for f in _option_group_fields} default.update(kwargs) return super(OptionGroup, cls).__new__( cls, **default)
f: None for f in _action_fields} default.update(kwargs) default['action_type'] = 'select' return super(MenuAction, cls).__new__( cls, **default) _option_group_fields = ['text', 'options'] class OptionGroup(namedtuple('Option', _option_group_fields)):
64
64
70
13
51
romaryd/lifoid
lifoid/message/__init__.py
Python
OptionGroup
OptionGroup
144
152
144
144
e64868c630a77e6691eabe53e4d6364382251a66
bigcode/the-stack
train
3fd1a30593cb17a6d3f90887
train
class
class Attachment(namedtuple('Attachment', _attachment_fields)): """ Attachment field """ def __new__(cls, **kwargs): default = {f: None for f in _attachment_fields} default.update(kwargs) return super(Attachment, cls).__new__( cls, **default)
class Attachment(namedtuple('Attachment', _attachment_fields)):
""" Attachment field """ def __new__(cls, **kwargs): default = {f: None for f in _attachment_fields} default.update(kwargs) return super(Attachment, cls).__new__( cls, **default)
# default['attachments'] = Attachment(**default['attachments']) return super(Chat, cls).__new__( cls, **default) _attachment_fields = [ 'text', 'image_url', 'actions', 'table', 'file_url', 'edit'] class Attachment(namedtuple('Attachment', _attachment_fields)):
64
64
64
11
53
romaryd/lifoid
lifoid/message/__init__.py
Python
Attachment
Attachment
53
61
53
53
c3b0d2816ddb4844880a4800ddc98c76a8eb7307
bigcode/the-stack
train
109ec86ff7f3df44bf2ace20
train
class
class Table(namedtuple('Table', _table_fields)): """ Table """ def __new__(cls, **kwargs): default = {f: None for f in _table_fields} default.update(kwargs) return super(Table, cls).__new__( cls, **default)
class Table(namedtuple('Table', _table_fields)):
""" Table """ def __new__(cls, **kwargs): default = {f: None for f in _table_fields} default.update(kwargs) return super(Table, cls).__new__( cls, **default)
: None for f in _edit_fields} default.update(kwargs) return super(Edit, cls).__new__( cls, **default) _table_fields = [ 'title', 'name', 'style', 'columns', 'rows', 'types' ] class Table(namedtuple('Table', _table_fields)):
64
64
62
11
53
romaryd/lifoid
lifoid/message/__init__.py
Python
Table
Table
85
93
85
85
f7b8c5dba80d72fe11d4ac571ca13b0422915d22
bigcode/the-stack
train
17d21d91644a4be8ab56d987
train
class
class Edit(namedtuple('Table', _edit_fields)): """ Edit action """ def __new__(cls, **kwargs): default = {f: None for f in _edit_fields} default.update(kwargs) return super(Edit, cls).__new__( cls, **default)
class Edit(namedtuple('Table', _edit_fields)):
""" Edit action """ def __new__(cls, **kwargs): default = {f: None for f in _edit_fields} default.update(kwargs) return super(Edit, cls).__new__( cls, **default)
**kwargs): default = {f: None for f in _attachment_fields} default.update(kwargs) return super(Attachment, cls).__new__( cls, **default) _edit_fields = [ 'action', 'text', 'translation' ] class Edit(namedtuple('Table', _edit_fields)):
64
64
63
11
53
romaryd/lifoid
lifoid/message/__init__.py
Python
Edit
Edit
69
77
69
69
2e0c1bbf3f8196d47ed077999e18f7a049e411d3
bigcode/the-stack
train
4fe89d7179668d71bdcbd418
train
class
class LifoidMessage(Message): """ Get NLU add useful information to a message """ def __new__(cls, **kwargs): return super(LifoidMessage, cls).__new__( cls, **kwargs) def __init__(self, **kwargs): self.parsed = False self.translated = False def parse(self, p...
class LifoidMessage(Message):
""" Get NLU add useful information to a message """ def __new__(cls, **kwargs): return super(LifoidMessage, cls).__new__( cls, **kwargs) def __init__(self, **kwargs): self.parsed = False self.translated = False def parse(self, parser, context): """ ...
**default) _option_fields = ['text', 'value'] class Option(namedtuple('Option', _option_fields)): """ Option """ def __new__(cls, **kwargs): default = {f: None for f in _option_fields} default.update(kwargs) return super(Option, cls).__new__( cls, **default) clas...
81
81
271
6
75
romaryd/lifoid
lifoid/message/__init__.py
Python
LifoidMessage
LifoidMessage
169
210
169
169
52147daadd7fe494ae8c569625dfbe60aaf9d438
bigcode/the-stack
train