blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
5105250e3e9aec567817b15cd6959344adcf99b8
[ "if not os.path.isfile(filename):\n return dict()\nwith open(filename, 'r') as f:\n portalocker.lock(f, portalocker.LOCK_SH)\n return json.load(f)", "if not update_dict:\n return\nif os.path.isfile(filename):\n ExclusiveCacheFile.__update_existing_cachefile(filename, update_dict, timeout_seconds)\n...
<|body_start_0|> if not os.path.isfile(filename): return dict() with open(filename, 'r') as f: portalocker.lock(f, portalocker.LOCK_SH) return json.load(f) <|end_body_0|> <|body_start_1|> if not update_dict: return if os.path.isfile(filena...
This class represents a cache file that allows reading and updating the file contents. The structure used to store cache data is a dict. The class can be used by concurrent processes - it uses file locking mechanism to synchronize access: 1. For reading - it shared-locks the file 2. For updating- it exclusively-locks t...
ExclusiveCacheFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExclusiveCacheFile: """This class represents a cache file that allows reading and updating the file contents. The structure used to store cache data is a dict. The class can be used by concurrent processes - it uses file locking mechanism to synchronize access: 1. For reading - it shared-locks th...
stack_v2_sparse_classes_36k_train_003500
3,043
no_license
[ { "docstring": "Read the cache dict from file if it exists, return empty dict otherwise", "name": "read_or_empty", "signature": "def read_or_empty(filename)" }, { "docstring": "Create new cache file if doesnt exist yet, update existing otherwise. Give up updating if cant get exclusive access in ...
4
null
Implement the Python class `ExclusiveCacheFile` described below. Class description: This class represents a cache file that allows reading and updating the file contents. The structure used to store cache data is a dict. The class can be used by concurrent processes - it uses file locking mechanism to synchronize acce...
Implement the Python class `ExclusiveCacheFile` described below. Class description: This class represents a cache file that allows reading and updating the file contents. The structure used to store cache data is a dict. The class can be used by concurrent processes - it uses file locking mechanism to synchronize acce...
653c1e7a96481c0b16617a8863ff8a56f5024d0a
<|skeleton|> class ExclusiveCacheFile: """This class represents a cache file that allows reading and updating the file contents. The structure used to store cache data is a dict. The class can be used by concurrent processes - it uses file locking mechanism to synchronize access: 1. For reading - it shared-locks th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExclusiveCacheFile: """This class represents a cache file that allows reading and updating the file contents. The structure used to store cache data is a dict. The class can be used by concurrent processes - it uses file locking mechanism to synchronize access: 1. For reading - it shared-locks the file 2. For...
the_stack_v2_python_sparse
src/outerspaceaccess/exclusive_cache_file.py
mateuszmidor/DwellingDigger
train
1
90951043a8b498ff0e9ff39f3e457cc309763d62
[ "if isinstance(field, str):\n field = Field[type](field, doc=doc, units=units, size=size, parse_strict=parse_strict)\nreturn field._addTo(self.editOutputSchema(), doReplace)", "if output is True or output is False:\n doReplace = output\n output = None\nreturn input._addMappingTo(self, output, doReplace)"...
<|body_start_0|> if isinstance(field, str): field = Field[type](field, doc=doc, units=units, size=size, parse_strict=parse_strict) return field._addTo(self.editOutputSchema(), doReplace) <|end_body_0|> <|body_start_1|> if output is True or output is False: doReplace = ou...
SchemaMapper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchemaMapper: def addOutputField(self, field, type=None, doc=None, units='', size=None, doReplace=False, parse_strict='raise'): """Add an un-mapped field to the output Schema. Parameters ---------- field : `str` or `~lsst.afw.table.Field` The string name of the `Field`, or a fully-constr...
stack_v2_sparse_classes_36k_train_003501
6,204
no_license
[ { "docstring": "Add an un-mapped field to the output Schema. Parameters ---------- field : `str` or `~lsst.afw.table.Field` The string name of the `Field`, or a fully-constructed `Field` object. If the latter, all other arguments besides doReplace are ignored. type : `str` The type of field to create. Valid typ...
4
stack_v2_sparse_classes_30k_train_018854
Implement the Python class `SchemaMapper` described below. Class description: Implement the SchemaMapper class. Method signatures and docstrings: - def addOutputField(self, field, type=None, doc=None, units='', size=None, doReplace=False, parse_strict='raise'): Add an un-mapped field to the output Schema. Parameters ...
Implement the Python class `SchemaMapper` described below. Class description: Implement the SchemaMapper class. Method signatures and docstrings: - def addOutputField(self, field, type=None, doc=None, units='', size=None, doReplace=False, parse_strict='raise'): Add an un-mapped field to the output Schema. Parameters ...
5b0a8152295a779573e119dde2297b13acc35365
<|skeleton|> class SchemaMapper: def addOutputField(self, field, type=None, doc=None, units='', size=None, doReplace=False, parse_strict='raise'): """Add an un-mapped field to the output Schema. Parameters ---------- field : `str` or `~lsst.afw.table.Field` The string name of the `Field`, or a fully-constr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SchemaMapper: def addOutputField(self, field, type=None, doc=None, units='', size=None, doReplace=False, parse_strict='raise'): """Add an un-mapped field to the output Schema. Parameters ---------- field : `str` or `~lsst.afw.table.Field` The string name of the `Field`, or a fully-constructed `Field` ...
the_stack_v2_python_sparse
python/lsst/afw/table/_schemaMapper.py
lsst/afw
train
18
7273282ef11f49a90226dbc72cbcffe054e97301
[ "from pylith.friction.StaticFriction import StaticFriction\nself.friction = StaticFriction()\nreturn", "label = 'friction abc'\nself.friction.label(label)\nself.assertEqual(label, self.friction.label())\nreturn", "dt = 0.5\nself.friction.timeStep(dt)\nself.assertEqual(dt, self.friction.timeStep())\nreturn", "...
<|body_start_0|> from pylith.friction.StaticFriction import StaticFriction self.friction = StaticFriction() return <|end_body_0|> <|body_start_1|> label = 'friction abc' self.friction.label(label) self.assertEqual(label, self.friction.label()) return <|end_body_1...
Unit testing of Material object.
TestFrictionModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFrictionModel: """Unit testing of Material object.""" def setUp(self): """Setup test subject.""" <|body_0|> def testLabel(self): """Test label().""" <|body_1|> def testTimeStep(self): """Test timeStep().""" <|body_2|> def tes...
stack_v2_sparse_classes_36k_train_003502
2,660
permissive
[ { "docstring": "Setup test subject.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test label().", "name": "testLabel", "signature": "def testLabel(self)" }, { "docstring": "Test timeStep().", "name": "testTimeStep", "signature": "def testTimeStep(se...
6
null
Implement the Python class `TestFrictionModel` described below. Class description: Unit testing of Material object. Method signatures and docstrings: - def setUp(self): Setup test subject. - def testLabel(self): Test label(). - def testTimeStep(self): Test timeStep(). - def testDBProperties(self): Test dbProperties()...
Implement the Python class `TestFrictionModel` described below. Class description: Unit testing of Material object. Method signatures and docstrings: - def setUp(self): Setup test subject. - def testLabel(self): Test label(). - def testTimeStep(self): Test timeStep(). - def testDBProperties(self): Test dbProperties()...
8d0170324d3fcdc5e6c4281759c680faa5dd8d38
<|skeleton|> class TestFrictionModel: """Unit testing of Material object.""" def setUp(self): """Setup test subject.""" <|body_0|> def testLabel(self): """Test label().""" <|body_1|> def testTimeStep(self): """Test timeStep().""" <|body_2|> def tes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestFrictionModel: """Unit testing of Material object.""" def setUp(self): """Setup test subject.""" from pylith.friction.StaticFriction import StaticFriction self.friction = StaticFriction() return def testLabel(self): """Test label().""" label = 'fri...
the_stack_v2_python_sparse
unittests/pytests/friction/TestFrictionModel.py
rwalkerlewis/pylith
train
0
cbed140c4cafb6636d33109c7fe2e76fa4895f2c
[ "if not meshRelax:\n return\nif not mc.objExists(meshRelax):\n raise UserInputError('IkaMeshRelax ' + meshRelax + ' does not exists! No influence data recorded!!')\nobjType = mc.objectType(meshRelax)\nif objType != 'ikaMeshRelax':\n raise UserInputError('Object ' + meshRelax + ' is not a vaild ikaMeshRelax...
<|body_start_0|> if not meshRelax: return if not mc.objExists(meshRelax): raise UserInputError('IkaMeshRelax ' + meshRelax + ' does not exists! No influence data recorded!!') objType = mc.objectType(meshRelax) if objType != 'ikaMeshRelax': raise UserIn...
IkaMeshRelaxData class object.
IkaMeshRelaxData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IkaMeshRelaxData: """IkaMeshRelaxData class object.""" def __init__(self, meshRelax=''): """IkaMeshRelaxData class initilizer.""" <|body_0|> def rebuild(self): """Rebuild surfaceSkin deformer from saved deformer data""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_003503
1,916
no_license
[ { "docstring": "IkaMeshRelaxData class initilizer.", "name": "__init__", "signature": "def __init__(self, meshRelax='')" }, { "docstring": "Rebuild surfaceSkin deformer from saved deformer data", "name": "rebuild", "signature": "def rebuild(self)" } ]
2
stack_v2_sparse_classes_30k_train_003836
Implement the Python class `IkaMeshRelaxData` described below. Class description: IkaMeshRelaxData class object. Method signatures and docstrings: - def __init__(self, meshRelax=''): IkaMeshRelaxData class initilizer. - def rebuild(self): Rebuild surfaceSkin deformer from saved deformer data
Implement the Python class `IkaMeshRelaxData` described below. Class description: IkaMeshRelaxData class object. Method signatures and docstrings: - def __init__(self, meshRelax=''): IkaMeshRelaxData class initilizer. - def rebuild(self): Rebuild surfaceSkin deformer from saved deformer data <|skeleton|> class IkaMe...
16337badb6d1b4266f31008ceb17cfd70fec3623
<|skeleton|> class IkaMeshRelaxData: """IkaMeshRelaxData class object.""" def __init__(self, meshRelax=''): """IkaMeshRelaxData class initilizer.""" <|body_0|> def rebuild(self): """Rebuild surfaceSkin deformer from saved deformer data""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IkaMeshRelaxData: """IkaMeshRelaxData class object.""" def __init__(self, meshRelax=''): """IkaMeshRelaxData class initilizer.""" if not meshRelax: return if not mc.objExists(meshRelax): raise UserInputError('IkaMeshRelax ' + meshRelax + ' does not exists! ...
the_stack_v2_python_sparse
glTools-master/data/ikaMeshRelaxData.py
moChen0607/pubTool
train
0
ea629f6b760a31b5459e5fd22426edaf77d38ae6
[ "self.start_value = start_value\nself.end_value = end_value\nself.num_iterations = EPSILON_GREEDY_MAX_STATES\nself.repeat = repeat\nself._coefficient = (end_value - start_value) / self.num_iterations", "if self.repeat:\n iteration %= self.num_iterations\nif iteration < self.num_iterations:\n value = iterati...
<|body_start_0|> self.start_value = start_value self.end_value = end_value self.num_iterations = EPSILON_GREEDY_MAX_STATES self.repeat = repeat self._coefficient = (end_value - start_value) / self.num_iterations <|end_body_0|> <|body_start_1|> if self.repeat: ...
A control signal that changes linearly over time. This is used to change e.g. the learning-rate for the optimizer of the Neural Network, as well as other parameters. TensorFlow has functionality for doing this, but it uses the global_step counter inside the TensorFlow graph, while we want the control signals to use a s...
LinearControlSignal
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinearControlSignal: """A control signal that changes linearly over time. This is used to change e.g. the learning-rate for the optimizer of the Neural Network, as well as other parameters. TensorFlow has functionality for doing this, but it uses the global_step counter inside the TensorFlow grap...
stack_v2_sparse_classes_36k_train_003504
7,023
permissive
[ { "docstring": "Create a new object. :param start_value: Start-value for the control signal. :param end_value: End-value for the control signal. :param num_iterations: Number of iterations it takes to reach the end_value from the start_value. :param repeat: Boolean whether to reset the control signal back to th...
2
stack_v2_sparse_classes_30k_train_013206
Implement the Python class `LinearControlSignal` described below. Class description: A control signal that changes linearly over time. This is used to change e.g. the learning-rate for the optimizer of the Neural Network, as well as other parameters. TensorFlow has functionality for doing this, but it uses the global_...
Implement the Python class `LinearControlSignal` described below. Class description: A control signal that changes linearly over time. This is used to change e.g. the learning-rate for the optimizer of the Neural Network, as well as other parameters. TensorFlow has functionality for doing this, but it uses the global_...
cc4181ed1a951ec9e82e86358a53f69b63d5328a
<|skeleton|> class LinearControlSignal: """A control signal that changes linearly over time. This is used to change e.g. the learning-rate for the optimizer of the Neural Network, as well as other parameters. TensorFlow has functionality for doing this, but it uses the global_step counter inside the TensorFlow grap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinearControlSignal: """A control signal that changes linearly over time. This is used to change e.g. the learning-rate for the optimizer of the Neural Network, as well as other parameters. TensorFlow has functionality for doing this, but it uses the global_step counter inside the TensorFlow graph, while we w...
the_stack_v2_python_sparse
deep_traffic_agent.py
sandip824/Reinforcement-Learning-for-Self-Driving-Cars
train
1
5a64418b307c241aac4824f46f6d0041f1222aa9
[ "QSearchTreeWidget.__init__(self, parent)\nself.header().hide()\nself.setRootIsDecorated(False)\nself.delegate = QAliasParameterTreeWidgetItemDelegate(self, self)\nself.setItemDelegate(self.delegate)\nself.aliasNames = []\nself.itemDoubleClicked.connect(self.changeAlias)", "self.clear()\nif not pipeline:\n ret...
<|body_start_0|> QSearchTreeWidget.__init__(self, parent) self.header().hide() self.setRootIsDecorated(False) self.delegate = QAliasParameterTreeWidgetItemDelegate(self, self) self.setItemDelegate(self.delegate) self.aliasNames = [] self.itemDoubleClicked.connect(...
QAliasParameterTreeWidget is a subclass of QSearchTreeWidget to display all Vistrails Module
QAliasParameterTreeWidget
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QAliasParameterTreeWidget: """QAliasParameterTreeWidget is a subclass of QSearchTreeWidget to display all Vistrails Module""" def __init__(self, parent=None): """QAliasParameterTreeWidget(parent: QWidget) -> QParameterTreeWidget Set up size policy and header""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_003505
18,014
permissive
[ { "docstring": "QAliasParameterTreeWidget(parent: QWidget) -> QParameterTreeWidget Set up size policy and header", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "updateFromPipeline(pipeline: Pipeline) -> None Read the list of aliases and parameters from the...
3
stack_v2_sparse_classes_30k_test_000672
Implement the Python class `QAliasParameterTreeWidget` described below. Class description: QAliasParameterTreeWidget is a subclass of QSearchTreeWidget to display all Vistrails Module Method signatures and docstrings: - def __init__(self, parent=None): QAliasParameterTreeWidget(parent: QWidget) -> QParameterTreeWidge...
Implement the Python class `QAliasParameterTreeWidget` described below. Class description: QAliasParameterTreeWidget is a subclass of QSearchTreeWidget to display all Vistrails Module Method signatures and docstrings: - def __init__(self, parent=None): QAliasParameterTreeWidget(parent: QWidget) -> QParameterTreeWidge...
23ef56ec24b85c82416e1437a08381635328abe5
<|skeleton|> class QAliasParameterTreeWidget: """QAliasParameterTreeWidget is a subclass of QSearchTreeWidget to display all Vistrails Module""" def __init__(self, parent=None): """QAliasParameterTreeWidget(parent: QWidget) -> QParameterTreeWidget Set up size policy and header""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QAliasParameterTreeWidget: """QAliasParameterTreeWidget is a subclass of QSearchTreeWidget to display all Vistrails Module""" def __init__(self, parent=None): """QAliasParameterTreeWidget(parent: QWidget) -> QParameterTreeWidget Set up size policy and header""" QSearchTreeWidget.__init__(...
the_stack_v2_python_sparse
vistrails_current/vistrails/gui/mashups/alias_parameter_view.py
lumig242/VisTrailsRecommendation
train
3
f46ae16d0f24258c72eb83c697dab4b5e2aecb0d
[ "def _item_to_string(key, value):\n return '%s=\"%s\"' % (key, value)\nv = [_item_to_string(key, value) for key, value in ce.items()]\nreturn ' '.join(v)", "if build_target.system == build_system.ANDROID:\n from ._toolchain_android_standalone import _toolchain_android_standalone as _toolchain_android\n r...
<|body_start_0|> def _item_to_string(key, value): return '%s="%s"' % (key, value) v = [_item_to_string(key, value) for key, value in ce.items()] return ' '.join(v) <|end_body_0|> <|body_start_1|> if build_target.system == build_system.ANDROID: from ._toolchain_an...
Foo.
toolchain
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class toolchain: """Foo.""" def flatten_for_shell(clazz, ce): """Return the compiler environment flattened and escaped for usage with shell commands.""" <|body_0|> def get_toolchain(clazz, build_target): """Return the toolchain for this particular build target.""" ...
stack_v2_sparse_classes_36k_train_003506
1,352
permissive
[ { "docstring": "Return the compiler environment flattened and escaped for usage with shell commands.", "name": "flatten_for_shell", "signature": "def flatten_for_shell(clazz, ce)" }, { "docstring": "Return the toolchain for this particular build target.", "name": "get_toolchain", "signat...
2
null
Implement the Python class `toolchain` described below. Class description: Foo. Method signatures and docstrings: - def flatten_for_shell(clazz, ce): Return the compiler environment flattened and escaped for usage with shell commands. - def get_toolchain(clazz, build_target): Return the toolchain for this particular ...
Implement the Python class `toolchain` described below. Class description: Foo. Method signatures and docstrings: - def flatten_for_shell(clazz, ce): Return the compiler environment flattened and escaped for usage with shell commands. - def get_toolchain(clazz, build_target): Return the toolchain for this particular ...
501e0897962297c5ce745784bfcba3889508e927
<|skeleton|> class toolchain: """Foo.""" def flatten_for_shell(clazz, ce): """Return the compiler environment flattened and escaped for usage with shell commands.""" <|body_0|> def get_toolchain(clazz, build_target): """Return the toolchain for this particular build target.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class toolchain: """Foo.""" def flatten_for_shell(clazz, ce): """Return the compiler environment flattened and escaped for usage with shell commands.""" def _item_to_string(key, value): return '%s="%s"' % (key, value) v = [_item_to_string(key, value) for key, value in ce.ite...
the_stack_v2_python_sparse
lib/rebuild/toolchain/toolchain.py
reconstruir/rebuild
train
0
27277bcf88c7c453655db83db33a0a516803e3c6
[ "blocked_message = self._message(access_point, message_key)\nif blocked_message is None:\n raise Http404\nreturn render_to_response(blocked_message.template, {})", "message_dict = dict()\nif access_point == self.ENROLLMENT_ACCESS_POINT:\n message_dict = messages.ENROLL_MESSAGES\nelif access_point == self.CO...
<|body_start_0|> blocked_message = self._message(access_point, message_key) if blocked_message is None: raise Http404 return render_to_response(blocked_message.template, {}) <|end_body_0|> <|body_start_1|> message_dict = dict() if access_point == self.ENROLLMENT_ACCE...
Show a message explaining that the user was blocked from a course.
CourseAccessMessageView
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CourseAccessMessageView: """Show a message explaining that the user was blocked from a course.""" def get(self, request, access_point=None, message_key=None): """Show a message explaining that the user was blocked. Arguments: request (HttpRequest) Keyword Arguments: access_point (str...
stack_v2_sparse_classes_36k_train_003507
3,848
permissive
[ { "docstring": "Show a message explaining that the user was blocked. Arguments: request (HttpRequest) Keyword Arguments: access_point (str): Either 'enrollment' or 'courseware', indicating how the user is trying to access the restricted content. message_key (str): An identifier for which message to show. See `e...
2
stack_v2_sparse_classes_30k_train_004215
Implement the Python class `CourseAccessMessageView` described below. Class description: Show a message explaining that the user was blocked from a course. Method signatures and docstrings: - def get(self, request, access_point=None, message_key=None): Show a message explaining that the user was blocked. Arguments: r...
Implement the Python class `CourseAccessMessageView` described below. Class description: Show a message explaining that the user was blocked from a course. Method signatures and docstrings: - def get(self, request, access_point=None, message_key=None): Show a message explaining that the user was blocked. Arguments: r...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class CourseAccessMessageView: """Show a message explaining that the user was blocked from a course.""" def get(self, request, access_point=None, message_key=None): """Show a message explaining that the user was blocked. Arguments: request (HttpRequest) Keyword Arguments: access_point (str...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CourseAccessMessageView: """Show a message explaining that the user was blocked from a course.""" def get(self, request, access_point=None, message_key=None): """Show a message explaining that the user was blocked. Arguments: request (HttpRequest) Keyword Arguments: access_point (str): Either 'en...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/embargo/views.py
luque/better-ways-of-thinking-about-software
train
3
56e41d8c7f3cc19ed777264d7f1d25eb4e3dc884
[ "self.upload_directory = upload_directory\nself.video_directory = video_directory\nself.db_host = db_host\nself.db_port = db_port", "res = r.table('videos').insert({'name': orig_filename, 'extension': extension}).run(r.connect(self.db_host, self.db_port, 'vor'))\ngenerated_key = res['generated_keys'][0]\nnew_file...
<|body_start_0|> self.upload_directory = upload_directory self.video_directory = video_directory self.db_host = db_host self.db_port = db_port <|end_body_0|> <|body_start_1|> res = r.table('videos').insert({'name': orig_filename, 'extension': extension}).run(r.connect(self.db_ho...
Die Klasse ist für die Speicherung von Keyframes und Keyframe-Predictions sowie die Abfrage von Keyframe-Metadaten aus der Datenbank zuständig.
VideoRepository
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoRepository: """Die Klasse ist für die Speicherung von Keyframes und Keyframe-Predictions sowie die Abfrage von Keyframe-Metadaten aus der Datenbank zuständig.""" def __init__(self, upload_directory, video_directory, db_host, db_port): """Konstruktor zum Erzeugen eines neuen Vide...
stack_v2_sparse_classes_36k_train_003508
2,057
permissive
[ { "docstring": "Konstruktor zum Erzeugen eines neuen VideoRepository. :param video_directory: Pfad des Ordners, in dem Videos gespeichert werden :param db_host: Datenbank Host Adresse :param db_port: Datenbank Port", "name": "__init__", "signature": "def __init__(self, upload_directory, video_directory,...
3
stack_v2_sparse_classes_30k_train_011972
Implement the Python class `VideoRepository` described below. Class description: Die Klasse ist für die Speicherung von Keyframes und Keyframe-Predictions sowie die Abfrage von Keyframe-Metadaten aus der Datenbank zuständig. Method signatures and docstrings: - def __init__(self, upload_directory, video_directory, db_...
Implement the Python class `VideoRepository` described below. Class description: Die Klasse ist für die Speicherung von Keyframes und Keyframe-Predictions sowie die Abfrage von Keyframe-Metadaten aus der Datenbank zuständig. Method signatures and docstrings: - def __init__(self, upload_directory, video_directory, db_...
9006b85ad5a0084d7501413649e0679ba8adbe63
<|skeleton|> class VideoRepository: """Die Klasse ist für die Speicherung von Keyframes und Keyframe-Predictions sowie die Abfrage von Keyframe-Metadaten aus der Datenbank zuständig.""" def __init__(self, upload_directory, video_directory, db_host, db_port): """Konstruktor zum Erzeugen eines neuen Vide...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VideoRepository: """Die Klasse ist für die Speicherung von Keyframes und Keyframe-Predictions sowie die Abfrage von Keyframe-Metadaten aus der Datenbank zuständig.""" def __init__(self, upload_directory, video_directory, db_host, db_port): """Konstruktor zum Erzeugen eines neuen VideoRepository. ...
the_stack_v2_python_sparse
ApplicationServer/repositories/video_repository.py
paltmey/scias
train
0
4b2213cfa726901a00f300e46d4d805883f21bdc
[ "self.identifier_exceptions = []\nself.iterator_exceptions = []\nself.iterator_list = []\nself.identifier = None", "list_args = sum([[(i, k) for k, v in iterator.items() if isinstance(v, list) and k not in self.iterator_exceptions] for i, iterator in enumerate(self.iterator_list)], [])\nif True in [len(la) > 0 fo...
<|body_start_0|> self.identifier_exceptions = [] self.iterator_exceptions = [] self.iterator_list = [] self.identifier = None <|end_body_0|> <|body_start_1|> list_args = sum([[(i, k) for k, v in iterator.items() if isinstance(v, list) and k not in self.iterator_exceptions] for i...
Descriptor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Descriptor: def __init__(self): """Parent class for all Descriptor objects""" <|body_0|> def __iter__(self): """Iteration over the Descriptor returns all combinations of Descriptor definitions that were provided as Lists.""" <|body_1|> def build_identifi...
stack_v2_sparse_classes_36k_train_003509
23,780
no_license
[ { "docstring": "Parent class for all Descriptor objects", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Iteration over the Descriptor returns all combinations of Descriptor definitions that were provided as Lists.", "name": "__iter__", "signature": "def __iter_...
3
stack_v2_sparse_classes_30k_train_019388
Implement the Python class `Descriptor` described below. Class description: Implement the Descriptor class. Method signatures and docstrings: - def __init__(self): Parent class for all Descriptor objects - def __iter__(self): Iteration over the Descriptor returns all combinations of Descriptor definitions that were p...
Implement the Python class `Descriptor` described below. Class description: Implement the Descriptor class. Method signatures and docstrings: - def __init__(self): Parent class for all Descriptor objects - def __iter__(self): Iteration over the Descriptor returns all combinations of Descriptor definitions that were p...
3c8aed76ac4dd5aa38539897a0d93b51801031b1
<|skeleton|> class Descriptor: def __init__(self): """Parent class for all Descriptor objects""" <|body_0|> def __iter__(self): """Iteration over the Descriptor returns all combinations of Descriptor definitions that were provided as Lists.""" <|body_1|> def build_identifi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Descriptor: def __init__(self): """Parent class for all Descriptor objects""" self.identifier_exceptions = [] self.iterator_exceptions = [] self.iterator_list = [] self.identifier = None def __iter__(self): """Iteration over the Descriptor returns all combi...
the_stack_v2_python_sparse
descriptor.py
m-guggenmos/decog
train
1
028d7388bed546a93689f27f4383985ba897b4f3
[ "self.type = node.attrib.get('type', 'UserGenerated')\nself.printTag = self.type + ' File'\nself.__linkedModel = node.attrib.get('linkedCode', None)\nself.perturbed = node.attrib.get('perturbable', True)\nself.subDirectory = node.attrib.get('subDirectory', '')\nself.setAbsFile(os.path.join(self.subDirectory, node.t...
<|body_start_0|> self.type = node.attrib.get('type', 'UserGenerated') self.printTag = self.type + ' File' self.__linkedModel = node.attrib.get('linkedCode', None) self.perturbed = node.attrib.get('perturbable', True) self.subDirectory = node.attrib.get('subDirectory', '') ...
This class is for file objects that are created and used internally by RAVEN. Initialization is through self._readMoreXML
UserGenerated
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserGenerated: """This class is for file objects that are created and used internally by RAVEN. Initialization is through self._readMoreXML""" def _readMoreXML(self, node): """reads the xmlNode and sets parameters @ In, xmlNode, XML node @ Out, None""" <|body_0|> def __g...
stack_v2_sparse_classes_36k_train_003510
17,137
permissive
[ { "docstring": "reads the xmlNode and sets parameters @ In, xmlNode, XML node @ Out, None", "name": "_readMoreXML", "signature": "def _readMoreXML(self, node)" }, { "docstring": "Pickle dump method hook. @ In, None @ Out, stateDict, dict, dict of objets needed to restore instance", "name": "...
3
stack_v2_sparse_classes_30k_test_001104
Implement the Python class `UserGenerated` described below. Class description: This class is for file objects that are created and used internally by RAVEN. Initialization is through self._readMoreXML Method signatures and docstrings: - def _readMoreXML(self, node): reads the xmlNode and sets parameters @ In, xmlNode...
Implement the Python class `UserGenerated` described below. Class description: This class is for file objects that are created and used internally by RAVEN. Initialization is through self._readMoreXML Method signatures and docstrings: - def _readMoreXML(self, node): reads the xmlNode and sets parameters @ In, xmlNode...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class UserGenerated: """This class is for file objects that are created and used internally by RAVEN. Initialization is through self._readMoreXML""" def _readMoreXML(self, node): """reads the xmlNode and sets parameters @ In, xmlNode, XML node @ Out, None""" <|body_0|> def __g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserGenerated: """This class is for file objects that are created and used internally by RAVEN. Initialization is through self._readMoreXML""" def _readMoreXML(self, node): """reads the xmlNode and sets parameters @ In, xmlNode, XML node @ Out, None""" self.type = node.attrib.get('type', ...
the_stack_v2_python_sparse
ravenframework/Files.py
idaholab/raven
train
201
a540bdb46f0da428db0f704804510af0cb11b37f
[ "self.dic = defaultdict(int)\nself.timex = defaultdict(list)\ntmex = 0\nfor i in range(len(sentences)):\n self.dic[sentences[i]] = times[i]\n self.timex[times[i]].append(sentences[i])\n tmex = max(tmex, times[i])\nself.prefix = ''\nfor each in self.timex:\n tmp = self.timex[each]\n tmp.sort()\n se...
<|body_start_0|> self.dic = defaultdict(int) self.timex = defaultdict(list) tmex = 0 for i in range(len(sentences)): self.dic[sentences[i]] = times[i] self.timex[times[i]].append(sentences[i]) tmex = max(tmex, times[i]) self.prefix = '' ...
AutocompleteSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.dic = defaultdict...
stack_v2_sparse_classes_36k_train_003511
2,821
no_license
[ { "docstring": ":type sentences: List[str] :type times: List[int]", "name": "__init__", "signature": "def __init__(self, sentences, times)" }, { "docstring": ":type c: str :rtype: List[str]", "name": "input", "signature": "def input(self, c)" } ]
2
null
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str]
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str] <|skeleton|> cla...
196e58cd38db846653fb074cfd0363997121a7cf
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" self.dic = defaultdict(int) self.timex = defaultdict(list) tmex = 0 for i in range(len(sentences)): self.dic[sentences[i]] = times[i] ...
the_stack_v2_python_sparse
Design Search Autocomplete System.py
nithinveer/leetcode-solutions
train
0
46454c4abddee222df23723f7da8a88494a1fe4f
[ "status = 0\ntry:\n cfg = config.load(sys.argv[1])\nexcept IndexError:\n raise SystemExit('Missing YML file. Usage: python2 objectdetector.py objectdetector.yml')\njdrc = comm.init(cfg, 'ObjectDetector')\nself.lock = threading.Lock()\ntry:\n self.cam = jdrc.getCameraClient('ObjectDetector.Camera')\n if ...
<|body_start_0|> status = 0 try: cfg = config.load(sys.argv[1]) except IndexError: raise SystemExit('Missing YML file. Usage: python2 objectdetector.py objectdetector.yml') jdrc = comm.init(cfg, 'ObjectDetector') self.lock = threading.Lock() try: ...
Camera
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Camera: def __init__(self): """Camera class gets images from live video and transform them in order to predict the digit in the image.""" <|body_0|> def getImage(self): """Gets the image from the webcam and returns the original image and the output image from the det...
stack_v2_sparse_classes_36k_train_003512
2,322
no_license
[ { "docstring": "Camera class gets images from live video and transform them in order to predict the digit in the image.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Gets the image from the webcam and returns the original image and the output image from the detection...
3
stack_v2_sparse_classes_30k_train_014618
Implement the Python class `Camera` described below. Class description: Implement the Camera class. Method signatures and docstrings: - def __init__(self): Camera class gets images from live video and transform them in order to predict the digit in the image. - def getImage(self): Gets the image from the webcam and r...
Implement the Python class `Camera` described below. Class description: Implement the Camera class. Method signatures and docstrings: - def __init__(self): Camera class gets images from live video and transform them in order to predict the digit in the image. - def getImage(self): Gets the image from the webcam and r...
20c3f1f8dfdd49a88256c434f9be6482a5426142
<|skeleton|> class Camera: def __init__(self): """Camera class gets images from live video and transform them in order to predict the digit in the image.""" <|body_0|> def getImage(self): """Gets the image from the webcam and returns the original image and the output image from the det...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Camera: def __init__(self): """Camera class gets images from live video and transform them in order to predict the digit in the image.""" status = 0 try: cfg = config.load(sys.argv[1]) except IndexError: raise SystemExit('Missing YML file. Usage: python2...
the_stack_v2_python_sparse
dl_objectdetector/Camera/camera.py
RoboticsLabURJC/2017-tfm-vanessa-fernandez
train
2
ceefcb20fdac0bf9b157b2cea0a7bf0dff2f8a92
[ "l1, l2 = (len(word1), len(word2))\ndp = [[0] * (l2 + 1) for _ in range(l1 + 1)]\nfor i in range(l1 + 1):\n for j in range(l2 + 1):\n if i == 0 or j == 0:\n dp[i][j] = max(i, j)\n continue\n if word1[i - 1:i] == word2[j - 1:j]:\n dp[i][j] = dp[i - 1][j - 1]\n ...
<|body_start_0|> l1, l2 = (len(word1), len(word2)) dp = [[0] * (l2 + 1) for _ in range(l1 + 1)] for i in range(l1 + 1): for j in range(l2 + 1): if i == 0 or j == 0: dp[i][j] = max(i, j) continue if word1[i - 1:i]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDistance(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_0|> def minDistance(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> l1, l...
stack_v2_sparse_classes_36k_train_003513
1,478
no_license
[ { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "minDistance", "signature": "def minDistance(self, word1, word2)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "minDistance", "signature": "def minDistance(self, word1, word2)" } ]
2
stack_v2_sparse_classes_30k_train_012376
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance(self, word1, word2): :type word1: str :type word2: str :rtype: int - def minDistance(self, word1, word2): :type word1: str :type word2: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance(self, word1, word2): :type word1: str :type word2: str :rtype: int - def minDistance(self, word1, word2): :type word1: str :type word2: str :rtype: int <|skeleto...
2a29426be1d690b6f90bc45b437900deee46d832
<|skeleton|> class Solution: def minDistance(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_0|> def minDistance(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minDistance(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" l1, l2 = (len(word1), len(word2)) dp = [[0] * (l2 + 1) for _ in range(l1 + 1)] for i in range(l1 + 1): for j in range(l2 + 1): if i == 0 or j == 0: ...
the_stack_v2_python_sparse
src/leet/72-edit-distance.py
sevenseablue/leetcode
train
0
170b4e28242c0eb5c48ff9de12821a6daff66041
[ "self.list = [v1, v2]\nself.pointer = [-1, -1]\nself.pl = 0", "res = self.list[self.pl][self.pointer[self.pl]]\nself.pl = ~self.pl\nreturn res", "self.pointer[self.pl] += 1\nif self.pointer[self.pl] < len(self.list[self.pl]):\n return True\nelse:\n self.pl = ~self.pl\n self.pointer[self.pl] += 1\n i...
<|body_start_0|> self.list = [v1, v2] self.pointer = [-1, -1] self.pl = 0 <|end_body_0|> <|body_start_1|> res = self.list[self.pl][self.pointer[self.pl]] self.pl = ~self.pl return res <|end_body_1|> <|body_start_2|> self.pointer[self.pl] += 1 if self.poi...
ZigzagIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end...
stack_v2_sparse_classes_36k_train_003514
2,633
no_license
[ { "docstring": "Initialize your data structure here. :type v1: List[int] :type v2: List[int]", "name": "__init__", "signature": "def __init__(self, v1, v2)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name"...
3
stack_v2_sparse_classes_30k_train_004942
Implement the Python class `ZigzagIterator` described below. Class description: Implement the ZigzagIterator class. Method signatures and docstrings: - def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int] - def next(self): :rtype: int - def hasNext(self): :rtype: bo...
Implement the Python class `ZigzagIterator` described below. Class description: Implement the ZigzagIterator class. Method signatures and docstrings: - def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int] - def next(self): :rtype: int - def hasNext(self): :rtype: bo...
85415872711c7c4b646f71ba44b5ef9200c03f5e
<|skeleton|> class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" self.list = [v1, v2] self.pointer = [-1, -1] self.pl = 0 def next(self): """:rtype: int""" res = self.list[self.pl][self.pointer[s...
the_stack_v2_python_sparse
281.py
ninini976/yf_leetcode_problems
train
0
20ec5cb3cff18943c4d0fe657a804672a45b9845
[ "samples = [sample]\ncollate_task = collate_microbe_directory.s(samples)\nreducer_task = microbe_directory_reducer.s()\nanalysis_result_uuid = sample['analysis_result']\npersist_task = persist_result.s(analysis_result_uuid, MODULE_NAME)\ntask_chain = chain(collate_task, reducer_task, persist_task)\nresult = task_ch...
<|body_start_0|> samples = [sample] collate_task = collate_microbe_directory.s(samples) reducer_task = microbe_directory_reducer.s() analysis_result_uuid = sample['analysis_result'] persist_task = persist_result.s(analysis_result_uuid, MODULE_NAME) task_chain = chain(coll...
Tasks for generating virulence results.
MicrobeDirectoryWrangler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MicrobeDirectoryWrangler: """Tasks for generating virulence results.""" def run_sample(cls, sample_id, sample): """Gather single sample and process.""" <|body_0|> def run_sample_group(cls, sample_group, samples): """Gather and process samples.""" <|body_1...
stack_v2_sparse_classes_36k_train_003515
1,346
permissive
[ { "docstring": "Gather single sample and process.", "name": "run_sample", "signature": "def run_sample(cls, sample_id, sample)" }, { "docstring": "Gather and process samples.", "name": "run_sample_group", "signature": "def run_sample_group(cls, sample_group, samples)" } ]
2
stack_v2_sparse_classes_30k_train_000729
Implement the Python class `MicrobeDirectoryWrangler` described below. Class description: Tasks for generating virulence results. Method signatures and docstrings: - def run_sample(cls, sample_id, sample): Gather single sample and process. - def run_sample_group(cls, sample_group, samples): Gather and process samples...
Implement the Python class `MicrobeDirectoryWrangler` described below. Class description: Tasks for generating virulence results. Method signatures and docstrings: - def run_sample(cls, sample_id, sample): Gather single sample and process. - def run_sample_group(cls, sample_group, samples): Gather and process samples...
609cd57c626c857c8efde8237a1f22f4d1e6065d
<|skeleton|> class MicrobeDirectoryWrangler: """Tasks for generating virulence results.""" def run_sample(cls, sample_id, sample): """Gather single sample and process.""" <|body_0|> def run_sample_group(cls, sample_group, samples): """Gather and process samples.""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MicrobeDirectoryWrangler: """Tasks for generating virulence results.""" def run_sample(cls, sample_id, sample): """Gather single sample and process.""" samples = [sample] collate_task = collate_microbe_directory.s(samples) reducer_task = microbe_directory_reducer.s() ...
the_stack_v2_python_sparse
app/display_modules/microbe_directory/wrangler.py
MetaGenScope/metagenscope-server
train
0
f186659caa63e90e21dcdf85988ac2c766f0c373
[ "if nums is None:\n return []\nelif len(nums) == 0:\n return [[]]\nresult = []\n\ndef helper(nums, index, resultList):\n result.append(resultList)\n for i in range(index, len(nums)):\n helper(nums, i + 1, resultList + [nums[i]])\nhelper(nums, 0, [])\nreturn result", "if nums is None:\n retur...
<|body_start_0|> if nums is None: return [] elif len(nums) == 0: return [[]] result = [] def helper(nums, index, resultList): result.append(resultList) for i in range(index, len(nums)): helper(nums, i + 1, resultList + [num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsetsI(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if nums is None: ...
stack_v2_sparse_classes_36k_train_003516
2,030
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsetsI", "signature": "def subsetsI(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsetsWithDup", "signature": "def subsetsWithDup(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_016467
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsI(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsI(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Soluti...
d1666d44226274f13af25cf878cd63a24e1c5528
<|skeleton|> class Solution: def subsetsI(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subsetsI(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" if nums is None: return [] elif len(nums) == 0: return [[]] result = [] def helper(nums, index, resultList): result.append(resultList) ...
the_stack_v2_python_sparse
DFS/LeetCode078_Subsets.py
rexhzhang/LeetCodeProbelms
train
0
71b451a96fb3ec06fbb539955938c8fe47bf8701
[ "super(CriticNetwork, self).__init__()\nif norm_in:\n self.in_fn = nn.BatchNorm1d(input_dim)\n self.in_fn.weight.data.fill_(1)\n self.in_fn.bias.data.fill_(0)\nelse:\n self.in_fn = lambda x: x\nself.fc1 = nn.Linear(input_dim, hidden_dim)\nself.fc2 = nn.Linear(hidden_dim, hidden_dim)\nself.fc3 = nn.Linea...
<|body_start_0|> super(CriticNetwork, self).__init__() if norm_in: self.in_fn = nn.BatchNorm1d(input_dim) self.in_fn.weight.data.fill_(1) self.in_fn.bias.data.fill_(0) else: self.in_fn = lambda x: x self.fc1 = nn.Linear(input_dim, hidden_di...
Deep Critic-Network applied on joint observations & actions based on https://github.com/shariqiqbal2810/maddpg-pytorch/blob/master/utils/networks.py
CriticNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CriticNetwork: """Deep Critic-Network applied on joint observations & actions based on https://github.com/shariqiqbal2810/maddpg-pytorch/blob/master/utils/networks.py""" def __init__(self, input_dim, hidden_dim=64, dropout_p=0.0, nonlin=F.relu, norm_in=True): """Initialize parameters...
stack_v2_sparse_classes_36k_train_003517
3,561
no_license
[ { "docstring": "Initialize parameters and build model. :param input_dim: dimension of network input :param hidden_dim: dimension of hidden layers :param dropout_p: dropout probability :param nonlin: nonlinearity to use :param norm_in: normalise input first", "name": "__init__", "signature": "def __init_...
2
stack_v2_sparse_classes_30k_train_011205
Implement the Python class `CriticNetwork` described below. Class description: Deep Critic-Network applied on joint observations & actions based on https://github.com/shariqiqbal2810/maddpg-pytorch/blob/master/utils/networks.py Method signatures and docstrings: - def __init__(self, input_dim, hidden_dim=64, dropout_p...
Implement the Python class `CriticNetwork` described below. Class description: Deep Critic-Network applied on joint observations & actions based on https://github.com/shariqiqbal2810/maddpg-pytorch/blob/master/utils/networks.py Method signatures and docstrings: - def __init__(self, input_dim, hidden_dim=64, dropout_p...
2afa0a9d83bd66a151c1a19242c5ef22cf4eb1f6
<|skeleton|> class CriticNetwork: """Deep Critic-Network applied on joint observations & actions based on https://github.com/shariqiqbal2810/maddpg-pytorch/blob/master/utils/networks.py""" def __init__(self, input_dim, hidden_dim=64, dropout_p=0.0, nonlin=F.relu, norm_in=True): """Initialize parameters...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CriticNetwork: """Deep Critic-Network applied on joint observations & actions based on https://github.com/shariqiqbal2810/maddpg-pytorch/blob/master/utils/networks.py""" def __init__(self, input_dim, hidden_dim=64, dropout_p=0.0, nonlin=F.relu, norm_in=True): """Initialize parameters and build mo...
the_stack_v2_python_sparse
marl_algorithms/maddpg/model.py
Jarvis-K/MSc_Curiosity_MARL
train
0
e6164e470ea8b3e7fb60a21db9dd465ee5738e07
[ "miner = Miner(name='Miner', version='1.0.b', slug='slug_already_exists')\nminer.save()\nself.assertEqual('slug_already_exists')", "miner = Miner(name='Miner', version='1.0.b')\nminer.save()\nself.assertNotEqual(miner.slug, '')", "miner = Miner.objects.create(name='Miner', version='1.0.b')\nserver = Server.obje...
<|body_start_0|> miner = Miner(name='Miner', version='1.0.b', slug='slug_already_exists') miner.save() self.assertEqual('slug_already_exists') <|end_body_0|> <|body_start_1|> miner = Miner(name='Miner', version='1.0.b') miner.save() self.assertNotEqual(miner.slug, '') <|...
Тестирование генерации slug при сохранении
PreSaveGetSlugTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreSaveGetSlugTest: """Тестирование генерации slug при сохранении""" def slug_already_exists(self): """Тестирование slug уже задан""" <|body_0|> def test_known_model(self): """Тестирование slug не задан""" <|body_1|> def test_unknown_model(self): ...
stack_v2_sparse_classes_36k_train_003518
13,105
permissive
[ { "docstring": "Тестирование slug уже задан", "name": "slug_already_exists", "signature": "def slug_already_exists(self)" }, { "docstring": "Тестирование slug не задан", "name": "test_known_model", "signature": "def test_known_model(self)" }, { "docstring": "Тестирование параметр...
3
stack_v2_sparse_classes_30k_val_000675
Implement the Python class `PreSaveGetSlugTest` described below. Class description: Тестирование генерации slug при сохранении Method signatures and docstrings: - def slug_already_exists(self): Тестирование slug уже задан - def test_known_model(self): Тестирование slug не задан - def test_unknown_model(self): Тестиро...
Implement the Python class `PreSaveGetSlugTest` described below. Class description: Тестирование генерации slug при сохранении Method signatures and docstrings: - def slug_already_exists(self): Тестирование slug уже задан - def test_known_model(self): Тестирование slug не задан - def test_unknown_model(self): Тестиро...
d173f1bee44d0752eefb53b1a0da847a3882a352
<|skeleton|> class PreSaveGetSlugTest: """Тестирование генерации slug при сохранении""" def slug_already_exists(self): """Тестирование slug уже задан""" <|body_0|> def test_known_model(self): """Тестирование slug не задан""" <|body_1|> def test_unknown_model(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PreSaveGetSlugTest: """Тестирование генерации slug при сохранении""" def slug_already_exists(self): """Тестирование slug уже задан""" miner = Miner(name='Miner', version='1.0.b', slug='slug_already_exists') miner.save() self.assertEqual('slug_already_exists') def test...
the_stack_v2_python_sparse
miningstatistic/core/tests.py
crowmurk/miners
train
0
a6b3b8c797ff66b5b4f9861edb28a421fb6dea9b
[ "if seed is None:\n self.seed = struct.unpack('<L', os.urandom(4))[0]\nelse:\n self.seed = seed\nnp.random.seed(self.seed)\nrandom.seed(self.seed)", "if output is None:\n output = StdOutput()\nif error_gen is None:\n generate_errors = False\n if error_circuits is None:\n error_circuits = {}\...
<|body_start_0|> if seed is None: self.seed = struct.unpack('<L', os.urandom(4))[0] else: self.seed = seed np.random.seed(self.seed) random.seed(self.seed) <|end_body_0|> <|body_start_1|> if output is None: output = StdOutput() if erro...
This class represents a standard model for running quantum circuits and adding in errors.
Standard
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Standard: """This class represents a standard model for running quantum circuits and adding in errors.""" def __init__(self, seed=None): """Args: seed:""" <|body_0|> def run(state, circuit, error_gen=None, error_params=None, error_circuits=None, output=None): """...
stack_v2_sparse_classes_36k_train_003519
3,414
permissive
[ { "docstring": "Args: seed:", "name": "__init__", "signature": "def __init__(self, seed=None)" }, { "docstring": "Args: state: circuit: error_gen: error_params: error_circuits: output: Returns:", "name": "run", "signature": "def run(state, circuit, error_gen=None, error_params=None, erro...
2
null
Implement the Python class `Standard` described below. Class description: This class represents a standard model for running quantum circuits and adding in errors. Method signatures and docstrings: - def __init__(self, seed=None): Args: seed: - def run(state, circuit, error_gen=None, error_params=None, error_circuits...
Implement the Python class `Standard` described below. Class description: This class represents a standard model for running quantum circuits and adding in errors. Method signatures and docstrings: - def __init__(self, seed=None): Args: seed: - def run(state, circuit, error_gen=None, error_params=None, error_circuits...
ab04127f5a6fce55ccf6bc8066a15e70912a6c47
<|skeleton|> class Standard: """This class represents a standard model for running quantum circuits and adding in errors.""" def __init__(self, seed=None): """Args: seed:""" <|body_0|> def run(state, circuit, error_gen=None, error_params=None, error_circuits=None, output=None): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Standard: """This class represents a standard model for running quantum circuits and adding in errors.""" def __init__(self, seed=None): """Args: seed:""" if seed is None: self.seed = struct.unpack('<L', os.urandom(4))[0] else: self.seed = seed np.r...
the_stack_v2_python_sparse
pecos/circuit_runners/standard.py
PECOS-packages/PECOS
train
24
f3b156b14db822e938d402def0fb9196cff9cf8b
[ "result = 0\nif nums[0] == 0:\n nums[0] = -1\nfor i in range(1, len(nums)):\n if nums[i] == 0:\n nums[i] = -1\n nums[i] += nums[i - 1]\n if nums[i] == 0:\n result = max(result, i + 1)\n elif nums[i] in nums[:i]:\n b = nums[:i].index(nums[i])\n result = max(result, i - b)\n...
<|body_start_0|> result = 0 if nums[0] == 0: nums[0] = -1 for i in range(1, len(nums)): if nums[i] == 0: nums[i] = -1 nums[i] += nums[i - 1] if nums[i] == 0: result = max(result, i + 1) elif nums[i] in nu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaxLength(self, nums: List[int]) -> int: """连续的一个list中. 0和1的个数相同. 要找最长的. 第一次0比1多k个与下一次0比1多k个的情况发生时, 中间的一段就是result,找最长的result. 把0换成-1, 一个个相加之后等于0时就能知道数量. 需要一个表记录sum. [0, 1, 0, 1, 1, 0] 0 0 -> index[0, 1]-1 -> 0 -> index[0, 5] -> 5 T(n^2) S(1) 超时 :param nums: :return:""" ...
stack_v2_sparse_classes_36k_train_003520
2,225
no_license
[ { "docstring": "连续的一个list中. 0和1的个数相同. 要找最长的. 第一次0比1多k个与下一次0比1多k个的情况发生时, 中间的一段就是result,找最长的result. 把0换成-1, 一个个相加之后等于0时就能知道数量. 需要一个表记录sum. [0, 1, 0, 1, 1, 0] 0 0 -> index[0, 1]-1 -> 0 -> index[0, 5] -> 5 T(n^2) S(1) 超时 :param nums: :return:", "name": "findMaxLength", "signature": "def findMaxLength(self, ...
2
stack_v2_sparse_classes_30k_train_013016
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxLength(self, nums: List[int]) -> int: 连续的一个list中. 0和1的个数相同. 要找最长的. 第一次0比1多k个与下一次0比1多k个的情况发生时, 中间的一段就是result,找最长的result. 把0换成-1, 一个个相加之后等于0时就能知道数量. 需要一个表记录sum. [0, 1, 0...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxLength(self, nums: List[int]) -> int: 连续的一个list中. 0和1的个数相同. 要找最长的. 第一次0比1多k个与下一次0比1多k个的情况发生时, 中间的一段就是result,找最长的result. 把0换成-1, 一个个相加之后等于0时就能知道数量. 需要一个表记录sum. [0, 1, 0...
b1680014ce3f55ba952a1e64241c0cbb783cc436
<|skeleton|> class Solution: def findMaxLength(self, nums: List[int]) -> int: """连续的一个list中. 0和1的个数相同. 要找最长的. 第一次0比1多k个与下一次0比1多k个的情况发生时, 中间的一段就是result,找最长的result. 把0换成-1, 一个个相加之后等于0时就能知道数量. 需要一个表记录sum. [0, 1, 0, 1, 1, 0] 0 0 -> index[0, 1]-1 -> 0 -> index[0, 5] -> 5 T(n^2) S(1) 超时 :param nums: :return:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMaxLength(self, nums: List[int]) -> int: """连续的一个list中. 0和1的个数相同. 要找最长的. 第一次0比1多k个与下一次0比1多k个的情况发生时, 中间的一段就是result,找最长的result. 把0换成-1, 一个个相加之后等于0时就能知道数量. 需要一个表记录sum. [0, 1, 0, 1, 1, 0] 0 0 -> index[0, 1]-1 -> 0 -> index[0, 5] -> 5 T(n^2) S(1) 超时 :param nums: :return:""" result...
the_stack_v2_python_sparse
a_525.py
sun510001/leetcode_jianzhi_offer_2
train
0
ebe9086b0b6559156cc0a3c72f78529b5d189159
[ "res = 0\nfor i in range(len(nums)):\n for j in range(i, len(nums)):\n res += bin(nums[i] ^ nums[j]).count('1')\nreturn res", "mask = [[0, 0] for _ in range(32)]\nfor n in nums:\n for pos in mask:\n pos[int(n % 2)] += 1\n n /= 2\nprint(mask)\nreturn sum((x * y for x, y in mask))" ]
<|body_start_0|> res = 0 for i in range(len(nums)): for j in range(i, len(nums)): res += bin(nums[i] ^ nums[j]).count('1') return res <|end_body_0|> <|body_start_1|> mask = [[0, 0] for _ in range(32)] for n in nums: for pos in mask: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def totalHammingDistance_n_square(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def totalHammingDistance_n(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = 0 ...
stack_v2_sparse_classes_36k_train_003521
1,441
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "totalHammingDistance_n_square", "signature": "def totalHammingDistance_n_square(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "totalHammingDistance_n", "signature": "def totalHammingDistance_n(self...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def totalHammingDistance_n_square(self, nums): :type nums: List[int] :rtype: int - def totalHammingDistance_n(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def totalHammingDistance_n_square(self, nums): :type nums: List[int] :rtype: int - def totalHammingDistance_n(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class S...
f3fc71f344cd758cfce77f16ab72992c99ab288e
<|skeleton|> class Solution: def totalHammingDistance_n_square(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def totalHammingDistance_n(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def totalHammingDistance_n_square(self, nums): """:type nums: List[int] :rtype: int""" res = 0 for i in range(len(nums)): for j in range(i, len(nums)): res += bin(nums[i] ^ nums[j]).count('1') return res def totalHammingDistance_n(self...
the_stack_v2_python_sparse
477_totalHammingDistance.py
jennyChing/leetCode
train
2
529d1aecb206088b9a183562576338b9a116d96a
[ "self.logger = logging.getLogger(__name__)\ntry:\n ct = diagram.Diagram_type.ConnectorTypes[connector_type]\nexcept IndexError:\n raise UnsupportedConnectorType(connector_type_name=connector_type, diagram_type_name=diagram.Diagram_type.Name)\nBinaryConnector.__init__(self, diagram=diagram, name=name, connecto...
<|body_start_0|> self.logger = logging.getLogger(__name__) try: ct = diagram.Diagram_type.ConnectorTypes[connector_type] except IndexError: raise UnsupportedConnectorType(connector_type_name=connector_type, diagram_type_name=diagram.Diagram_type.Name) BinaryConnec...
Connects two Stems with a straight line. One plays the role of a Projecting Binary Stem and the other is a Floating Binary Stem. The user has specified an anchor position (Face Placement value) for the projecting stem. Its root end will be placed at this position. For the floating stem, either the x or y value will be ...
StraightBinaryConnector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StraightBinaryConnector: """Connects two Stems with a straight line. One plays the role of a Projecting Binary Stem and the other is a Floating Binary Stem. The user has specified an anchor position (Face Placement value) for the projecting stem. Its root end will be placed at this position. For ...
stack_v2_sparse_classes_36k_train_003522
7,552
permissive
[ { "docstring": "Constructor – see class description for meaning of the attributes :param diagram: Reference to the Diagram :param connector_type: Name of connector type :param t_stem: T side of the association (T and P are arbitrary side names, could have been A and B) :param p_stem: P side of the association :...
3
stack_v2_sparse_classes_30k_val_000927
Implement the Python class `StraightBinaryConnector` described below. Class description: Connects two Stems with a straight line. One plays the role of a Projecting Binary Stem and the other is a Floating Binary Stem. The user has specified an anchor position (Face Placement value) for the projecting stem. Its root en...
Implement the Python class `StraightBinaryConnector` described below. Class description: Connects two Stems with a straight line. One plays the role of a Projecting Binary Stem and the other is a Floating Binary Stem. The user has specified an anchor position (Face Placement value) for the projecting stem. Its root en...
088e27cded9eca2cacba2c6168c03caf4b43ef72
<|skeleton|> class StraightBinaryConnector: """Connects two Stems with a straight line. One plays the role of a Projecting Binary Stem and the other is a Floating Binary Stem. The user has specified an anchor position (Face Placement value) for the projecting stem. Its root end will be placed at this position. For ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StraightBinaryConnector: """Connects two Stems with a straight line. One plays the role of a Projecting Binary Stem and the other is a Floating Binary Stem. The user has specified an anchor position (Face Placement value) for the projecting stem. Its root end will be placed at this position. For the floating ...
the_stack_v2_python_sparse
flatland/connector_subsystem/straight_binary_connector.py
Laurelinex/flatland-model-diagram-editor
train
0
9de59a9a6c2394f186fea72b7d8de251bb131f92
[ "self._sha = sha_type\nself._message = message\nself._rsa_key = rsa_key_size\nself._rsa = None\nself._signature = None", "_hash = SHA_2(self._sha, self._message).hash()\nrsa = RSA(self._rsa_key, None)\nself._rsa = rsa\nsignature = pkcs1_15.new(self._rsa.private_key).sign(_hash)\nHelper.write_signature(['SHA-2', '...
<|body_start_0|> self._sha = sha_type self._message = message self._rsa_key = rsa_key_size self._rsa = None self._signature = None <|end_body_0|> <|body_start_1|> _hash = SHA_2(self._sha, self._message).hash() rsa = RSA(self._rsa_key, None) self._rsa = rs...
Class Signature represents digital signature. It combines hashing and the asymmetric algorithm.
Signature
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Signature: """Class Signature represents digital signature. It combines hashing and the asymmetric algorithm.""" def __init__(self, sha_type, rsa_key_size, message): """Initialization method. :param sha_type: type of the hash method :param rsa_key_size: key size for the asymmetric al...
stack_v2_sparse_classes_36k_train_003523
1,598
no_license
[ { "docstring": "Initialization method. :param sha_type: type of the hash method :param rsa_key_size: key size for the asymmetric algorithm :param message: message", "name": "__init__", "signature": "def __init__(self, sha_type, rsa_key_size, message)" }, { "docstring": "Signing method. :return: ...
3
stack_v2_sparse_classes_30k_train_007947
Implement the Python class `Signature` described below. Class description: Class Signature represents digital signature. It combines hashing and the asymmetric algorithm. Method signatures and docstrings: - def __init__(self, sha_type, rsa_key_size, message): Initialization method. :param sha_type: type of the hash m...
Implement the Python class `Signature` described below. Class description: Class Signature represents digital signature. It combines hashing and the asymmetric algorithm. Method signatures and docstrings: - def __init__(self, sha_type, rsa_key_size, message): Initialization method. :param sha_type: type of the hash m...
6a285ef6a0a0356a942e02e25607fa30c49f7e67
<|skeleton|> class Signature: """Class Signature represents digital signature. It combines hashing and the asymmetric algorithm.""" def __init__(self, sha_type, rsa_key_size, message): """Initialization method. :param sha_type: type of the hash method :param rsa_key_size: key size for the asymmetric al...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Signature: """Class Signature represents digital signature. It combines hashing and the asymmetric algorithm.""" def __init__(self, sha_type, rsa_key_size, message): """Initialization method. :param sha_type: type of the hash method :param rsa_key_size: key size for the asymmetric algorithm :para...
the_stack_v2_python_sparse
lab2/Signature.py
evukelic/NOS
train
0
fca93300090d0b0a45cc39453432f3aa6b058da1
[ "threading.Thread.__init__(self)\nself.daemon = False\nself.hass = hass\nself.mac = mac\nself.name = name\nself.data = {'temp': STATE_UNKNOWN, 'humid': STATE_UNKNOWN}\nself.keep_going = True\nself.event = threading.Event()", "cached_char = Characteristic(BLE_TEMP_UUID, BLE_TEMP_HANDLE)\nadapter = GATTToolBackend(...
<|body_start_0|> threading.Thread.__init__(self) self.daemon = False self.hass = hass self.mac = mac self.name = name self.data = {'temp': STATE_UNKNOWN, 'humid': STATE_UNKNOWN} self.keep_going = True self.event = threading.Event() <|end_body_0|> <|body_s...
Connection handling.
Monitor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Monitor: """Connection handling.""" def __init__(self, hass, mac, name): """Construct interface object.""" <|body_0|> def run(self): """Thread that keeps connection alive.""" <|body_1|> def _update(self, handle, value): """Notification callba...
stack_v2_sparse_classes_36k_train_003524
5,965
permissive
[ { "docstring": "Construct interface object.", "name": "__init__", "signature": "def __init__(self, hass, mac, name)" }, { "docstring": "Thread that keeps connection alive.", "name": "run", "signature": "def run(self)" }, { "docstring": "Notification callback from pygatt.", "n...
4
stack_v2_sparse_classes_30k_train_005044
Implement the Python class `Monitor` described below. Class description: Connection handling. Method signatures and docstrings: - def __init__(self, hass, mac, name): Construct interface object. - def run(self): Thread that keeps connection alive. - def _update(self, handle, value): Notification callback from pygatt....
Implement the Python class `Monitor` described below. Class description: Connection handling. Method signatures and docstrings: - def __init__(self, hass, mac, name): Construct interface object. - def run(self): Thread that keeps connection alive. - def _update(self, handle, value): Notification callback from pygatt....
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class Monitor: """Connection handling.""" def __init__(self, hass, mac, name): """Construct interface object.""" <|body_0|> def run(self): """Thread that keeps connection alive.""" <|body_1|> def _update(self, handle, value): """Notification callba...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Monitor: """Connection handling.""" def __init__(self, hass, mac, name): """Construct interface object.""" threading.Thread.__init__(self) self.daemon = False self.hass = hass self.mac = mac self.name = name self.data = {'temp': STATE_UNKNOWN, 'humi...
the_stack_v2_python_sparse
homeassistant/components/skybeacon/sensor.py
home-assistant/core
train
35,501
303330fa98fe8805c9bc2f1ea1f4bd348e9a6ba7
[ "if minutes is None:\n return ''\ntd = timedelta(minutes=minutes)\nd = datetime(1, 1, 1) + td\nif d.day - 1 > 0:\n return '%d day%s, %d hour%s, %d minute%s' % (d.day - 1, pluralize(d.day - 1), d.hour, pluralize(d.hour), d.minute, pluralize(d.minute))\nelif d.hour > 0:\n return '%d hour%s, %d minute%s' % (d...
<|body_start_0|> if minutes is None: return '' td = timedelta(minutes=minutes) d = datetime(1, 1, 1) + td if d.day - 1 > 0: return '%d day%s, %d hour%s, %d minute%s' % (d.day - 1, pluralize(d.day - 1), d.hour, pluralize(d.hour), d.minute, pluralize(d.minute)) ...
ProblemsCSV
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProblemsCSV: def minutes_as_days_hours_mins(self, minutes): """Format a number of minutes as days, hours, minutes, only showing the values we need to. Taken from: http://stackoverflow.com/questions/4048651/python-function-to-convert-seconds-into-minutes-hours-and-days with some adjustmen...
stack_v2_sparse_classes_36k_train_003525
6,704
no_license
[ { "docstring": "Format a number of minutes as days, hours, minutes, only showing the values we need to. Taken from: http://stackoverflow.com/questions/4048651/python-function-to-convert-seconds-into-minutes-hours-and-days with some adjustments.", "name": "minutes_as_days_hours_mins", "signature": "def m...
2
stack_v2_sparse_classes_30k_train_015966
Implement the Python class `ProblemsCSV` described below. Class description: Implement the ProblemsCSV class. Method signatures and docstrings: - def minutes_as_days_hours_mins(self, minutes): Format a number of minutes as days, hours, minutes, only showing the values we need to. Taken from: http://stackoverflow.com/...
Implement the Python class `ProblemsCSV` described below. Class description: Implement the ProblemsCSV class. Method signatures and docstrings: - def minutes_as_days_hours_mins(self, minutes): Format a number of minutes as days, hours, minutes, only showing the values we need to. Taken from: http://stackoverflow.com/...
28ae4fc46bd1fdfd37a9ecad71402bc558c7b15c
<|skeleton|> class ProblemsCSV: def minutes_as_days_hours_mins(self, minutes): """Format a number of minutes as days, hours, minutes, only showing the values we need to. Taken from: http://stackoverflow.com/questions/4048651/python-function-to-convert-seconds-into-minutes-hours-and-days with some adjustmen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProblemsCSV: def minutes_as_days_hours_mins(self, minutes): """Format a number of minutes as days, hours, minutes, only showing the values we need to. Taken from: http://stackoverflow.com/questions/4048651/python-function-to-convert-seconds-into-minutes-hours-and-days with some adjustments.""" ...
the_stack_v2_python_sparse
organisations/views/superusers.py
mysociety/citizenconnect
train
1
15ae9750fd1fe44be7d58f78d711e9958bbdacb7
[ "serializer = self.get_serializer(data=request.data)\nif serializer.is_valid():\n user = serializer.create(serializer.data)\n login_response_serializer = serializers.LoginResponseV2Serializer(user)\n return Response(login_response_serializer.data)\nreturn Response(serializer.errors, status=status.HTTP_400_...
<|body_start_0|> serializer = self.get_serializer(data=request.data) if serializer.is_valid(): user = serializer.create(serializer.data) login_response_serializer = serializers.LoginResponseV2Serializer(user) return Response(login_response_serializer.data) ret...
AuthViewSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthViewSet: def login(self, request, *args, **kwargs): """Logs the user in. --- type: email: required: true type: string password: required: true type: string device_os: required: true type: string device_user_token: required: false type: string parameters: - name: email description: em...
stack_v2_sparse_classes_36k_train_003526
3,412
permissive
[ { "docstring": "Logs the user in. --- type: email: required: true type: string password: required: true type: string device_os: required: true type: string device_user_token: required: false type: string parameters: - name: email description: email user. required: true type: string paramType: form - name: passw...
3
stack_v2_sparse_classes_30k_train_020239
Implement the Python class `AuthViewSet` described below. Class description: Implement the AuthViewSet class. Method signatures and docstrings: - def login(self, request, *args, **kwargs): Logs the user in. --- type: email: required: true type: string password: required: true type: string device_os: required: true ty...
Implement the Python class `AuthViewSet` described below. Class description: Implement the AuthViewSet class. Method signatures and docstrings: - def login(self, request, *args, **kwargs): Logs the user in. --- type: email: required: true type: string password: required: true type: string device_os: required: true ty...
7349ce18f56658d67daedf5e1abb352b5c15a029
<|skeleton|> class AuthViewSet: def login(self, request, *args, **kwargs): """Logs the user in. --- type: email: required: true type: string password: required: true type: string device_os: required: true type: string device_user_token: required: false type: string parameters: - name: email description: em...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthViewSet: def login(self, request, *args, **kwargs): """Logs the user in. --- type: email: required: true type: string password: required: true type: string device_os: required: true type: string device_user_token: required: false type: string parameters: - name: email description: email user. requ...
the_stack_v2_python_sparse
src/tandlr/authentication/api.py
shrmoud/schoolapp
train
0
ddb7efc72ca3e9fbfa1def3c5e3a6f05f74328ef
[ "self._crossover = actual_crossover\nself._accept_less_percent = accept_less\nself._accept_less_rand = random.Random()", "new_org_1, new_org_2 = self._crossover.do_crossover(org_1, org_2)\nreturn_orgs = []\nfor start_org, new_org in ((org_1, new_org_1), (org_2, new_org_2)):\n new_org.recalculate_fitness()\n ...
<|body_start_0|> self._crossover = actual_crossover self._accept_less_percent = accept_less self._accept_less_rand = random.Random() <|end_body_0|> <|body_start_1|> new_org_1, new_org_2 = self._crossover.do_crossover(org_1, org_2) return_orgs = [] for start_org, new_org ...
Perform crossovers, but do not allow decreases in organism fitness. This doesn't actually do any crossover work, but instead relies on another class to do the crossover and just checks that newly created organisms do not have less fitness. This is useful for cases where crossovers can
SafeFitnessCrossover
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SafeFitnessCrossover: """Perform crossovers, but do not allow decreases in organism fitness. This doesn't actually do any crossover work, but instead relies on another class to do the crossover and just checks that newly created organisms do not have less fitness. This is useful for cases where c...
stack_v2_sparse_classes_36k_train_003527
2,143
permissive
[ { "docstring": "Initialize to do safe crossovers. Arguments: o actual_crossover - A Crossover class which actually implements crossover functionality. o accept_less - A probability to accept crossovers which generate less fitness. This allows you to accept some crossovers which reduce fitness, but not all of th...
2
stack_v2_sparse_classes_30k_train_018698
Implement the Python class `SafeFitnessCrossover` described below. Class description: Perform crossovers, but do not allow decreases in organism fitness. This doesn't actually do any crossover work, but instead relies on another class to do the crossover and just checks that newly created organisms do not have less fi...
Implement the Python class `SafeFitnessCrossover` described below. Class description: Perform crossovers, but do not allow decreases in organism fitness. This doesn't actually do any crossover work, but instead relies on another class to do the crossover and just checks that newly created organisms do not have less fi...
1d9a8e84a8572809ee3260ede44290e14de3bdd1
<|skeleton|> class SafeFitnessCrossover: """Perform crossovers, but do not allow decreases in organism fitness. This doesn't actually do any crossover work, but instead relies on another class to do the crossover and just checks that newly created organisms do not have less fitness. This is useful for cases where c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SafeFitnessCrossover: """Perform crossovers, but do not allow decreases in organism fitness. This doesn't actually do any crossover work, but instead relies on another class to do the crossover and just checks that newly created organisms do not have less fitness. This is useful for cases where crossovers can...
the_stack_v2_python_sparse
bin/last_wrapper/Bio/GA/Crossover/General.py
LyonsLab/coge
train
41
e2c6c561848ea8c3460ac756ad955ca2ef5be68c
[ "def DFS(res, node):\n if node:\n res.append(str(node.val))\n DFS(res, node.left)\n DFS(res, node.right)\n else:\n res.append('#')\nres = []\nDFS(res, root)\nreturn ' '.join(res)", "def DFS():\n pointer = next(data_list)\n if pointer != '#':\n node = TreeNode(pointer...
<|body_start_0|> def DFS(res, node): if node: res.append(str(node.val)) DFS(res, node.left) DFS(res, node.right) else: res.append('#') res = [] DFS(res, root) return ' '.join(res) <|end_body_0|> <|bo...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize1(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize1(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> def serialize2(self...
stack_v2_sparse_classes_36k_train_003528
2,044
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize1", "signature": "def serialize1(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize1", "signature": "def deseria...
4
stack_v2_sparse_classes_30k_train_010529
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize1(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize1(self, data): Decodes your encoded data to tree. :type data: str :rtyp...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize1(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize1(self, data): Decodes your encoded data to tree. :type data: str :rtyp...
5f5018035fc5e70103e1d4bb5dadb88e5949f6ca
<|skeleton|> class Codec: def serialize1(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize1(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> def serialize2(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize1(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def DFS(res, node): if node: res.append(str(node.val)) DFS(res, node.left) DFS(res, node.right) else: ...
the_stack_v2_python_sparse
Company/Amazon/VO/297. Serialize and Deserialize Binary Tree.py
JianhangYin/LeetCode
train
0
9e6fff1b87214c7a11b8d00be7c6166de86e5f64
[ "self.timeToSpawn = timeToSpawn\nself.spawnTimer = 0\nself.map = map\nself.currTankId = 1", "if self.spawnTimer == 0:\n if len(self.map.tanks) < self.map.maxNoOfEnemies + 1 and len(self.map.tanks) < self.map.enemiesToKill + 1:\n tank = Tank(self.currTankId, self.map.getFreeCoords(), self.map)\n s...
<|body_start_0|> self.timeToSpawn = timeToSpawn self.spawnTimer = 0 self.map = map self.currTankId = 1 <|end_body_0|> <|body_start_1|> if self.spawnTimer == 0: if len(self.map.tanks) < self.map.maxNoOfEnemies + 1 and len(self.map.tanks) < self.map.enemiesToKill + 1: ...
A class that spawns enemies.
EnemySpawner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnemySpawner: """A class that spawns enemies.""" def __init__(self, map, timeToSpawn): """The constructor""" <|body_0|> def process(self): """Method checks wether the timer to spawn is equal to 0. If not then it decrements the timer. Otherwise it checks if the nu...
stack_v2_sparse_classes_36k_train_003529
1,138
no_license
[ { "docstring": "The constructor", "name": "__init__", "signature": "def __init__(self, map, timeToSpawn)" }, { "docstring": "Method checks wether the timer to spawn is equal to 0. If not then it decrements the timer. Otherwise it checks if the number of enemies has not exceeded the maximum numbe...
2
stack_v2_sparse_classes_30k_val_000554
Implement the Python class `EnemySpawner` described below. Class description: A class that spawns enemies. Method signatures and docstrings: - def __init__(self, map, timeToSpawn): The constructor - def process(self): Method checks wether the timer to spawn is equal to 0. If not then it decrements the timer. Otherwis...
Implement the Python class `EnemySpawner` described below. Class description: A class that spawns enemies. Method signatures and docstrings: - def __init__(self, map, timeToSpawn): The constructor - def process(self): Method checks wether the timer to spawn is equal to 0. If not then it decrements the timer. Otherwis...
eec95e28603b3a55c1df4f39e98ef9978881df73
<|skeleton|> class EnemySpawner: """A class that spawns enemies.""" def __init__(self, map, timeToSpawn): """The constructor""" <|body_0|> def process(self): """Method checks wether the timer to spawn is equal to 0. If not then it decrements the timer. Otherwise it checks if the nu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnemySpawner: """A class that spawns enemies.""" def __init__(self, map, timeToSpawn): """The constructor""" self.timeToSpawn = timeToSpawn self.spawnTimer = 0 self.map = map self.currTankId = 1 def process(self): """Method checks wether the timer to s...
the_stack_v2_python_sparse
game/EnemySpawner.py
eatrunner/tank-game
train
0
e71385554a7c39850dcaee75dfbef8338fefd5f0
[ "self.description = description\nself.is_update = is_update\nself.network_interface_group = network_interface_group\nself.network_interface_ids = network_interface_ids\nself.subnet = subnet\nself.vlan_id = vlan_id", "if dictionary is None:\n return None\ndescription = dictionary.get('description')\nis_update =...
<|body_start_0|> self.description = description self.is_update = is_update self.network_interface_group = network_interface_group self.network_interface_ids = network_interface_ids self.subnet = subnet self.vlan_id = vlan_id <|end_body_0|> <|body_start_1|> if dic...
Implementation of the 'StaticRoute' model. Specifies the settings of a Static Route. Attributes: description (string): Specifies a description of the Static Route. is_update (bool): Specifies if the route is currently being updated on the Cohesity Cluster. network_interface_group (string): Specifies the group name of t...
StaticRoute
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StaticRoute: """Implementation of the 'StaticRoute' model. Specifies the settings of a Static Route. Attributes: description (string): Specifies a description of the Static Route. is_update (bool): Specifies if the route is currently being updated on the Cohesity Cluster. network_interface_group ...
stack_v2_sparse_classes_36k_train_003530
3,382
permissive
[ { "docstring": "Constructor for the StaticRoute class", "name": "__init__", "signature": "def __init__(self, description=None, is_update=None, network_interface_group=None, network_interface_ids=None, subnet=None, vlan_id=None)" }, { "docstring": "Creates an instance of this model from a diction...
2
null
Implement the Python class `StaticRoute` described below. Class description: Implementation of the 'StaticRoute' model. Specifies the settings of a Static Route. Attributes: description (string): Specifies a description of the Static Route. is_update (bool): Specifies if the route is currently being updated on the Coh...
Implement the Python class `StaticRoute` described below. Class description: Implementation of the 'StaticRoute' model. Specifies the settings of a Static Route. Attributes: description (string): Specifies a description of the Static Route. is_update (bool): Specifies if the route is currently being updated on the Coh...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class StaticRoute: """Implementation of the 'StaticRoute' model. Specifies the settings of a Static Route. Attributes: description (string): Specifies a description of the Static Route. is_update (bool): Specifies if the route is currently being updated on the Cohesity Cluster. network_interface_group ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StaticRoute: """Implementation of the 'StaticRoute' model. Specifies the settings of a Static Route. Attributes: description (string): Specifies a description of the Static Route. is_update (bool): Specifies if the route is currently being updated on the Cohesity Cluster. network_interface_group (string): Spe...
the_stack_v2_python_sparse
cohesity_management_sdk/models/static_route.py
cohesity/management-sdk-python
train
24
6b1f89e00cb4a6d86f0f5ce6ed1c4dadac62e9a5
[ "x_headers = 'x-ms-date:' + date\nstring_to_hash = method + '\\n' + str(content_length) + '\\n' + content_type + '\\n' + x_headers + '\\n' + resource\nbytes_to_hash = bytes(string_to_hash, encoding='utf-8')\ndecoded_key = base64.b64decode(shared_key)\nencoded_hash = base64.b64encode(hmac.new(decoded_key, bytes_to_h...
<|body_start_0|> x_headers = 'x-ms-date:' + date string_to_hash = method + '\n' + str(content_length) + '\n' + content_type + '\n' + x_headers + '\n' + resource bytes_to_hash = bytes(string_to_hash, encoding='utf-8') decoded_key = base64.b64decode(shared_key) encoded_hash = base6...
AzureSentinel is Used to post data to log analytics.
AzureSentinel
[ "MIT", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AzureSentinel: """AzureSentinel is Used to post data to log analytics.""" def build_signature(self, date, content_length, method, content_type, resource): """To build the signature.""" <|body_0|> def post_data(self, customer_id, body, log_type): """Build and send...
stack_v2_sparse_classes_36k_train_003531
8,404
permissive
[ { "docstring": "To build the signature.", "name": "build_signature", "signature": "def build_signature(self, date, content_length, method, content_type, resource)" }, { "docstring": "Build and send a request to the POST API.", "name": "post_data", "signature": "def post_data(self, custom...
2
null
Implement the Python class `AzureSentinel` described below. Class description: AzureSentinel is Used to post data to log analytics. Method signatures and docstrings: - def build_signature(self, date, content_length, method, content_type, resource): To build the signature. - def post_data(self, customer_id, body, log_...
Implement the Python class `AzureSentinel` described below. Class description: AzureSentinel is Used to post data to log analytics. Method signatures and docstrings: - def build_signature(self, date, content_length, method, content_type, resource): To build the signature. - def post_data(self, customer_id, body, log_...
4536a3f6b9bdef902312b3d96f9c2e66b8bf52c1
<|skeleton|> class AzureSentinel: """AzureSentinel is Used to post data to log analytics.""" def build_signature(self, date, content_length, method, content_type, resource): """To build the signature.""" <|body_0|> def post_data(self, customer_id, body, log_type): """Build and send...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AzureSentinel: """AzureSentinel is Used to post data to log analytics.""" def build_signature(self, date, content_length, method, content_type, resource): """To build the signature.""" x_headers = 'x-ms-date:' + date string_to_hash = method + '\n' + str(content_length) + '\n' + co...
the_stack_v2_python_sparse
Solutions/SecurityScorecard Cybersecurity Ratings/Data Connectors/SecurityScorecardFactor/SecurityScorecardFactorSentinelConnector/writers.py
Azure/Azure-Sentinel
train
3,697
b34dd614c6b7da0a6a80d608d0b45bca5a481470
[ "dp = [[0 for _ in range(100)] for _ in range(100)]\ndp[0][0] = poured\ncur = [0, 1]\nrow = 0\nwhile cur[0] < cur[1] and row < 99:\n next_max = -1\n next_min = 100\n print(row, cur[0], cur[1])\n for i in range(cur[0], cur[1]):\n if dp[row][i] > 1:\n next_one = (dp[row][i] - 1) / 2.0\n ...
<|body_start_0|> dp = [[0 for _ in range(100)] for _ in range(100)] dp[0][0] = poured cur = [0, 1] row = 0 while cur[0] < cur[1] and row < 99: next_max = -1 next_min = 100 print(row, cur[0], cur[1]) for i in range(cur[0], cur[1]): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def champagneTower(self, poured, query_row, query_glass): """:type poured: int :type query_row: int :type query_glass: int :rtype: float 392ms""" <|body_0|> def champagneTower_1(self, poured, query_row, query_glass): """:type poured: int :type query_row: in...
stack_v2_sparse_classes_36k_train_003532
4,193
no_license
[ { "docstring": ":type poured: int :type query_row: int :type query_glass: int :rtype: float 392ms", "name": "champagneTower", "signature": "def champagneTower(self, poured, query_row, query_glass)" }, { "docstring": ":type poured: int :type query_row: int :type query_glass: int :rtype: float 125...
3
stack_v2_sparse_classes_30k_train_008123
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def champagneTower(self, poured, query_row, query_glass): :type poured: int :type query_row: int :type query_glass: int :rtype: float 392ms - def champagneTower_1(self, poured, q...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def champagneTower(self, poured, query_row, query_glass): :type poured: int :type query_row: int :type query_glass: int :rtype: float 392ms - def champagneTower_1(self, poured, q...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def champagneTower(self, poured, query_row, query_glass): """:type poured: int :type query_row: int :type query_glass: int :rtype: float 392ms""" <|body_0|> def champagneTower_1(self, poured, query_row, query_glass): """:type poured: int :type query_row: in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def champagneTower(self, poured, query_row, query_glass): """:type poured: int :type query_row: int :type query_glass: int :rtype: float 392ms""" dp = [[0 for _ in range(100)] for _ in range(100)] dp[0][0] = poured cur = [0, 1] row = 0 while cur[0] < c...
the_stack_v2_python_sparse
ChampagneTower_MID_799.py
953250587/leetcode-python
train
2
8fbb0b77dc9ba55ae18078970099b0bd18ff4109
[ "cuerpos_solicitados = self.request.GET.getlist('numero')\nif cuerpos_solicitados:\n cuerpos = Cuerpo.objects.filter(numero__in=cuerpos_solicitados)\nelse:\n cuerpos = Cuerpo.objects\nreturn cuerpos.all()", "context = super(TvCuerposListView, self).get_context_data(**kwargs)\nnivel = self.request.GET.get('n...
<|body_start_0|> cuerpos_solicitados = self.request.GET.getlist('numero') if cuerpos_solicitados: cuerpos = Cuerpo.objects.filter(numero__in=cuerpos_solicitados) else: cuerpos = Cuerpo.objects return cuerpos.all() <|end_body_0|> <|body_start_1|> context =...
Vista de lista para la visualización en TV de instancias de Cuerpo, ordenadas por número.
TvCuerposListView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TvCuerposListView: """Vista de lista para la visualización en TV de instancias de Cuerpo, ordenadas por número.""" def get_queryset(self): """Retorna las instancias de Cuerpo cuyo número se encuentra especificado en el parámetro GET 'numero' de la URL, o todos los cuerpos en caso de ...
stack_v2_sparse_classes_36k_train_003533
5,540
permissive
[ { "docstring": "Retorna las instancias de Cuerpo cuyo número se encuentra especificado en el parámetro GET 'numero' de la URL, o todos los cuerpos en caso de que el parámetro no sea especificado. Los cuerpos son ordenados por número.", "name": "get_queryset", "signature": "def get_queryset(self)" }, ...
2
stack_v2_sparse_classes_30k_train_013317
Implement the Python class `TvCuerposListView` described below. Class description: Vista de lista para la visualización en TV de instancias de Cuerpo, ordenadas por número. Method signatures and docstrings: - def get_queryset(self): Retorna las instancias de Cuerpo cuyo número se encuentra especificado en el parámetr...
Implement the Python class `TvCuerposListView` described below. Class description: Vista de lista para la visualización en TV de instancias de Cuerpo, ordenadas por número. Method signatures and docstrings: - def get_queryset(self): Retorna las instancias de Cuerpo cuyo número se encuentra especificado en el parámetr...
75fc06b9dedf53eca76b61ea0ccc914d5e084b2d
<|skeleton|> class TvCuerposListView: """Vista de lista para la visualización en TV de instancias de Cuerpo, ordenadas por número.""" def get_queryset(self): """Retorna las instancias de Cuerpo cuyo número se encuentra especificado en el parámetro GET 'numero' de la URL, o todos los cuerpos en caso de ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TvCuerposListView: """Vista de lista para la visualización en TV de instancias de Cuerpo, ordenadas por número.""" def get_queryset(self): """Retorna las instancias de Cuerpo cuyo número se encuentra especificado en el parámetro GET 'numero' de la URL, o todos los cuerpos en caso de que el paráme...
the_stack_v2_python_sparse
app_reservas/views/tv.py
desarrollogt-frm-utn/reservas
train
1
77081448eaea0b60a13405d474501c41b45d8850
[ "super(WfnCube, self).__init__(title, comment, origin, atoms, data)\nself.spin = spin\nself.wfn = wfn\nself.energy = energy\nself.occupation = occupation", "tmp = WfnCube()\ntmp.read_cube_file(fname, read_data=read_data)\nreturn tmp", "super(WfnCube, self).read_cube_file(fname, read_data, v)\ncommentregex = 'WA...
<|body_start_0|> super(WfnCube, self).__init__(title, comment, origin, atoms, data) self.spin = spin self.wfn = wfn self.energy = energy self.occupation = occupation <|end_body_0|> <|body_start_1|> tmp = WfnCube() tmp.read_cube_file(fname, read_data=read_data) ...
Gaussian cube file written by CP2K CP2K writes the index of level and spin into the comment line of the cube file
WfnCube
[ "LGPL-2.1-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WfnCube: """Gaussian cube file written by CP2K CP2K writes the index of level and spin into the comment line of the cube file""" def __init__(self, title=None, comment=None, origin=None, atoms=None, data=None, spin=None, wfn=None, energy=None, occupation=None): """Standard constructo...
stack_v2_sparse_classes_36k_train_003534
11,243
permissive
[ { "docstring": "Standard constructor, all parameters default to None. energy and occupation are not stored in the cube file, but can be assigned by linking the cube file with the output from the calculation.", "name": "__init__", "signature": "def __init__(self, title=None, comment=None, origin=None, at...
3
null
Implement the Python class `WfnCube` described below. Class description: Gaussian cube file written by CP2K CP2K writes the index of level and spin into the comment line of the cube file Method signatures and docstrings: - def __init__(self, title=None, comment=None, origin=None, atoms=None, data=None, spin=None, wfn...
Implement the Python class `WfnCube` described below. Class description: Gaussian cube file written by CP2K CP2K writes the index of level and spin into the comment line of the cube file Method signatures and docstrings: - def __init__(self, title=None, comment=None, origin=None, atoms=None, data=None, spin=None, wfn...
bdb31934a5eb49d601e492fc98078d27f5dd2ebd
<|skeleton|> class WfnCube: """Gaussian cube file written by CP2K CP2K writes the index of level and spin into the comment line of the cube file""" def __init__(self, title=None, comment=None, origin=None, atoms=None, data=None, spin=None, wfn=None, energy=None, occupation=None): """Standard constructo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WfnCube: """Gaussian cube file written by CP2K CP2K writes the index of level and spin into the comment line of the cube file""" def __init__(self, title=None, comment=None, origin=None, atoms=None, data=None, spin=None, wfn=None, energy=None, occupation=None): """Standard constructor, all parame...
the_stack_v2_python_sparse
asetk/format/cp2k.py
ltalirz/asetk
train
20
8abe3011312981ce1e33153ff6f6d7140ffcdead
[ "self.sparse = sparse\nself.index = index\nself.value = value\nself.shape = shape", "if beta is not None:\n thr = beta * np.mean(np.abs(data))\n index = np.argwhere(np.abs(data) > thr)\n value = data[np.abs(data) > thr].reshape(-1, 1)\nelse:\n index = np.argwhere(data != 0)\n value = data[data != 0...
<|body_start_0|> self.sparse = sparse self.index = index self.value = value self.shape = shape <|end_body_0|> <|body_start_1|> if beta is not None: thr = beta * np.mean(np.abs(data)) index = np.argwhere(np.abs(data) > thr) value = data[np.abs(...
FLANgrid
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FLANgrid: def __init__(self, sparse=None, index=None, value=None, shape=None): """Flat Array sparse matrix. Args: sparse (bool, optional): Sparse or Not index (list(int), optional): single index of each non-zero element value (list(float), optional): values of non-zero elements shape (3x...
stack_v2_sparse_classes_36k_train_003535
4,312
permissive
[ { "docstring": "Flat Array sparse matrix. Args: sparse (bool, optional): Sparse or Not index (list(int), optional): single index of each non-zero element value (list(float), optional): values of non-zero elements shape (3x3 array, optional): Shape of the matrix", "name": "__init__", "signature": "def __...
5
stack_v2_sparse_classes_30k_test_000614
Implement the Python class `FLANgrid` described below. Class description: Implement the FLANgrid class. Method signatures and docstrings: - def __init__(self, sparse=None, index=None, value=None, shape=None): Flat Array sparse matrix. Args: sparse (bool, optional): Sparse or Not index (list(int), optional): single in...
Implement the Python class `FLANgrid` described below. Class description: Implement the FLANgrid class. Method signatures and docstrings: - def __init__(self, sparse=None, index=None, value=None, shape=None): Flat Array sparse matrix. Args: sparse (bool, optional): Sparse or Not index (list(int), optional): single in...
6bc8d7e4893fc06f952d6e2b1edfc4e1c19bc671
<|skeleton|> class FLANgrid: def __init__(self, sparse=None, index=None, value=None, shape=None): """Flat Array sparse matrix. Args: sparse (bool, optional): Sparse or Not index (list(int), optional): single index of each non-zero element value (list(float), optional): values of non-zero elements shape (3x...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FLANgrid: def __init__(self, sparse=None, index=None, value=None, shape=None): """Flat Array sparse matrix. Args: sparse (bool, optional): Sparse or Not index (list(int), optional): single index of each non-zero element value (list(float), optional): values of non-zero elements shape (3x3 array, optio...
the_stack_v2_python_sparse
deeprank/tools/sparse.py
DeepRank/deeprank
train
140
0fb98998ddaeef5c4bbfdb856d3133c142f8a643
[ "assert isinstance(request, HttpRequest)\nqapp_id = request.GET.get('qapp_id', None)\nqapp = Qapp.objects.get(id=qapp_id)\nedit_message = ''\nif not check_can_edit(qapp, request.user):\n edit_message = 'You cannot edit this QAPP.'\nexisting_references = References.objects.filter(qapp=qapp).first()\nif existing_r...
<|body_start_0|> assert isinstance(request, HttpRequest) qapp_id = request.GET.get('qapp_id', None) qapp = Qapp.objects.get(id=qapp_id) edit_message = '' if not check_can_edit(qapp, request.user): edit_message = 'You cannot edit this QAPP.' existing_references...
Class for processing QAPP Section E information.
SectionEView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SectionEView: """Class for processing QAPP Section E information.""" def get(self, request, *args, **kwargs): """Return the index page for QAPP Section E.""" <|body_0|> def post(self, request, *args, **kwargs): """Process the post request with a SectionE form fil...
stack_v2_sparse_classes_36k_train_003536
36,787
no_license
[ { "docstring": "Return the index page for QAPP Section E.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Process the post request with a SectionE form filled out.", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
null
Implement the Python class `SectionEView` described below. Class description: Class for processing QAPP Section E information. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Return the index page for QAPP Section E. - def post(self, request, *args, **kwargs): Process the post request wit...
Implement the Python class `SectionEView` described below. Class description: Class for processing QAPP Section E information. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Return the index page for QAPP Section E. - def post(self, request, *args, **kwargs): Process the post request wit...
ee419afa3c9f4b9ef3b30b62b693cfac956ce5b4
<|skeleton|> class SectionEView: """Class for processing QAPP Section E information.""" def get(self, request, *args, **kwargs): """Return the index page for QAPP Section E.""" <|body_0|> def post(self, request, *args, **kwargs): """Process the post request with a SectionE form fil...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SectionEView: """Class for processing QAPP Section E information.""" def get(self, request, *args, **kwargs): """Return the index page for QAPP Section E.""" assert isinstance(request, HttpRequest) qapp_id = request.GET.get('qapp_id', None) qapp = Qapp.objects.get(id=qapp_...
the_stack_v2_python_sparse
DataSearch/qar5/views.py
USEPA/FoodWaste
train
1
cf60a72e9f7da153f5650032477df0d3dd978f3f
[ "google.logging_utils.config_root()\nself.revision = revision\nself.instrumented = False\nself.tools_path = tools_path\nself.src_path = src_path\nself._dir = None", "if self.instrumented:\n logging.error('Binaries already instrumented')\n return None\ncoverage_file = None\nif IsWindows():\n counters_comm...
<|body_start_0|> google.logging_utils.config_root() self.revision = revision self.instrumented = False self.tools_path = tools_path self.src_path = src_path self._dir = None <|end_body_0|> <|body_start_1|> if self.instrumented: logging.error('Binaries...
Class to set up and generate code coverage. This class contains methods that are useful to set up the environment for code coverage. Attributes: instrumented: A boolean indicating if all the binaries have been instrumented.
Coverage
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Coverage: """Class to set up and generate code coverage. This class contains methods that are useful to set up the environment for code coverage. Attributes: instrumented: A boolean indicating if all the binaries have been instrumented.""" def __init__(self, revision, src_path=None, tools_pa...
stack_v2_sparse_classes_36k_train_003537
11,129
permissive
[ { "docstring": "Init method for the Coverage class. Args: revision: Revision number of the Chromium source tree. src_path: Location of the Chromium source base. tools_path: Location of the Visual Studio Team Tools. (Win32 only)", "name": "__init__", "signature": "def __init__(self, revision, src_path=No...
4
null
Implement the Python class `Coverage` described below. Class description: Class to set up and generate code coverage. This class contains methods that are useful to set up the environment for code coverage. Attributes: instrumented: A boolean indicating if all the binaries have been instrumented. Method signatures an...
Implement the Python class `Coverage` described below. Class description: Class to set up and generate code coverage. This class contains methods that are useful to set up the environment for code coverage. Attributes: instrumented: A boolean indicating if all the binaries have been instrumented. Method signatures an...
008c4fef2676506869a0404239da31e83fd6ccc7
<|skeleton|> class Coverage: """Class to set up and generate code coverage. This class contains methods that are useful to set up the environment for code coverage. Attributes: instrumented: A boolean indicating if all the binaries have been instrumented.""" def __init__(self, revision, src_path=None, tools_pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Coverage: """Class to set up and generate code coverage. This class contains methods that are useful to set up the environment for code coverage. Attributes: instrumented: A boolean indicating if all the binaries have been instrumented.""" def __init__(self, revision, src_path=None, tools_path=None): ...
the_stack_v2_python_sparse
tools/code_coverage/coverage.py
bluebellzhy/chromium
train
1
47ab5ac4fc8f1707236e4b7c785c21d539943c9c
[ "super(BaseAddCaseForm, self).__init__(*args, **kwargs)\nif self.user and self.user.has_perm('library.manage_suite_cases'):\n self.fields['suite'] = mtforms.MTModelChoiceField(model.Suite.objects.all(), choice_attrs=mtforms.product_id_attrs, required=False)", "productversion = self.cleaned_data.get('productver...
<|body_start_0|> super(BaseAddCaseForm, self).__init__(*args, **kwargs) if self.user and self.user.has_perm('library.manage_suite_cases'): self.fields['suite'] = mtforms.MTModelChoiceField(model.Suite.objects.all(), choice_attrs=mtforms.product_id_attrs, required=False) <|end_body_0|> <|bod...
Base form for adding cases.
BaseAddCaseForm
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseAddCaseForm: """Base form for adding cases.""" def __init__(self, *args, **kwargs): """Initialize form; possibly add suite field.""" <|body_0|> def clean(self): """Verify that products all match up.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_003538
16,711
permissive
[ { "docstring": "Initialize form; possibly add suite field.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Verify that products all match up.", "name": "clean", "signature": "def clean(self)" } ]
2
stack_v2_sparse_classes_30k_train_014330
Implement the Python class `BaseAddCaseForm` described below. Class description: Base form for adding cases. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize form; possibly add suite field. - def clean(self): Verify that products all match up.
Implement the Python class `BaseAddCaseForm` described below. Class description: Base form for adding cases. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize form; possibly add suite field. - def clean(self): Verify that products all match up. <|skeleton|> class BaseAddCaseForm: ...
ee54db2fe8ffbf2216d359b7a093b51f2574878e
<|skeleton|> class BaseAddCaseForm: """Base form for adding cases.""" def __init__(self, *args, **kwargs): """Initialize form; possibly add suite field.""" <|body_0|> def clean(self): """Verify that products all match up.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseAddCaseForm: """Base form for adding cases.""" def __init__(self, *args, **kwargs): """Initialize form; possibly add suite field.""" super(BaseAddCaseForm, self).__init__(*args, **kwargs) if self.user and self.user.has_perm('library.manage_suite_cases'): self.field...
the_stack_v2_python_sparse
moztrap/view/manage/cases/forms.py
isakib/moztrap
train
1
595febee38b17881f5b08ea33025b792f1639039
[ "self.start_all()\nclient = self.get_client('deproxy')\ncookie = self.client_send_first_req(client)\ns_id = self.client_send_next_req(client, cookie)\nsrv = self.get_server(s_id)\nself.assertIsNotNone(srv, 'Backend server is not known')\nsrv.stop()\nfailovered_s_id = self.client_send_next_req(client, cookie)\nself....
<|body_start_0|> self.start_all() client = self.get_client('deproxy') cookie = self.client_send_first_req(client) s_id = self.client_send_next_req(client, cookie) srv = self.get_server(s_id) self.assertIsNotNone(srv, 'Backend server is not known') srv.stop() ...
Test how the sticky sessions is moved to a new server when original one is down.
StickySessionsFailover
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StickySessionsFailover: """Test how the sticky sessions is moved to a new server when original one is down.""" def test_sessions(self): """Backend goes offline, another backend from the primary group takes the load. When the original backend server goes back online, the session remai...
stack_v2_sparse_classes_36k_train_003539
15,021
no_license
[ { "docstring": "Backend goes offline, another backend from the primary group takes the load. When the original backend server goes back online, the session remains on fallbacked server.", "name": "test_sessions", "signature": "def test_sessions(self)" }, { "docstring": "Same as test_sessions(), ...
2
null
Implement the Python class `StickySessionsFailover` described below. Class description: Test how the sticky sessions is moved to a new server when original one is down. Method signatures and docstrings: - def test_sessions(self): Backend goes offline, another backend from the primary group takes the load. When the or...
Implement the Python class `StickySessionsFailover` described below. Class description: Test how the sticky sessions is moved to a new server when original one is down. Method signatures and docstrings: - def test_sessions(self): Backend goes offline, another backend from the primary group takes the load. When the or...
d56358ea653dbb367624937197ce5e489abf0b00
<|skeleton|> class StickySessionsFailover: """Test how the sticky sessions is moved to a new server when original one is down.""" def test_sessions(self): """Backend goes offline, another backend from the primary group takes the load. When the original backend server goes back online, the session remai...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StickySessionsFailover: """Test how the sticky sessions is moved to a new server when original one is down.""" def test_sessions(self): """Backend goes offline, another backend from the primary group takes the load. When the original backend server goes back online, the session remains on fallbac...
the_stack_v2_python_sparse
sessions/test_sessions.py
tempesta-tech/tempesta-test
train
13
d23879fbb4919967e4d9b07a7b7b2fdcd1cbabe0
[ "local_path = tempfile.mkdtemp()\nmodel.model.save_pretrained(local_path)\nmodel.tokenizer.save_pretrained(local_path)\ndm.fs.copy_dir(local_path, path, force=True, progress=True, leave_progress=False)\nlogger.info(f'Model saved to {path}')\nif clean_up:\n mapper = dm.fs.get_mapper(local_path)\n mapper.fs.del...
<|body_start_0|> local_path = tempfile.mkdtemp() model.model.save_pretrained(local_path) model.tokenizer.save_pretrained(local_path) dm.fs.copy_dir(local_path, path, force=True, progress=True, leave_progress=False) logger.info(f'Model saved to {path}') if clean_up: ...
HFExperiment
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HFExperiment: def save(cls, model: HFExperiment, path: str, clean_up: bool=False): """Save a hugging face model to a specific path Args: model: model to save path: path to the folder root where to save the model clean_up: whether to clean up the local path after saving""" <|body_...
stack_v2_sparse_classes_36k_train_003540
16,347
permissive
[ { "docstring": "Save a hugging face model to a specific path Args: model: model to save path: path to the folder root where to save the model clean_up: whether to clean up the local path after saving", "name": "save", "signature": "def save(cls, model: HFExperiment, path: str, clean_up: bool=False)" }...
2
stack_v2_sparse_classes_30k_train_007561
Implement the Python class `HFExperiment` described below. Class description: Implement the HFExperiment class. Method signatures and docstrings: - def save(cls, model: HFExperiment, path: str, clean_up: bool=False): Save a hugging face model to a specific path Args: model: model to save path: path to the folder root...
Implement the Python class `HFExperiment` described below. Class description: Implement the HFExperiment class. Method signatures and docstrings: - def save(cls, model: HFExperiment, path: str, clean_up: bool=False): Save a hugging face model to a specific path Args: model: model to save path: path to the folder root...
4390f9fce25fa2da94338227f7c8f33a23e25b2a
<|skeleton|> class HFExperiment: def save(cls, model: HFExperiment, path: str, clean_up: bool=False): """Save a hugging face model to a specific path Args: model: model to save path: path to the folder root where to save the model clean_up: whether to clean up the local path after saving""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HFExperiment: def save(cls, model: HFExperiment, path: str, clean_up: bool=False): """Save a hugging face model to a specific path Args: model: model to save path: path to the folder root where to save the model clean_up: whether to clean up the local path after saving""" local_path = tempfile...
the_stack_v2_python_sparse
molfeat/trans/pretrained/hf_transformers.py
datamol-io/molfeat
train
111
649e384ac41025da32f97750ec865318a2c6fa46
[ "self.mac = st[:6]\nself.hw_rev, self.sw_rev, self.buffer_capacity, self.max_point_rate = struct.unpack('<HHHI', st[6:16])\nself.status = Status(st[16:36])", "lines = ['MAC: ' + ':'.join(('%02x' % (ord(o),) for o in self.mac)), 'HW %d, SW %d' % (self.hw_rev, self.sw_rev), 'Capabilities: max %d points, %d kpps' % ...
<|body_start_0|> self.mac = st[:6] self.hw_rev, self.sw_rev, self.buffer_capacity, self.max_point_rate = struct.unpack('<HHHI', st[6:16]) self.status = Status(st[16:36]) <|end_body_0|> <|body_start_1|> lines = ['MAC: ' + ':'.join(('%02x' % (ord(o),) for o in self.mac)), 'HW %d, SW %d' %...
Represents a broadcast packet from the DAC.
BroadcastPacket
[ "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BroadcastPacket: """Represents a broadcast packet from the DAC.""" def __init__(self, st): """Initialize from a chunk of data.""" <|body_0|> def dump(self, prefix=' - '): """Dump to a string.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self....
stack_v2_sparse_classes_36k_train_003541
17,737
permissive
[ { "docstring": "Initialize from a chunk of data.", "name": "__init__", "signature": "def __init__(self, st)" }, { "docstring": "Dump to a string.", "name": "dump", "signature": "def dump(self, prefix=' - ')" } ]
2
stack_v2_sparse_classes_30k_test_000343
Implement the Python class `BroadcastPacket` described below. Class description: Represents a broadcast packet from the DAC. Method signatures and docstrings: - def __init__(self, st): Initialize from a chunk of data. - def dump(self, prefix=' - '): Dump to a string.
Implement the Python class `BroadcastPacket` described below. Class description: Represents a broadcast packet from the DAC. Method signatures and docstrings: - def __init__(self, st): Initialize from a chunk of data. - def dump(self, prefix=' - '): Dump to a string. <|skeleton|> class BroadcastPacket: """Repres...
4c40e2ddf862f94dcfeb3cc48c41aad44a3a8d34
<|skeleton|> class BroadcastPacket: """Represents a broadcast packet from the DAC.""" def __init__(self, st): """Initialize from a chunk of data.""" <|body_0|> def dump(self, prefix=' - '): """Dump to a string.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BroadcastPacket: """Represents a broadcast packet from the DAC.""" def __init__(self, st): """Initialize from a chunk of data.""" self.mac = st[:6] self.hw_rev, self.sw_rev, self.buffer_capacity, self.max_point_rate = struct.unpack('<HHHI', st[6:16]) self.status = Status(s...
the_stack_v2_python_sparse
libs3/tracer3.py
tmpbci/LJ
train
8
138eb532c34a139b64217cb8ad8dfe6037dc924a
[ "crc = self._value\nhighbit = 1 << self._width - 1\nmask = highbit - 1 << 1 | 1\npoly = self._poly\nshift = self._width - 8\ndiff8 = -shift\nif diff8 > 0:\n mask = 255\n crc <<= diff8\n shift = 0\n highbit = 128\n poly = self._poly << diff8\nreflect = self._reflect_input\nfor byte in data:\n if re...
<|body_start_0|> crc = self._value highbit = 1 << self._width - 1 mask = highbit - 1 << 1 | 1 poly = self._poly shift = self._width - 8 diff8 = -shift if diff8 > 0: mask = 255 crc <<= diff8 shift = 0 highbit = 128 ...
Abstract base class for all Cyclic Redundancy Checks (CRC) checksums
CrcBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrcBase: """Abstract base class for all Cyclic Redundancy Checks (CRC) checksums""" def process(self, data): """Process given data. Args: data (bytes, bytearray or list of ints [0-255]): input data to process. Returns: self""" <|body_0|> def final(self): """Retur...
stack_v2_sparse_classes_36k_train_003542
11,475
no_license
[ { "docstring": "Process given data. Args: data (bytes, bytearray or list of ints [0-255]): input data to process. Returns: self", "name": "process", "signature": "def process(self, data)" }, { "docstring": "Return final CRC value. Return: int: final CRC value", "name": "final", "signatur...
2
stack_v2_sparse_classes_30k_train_000038
Implement the Python class `CrcBase` described below. Class description: Abstract base class for all Cyclic Redundancy Checks (CRC) checksums Method signatures and docstrings: - def process(self, data): Process given data. Args: data (bytes, bytearray or list of ints [0-255]): input data to process. Returns: self - d...
Implement the Python class `CrcBase` described below. Class description: Abstract base class for all Cyclic Redundancy Checks (CRC) checksums Method signatures and docstrings: - def process(self, data): Process given data. Args: data (bytes, bytearray or list of ints [0-255]): input data to process. Returns: self - d...
f22c7620d8d3bf8306175bdde15621ae0a010660
<|skeleton|> class CrcBase: """Abstract base class for all Cyclic Redundancy Checks (CRC) checksums""" def process(self, data): """Process given data. Args: data (bytes, bytearray or list of ints [0-255]): input data to process. Returns: self""" <|body_0|> def final(self): """Retur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrcBase: """Abstract base class for all Cyclic Redundancy Checks (CRC) checksums""" def process(self, data): """Process given data. Args: data (bytes, bytearray or list of ints [0-255]): input data to process. Returns: self""" crc = self._value highbit = 1 << self._width - 1 ...
the_stack_v2_python_sparse
common/crc.py
AsteriskAmpersand/Mod3-MHW-Importer
train
74
2b87986897b4c1a914fc6d44e0fd0a9501f56877
[ "self.num_eval_symbols = num_eval_symbols\nself.remove_end_of_line = remove_end_of_line\nresponse = requests.get(self.ENWIKI_URL, stream=True)\nwith ZipFile(BytesIO(response.content), 'r') as z:\n train, val, test = self._process(z.read('enwik8'))\nsuper().__init__(train, val, test, cache=cache, transform=transf...
<|body_start_0|> self.num_eval_symbols = num_eval_symbols self.remove_end_of_line = remove_end_of_line response = requests.get(self.ENWIKI_URL, stream=True) with ZipFile(BytesIO(response.content), 'r') as z: train, val, test = self._process(z.read('enwik8')) super()._...
The official WikiText103 dataset.
Enwiki8
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Enwiki8: """The official WikiText103 dataset.""" def __init__(self, num_eval_symbols: int=5000000, remove_end_of_line: bool=False, cache: bool=False, transform: Dict[str, Union[Field, Dict]]=None) -> None: """Initialize the Wiki103 built-in. Parameters ----------. num_eval_symbols: i...
stack_v2_sparse_classes_36k_train_003543
6,879
permissive
[ { "docstring": "Initialize the Wiki103 built-in. Parameters ----------. num_eval_symbols: int, optional The number of symbols to use for seach of validation, and testing. Default ``5000000``. remove_end_of_line: bool, optional If True, remove end of line tokens. Default ``True``. see TabularDataset for other ar...
2
stack_v2_sparse_classes_30k_test_001048
Implement the Python class `Enwiki8` described below. Class description: The official WikiText103 dataset. Method signatures and docstrings: - def __init__(self, num_eval_symbols: int=5000000, remove_end_of_line: bool=False, cache: bool=False, transform: Dict[str, Union[Field, Dict]]=None) -> None: Initialize the Wik...
Implement the Python class `Enwiki8` described below. Class description: The official WikiText103 dataset. Method signatures and docstrings: - def __init__(self, num_eval_symbols: int=5000000, remove_end_of_line: bool=False, cache: bool=False, transform: Dict[str, Union[Field, Dict]]=None) -> None: Initialize the Wik...
0dc2f5b2b286694defe8abf450fe5be9ae12c097
<|skeleton|> class Enwiki8: """The official WikiText103 dataset.""" def __init__(self, num_eval_symbols: int=5000000, remove_end_of_line: bool=False, cache: bool=False, transform: Dict[str, Union[Field, Dict]]=None) -> None: """Initialize the Wiki103 built-in. Parameters ----------. num_eval_symbols: i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Enwiki8: """The official WikiText103 dataset.""" def __init__(self, num_eval_symbols: int=5000000, remove_end_of_line: bool=False, cache: bool=False, transform: Dict[str, Union[Field, Dict]]=None) -> None: """Initialize the Wiki103 built-in. Parameters ----------. num_eval_symbols: int, optional ...
the_stack_v2_python_sparse
flambe/nlp/language_modeling/datasets.py
cle-ros/flambe
train
1
7d2b8d639e6d7fbf51942b1287bed7e1f83d59c9
[ "data = {'text': 'test profession'}\nresponse = self.client.post(self.url, data, headers={'Content-Type': 'application/json'})\nself.assertEqual(200, response.status_code)", "self.profession = Profession.objects.create(text='Test')\nresponse = self.client.get(self.url)\nself.assertEqual(len(response.data['results...
<|body_start_0|> data = {'text': 'test profession'} response = self.client.post(self.url, data, headers={'Content-Type': 'application/json'}) self.assertEqual(200, response.status_code) <|end_body_0|> <|body_start_1|> self.profession = Profession.objects.create(text='Test') resp...
Test cases for profession list call
ProfessionListTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfessionListTestCase: """Test cases for profession list call""" def test_add_profession(self): """Test to add a Profession""" <|body_0|> def test_profession(self): """Test to verify user created profession""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_003544
21,995
no_license
[ { "docstring": "Test to add a Profession", "name": "test_add_profession", "signature": "def test_add_profession(self)" }, { "docstring": "Test to verify user created profession", "name": "test_profession", "signature": "def test_profession(self)" } ]
2
null
Implement the Python class `ProfessionListTestCase` described below. Class description: Test cases for profession list call Method signatures and docstrings: - def test_add_profession(self): Test to add a Profession - def test_profession(self): Test to verify user created profession
Implement the Python class `ProfessionListTestCase` described below. Class description: Test cases for profession list call Method signatures and docstrings: - def test_add_profession(self): Test to add a Profession - def test_profession(self): Test to verify user created profession <|skeleton|> class ProfessionList...
f38ea1ff9283416f4b4b1a9eb134344a566856a4
<|skeleton|> class ProfessionListTestCase: """Test cases for profession list call""" def test_add_profession(self): """Test to add a Profession""" <|body_0|> def test_profession(self): """Test to verify user created profession""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProfessionListTestCase: """Test cases for profession list call""" def test_add_profession(self): """Test to add a Profession""" data = {'text': 'test profession'} response = self.client.post(self.url, data, headers={'Content-Type': 'application/json'}) self.assertEqual(200...
the_stack_v2_python_sparse
userprofile/tests.py
meanwise-eng/meanwise-server
train
0
d01e4f7e3b3ee39208237293aaf6869aefbce9e5
[ "node1 = None\nwords = ['']\nself.assertEqual(make_dafsa.to_words(node1), words)", "node1 = ('ab', [None])\nwords = ['ab']\nself.assertEqual(make_dafsa.to_words(node1), words)", "node2 = ('cd', [None])\nnode1 = ('ab', [node2])\nwords = ['abcd']\nself.assertEqual(make_dafsa.to_words(node1), words)", "node2 = (...
<|body_start_0|> node1 = None words = [''] self.assertEqual(make_dafsa.to_words(node1), words) <|end_body_0|> <|body_start_1|> node1 = ('ab', [None]) words = ['ab'] self.assertEqual(make_dafsa.to_words(node1), words) <|end_body_1|> <|body_start_2|> node2 = ('cd'...
ToWordsTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToWordsTest: def testSink(self): """Tests the sink is exapnded to a list with an empty string.""" <|body_0|> def testSingleNode(self): """Tests a single node is expanded to a list with the label string.""" <|body_1|> def testChain(self): """Tests...
stack_v2_sparse_classes_36k_train_003545
20,781
permissive
[ { "docstring": "Tests the sink is exapnded to a list with an empty string.", "name": "testSink", "signature": "def testSink(self)" }, { "docstring": "Tests a single node is expanded to a list with the label string.", "name": "testSingleNode", "signature": "def testSingleNode(self)" }, ...
5
null
Implement the Python class `ToWordsTest` described below. Class description: Implement the ToWordsTest class. Method signatures and docstrings: - def testSink(self): Tests the sink is exapnded to a list with an empty string. - def testSingleNode(self): Tests a single node is expanded to a list with the label string. ...
Implement the Python class `ToWordsTest` described below. Class description: Implement the ToWordsTest class. Method signatures and docstrings: - def testSink(self): Tests the sink is exapnded to a list with an empty string. - def testSingleNode(self): Tests a single node is expanded to a list with the label string. ...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class ToWordsTest: def testSink(self): """Tests the sink is exapnded to a list with an empty string.""" <|body_0|> def testSingleNode(self): """Tests a single node is expanded to a list with the label string.""" <|body_1|> def testChain(self): """Tests...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ToWordsTest: def testSink(self): """Tests the sink is exapnded to a list with an empty string.""" node1 = None words = [''] self.assertEqual(make_dafsa.to_words(node1), words) def testSingleNode(self): """Tests a single node is expanded to a list with the label str...
the_stack_v2_python_sparse
tools/media_engagement_preload/make_dafsa_unittest.py
chromium/chromium
train
17,408
2d71d5032e29b772e4a23624cd052d97ef8f7248
[ "super(Application, self).__init__(master)\nself.grid()\nself.create_widgets()", "self.inst_lbl = Label(self, text='Input password to longevity secret.')\nself.inst_lbl.grid(row=0, column=0, columnspan=2, sticky=W)\nself.pw_lbl = Label(self, text='Password: ')\nself.pw_lbl.grid(row=1, column=0, sticky=W)\nself.pw...
<|body_start_0|> super(Application, self).__init__(master) self.grid() self.create_widgets() <|end_body_0|> <|body_start_1|> self.inst_lbl = Label(self, text='Input password to longevity secret.') self.inst_lbl.grid(row=0, column=0, columnspan=2, sticky=W) self.pw_lbl = ...
Application with GUI, which can revealed secret of longevity.
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """Application with GUI, which can revealed secret of longevity.""" def __init__(self, master): """Initialize frame.""" <|body_0|> def create_widgets(self): """Create widgets Button, Text and Entry.""" <|body_1|> def reveal(self): ...
stack_v2_sparse_classes_36k_train_003546
2,625
no_license
[ { "docstring": "Initialize frame.", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "Create widgets Button, Text and Entry.", "name": "create_widgets", "signature": "def create_widgets(self)" }, { "docstring": "Print message depends of password val...
3
stack_v2_sparse_classes_30k_val_000482
Implement the Python class `Application` described below. Class description: Application with GUI, which can revealed secret of longevity. Method signatures and docstrings: - def __init__(self, master): Initialize frame. - def create_widgets(self): Create widgets Button, Text and Entry. - def reveal(self): Print mess...
Implement the Python class `Application` described below. Class description: Application with GUI, which can revealed secret of longevity. Method signatures and docstrings: - def __init__(self, master): Initialize frame. - def create_widgets(self): Create widgets Button, Text and Entry. - def reveal(self): Print mess...
120e2d62468a085424ec71a22effe27d6b38b548
<|skeleton|> class Application: """Application with GUI, which can revealed secret of longevity.""" def __init__(self, master): """Initialize frame.""" <|body_0|> def create_widgets(self): """Create widgets Button, Text and Entry.""" <|body_1|> def reveal(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Application: """Application with GUI, which can revealed secret of longevity.""" def __init__(self, master): """Initialize frame.""" super(Application, self).__init__(master) self.grid() self.create_widgets() def create_widgets(self): """Create widgets Button,...
the_stack_v2_python_sparse
Chapter 10/longevity.py
MartaSzuran/Python-for-the-Absolute-Beginner-M.Dawson
train
1
3cac6faab86ac028c607954858d0807cba960036
[ "if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.Shadow = Shadow\nself.Layover = Layover\nself.MultiPath = MultiPath\nself.GroundTrack = GroundTrack\nself.Extensions = Extensions\nsuper(ExploitationFeaturesCollectionPheno...
<|body_start_0|> if '_xml_ns' in kwargs: self._xml_ns = kwargs['_xml_ns'] if '_xml_ns_key' in kwargs: self._xml_ns_key = kwargs['_xml_ns_key'] self.Shadow = Shadow self.Layover = Layover self.MultiPath = MultiPath self.GroundTrack = GroundTrack ...
Phenomenology related to both the geometry and the final product processing. All values computed at the center time of the full collection.
ExploitationFeaturesCollectionPhenomenologyType
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExploitationFeaturesCollectionPhenomenologyType: """Phenomenology related to both the geometry and the final product processing. All values computed at the center time of the full collection.""" def __init__(self, Shadow=None, Layover=None, MultiPath=None, GroundTrack=None, Extensions=None, ...
stack_v2_sparse_classes_36k_train_003547
30,331
permissive
[ { "docstring": "Parameters ---------- Shadow : None|AngleZeroToExclusive360MagnitudeType|numpy.ndarray|list|tuple Layover : None|AngleZeroToExclusive360MagnitudeType|numpy.ndarray|list|tuple MultiPath : None|float GroundTrack : None|float Extensions : None|ParametersCollection|dict kwargs", "name": "__init_...
2
null
Implement the Python class `ExploitationFeaturesCollectionPhenomenologyType` described below. Class description: Phenomenology related to both the geometry and the final product processing. All values computed at the center time of the full collection. Method signatures and docstrings: - def __init__(self, Shadow=Non...
Implement the Python class `ExploitationFeaturesCollectionPhenomenologyType` described below. Class description: Phenomenology related to both the geometry and the final product processing. All values computed at the center time of the full collection. Method signatures and docstrings: - def __init__(self, Shadow=Non...
de1b1886f161a83b6c89aadc7a2c7cfc4892ef81
<|skeleton|> class ExploitationFeaturesCollectionPhenomenologyType: """Phenomenology related to both the geometry and the final product processing. All values computed at the center time of the full collection.""" def __init__(self, Shadow=None, Layover=None, MultiPath=None, GroundTrack=None, Extensions=None, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExploitationFeaturesCollectionPhenomenologyType: """Phenomenology related to both the geometry and the final product processing. All values computed at the center time of the full collection.""" def __init__(self, Shadow=None, Layover=None, MultiPath=None, GroundTrack=None, Extensions=None, **kwargs): ...
the_stack_v2_python_sparse
sarpy/io/product/sidd3_elements/ExploitationFeatures.py
ngageoint/sarpy
train
192
2d73583e2ab1d9976c007a1cc2771f752668af40
[ "super(AnalysisTool, self).__init__(input_reader=input_reader, output_writer=output_writer)\nself._analysis_manager = analysis_manager.AnalysisPluginManager\nself._analysis_plugins = None\nself._analysis_plugins_output_format = None\nself._command_line_arguments = None\nself._event_filter_expression = None\nself._e...
<|body_start_0|> super(AnalysisTool, self).__init__(input_reader=input_reader, output_writer=output_writer) self._analysis_manager = analysis_manager.AnalysisPluginManager self._analysis_plugins = None self._analysis_plugins_output_format = None self._command_line_arguments = Non...
Analysis CLI tool. Attributes: list_analysis_plugins (bool): True if information about the analysis plugins should be shown.
AnalysisTool
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnalysisTool: """Analysis CLI tool. Attributes: list_analysis_plugins (bool): True if information about the analysis plugins should be shown.""" def __init__(self, input_reader=None, output_writer=None): """Initializes the CLI tool object. Args: input_reader (Optional[InputReader]): ...
stack_v2_sparse_classes_36k_train_003548
5,147
permissive
[ { "docstring": "Initializes the CLI tool object. Args: input_reader (Optional[InputReader]): input reader, where None indicates that the stdin input reader should be used. output_writer (Optional[OutputWriter]): output writer, where None indicates that the stdout output writer should be used.", "name": "__i...
3
null
Implement the Python class `AnalysisTool` described below. Class description: Analysis CLI tool. Attributes: list_analysis_plugins (bool): True if information about the analysis plugins should be shown. Method signatures and docstrings: - def __init__(self, input_reader=None, output_writer=None): Initializes the CLI ...
Implement the Python class `AnalysisTool` described below. Class description: Analysis CLI tool. Attributes: list_analysis_plugins (bool): True if information about the analysis plugins should be shown. Method signatures and docstrings: - def __init__(self, input_reader=None, output_writer=None): Initializes the CLI ...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class AnalysisTool: """Analysis CLI tool. Attributes: list_analysis_plugins (bool): True if information about the analysis plugins should be shown.""" def __init__(self, input_reader=None, output_writer=None): """Initializes the CLI tool object. Args: input_reader (Optional[InputReader]): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnalysisTool: """Analysis CLI tool. Attributes: list_analysis_plugins (bool): True if information about the analysis plugins should be shown.""" def __init__(self, input_reader=None, output_writer=None): """Initializes the CLI tool object. Args: input_reader (Optional[InputReader]): input reader,...
the_stack_v2_python_sparse
plaso/cli/analysis_tool.py
log2timeline/plaso
train
1,506
c416bb36fc141debebd4f63bd7372035523d5e34
[ "if request.user.is_authenticated:\n lists = ListsStream().get_list_stream(request.user)\nelse:\n lists = models.List.objects.filter(privacy='public')\npaginated = Paginator(lists, 12)\ndata = {'lists': paginated.get_page(request.GET.get('page')), 'list_form': forms.ListForm(), 'path': '/list'}\nreturn Templa...
<|body_start_0|> if request.user.is_authenticated: lists = ListsStream().get_list_stream(request.user) else: lists = models.List.objects.filter(privacy='public') paginated = Paginator(lists, 12) data = {'lists': paginated.get_page(request.GET.get('page')), 'list_f...
book list page
Lists
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Lists: """book list page""" def get(self, request): """display a book list""" <|body_0|> def post(self, request): """create a book_list""" <|body_1|> <|end_skeleton|> <|body_start_0|> if request.user.is_authenticated: lists = ListsSt...
stack_v2_sparse_classes_36k_train_003549
2,823
no_license
[ { "docstring": "display a book list", "name": "get", "signature": "def get(self, request)" }, { "docstring": "create a book_list", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_019516
Implement the Python class `Lists` described below. Class description: book list page Method signatures and docstrings: - def get(self, request): display a book list - def post(self, request): create a book_list
Implement the Python class `Lists` described below. Class description: book list page Method signatures and docstrings: - def get(self, request): display a book list - def post(self, request): create a book_list <|skeleton|> class Lists: """book list page""" def get(self, request): """display a book...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class Lists: """book list page""" def get(self, request): """display a book list""" <|body_0|> def post(self, request): """create a book_list""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Lists: """book list page""" def get(self, request): """display a book list""" if request.user.is_authenticated: lists = ListsStream().get_list_stream(request.user) else: lists = models.List.objects.filter(privacy='public') paginated = Paginator(list...
the_stack_v2_python_sparse
bookwyrm/views/list/lists.py
bookwyrm-social/bookwyrm
train
1,398
f7b5d00e8fdc11dbb7352cb92c7597c2515969e5
[ "def dfs(node):\n if not node:\n return 'None'\n if node:\n return str(node.val) + ',' + dfs(node.left) + ',' + dfs(node.right)\nreturn dfs(root)", "data = data.split(',')\n\ndef dfs(ind):\n if ind >= len(data) or data[ind] == 'None':\n return None\n root = TreeNode(data[ind])\n ...
<|body_start_0|> def dfs(node): if not node: return 'None' if node: return str(node.val) + ',' + dfs(node.left) + ',' + dfs(node.right) return dfs(root) <|end_body_0|> <|body_start_1|> data = data.split(',') def dfs(ind): ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_003550
1,347
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
ee9eebf44bc9f93f585ac2813da6ddd46f484989
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def dfs(node): if not node: return 'None' if node: return str(node.val) + ',' + dfs(node.left) + ',' + dfs(node.right) ret...
the_stack_v2_python_sparse
Hard/Serialize and Deserialize Binary Tree.py
amogchandrashekar/Leetcode
train
1
e1da563b367b7c305052ee9500eab6bb1f79666b
[ "self.sum_hit_at_one = 0.0\nself.sum_perr = 0.0\nself.sum_loss = 0.0\nself.map_calculator = map_calculator.MeanAveragePrecisionCalculator(num_class)\nself.global_ap_calculator = ap_calculator.AveragePrecisionCalculator()\nself.pr_calculator = PRCalculator()\nself.pr_calculator_per_tag = PRCalculatorPerTag(num_class...
<|body_start_0|> self.sum_hit_at_one = 0.0 self.sum_perr = 0.0 self.sum_loss = 0.0 self.map_calculator = map_calculator.MeanAveragePrecisionCalculator(num_class) self.global_ap_calculator = ap_calculator.AveragePrecisionCalculator() self.pr_calculator = PRCalculator() ...
A class to store the evaluation metrics.
EvaluationMetrics
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EvaluationMetrics: """A class to store the evaluation metrics.""" def __init__(self, num_class, top_k, accumulate_per_tag=False): """Construct an EvaluationMetrics object to store the evaluation metrics. Args: num_class: A positive integer specifying the number of classes. top_k: A p...
stack_v2_sparse_classes_36k_train_003551
13,024
no_license
[ { "docstring": "Construct an EvaluationMetrics object to store the evaluation metrics. Args: num_class: A positive integer specifying the number of classes. top_k: A positive integer specifying how many predictions are considered per frame. Raises: ValueError: An error occurred when MeanAveragePrecisionCalculat...
4
stack_v2_sparse_classes_30k_train_014309
Implement the Python class `EvaluationMetrics` described below. Class description: A class to store the evaluation metrics. Method signatures and docstrings: - def __init__(self, num_class, top_k, accumulate_per_tag=False): Construct an EvaluationMetrics object to store the evaluation metrics. Args: num_class: A posi...
Implement the Python class `EvaluationMetrics` described below. Class description: A class to store the evaluation metrics. Method signatures and docstrings: - def __init__(self, num_class, top_k, accumulate_per_tag=False): Construct an EvaluationMetrics object to store the evaluation metrics. Args: num_class: A posi...
2415bb7ae3bd773924e18be6d76f835292b39f21
<|skeleton|> class EvaluationMetrics: """A class to store the evaluation metrics.""" def __init__(self, num_class, top_k, accumulate_per_tag=False): """Construct an EvaluationMetrics object to store the evaluation metrics. Args: num_class: A positive integer specifying the number of classes. top_k: A p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EvaluationMetrics: """A class to store the evaluation metrics.""" def __init__(self, num_class, top_k, accumulate_per_tag=False): """Construct an EvaluationMetrics object to store the evaluation metrics. Args: num_class: A positive integer specifying the number of classes. top_k: A positive integ...
the_stack_v2_python_sparse
src/utils/mmt/utils/metrics/calculate_gap.py
Chrisfsj2051/Multi-Modal-Tagging
train
0
e8bf5a4dd911b9f97b028eb5232fb60cd60d8e24
[ "path = os.path.abspath(os.path.dirname(__file__))\nupload_path = os.path.join(path, FileService.UPLOAD_PATH)\nreturn upload_path", "file_handler = FileService.__create_file_handler(file_name=data_source.file_name)\ndata_frame = file_handler.read_columns(data_source=data_source, file_path=FileService.get_upload_f...
<|body_start_0|> path = os.path.abspath(os.path.dirname(__file__)) upload_path = os.path.join(path, FileService.UPLOAD_PATH) return upload_path <|end_body_0|> <|body_start_1|> file_handler = FileService.__create_file_handler(file_name=data_source.file_name) data_frame = file_han...
Service handling upload, parsing and reading data off of a file. Attributes: UPLOAD_PATH: (str) path under which the uploaded files are stored. file_handlers: (FileHandlers) file handlers used for file reading.
FileService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileService: """Service handling upload, parsing and reading data off of a file. Attributes: UPLOAD_PATH: (str) path under which the uploaded files are stored. file_handlers: (FileHandlers) file handlers used for file reading.""" def get_upload_folder() -> str: """Returns path to the...
stack_v2_sparse_classes_36k_train_003552
15,724
no_license
[ { "docstring": "Returns path to the folder in which uploaded files are stored. :return: upload_path(str) - path to the folder under which uploaded files are stored.", "name": "get_upload_folder", "signature": "def get_upload_folder() -> str" }, { "docstring": "Read columns from a given file and ...
5
stack_v2_sparse_classes_30k_train_006673
Implement the Python class `FileService` described below. Class description: Service handling upload, parsing and reading data off of a file. Attributes: UPLOAD_PATH: (str) path under which the uploaded files are stored. file_handlers: (FileHandlers) file handlers used for file reading. Method signatures and docstrin...
Implement the Python class `FileService` described below. Class description: Service handling upload, parsing and reading data off of a file. Attributes: UPLOAD_PATH: (str) path under which the uploaded files are stored. file_handlers: (FileHandlers) file handlers used for file reading. Method signatures and docstrin...
eae965a1eb6f53ec5bd5ab961ec0383737165ce4
<|skeleton|> class FileService: """Service handling upload, parsing and reading data off of a file. Attributes: UPLOAD_PATH: (str) path under which the uploaded files are stored. file_handlers: (FileHandlers) file handlers used for file reading.""" def get_upload_folder() -> str: """Returns path to the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileService: """Service handling upload, parsing and reading data off of a file. Attributes: UPLOAD_PATH: (str) path under which the uploaded files are stored. file_handlers: (FileHandlers) file handlers used for file reading.""" def get_upload_folder() -> str: """Returns path to the folder in wh...
the_stack_v2_python_sparse
Visualiser/modules/common/services.py
RadoslawPotyka/DataVisualiser
train
0
df3a33830864f5c3aba80dcb6e191138a6cc355a
[ "class TestAbstract(AbstractLog):\n pass\ntest = TestAbstract()\nself.assertRaises(LogMethodException, lambda: test.log())", "stringVal = 'This is proper log return value'\n\nclass TestAbstract(AbstractLog):\n\n def log(self):\n return stringVal\ntest = TestAbstract()\nself.assertEquals(test.log(), s...
<|body_start_0|> class TestAbstract(AbstractLog): pass test = TestAbstract() self.assertRaises(LogMethodException, lambda: test.log()) <|end_body_0|> <|body_start_1|> stringVal = 'This is proper log return value' class TestAbstract(AbstractLog): def log...
Tests the :class:`dfslog.logger.AbstractLog` class
AbstractLogTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractLogTest: """Tests the :class:`dfslog.logger.AbstractLog` class""" def test_log_method_not_implemented(self): """Tests to verify that the exception is thrown when log is called on a class that implements :class:`dfslog.logger.AbstractLog` but does not implement the log file.""...
stack_v2_sparse_classes_36k_train_003553
2,699
no_license
[ { "docstring": "Tests to verify that the exception is thrown when log is called on a class that implements :class:`dfslog.logger.AbstractLog` but does not implement the log file.", "name": "test_log_method_not_implemented", "signature": "def test_log_method_not_implemented(self)" }, { "docstring...
2
null
Implement the Python class `AbstractLogTest` described below. Class description: Tests the :class:`dfslog.logger.AbstractLog` class Method signatures and docstrings: - def test_log_method_not_implemented(self): Tests to verify that the exception is thrown when log is called on a class that implements :class:`dfslog.l...
Implement the Python class `AbstractLogTest` described below. Class description: Tests the :class:`dfslog.logger.AbstractLog` class Method signatures and docstrings: - def test_log_method_not_implemented(self): Tests to verify that the exception is thrown when log is called on a class that implements :class:`dfslog.l...
4796fa9d88b56f80def011e2b043ce595bfce8c4
<|skeleton|> class AbstractLogTest: """Tests the :class:`dfslog.logger.AbstractLog` class""" def test_log_method_not_implemented(self): """Tests to verify that the exception is thrown when log is called on a class that implements :class:`dfslog.logger.AbstractLog` but does not implement the log file.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbstractLogTest: """Tests the :class:`dfslog.logger.AbstractLog` class""" def test_log_method_not_implemented(self): """Tests to verify that the exception is thrown when log is called on a class that implements :class:`dfslog.logger.AbstractLog` but does not implement the log file.""" cla...
the_stack_v2_python_sparse
dfslog/tests.py
nakamotohideyoshi/draftboard-web
train
0
aab46ded76c614514d15dfa759434653f1526a03
[ "queue_choices = kwargs.pop('queue_choices')\nsuper().__init__(*args, **kwargs)\nself.fields['queue'].choices = queue_choices\nif helpdesk_settings.HELPDESK_STAFF_ONLY_TICKET_OWNERS:\n assignable_users = User.objects.filter(is_active=True, is_staff=True).order_by(User.USERNAME_FIELD)\nelse:\n assignable_users...
<|body_start_0|> queue_choices = kwargs.pop('queue_choices') super().__init__(*args, **kwargs) self.fields['queue'].choices = queue_choices if helpdesk_settings.HELPDESK_STAFF_ONLY_TICKET_OWNERS: assignable_users = User.objects.filter(is_active=True, is_staff=True).order_by(U...
Ticket Form creation for registered users.
TicketForm
[ "BSD-2-Clause", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "MIT", "CC-BY-4.0", "OFL-1.0", "OFL-1.1", "LicenseRef-scancode-proprietary-license", "MPL-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TicketForm: """Ticket Form creation for registered users.""" def __init__(self, *args, **kwargs): """Add any custom fields that are defined to the form.""" <|body_0|> def save(self, user): """Writes and returns a Ticket() object""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_003554
23,194
permissive
[ { "docstring": "Add any custom fields that are defined to the form.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Writes and returns a Ticket() object", "name": "save", "signature": "def save(self, user)" } ]
2
null
Implement the Python class `TicketForm` described below. Class description: Ticket Form creation for registered users. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Add any custom fields that are defined to the form. - def save(self, user): Writes and returns a Ticket() object
Implement the Python class `TicketForm` described below. Class description: Ticket Form creation for registered users. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Add any custom fields that are defined to the form. - def save(self, user): Writes and returns a Ticket() object <|skeleton|>...
67eb0974c7f163216ececc1d8a715a0144d0375c
<|skeleton|> class TicketForm: """Ticket Form creation for registered users.""" def __init__(self, *args, **kwargs): """Add any custom fields that are defined to the form.""" <|body_0|> def save(self, user): """Writes and returns a Ticket() object""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TicketForm: """Ticket Form creation for registered users.""" def __init__(self, *args, **kwargs): """Add any custom fields that are defined to the form.""" queue_choices = kwargs.pop('queue_choices') super().__init__(*args, **kwargs) self.fields['queue'].choices = queue_ch...
the_stack_v2_python_sparse
helpdesk/forms.py
django-helpdesk/django-helpdesk
train
931
b2c651ca1856de05b4edc60d44e18493e3cc29c9
[ "infraction_duration = data.get('infraction_duration')\nif (data.get('infraction_reason') or infraction_duration) and (not data.get('infraction_type')):\n raise ValidationError('Infraction type is required with infraction duration or reason')\nif data.get('disabled_channels') is not None and data.get('enabled_ch...
<|body_start_0|> infraction_duration = data.get('infraction_duration') if (data.get('infraction_reason') or infraction_duration) and (not data.get('infraction_type')): raise ValidationError('Infraction type is required with infraction duration or reason') if data.get('disabled_channe...
A class providing (de-)serialization of `FilterList` instances.
FilterListSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilterListSerializer: """A class providing (de-)serialization of `FilterList` instances.""" def validate(self, data: dict) -> dict: """Perform infraction data + allow and disallowed lists validation.""" <|body_0|> def to_representation(self, instance: FilterList) -> dict...
stack_v2_sparse_classes_36k_train_003555
23,871
permissive
[ { "docstring": "Perform infraction data + allow and disallowed lists validation.", "name": "validate", "signature": "def validate(self, data: dict) -> dict" }, { "docstring": "Provides a custom JSON representation to the FilterList Serializers. This representation restructures how the Filter is ...
2
null
Implement the Python class `FilterListSerializer` described below. Class description: A class providing (de-)serialization of `FilterList` instances. Method signatures and docstrings: - def validate(self, data: dict) -> dict: Perform infraction data + allow and disallowed lists validation. - def to_representation(sel...
Implement the Python class `FilterListSerializer` described below. Class description: A class providing (de-)serialization of `FilterList` instances. Method signatures and docstrings: - def validate(self, data: dict) -> dict: Perform infraction data + allow and disallowed lists validation. - def to_representation(sel...
cb6326cabee6570a5725702cb2893ae39f752279
<|skeleton|> class FilterListSerializer: """A class providing (de-)serialization of `FilterList` instances.""" def validate(self, data: dict) -> dict: """Perform infraction data + allow and disallowed lists validation.""" <|body_0|> def to_representation(self, instance: FilterList) -> dict...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilterListSerializer: """A class providing (de-)serialization of `FilterList` instances.""" def validate(self, data: dict) -> dict: """Perform infraction data + allow and disallowed lists validation.""" infraction_duration = data.get('infraction_duration') if (data.get('infraction...
the_stack_v2_python_sparse
pydis_site/apps/api/serializers.py
python-discord/site
train
746
2639e78b4a554c3d0793b581bc816f465ff0c57b
[ "self.file = file\nself.type = type\nself.group = group\nself.testclass = testclass\nself.module = module", "fp = open(self.file, 'w')\nfp.writelines(DESCRIPTOR_TEMPLATE % (self.type, self.group, self.testclass, self.module))\nfp.close" ]
<|body_start_0|> self.file = file self.type = type self.group = group self.testclass = testclass self.module = module <|end_body_0|> <|body_start_1|> fp = open(self.file, 'w') fp.writelines(DESCRIPTOR_TEMPLATE % (self.type, self.group, self.testclass, self.module...
Helper class to create a test descriptor template.
XMLDescriptorCreator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XMLDescriptorCreator: """Helper class to create a test descriptor template.""" def __init__(self, file, type='auto', group=DEFAULT_GROUP, testclass=DEFAULT_TESTCLASS, module=DEFAULT_MODULE): """Class constructor.""" <|body_0|> def writeXML(self): """Write a test ...
stack_v2_sparse_classes_36k_train_003556
12,973
no_license
[ { "docstring": "Class constructor.", "name": "__init__", "signature": "def __init__(self, file, type='auto', group=DEFAULT_GROUP, testclass=DEFAULT_TESTCLASS, module=DEFAULT_MODULE)" }, { "docstring": "Write a test descriptor template to file.", "name": "writeXML", "signature": "def writ...
2
stack_v2_sparse_classes_30k_train_003496
Implement the Python class `XMLDescriptorCreator` described below. Class description: Helper class to create a test descriptor template. Method signatures and docstrings: - def __init__(self, file, type='auto', group=DEFAULT_GROUP, testclass=DEFAULT_TESTCLASS, module=DEFAULT_MODULE): Class constructor. - def writeXML...
Implement the Python class `XMLDescriptorCreator` described below. Class description: Helper class to create a test descriptor template. Method signatures and docstrings: - def __init__(self, file, type='auto', group=DEFAULT_GROUP, testclass=DEFAULT_TESTCLASS, module=DEFAULT_MODULE): Class constructor. - def writeXML...
3f93cbedbb806b6c53de89358025f93c740ebdc3
<|skeleton|> class XMLDescriptorCreator: """Helper class to create a test descriptor template.""" def __init__(self, file, type='auto', group=DEFAULT_GROUP, testclass=DEFAULT_TESTCLASS, module=DEFAULT_MODULE): """Class constructor.""" <|body_0|> def writeXML(self): """Write a test ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XMLDescriptorCreator: """Helper class to create a test descriptor template.""" def __init__(self, file, type='auto', group=DEFAULT_GROUP, testclass=DEFAULT_TESTCLASS, module=DEFAULT_MODULE): """Class constructor.""" self.file = file self.type = type self.group = group ...
the_stack_v2_python_sparse
pysys/xml/descriptor.py
moraygrieve/pysys
train
0
1a67a30fbf5502c8eb6dc2ca307efbeaf00c040c
[ "super().__init__()\nself._selected = selected\nself._is_visible = False\nself._actions = dict()\nfor action in ActionEnum:\n self._actions[action.name] = cocos.sprite.Sprite(pyglet.image.load(PATH + '/assets/img/battle/actions/action.png'))\n self._actions[action.name].position = (700 + self._actions[action....
<|body_start_0|> super().__init__() self._selected = selected self._is_visible = False self._actions = dict() for action in ActionEnum: self._actions[action.name] = cocos.sprite.Sprite(pyglet.image.load(PATH + '/assets/img/battle/actions/action.png')) self...
Shows the list of actions available to the player.
ActionsLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActionsLayer: """Shows the list of actions available to the player.""" def __init__(self, selected: ActionEnum=ActionEnum.FIGHT) -> None: """Create a layer with the list of actions and manage their interaction. :param selected: The selected action.""" <|body_0|> def _upd...
stack_v2_sparse_classes_36k_train_003557
3,928
no_license
[ { "docstring": "Create a layer with the list of actions and manage their interaction. :param selected: The selected action.", "name": "__init__", "signature": "def __init__(self, selected: ActionEnum=ActionEnum.FIGHT) -> None" }, { "docstring": "Show the selected sprite of the selected action.",...
4
null
Implement the Python class `ActionsLayer` described below. Class description: Shows the list of actions available to the player. Method signatures and docstrings: - def __init__(self, selected: ActionEnum=ActionEnum.FIGHT) -> None: Create a layer with the list of actions and manage their interaction. :param selected:...
Implement the Python class `ActionsLayer` described below. Class description: Shows the list of actions available to the player. Method signatures and docstrings: - def __init__(self, selected: ActionEnum=ActionEnum.FIGHT) -> None: Create a layer with the list of actions and manage their interaction. :param selected:...
dfff995e3e50a8cfa56af73d93de82c427bfa2f5
<|skeleton|> class ActionsLayer: """Shows the list of actions available to the player.""" def __init__(self, selected: ActionEnum=ActionEnum.FIGHT) -> None: """Create a layer with the list of actions and manage their interaction. :param selected: The selected action.""" <|body_0|> def _upd...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActionsLayer: """Shows the list of actions available to the player.""" def __init__(self, selected: ActionEnum=ActionEnum.FIGHT) -> None: """Create a layer with the list of actions and manage their interaction. :param selected: The selected action.""" super().__init__() self._sele...
the_stack_v2_python_sparse
src/views/battle/actions_layer.py
J-GG/Pymon
train
0
5629ad020469bb4f0749842a5e0a615cc8c15d4c
[ "Frame.__init__(self, master)\nself.pack()\nself.createSongWidgets()", "top_frame = Frame(self)\nself.labelInput = Label(top_frame, text='Song Name \\n mp3 aiff m4p ')\nself.text_in = Entry(top_frame)\nself.labelResult = Label(top_frame, text='Result')\nself.labelInput.pack()\nself.text_in.pack()\nself.labelResul...
<|body_start_0|> Frame.__init__(self, master) self.pack() self.createSongWidgets() <|end_body_0|> <|body_start_1|> top_frame = Frame(self) self.labelInput = Label(top_frame, text='Song Name \n mp3 aiff m4p ') self.text_in = Entry(top_frame) self.labelResult = Lab...
Application main window class.
getSong_UI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class getSong_UI: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createSongWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle(self): ...
stack_v2_sparse_classes_36k_train_003558
10,077
no_license
[ { "docstring": "Main frame initialization (mostly delegated)", "name": "__init__", "signature": "def __init__(self, master=None)" }, { "docstring": "Add all the widgets to the main frame.", "name": "createSongWidgets", "signature": "def createSongWidgets(self)" }, { "docstring": ...
3
stack_v2_sparse_classes_30k_train_014730
Implement the Python class `getSong_UI` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createSongWidgets(self): Add all the widgets to the main frame. - def handle(self): Handle ...
Implement the Python class `getSong_UI` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createSongWidgets(self): Add all the widgets to the main frame. - def handle(self): Handle ...
2dba11861f91e4bdc1ef28279132a6d8dd4ccf54
<|skeleton|> class getSong_UI: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createSongWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class getSong_UI: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" Frame.__init__(self, master) self.pack() self.createSongWidgets() def createSongWidgets(self): """Add all the widgets to the ma...
the_stack_v2_python_sparse
Mux_src/Fix_All_Music_Guis.py
rduvalwa5/Mux
train
0
0cf275b381fbe8da803bce9da473ed329be123d5
[ "self.min_radius = min_radius\nself.max_radius = max_radius\nself.min_az = min_az * np.pi\nself.max_az = max_az * np.pi\nself.min_elev = min_elev * np.pi\nself.max_elev = max_elev * np.pi\nself.min_roll = min_roll * np.pi\nself.max_roll = max_roll * np.pi\nself.num_prealloc_samples = num_prealloc_samples\nself.rad_...
<|body_start_0|> self.min_radius = min_radius self.max_radius = max_radius self.min_az = min_az * np.pi self.max_az = max_az * np.pi self.min_elev = min_elev * np.pi self.max_elev = max_elev * np.pi self.min_roll = min_roll * np.pi self.max_roll = max_roll...
Uniform distribution over a bounded region of a viewing sphere.
UniformViewsphereRandomVariable
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UniformViewsphereRandomVariable: """Uniform distribution over a bounded region of a viewing sphere.""" def __init__(self, min_radius, max_radius, min_elev, max_elev, min_az=0, max_az=2 * np.pi, min_roll=0, max_roll=2 * np.pi, num_prealloc_samples=1): """Initialize a ViewsphereDiscret...
stack_v2_sparse_classes_36k_train_003559
19,794
permissive
[ { "docstring": "Initialize a ViewsphereDiscretizer. Parameters ---------- min_radius : float Minimum radius for viewing sphere. max_radius : float Maximum radius for viewing sphere. min_elev : float Minimum elevation (angle from z-axis) for camera position. max_elev : float Maximum elevation for camera position...
3
stack_v2_sparse_classes_30k_test_000057
Implement the Python class `UniformViewsphereRandomVariable` described below. Class description: Uniform distribution over a bounded region of a viewing sphere. Method signatures and docstrings: - def __init__(self, min_radius, max_radius, min_elev, max_elev, min_az=0, max_az=2 * np.pi, min_roll=0, max_roll=2 * np.pi...
Implement the Python class `UniformViewsphereRandomVariable` described below. Class description: Uniform distribution over a bounded region of a viewing sphere. Method signatures and docstrings: - def __init__(self, min_radius, max_radius, min_elev, max_elev, min_az=0, max_az=2 * np.pi, min_roll=0, max_roll=2 * np.pi...
336eb9e9cbb534dea36b3e92e0d1b7adef13d7f3
<|skeleton|> class UniformViewsphereRandomVariable: """Uniform distribution over a bounded region of a viewing sphere.""" def __init__(self, min_radius, max_radius, min_elev, max_elev, min_az=0, max_az=2 * np.pi, min_roll=0, max_roll=2 * np.pi, num_prealloc_samples=1): """Initialize a ViewsphereDiscret...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UniformViewsphereRandomVariable: """Uniform distribution over a bounded region of a viewing sphere.""" def __init__(self, min_radius, max_radius, min_elev, max_elev, min_az=0, max_az=2 * np.pi, min_roll=0, max_roll=2 * np.pi, num_prealloc_samples=1): """Initialize a ViewsphereDiscretizer. Paramet...
the_stack_v2_python_sparse
meshpy/meshpy/random_variables.py
lianghongzhuo/PointNetGPD
train
285
f9aeea9ccfa82e9f81485924fd0184cebcca6521
[ "self.adafruit_sht = adafruit_sht\nself.temperature = None\nself.humidity = None", "temperature, humidity = self.adafruit_sht.read_temperature_humidity()\nif math.isnan(temperature) or math.isnan(humidity):\n _LOGGER.warning('Bad sample from sensor SHT31')\n return\nself.temperature = temperature\nself.humi...
<|body_start_0|> self.adafruit_sht = adafruit_sht self.temperature = None self.humidity = None <|end_body_0|> <|body_start_1|> temperature, humidity = self.adafruit_sht.read_temperature_humidity() if math.isnan(temperature) or math.isnan(humidity): _LOGGER.warning('B...
Get the latest data from the SHT sensor.
SHTClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SHTClient: """Get the latest data from the SHT sensor.""" def __init__(self, adafruit_sht): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from the SHT sensor.""" <|body_1|> <|end_skeleton|> <|body_start_0|> sel...
stack_v2_sparse_classes_36k_train_003560
4,393
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, adafruit_sht)" }, { "docstring": "Get the latest data from the SHT sensor.", "name": "update", "signature": "def update(self)" } ]
2
null
Implement the Python class `SHTClient` described below. Class description: Get the latest data from the SHT sensor. Method signatures and docstrings: - def __init__(self, adafruit_sht): Initialize the sensor. - def update(self): Get the latest data from the SHT sensor.
Implement the Python class `SHTClient` described below. Class description: Get the latest data from the SHT sensor. Method signatures and docstrings: - def __init__(self, adafruit_sht): Initialize the sensor. - def update(self): Get the latest data from the SHT sensor. <|skeleton|> class SHTClient: """Get the la...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class SHTClient: """Get the latest data from the SHT sensor.""" def __init__(self, adafruit_sht): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from the SHT sensor.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SHTClient: """Get the latest data from the SHT sensor.""" def __init__(self, adafruit_sht): """Initialize the sensor.""" self.adafruit_sht = adafruit_sht self.temperature = None self.humidity = None def update(self): """Get the latest data from the SHT sensor....
the_stack_v2_python_sparse
homeassistant/components/sht31/sensor.py
BenWoodford/home-assistant
train
11
6ebd91d1e9ce04d8034fe779c2ade810c0395060
[ "success_url = kwargs.get('success_url', '/my')\ncallback_method = kwargs.get('callback_method', '')\norder_sudo = request.env['sale.order'].sudo().browse(order_id)\nif not order_sudo:\n return False\ntry:\n acquirer = request.env['payment.acquirer'].browse(int(acquirer_id))\nexcept:\n return False\ntoken ...
<|body_start_0|> success_url = kwargs.get('success_url', '/my') callback_method = kwargs.get('callback_method', '') order_sudo = request.env['sale.order'].sudo().browse(order_id) if not order_sudo: return False try: acquirer = request.env['payment.acquirer...
PaymentPortal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaymentPortal: def sale_pay_form(self, acquirer_id, order_id, save_token=False, access_token=None, **kwargs): """Json method that creates a payment.transaction, used to create a transaction when the user clicks on 'pay now' button on the payment form. :return html: form containing all va...
stack_v2_sparse_classes_36k_train_003561
4,295
no_license
[ { "docstring": "Json method that creates a payment.transaction, used to create a transaction when the user clicks on 'pay now' button on the payment form. :return html: form containing all values related to the acquirer to redirect customers to the acquirer website", "name": "sale_pay_form", "signature"...
2
stack_v2_sparse_classes_30k_train_007473
Implement the Python class `PaymentPortal` described below. Class description: Implement the PaymentPortal class. Method signatures and docstrings: - def sale_pay_form(self, acquirer_id, order_id, save_token=False, access_token=None, **kwargs): Json method that creates a payment.transaction, used to create a transact...
Implement the Python class `PaymentPortal` described below. Class description: Implement the PaymentPortal class. Method signatures and docstrings: - def sale_pay_form(self, acquirer_id, order_id, save_token=False, access_token=None, **kwargs): Json method that creates a payment.transaction, used to create a transact...
77e56da362bec56f13bf0abc9f8cf13e98461111
<|skeleton|> class PaymentPortal: def sale_pay_form(self, acquirer_id, order_id, save_token=False, access_token=None, **kwargs): """Json method that creates a payment.transaction, used to create a transaction when the user clicks on 'pay now' button on the payment form. :return html: form containing all va...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PaymentPortal: def sale_pay_form(self, acquirer_id, order_id, save_token=False, access_token=None, **kwargs): """Json method that creates a payment.transaction, used to create a transaction when the user clicks on 'pay now' button on the payment form. :return html: form containing all values related t...
the_stack_v2_python_sparse
addons/sale_payment/controllers/payment.py
gahan-corporation/wyatt
train
0
e21ac1dec0b76efa73ebc920a2f2defb57b2e574
[ "super(FakeFileSystemBuilder, self).__init__()\nresolver_context = context.Context()\npath_spec = fake_path_spec.FakePathSpec(location='/')\nself.file_system = fake_file_system.FakeFileSystem(resolver_context, path_spec)", "path_segments = self.file_system.SplitPath(path)\nfor segment_index in range(len(path_segm...
<|body_start_0|> super(FakeFileSystemBuilder, self).__init__() resolver_context = context.Context() path_spec = fake_path_spec.FakePathSpec(location='/') self.file_system = fake_file_system.FakeFileSystem(resolver_context, path_spec) <|end_body_0|> <|body_start_1|> path_segments...
Builder object for fake file systems. Attributes: file_system (FakeFileSystem): fake file system.
FakeFileSystemBuilder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FakeFileSystemBuilder: """Builder object for fake file systems. Attributes: file_system (FakeFileSystem): fake file system.""" def __init__(self): """Initializes a fake file system builder.""" <|body_0|> def _AddParentDirectories(self, path): """Adds the parent d...
stack_v2_sparse_classes_36k_train_003562
3,992
permissive
[ { "docstring": "Initializes a fake file system builder.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Adds the parent directories of a path to the fake file system. Args: path (str): path of the file within the fake file system. Raises: ValueError: if a parent direct...
6
stack_v2_sparse_classes_30k_train_016908
Implement the Python class `FakeFileSystemBuilder` described below. Class description: Builder object for fake file systems. Attributes: file_system (FakeFileSystem): fake file system. Method signatures and docstrings: - def __init__(self): Initializes a fake file system builder. - def _AddParentDirectories(self, pat...
Implement the Python class `FakeFileSystemBuilder` described below. Class description: Builder object for fake file systems. Attributes: file_system (FakeFileSystem): fake file system. Method signatures and docstrings: - def __init__(self): Initializes a fake file system builder. - def _AddParentDirectories(self, pat...
28756d910e951a22c5f0b2bcf5184f055a19d544
<|skeleton|> class FakeFileSystemBuilder: """Builder object for fake file systems. Attributes: file_system (FakeFileSystem): fake file system.""" def __init__(self): """Initializes a fake file system builder.""" <|body_0|> def _AddParentDirectories(self, path): """Adds the parent d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FakeFileSystemBuilder: """Builder object for fake file systems. Attributes: file_system (FakeFileSystem): fake file system.""" def __init__(self): """Initializes a fake file system builder.""" super(FakeFileSystemBuilder, self).__init__() resolver_context = context.Context() ...
the_stack_v2_python_sparse
dfvfs/helpers/fake_file_system_builder.py
log2timeline/dfvfs
train
197
c799c473c22cc454275a942954661ae0d90bccc2
[ "self.data = data\nself.k = k\nself.n = n", "new_data = list()\nout_prev = data[0]\nfor i in range(len(data)):\n new_data.append(int((data[i] + self.k * out_prev) / (self.k + 1)))\n out_prev = new_data[-1]\nreturn new_data", "b = {0: bytearray(), 1: bytearray()}\nout = {0: list(), 1: list()}\nfor i in ran...
<|body_start_0|> self.data = data self.k = k self.n = n <|end_body_0|> <|body_start_1|> new_data = list() out_prev = data[0] for i in range(len(data)): new_data.append(int((data[i] + self.k * out_prev) / (self.k + 1))) out_prev = new_data[-1] ...
Filter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Filter: def __init__(self, data, k, n): """Las instancias de esta clase filtran las altas frecuencias de un audio data: objeto clase bytes con las muestras de audio k: Frecuencia de muestreo dividida en la frecuencia de corte n: orden del filtro""" <|body_0|> def low_pass_fi...
stack_v2_sparse_classes_36k_train_003563
7,055
no_license
[ { "docstring": "Las instancias de esta clase filtran las altas frecuencias de un audio data: objeto clase bytes con las muestras de audio k: Frecuencia de muestreo dividida en la frecuencia de corte n: orden del filtro", "name": "__init__", "signature": "def __init__(self, data, k, n)" }, { "doc...
6
stack_v2_sparse_classes_30k_train_008596
Implement the Python class `Filter` described below. Class description: Implement the Filter class. Method signatures and docstrings: - def __init__(self, data, k, n): Las instancias de esta clase filtran las altas frecuencias de un audio data: objeto clase bytes con las muestras de audio k: Frecuencia de muestreo di...
Implement the Python class `Filter` described below. Class description: Implement the Filter class. Method signatures and docstrings: - def __init__(self, data, k, n): Las instancias de esta clase filtran las altas frecuencias de un audio data: objeto clase bytes con las muestras de audio k: Frecuencia de muestreo di...
1458756a37d927d8dd365ba21cef4490360f1985
<|skeleton|> class Filter: def __init__(self, data, k, n): """Las instancias de esta clase filtran las altas frecuencias de un audio data: objeto clase bytes con las muestras de audio k: Frecuencia de muestreo dividida en la frecuencia de corte n: orden del filtro""" <|body_0|> def low_pass_fi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Filter: def __init__(self, data, k, n): """Las instancias de esta clase filtran las altas frecuencias de un audio data: objeto clase bytes con las muestras de audio k: Frecuencia de muestreo dividida en la frecuencia de corte n: orden del filtro""" self.data = data self.k = k s...
the_stack_v2_python_sparse
Ayudantias/10 - IO Archivos/WAV example/ejemplo_wav.py
frhuerta/Syllabus
train
0
33f8363ce5b1bafaf6c830e8665c80f834104607
[ "q = quantity.Mass(1.0, 'kg')\nself.assertAlmostEqual(q.value, 1.0, 6)\nself.assertAlmostEqual(q.value_si, 1.0, delta=1e-06)\nself.assertEqual(q.units, 'kg')", "q = quantity.Mass(1.0, 'g/mol')\nself.assertAlmostEqual(q.value, 1.0, 6)\nself.assertAlmostEqual(q.value_si, constants.amu, delta=1e-32)\nself.assertEqua...
<|body_start_0|> q = quantity.Mass(1.0, 'kg') self.assertAlmostEqual(q.value, 1.0, 6) self.assertAlmostEqual(q.value_si, 1.0, delta=1e-06) self.assertEqual(q.units, 'kg') <|end_body_0|> <|body_start_1|> q = quantity.Mass(1.0, 'g/mol') self.assertAlmostEqual(q.value, 1.0,...
Contains unit tests of the Mass unit type object. Note that value_si is always kg (per molecule), not kg/mol.
TestMass
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMass: """Contains unit tests of the Mass unit type object. Note that value_si is always kg (per molecule), not kg/mol.""" def test_kg(self): """Test the creation of a mass quantity with units of kg.""" <|body_0|> def test_gpermol(self): """Test the creation o...
stack_v2_sparse_classes_36k_train_003564
49,563
permissive
[ { "docstring": "Test the creation of a mass quantity with units of kg.", "name": "test_kg", "signature": "def test_kg(self)" }, { "docstring": "Test the creation of a mass quantity with units of g/mol. Note that g/mol is automatically coerced to amu.", "name": "test_gpermol", "signature"...
4
null
Implement the Python class `TestMass` described below. Class description: Contains unit tests of the Mass unit type object. Note that value_si is always kg (per molecule), not kg/mol. Method signatures and docstrings: - def test_kg(self): Test the creation of a mass quantity with units of kg. - def test_gpermol(self)...
Implement the Python class `TestMass` described below. Class description: Contains unit tests of the Mass unit type object. Note that value_si is always kg (per molecule), not kg/mol. Method signatures and docstrings: - def test_kg(self): Test the creation of a mass quantity with units of kg. - def test_gpermol(self)...
349a4af759cf8877197772cd7eaca1e51d46eff5
<|skeleton|> class TestMass: """Contains unit tests of the Mass unit type object. Note that value_si is always kg (per molecule), not kg/mol.""" def test_kg(self): """Test the creation of a mass quantity with units of kg.""" <|body_0|> def test_gpermol(self): """Test the creation o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestMass: """Contains unit tests of the Mass unit type object. Note that value_si is always kg (per molecule), not kg/mol.""" def test_kg(self): """Test the creation of a mass quantity with units of kg.""" q = quantity.Mass(1.0, 'kg') self.assertAlmostEqual(q.value, 1.0, 6) ...
the_stack_v2_python_sparse
rmgpy/quantityTest.py
CanePan-cc/CanePanWorkshop
train
2
deddc093edcbd0ecbe5e5a821330de0d03642b86
[ "if not kwargs['reservation'].can_change(request.user) and (not kwargs['reservation'].can_change_end_time(request.user)):\n return redirect('my_reservations')\nreturn super().dispatch(request, *args, **kwargs)", "reservation = kwargs['reservation']\nif reservation.machine != form.cleaned_data['machine']:\n ...
<|body_start_0|> if not kwargs['reservation'].can_change(request.user) and (not kwargs['reservation'].can_change_end_time(request.user)): return redirect('my_reservations') return super().dispatch(request, *args, **kwargs) <|end_body_0|> <|body_start_1|> reservation = kwargs['reserv...
View for changing a reservation (Cannot be UpdateView due to the abstract inheritance of reservations)
ChangeReservationView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChangeReservationView: """View for changing a reservation (Cannot be UpdateView due to the abstract inheritance of reservations)""" def dispatch(self, request, *args, **kwargs): """Redirects the user to it's reservation page if the given reservation cannot be changed :param request: ...
stack_v2_sparse_classes_36k_train_003565
12,808
permissive
[ { "docstring": "Redirects the user to it's reservation page if the given reservation cannot be changed :param request: The HTTP request", "name": "dispatch", "signature": "def dispatch(self, request, *args, **kwargs)" }, { "docstring": "Handles updating the reservation if the form is valid, othe...
2
stack_v2_sparse_classes_30k_train_008506
Implement the Python class `ChangeReservationView` described below. Class description: View for changing a reservation (Cannot be UpdateView due to the abstract inheritance of reservations) Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Redirects the user to it's reservation page if...
Implement the Python class `ChangeReservationView` described below. Class description: View for changing a reservation (Cannot be UpdateView due to the abstract inheritance of reservations) Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Redirects the user to it's reservation page if...
1d190a86e3277315804bfcc0b8f9abd4f9c1d780
<|skeleton|> class ChangeReservationView: """View for changing a reservation (Cannot be UpdateView due to the abstract inheritance of reservations)""" def dispatch(self, request, *args, **kwargs): """Redirects the user to it's reservation page if the given reservation cannot be changed :param request: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChangeReservationView: """View for changing a reservation (Cannot be UpdateView due to the abstract inheritance of reservations)""" def dispatch(self, request, *args, **kwargs): """Redirects the user to it's reservation page if the given reservation cannot be changed :param request: The HTTP requ...
the_stack_v2_python_sparse
make_queue/views/reservation/reservation.py
mahoyen/web
train
0
c466985a84b5132fa32035a0b9e087ce1c295f0b
[ "offset, limit = get_limits(request)\nquery = UserPrefs.all()\nif request.order == apimessages.UserOrder.NAME:\n query = query.order('name')\nelif request.order == apimessages.UserOrder.JOINED:\n query = query.order('-joined')\nusers = query.fetch(limit, offset=offset)\nitems = []\nfor user in users:\n ite...
<|body_start_0|> offset, limit = get_limits(request) query = UserPrefs.all() if request.order == apimessages.UserOrder.NAME: query = query.order('name') elif request.order == apimessages.UserOrder.JOINED: query = query.order('-joined') users = query.fetch(...
Malt.io Public API ------------------ This provides a ProtoRPC interface for the Endpoints API that allows Google's infrastructure to be used for serving API calls for our app. Methods are provided such that fully-featured external apps and mash- ups can be created, e.g. mobile apps and interesting third party sites.
MaltioApi
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaltioApi: """Malt.io Public API ------------------ This provides a ProtoRPC interface for the Endpoints API that allows Google's infrastructure to be used for serving API calls for our app. Methods are provided such that fully-featured external apps and mash- ups can be created, e.g. mobile apps...
stack_v2_sparse_classes_36k_train_003566
8,429
permissive
[ { "docstring": "Get a list of users.", "name": "get_users", "signature": "def get_users(self, request)" }, { "docstring": "Get a user by name.", "name": "get_user", "signature": "def get_user(self, request)" }, { "docstring": "Get a list of recipes, optionally filtered by user na...
4
stack_v2_sparse_classes_30k_train_017180
Implement the Python class `MaltioApi` described below. Class description: Malt.io Public API ------------------ This provides a ProtoRPC interface for the Endpoints API that allows Google's infrastructure to be used for serving API calls for our app. Methods are provided such that fully-featured external apps and mas...
Implement the Python class `MaltioApi` described below. Class description: Malt.io Public API ------------------ This provides a ProtoRPC interface for the Endpoints API that allows Google's infrastructure to be used for serving API calls for our app. Methods are provided such that fully-featured external apps and mas...
beeb2e25a41d91df418b132ddf19619fa1ba9a5a
<|skeleton|> class MaltioApi: """Malt.io Public API ------------------ This provides a ProtoRPC interface for the Endpoints API that allows Google's infrastructure to be used for serving API calls for our app. Methods are provided such that fully-featured external apps and mash- ups can be created, e.g. mobile apps...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaltioApi: """Malt.io Public API ------------------ This provides a ProtoRPC interface for the Endpoints API that allows Google's infrastructure to be used for serving API calls for our app. Methods are provided such that fully-featured external apps and mash- ups can be created, e.g. mobile apps and interest...
the_stack_v2_python_sparse
api.py
oboyle/old.malt.io
train
0
af5ff3636a9d98701999054ea8839c2fd5019561
[ "if not nums:\n return 0\nn, count = (len(nums), 0)\ndp = [[1] * n for _ in range(n)]\nfor i in range(n - 1, -1, -1):\n for j in range(i, n):\n if i == j:\n dp[i][j] = nums[i]\n else:\n dp[i][j] = dp[i][j - 1] * nums[j]\n if dp[i][j] < k:\n count += 1\nret...
<|body_start_0|> if not nums: return 0 n, count = (len(nums), 0) dp = [[1] * n for _ in range(n)] for i in range(n - 1, -1, -1): for j in range(i, n): if i == j: dp[i][j] = nums[i] else: dp[i]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSubarrayProductLessThanK_dp(self, nums: List[int], k: int) -> int: """思路: DP,超时""" <|body_0|> def numSubarrayProductLessThanK_window(self, nums: List[int], k: int) -> int: """思路:滑动窗口 + 二分法 对于 每个 right, nums[left], nums[left + 1], nums[left +2] ... nu...
stack_v2_sparse_classes_36k_train_003567
1,955
no_license
[ { "docstring": "思路: DP,超时", "name": "numSubarrayProductLessThanK_dp", "signature": "def numSubarrayProductLessThanK_dp(self, nums: List[int], k: int) -> int" }, { "docstring": "思路:滑动窗口 + 二分法 对于 每个 right, nums[left], nums[left + 1], nums[left +2] ... nums[right] [0, right] 是单调递增的,找到 最大 sub_max < ...
2
stack_v2_sparse_classes_30k_train_016508
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayProductLessThanK_dp(self, nums: List[int], k: int) -> int: 思路: DP,超时 - def numSubarrayProductLessThanK_window(self, nums: List[int], k: int) -> int: 思路:滑动窗口 + 二分法 ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayProductLessThanK_dp(self, nums: List[int], k: int) -> int: 思路: DP,超时 - def numSubarrayProductLessThanK_window(self, nums: List[int], k: int) -> int: 思路:滑动窗口 + 二分法 ...
4994b8b19abcdbcc0bda2944350e325242fadfd1
<|skeleton|> class Solution: def numSubarrayProductLessThanK_dp(self, nums: List[int], k: int) -> int: """思路: DP,超时""" <|body_0|> def numSubarrayProductLessThanK_window(self, nums: List[int], k: int) -> int: """思路:滑动窗口 + 二分法 对于 每个 right, nums[left], nums[left + 1], nums[left +2] ... nu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numSubarrayProductLessThanK_dp(self, nums: List[int], k: int) -> int: """思路: DP,超时""" if not nums: return 0 n, count = (len(nums), 0) dp = [[1] * n for _ in range(n)] for i in range(n - 1, -1, -1): for j in range(i, n): ...
the_stack_v2_python_sparse
Week_04/numSubarrayProductLessThanK.py
NanZhang715/AlgorithmCHUNZHAO
train
0
42153f56014992701cd067ade344437b52954cf0
[ "card = CardRepository().find_by_id(id)\nprint(card)\nif card == None:\n return abort(404, 'Not found card')", "cls.check_exist_card(card_id)\nprint(card_id)\nCardRepository().delete_by_id(card_id)\nprint('Deletado com sucesso!')" ]
<|body_start_0|> card = CardRepository().find_by_id(id) print(card) if card == None: return abort(404, 'Not found card') <|end_body_0|> <|body_start_1|> cls.check_exist_card(card_id) print(card_id) CardRepository().delete_by_id(card_id) print('Deletad...
DeleteCard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeleteCard: def check_exist_card(cls, id): """Verifica se um card existe, caso não exista obtemos um erro.""" <|body_0|> def run(cls, card_id: str) -> None: """Verifica e delete um card pelo id, caso ele exista.""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_003568
712
no_license
[ { "docstring": "Verifica se um card existe, caso não exista obtemos um erro.", "name": "check_exist_card", "signature": "def check_exist_card(cls, id)" }, { "docstring": "Verifica e delete um card pelo id, caso ele exista.", "name": "run", "signature": "def run(cls, card_id: str) -> None...
2
stack_v2_sparse_classes_30k_train_019454
Implement the Python class `DeleteCard` described below. Class description: Implement the DeleteCard class. Method signatures and docstrings: - def check_exist_card(cls, id): Verifica se um card existe, caso não exista obtemos um erro. - def run(cls, card_id: str) -> None: Verifica e delete um card pelo id, caso ele ...
Implement the Python class `DeleteCard` described below. Class description: Implement the DeleteCard class. Method signatures and docstrings: - def check_exist_card(cls, id): Verifica se um card existe, caso não exista obtemos um erro. - def run(cls, card_id: str) -> None: Verifica e delete um card pelo id, caso ele ...
fb47a578f229f78473657342e7b49957ae5d2d0b
<|skeleton|> class DeleteCard: def check_exist_card(cls, id): """Verifica se um card existe, caso não exista obtemos um erro.""" <|body_0|> def run(cls, card_id: str) -> None: """Verifica e delete um card pelo id, caso ele exista.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeleteCard: def check_exist_card(cls, id): """Verifica se um card existe, caso não exista obtemos um erro.""" card = CardRepository().find_by_id(id) print(card) if card == None: return abort(404, 'Not found card') def run(cls, card_id: str) -> None: """...
the_stack_v2_python_sparse
back_end/src/applications/card/delete.py
Simeone-Holanda/Criador-de-cards
train
0
e9786edf5a55500659f54191922796952d16ed6a
[ "head = ListNode(0)\ncurosr = head\nwhile l1 and l2:\n if l1.val < l2.va1:\n curosr.next = l1\n l1 = l1.next\n else:\n curosr.next = l2\n l2 = l2.next\n curosr = curosr.next\ncurosr.next = l1 or l2\nreturn head.next", "p1, p2 = (l1, l2)\nwhile p1 and p2:\n if p1.val < p2.va...
<|body_start_0|> head = ListNode(0) curosr = head while l1 and l2: if l1.val < l2.va1: curosr.next = l1 l1 = l1.next else: curosr.next = l2 l2 = l2.next curosr = curosr.next curosr.next = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists_opt(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_003569
1,289
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists_opt", "signature": "def mergeTwoLists_opt(self, l1, l2)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(se...
2
stack_v2_sparse_classes_30k_train_014132
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists_opt(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListN...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists_opt(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListN...
84c81fd17c652141d3d194da3481a7241c2accf6
<|skeleton|> class Solution: def mergeTwoLists_opt(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists_opt(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" head = ListNode(0) curosr = head while l1 and l2: if l1.val < l2.va1: curosr.next = l1 l1 = l1.next else: ...
the_stack_v2_python_sparse
leetcode/21-merge two sorted list.py
harvey103565/OI-Algorithm-wareh
train
0
1390d0e7272e1e101fd32cfa60a3f7d69555b372
[ "cmd = 'fleetrun --gpu=0,1 dist_fleet_dygraph_api.py'\npro = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\npro.wait()\npro.returncode == 0", "cmd = 'fleetrun --gpu=0 dist_fleet_dygraph_api.py'\npro = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.P...
<|body_start_0|> cmd = 'fleetrun --gpu=0,1 dist_fleet_dygraph_api.py' pro = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) pro.wait() pro.returncode == 0 <|end_body_0|> <|body_start_1|> cmd = 'fleetrun --gpu=0 dist_fleet_dygraph_api.py' ...
Test dygraph
TestDygraph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDygraph: """Test dygraph""" def test_dist_fleet_dygraph_api_2gpus(self): """test_dist_fleet_dygraph_api_2gpus.""" <|body_0|> def test_dist_fleet_dygraph_api_1gpus(self): """test_dist_fleet_dygraph_api_1gpus""" <|body_1|> def test_dist_fleet_dygra...
stack_v2_sparse_classes_36k_train_003570
1,941
no_license
[ { "docstring": "test_dist_fleet_dygraph_api_2gpus.", "name": "test_dist_fleet_dygraph_api_2gpus", "signature": "def test_dist_fleet_dygraph_api_2gpus(self)" }, { "docstring": "test_dist_fleet_dygraph_api_1gpus", "name": "test_dist_fleet_dygraph_api_1gpus", "signature": "def test_dist_fle...
4
stack_v2_sparse_classes_30k_train_021034
Implement the Python class `TestDygraph` described below. Class description: Test dygraph Method signatures and docstrings: - def test_dist_fleet_dygraph_api_2gpus(self): test_dist_fleet_dygraph_api_2gpus. - def test_dist_fleet_dygraph_api_1gpus(self): test_dist_fleet_dygraph_api_1gpus - def test_dist_fleet_dygraph_l...
Implement the Python class `TestDygraph` described below. Class description: Test dygraph Method signatures and docstrings: - def test_dist_fleet_dygraph_api_2gpus(self): test_dist_fleet_dygraph_api_2gpus. - def test_dist_fleet_dygraph_api_1gpus(self): test_dist_fleet_dygraph_api_1gpus - def test_dist_fleet_dygraph_l...
e3562ab40b574f06bba68df6895a055fa31a085d
<|skeleton|> class TestDygraph: """Test dygraph""" def test_dist_fleet_dygraph_api_2gpus(self): """test_dist_fleet_dygraph_api_2gpus.""" <|body_0|> def test_dist_fleet_dygraph_api_1gpus(self): """test_dist_fleet_dygraph_api_1gpus""" <|body_1|> def test_dist_fleet_dygra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDygraph: """Test dygraph""" def test_dist_fleet_dygraph_api_2gpus(self): """test_dist_fleet_dygraph_api_2gpus.""" cmd = 'fleetrun --gpu=0,1 dist_fleet_dygraph_api.py' pro = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) pro.wait() ...
the_stack_v2_python_sparse
dist_cts/dist_fleet_pipeline/test_dist_fleet_dygraph_api.py
gentelyang/scripts
train
0
1d0fc0637023327c157db316a3ac46f46e4572af
[ "try:\n config = Config(sample_buffers=1, samples=1, double_buffer=True)\n super(PendulumWindow, self).__init__(config=config, resizable=True, caption=caption)\nexcept:\n super(PendulumWindow, self).__init__(resizable=True, caption=caption)\nself.font_sans = font.load(None, 16)\nself.fps_display = clock.Cl...
<|body_start_0|> try: config = Config(sample_buffers=1, samples=1, double_buffer=True) super(PendulumWindow, self).__init__(config=config, resizable=True, caption=caption) except: super(PendulumWindow, self).__init__(resizable=True, caption=caption) self.font_...
PendulumWindow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PendulumWindow: def __init__(self, caption='Simulation'): """Initialisiert das Fenster.""" <|body_0|> def on_resize(self, width, height): """Auf Veränderung der Fenstergröße reagieren.""" <|body_1|> def run(self): """Mainloop. Arbeitet Ereignisse...
stack_v2_sparse_classes_36k_train_003571
8,184
no_license
[ { "docstring": "Initialisiert das Fenster.", "name": "__init__", "signature": "def __init__(self, caption='Simulation')" }, { "docstring": "Auf Veränderung der Fenstergröße reagieren.", "name": "on_resize", "signature": "def on_resize(self, width, height)" }, { "docstring": "Main...
5
stack_v2_sparse_classes_30k_train_015383
Implement the Python class `PendulumWindow` described below. Class description: Implement the PendulumWindow class. Method signatures and docstrings: - def __init__(self, caption='Simulation'): Initialisiert das Fenster. - def on_resize(self, width, height): Auf Veränderung der Fenstergröße reagieren. - def run(self)...
Implement the Python class `PendulumWindow` described below. Class description: Implement the PendulumWindow class. Method signatures and docstrings: - def __init__(self, caption='Simulation'): Initialisiert das Fenster. - def on_resize(self, width, height): Auf Veränderung der Fenstergröße reagieren. - def run(self)...
f54eee2d2c3af7a628d8058f913bb5ea51724f4a
<|skeleton|> class PendulumWindow: def __init__(self, caption='Simulation'): """Initialisiert das Fenster.""" <|body_0|> def on_resize(self, width, height): """Auf Veränderung der Fenstergröße reagieren.""" <|body_1|> def run(self): """Mainloop. Arbeitet Ereignisse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PendulumWindow: def __init__(self, caption='Simulation'): """Initialisiert das Fenster.""" try: config = Config(sample_buffers=1, samples=1, double_buffer=True) super(PendulumWindow, self).__init__(config=config, resizable=True, caption=caption) except: ...
the_stack_v2_python_sparse
Python/PythonKurs 2015.04/double_pendulum-r25/simulation.py
Sir2B/Uni
train
0
91f5a9f906436566e2cc0f844ba731d7ef2ca05d
[ "self._classMapping = OrderedDict()\nself._classMapping['Resource'] = 'http://www.w3.org/2000/01/rdf-schema#Class'\nself._classMapping['SendState'] = 'http://www.imi.kit.edu/abstract-pass-ont#SendState'\nself._classMapping['FunctionState'] = 'http://www.imi.kit.edu/abstract-pass-ont#FunctionState'\nself._classMappi...
<|body_start_0|> self._classMapping = OrderedDict() self._classMapping['Resource'] = 'http://www.w3.org/2000/01/rdf-schema#Class' self._classMapping['SendState'] = 'http://www.imi.kit.edu/abstract-pass-ont#SendState' self._classMapping['FunctionState'] = 'http://www.imi.kit.edu/abstract-...
The class mapper is responsible for mapping the rdf:type attribute to the python classes and vice versa. :version: 2015-12-04 :author: Lukas Block
ClassMapper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassMapper: """The class mapper is responsible for mapping the rdf:type attribute to the python classes and vice versa. :version: 2015-12-04 :author: Lukas Block""" def __init__(self): """Constructor @return : @author""" <|body_0|> def getClassName(self, uris): ...
stack_v2_sparse_classes_36k_train_003572
4,695
no_license
[ { "docstring": "Constructor @return : @author", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Returns the class name that should be associated with the given rdfs class which is specified by the uri strings. The string with the highest specificy (regarding this class m...
3
stack_v2_sparse_classes_30k_train_002382
Implement the Python class `ClassMapper` described below. Class description: The class mapper is responsible for mapping the rdf:type attribute to the python classes and vice versa. :version: 2015-12-04 :author: Lukas Block Method signatures and docstrings: - def __init__(self): Constructor @return : @author - def ge...
Implement the Python class `ClassMapper` described below. Class description: The class mapper is responsible for mapping the rdf:type attribute to the python classes and vice versa. :version: 2015-12-04 :author: Lukas Block Method signatures and docstrings: - def __init__(self): Constructor @return : @author - def ge...
f7a0f19c5c697f0050db94e1aca669ea3d2f3d34
<|skeleton|> class ClassMapper: """The class mapper is responsible for mapping the rdf:type attribute to the python classes and vice versa. :version: 2015-12-04 :author: Lukas Block""" def __init__(self): """Constructor @return : @author""" <|body_0|> def getClassName(self, uris): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassMapper: """The class mapper is responsible for mapping the rdf:type attribute to the python classes and vice versa. :version: 2015-12-04 :author: Lukas Block""" def __init__(self): """Constructor @return : @author""" self._classMapping = OrderedDict() self._classMapping['Reso...
the_stack_v2_python_sparse
Model/PASS/ClassMapper.py
uagnd/S-BPM_VR
train
0
83a404d07106b450ce01eb8b29b92fff0c9ce8dd
[ "super(UNIInterface, self).__init__(vrf_name=vrf_name, if_name=if_name)\nself.vlan_id = vlan_id\nself.ip_address = ip_address\nself.subnet_mask = subnet_mask\nself.vip_ip_address = vip_ip_address\nself.hsrp_id = hsrp_id\nself.mtu = mtu\nself.is_active = is_active", "parame = self._get_param()\nself._interface_com...
<|body_start_0|> super(UNIInterface, self).__init__(vrf_name=vrf_name, if_name=if_name) self.vlan_id = vlan_id self.ip_address = ip_address self.subnet_mask = subnet_mask self.vip_ip_address = vip_ip_address self.hsrp_id = hsrp_id self.mtu = mtu self.is_ac...
Parts class for ASR driver UNI interface configuraton
UNIInterface
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UNIInterface: """Parts class for ASR driver UNI interface configuraton""" def __init__(self, vrf_name=None, if_name=None, vlan_id=None, ip_address=None, subnet_mask=None, vip_ip_address=None, hsrp_id=None, mtu=None, is_active=True): """Costructor""" <|body_0|> def output...
stack_v2_sparse_classes_36k_train_003573
2,676
permissive
[ { "docstring": "Costructor", "name": "__init__", "signature": "def __init__(self, vrf_name=None, if_name=None, vlan_id=None, ip_address=None, subnet_mask=None, vip_ip_address=None, hsrp_id=None, mtu=None, is_active=True)" }, { "docstring": "Command line to add configuration is output.", "nam...
3
null
Implement the Python class `UNIInterface` described below. Class description: Parts class for ASR driver UNI interface configuraton Method signatures and docstrings: - def __init__(self, vrf_name=None, if_name=None, vlan_id=None, ip_address=None, subnet_mask=None, vip_ip_address=None, hsrp_id=None, mtu=None, is_activ...
Implement the Python class `UNIInterface` described below. Class description: Parts class for ASR driver UNI interface configuraton Method signatures and docstrings: - def __init__(self, vrf_name=None, if_name=None, vlan_id=None, ip_address=None, subnet_mask=None, vip_ip_address=None, hsrp_id=None, mtu=None, is_activ...
e550d1b5ec9419f1fb3eb6e058ce46b57c92ee2f
<|skeleton|> class UNIInterface: """Parts class for ASR driver UNI interface configuraton""" def __init__(self, vrf_name=None, if_name=None, vlan_id=None, ip_address=None, subnet_mask=None, vip_ip_address=None, hsrp_id=None, mtu=None, is_active=True): """Costructor""" <|body_0|> def output...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UNIInterface: """Parts class for ASR driver UNI interface configuraton""" def __init__(self, vrf_name=None, if_name=None, vlan_id=None, ip_address=None, subnet_mask=None, vip_ip_address=None, hsrp_id=None, mtu=None, is_active=True): """Costructor""" super(UNIInterface, self).__init__(vrf_...
the_stack_v2_python_sparse
lib/SeparateDriver/ASRDriverParts/UNIInterface.py
lixiaochun/element-manager
train
0
71a15946fd8337a225ed43f2b13fb68057be0f2e
[ "def helper(node):\n if not node:\n return ''\n return helper(node.left) + ',' + helper(node.right) + ',' + str(node.val)\nres = helper(root)\nprint(res)\nreturn res", "def helper(lower, upper):\n if not values or values[-1] < lower or values[-1] > upper:\n return None\n val = values.pop...
<|body_start_0|> def helper(node): if not node: return '' return helper(node.left) + ',' + helper(node.right) + ',' + str(node.val) res = helper(root) print(res) return res <|end_body_0|> <|body_start_1|> def helper(lower, upper): ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_003574
1,280
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_021322
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
5b14b6f42baf59b04cbcc8e115df4272029b64c8
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def helper(node): if not node: return '' return helper(node.left) + ',' + helper(node.right) + ',' + str(node.val) res = helper(root) ...
the_stack_v2_python_sparse
LeetCode/0449.Serialize-And-Deserialize-Bst/Serialize-And-Deserialize-Bst.py
htingwang/HandsOnAlgoDS
train
12
9ad5d56a2414c2fd9cf81e60bf8ed5a2b460f87a
[ "self.class_ = 'd-block flex-wrap'\nsuper().__init__(**kwargs)\nself.planet_model = planet_model if planet_model else PlanetModel()\nself.btn = btn if btn else sw.Btn('Validate', small=True, class_='mr-1')\nself.alert = alert if alert else sw.Alert()\nself.w_username = sw.TextField(label=ms.planet.widget.username, ...
<|body_start_0|> self.class_ = 'd-block flex-wrap' super().__init__(**kwargs) self.planet_model = planet_model if planet_model else PlanetModel() self.btn = btn if btn else sw.Btn('Validate', small=True, class_='mr-1') self.alert = alert if alert else sw.Alert() self.w_us...
PlanetView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlanetView: def __init__(self, btn: Optional[sw.Btn]=None, alert: Optional[sw.Alert]=None, planet_model: Optional[PlanetModel]=None, info: bool=False, **kwargs): """Stand-alone interface to capture planet lab credentials. It also validate its subscription and connect to the client stored...
stack_v2_sparse_classes_36k_train_003575
4,677
permissive
[ { "docstring": "Stand-alone interface to capture planet lab credentials. It also validate its subscription and connect to the client stored in the model. Args: btn (sw.Btn, optional): Button to trigger the validation process in the associated model. alert (sw.Alert, v.Alert, optional): Alert component to displa...
4
stack_v2_sparse_classes_30k_test_001076
Implement the Python class `PlanetView` described below. Class description: Implement the PlanetView class. Method signatures and docstrings: - def __init__(self, btn: Optional[sw.Btn]=None, alert: Optional[sw.Alert]=None, planet_model: Optional[PlanetModel]=None, info: bool=False, **kwargs): Stand-alone interface to...
Implement the Python class `PlanetView` described below. Class description: Implement the PlanetView class. Method signatures and docstrings: - def __init__(self, btn: Optional[sw.Btn]=None, alert: Optional[sw.Alert]=None, planet_model: Optional[PlanetModel]=None, info: bool=False, **kwargs): Stand-alone interface to...
b26c7d698659d5c5a2029d02fc94dcd9daf0df98
<|skeleton|> class PlanetView: def __init__(self, btn: Optional[sw.Btn]=None, alert: Optional[sw.Alert]=None, planet_model: Optional[PlanetModel]=None, info: bool=False, **kwargs): """Stand-alone interface to capture planet lab credentials. It also validate its subscription and connect to the client stored...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlanetView: def __init__(self, btn: Optional[sw.Btn]=None, alert: Optional[sw.Alert]=None, planet_model: Optional[PlanetModel]=None, info: bool=False, **kwargs): """Stand-alone interface to capture planet lab credentials. It also validate its subscription and connect to the client stored in the model....
the_stack_v2_python_sparse
sepal_ui/planetapi/planet_view.py
12rambau/sepal_ui
train
17
5ad63ef887c802f16567ddf86cfdf1241e164389
[ "self.max_sequence_size = max_sequence_size\nself.pad_id = pad_id\nself.cut_sequence = cut_sequence", "seq_size = token.size(0)\nif self.cut_sequence is True:\n if seq_size > self.max_sequence_size:\n seq_size = self.max_sequence_size\nelse:\n assert seq_size <= self.max_sequence_size\npadded_token =...
<|body_start_0|> self.max_sequence_size = max_sequence_size self.pad_id = pad_id self.cut_sequence = cut_sequence <|end_body_0|> <|body_start_1|> seq_size = token.size(0) if self.cut_sequence is True: if seq_size > self.max_sequence_size: seq_size = s...
TokenPadding
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokenPadding: def __init__(self, max_sequence_size, pad_id=0, cut_sequence=False): """Pad to token Args: max_sequence_size (int): Sequence size after padding pad_id (int, default=0): Token id of <PAD> cut_sequence (bool): If True, when feature sequence is longer than max_sequence_size, c...
stack_v2_sparse_classes_36k_train_003576
1,226
no_license
[ { "docstring": "Pad to token Args: max_sequence_size (int): Sequence size after padding pad_id (int, default=0): Token id of <PAD> cut_sequence (bool): If True, when feature sequence is longer than max_sequence_size, cut the feature. If False, when feature sequence is longer than max_sequence_size, alert error....
2
stack_v2_sparse_classes_30k_train_021434
Implement the Python class `TokenPadding` described below. Class description: Implement the TokenPadding class. Method signatures and docstrings: - def __init__(self, max_sequence_size, pad_id=0, cut_sequence=False): Pad to token Args: max_sequence_size (int): Sequence size after padding pad_id (int, default=0): Toke...
Implement the Python class `TokenPadding` described below. Class description: Implement the TokenPadding class. Method signatures and docstrings: - def __init__(self, max_sequence_size, pad_id=0, cut_sequence=False): Pad to token Args: max_sequence_size (int): Sequence size after padding pad_id (int, default=0): Toke...
dc6fdb5ed4ee7746e731cbe449ce83a0831eb860
<|skeleton|> class TokenPadding: def __init__(self, max_sequence_size, pad_id=0, cut_sequence=False): """Pad to token Args: max_sequence_size (int): Sequence size after padding pad_id (int, default=0): Token id of <PAD> cut_sequence (bool): If True, when feature sequence is longer than max_sequence_size, c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TokenPadding: def __init__(self, max_sequence_size, pad_id=0, cut_sequence=False): """Pad to token Args: max_sequence_size (int): Sequence size after padding pad_id (int, default=0): Token id of <PAD> cut_sequence (bool): If True, when feature sequence is longer than max_sequence_size, cut the feature...
the_stack_v2_python_sparse
utils/token_transforms.py
robinstart/video2text_abr
train
5
558e0ed24330ec9dd2646cc760bddba35c849375
[ "super(EffectOnStatModAbility, self).__init__(name)\nself.effects = effects\nself.message = message", "messages = []\nif not selfInflicted:\n self.callEffects(user=pkmn)\n messages.append(self.message % pkmn.getHeader())\nreturn (degree, messages)" ]
<|body_start_0|> super(EffectOnStatModAbility, self).__init__(name) self.effects = effects self.message = message <|end_body_0|> <|body_start_1|> messages = [] if not selfInflicted: self.callEffects(user=pkmn) messages.append(self.message % pkmn.getHeader...
An ability that performs an effect on stat mod
EffectOnStatModAbility
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EffectOnStatModAbility: """An ability that performs an effect on stat mod""" def __init__(self, name, effects, message): """Builds the Ability""" <|body_0|> def onStatMod(self, pkmn, stat, degree, selfInflicted): """Perform when a stat is modded""" <|body...
stack_v2_sparse_classes_36k_train_003577
710
no_license
[ { "docstring": "Builds the Ability", "name": "__init__", "signature": "def __init__(self, name, effects, message)" }, { "docstring": "Perform when a stat is modded", "name": "onStatMod", "signature": "def onStatMod(self, pkmn, stat, degree, selfInflicted)" } ]
2
null
Implement the Python class `EffectOnStatModAbility` described below. Class description: An ability that performs an effect on stat mod Method signatures and docstrings: - def __init__(self, name, effects, message): Builds the Ability - def onStatMod(self, pkmn, stat, degree, selfInflicted): Perform when a stat is mod...
Implement the Python class `EffectOnStatModAbility` described below. Class description: An ability that performs an effect on stat mod Method signatures and docstrings: - def __init__(self, name, effects, message): Builds the Ability - def onStatMod(self, pkmn, stat, degree, selfInflicted): Perform when a stat is mod...
3931eee5fd04e18bb1738a0b27a4c6979dc4db01
<|skeleton|> class EffectOnStatModAbility: """An ability that performs an effect on stat mod""" def __init__(self, name, effects, message): """Builds the Ability""" <|body_0|> def onStatMod(self, pkmn, stat, degree, selfInflicted): """Perform when a stat is modded""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EffectOnStatModAbility: """An ability that performs an effect on stat mod""" def __init__(self, name, effects, message): """Builds the Ability""" super(EffectOnStatModAbility, self).__init__(name) self.effects = effects self.message = message def onStatMod(self, pkmn,...
the_stack_v2_python_sparse
src/Pokemon/Abilities/effecton_statmod_ability.py
sgtnourry/Pokemon-Project
train
0
045900bf89057e4fae9a7a2120d5c3e602de28d0
[ "super().__init__()\nself.left = left\nself.right = right\nself.op = op", "right = self.right.make_il(il_code, symbol_table, c)\nlvalue = self.left.lvalue(il_code, symbol_table, c)\nif lvalue and lvalue.modable():\n return lvalue.set_to(right, il_code, self.op.r)\nelse:\n err = \"expression on left of '=' i...
<|body_start_0|> super().__init__() self.left = left self.right = right self.op = op <|end_body_0|> <|body_start_1|> right = self.right.make_il(il_code, symbol_table, c) lvalue = self.left.lvalue(il_code, symbol_table, c) if lvalue and lvalue.modable(): ...
Expression that is an assignment.
Equals
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Equals: """Expression that is an assignment.""" def __init__(self, left, right, op): """Initialize node.""" <|body_0|> def make_il(self, il_code, symbol_table, c): """Make code for this node.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super...
stack_v2_sparse_classes_36k_train_003578
45,651
permissive
[ { "docstring": "Initialize node.", "name": "__init__", "signature": "def __init__(self, left, right, op)" }, { "docstring": "Make code for this node.", "name": "make_il", "signature": "def make_il(self, il_code, symbol_table, c)" } ]
2
stack_v2_sparse_classes_30k_train_011582
Implement the Python class `Equals` described below. Class description: Expression that is an assignment. Method signatures and docstrings: - def __init__(self, left, right, op): Initialize node. - def make_il(self, il_code, symbol_table, c): Make code for this node.
Implement the Python class `Equals` described below. Class description: Expression that is an assignment. Method signatures and docstrings: - def __init__(self, left, right, op): Initialize node. - def make_il(self, il_code, symbol_table, c): Make code for this node. <|skeleton|> class Equals: """Expression that...
6232136be38a29e8c18beae3d23e49ecfb7906fd
<|skeleton|> class Equals: """Expression that is an assignment.""" def __init__(self, left, right, op): """Initialize node.""" <|body_0|> def make_il(self, il_code, symbol_table, c): """Make code for this node.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Equals: """Expression that is an assignment.""" def __init__(self, left, right, op): """Initialize node.""" super().__init__() self.left = left self.right = right self.op = op def make_il(self, il_code, symbol_table, c): """Make code for this node.""" ...
the_stack_v2_python_sparse
shivyc/tree/expr_nodes.py
ShivamSarodia/ShivyC
train
1,072
023292b9fd8e567eb781900ff1ec017b0542fc97
[ "logger.info('load trainset from %s' % path)\nmode = TaskMode.create_train()\nreturn self._parse_creator(path, mode)", "logger.info('load testset from %s' % path)\nmode = TaskMode.create_test()\nreturn self._parse_creator(path, mode)", "logger.info('load inferset from %s' % path)\nmode = TaskMode.create_infer()...
<|body_start_0|> logger.info('load trainset from %s' % path) mode = TaskMode.create_train() return self._parse_creator(path, mode) <|end_body_0|> <|body_start_1|> logger.info('load testset from %s' % path) mode = TaskMode.create_test() return self._parse_creator(path, mo...
Dataset
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: def train(self, path): """Load trainset.""" <|body_0|> def test(self, path): """Load testset.""" <|body_1|> def infer(self, path): """Load infer set.""" <|body_2|> def _parse_creator(self, path, mode): """Parse datas...
stack_v2_sparse_classes_36k_train_003579
1,947
permissive
[ { "docstring": "Load trainset.", "name": "train", "signature": "def train(self, path)" }, { "docstring": "Load testset.", "name": "test", "signature": "def test(self, path)" }, { "docstring": "Load infer set.", "name": "infer", "signature": "def infer(self, path)" }, ...
4
null
Implement the Python class `Dataset` described below. Class description: Implement the Dataset class. Method signatures and docstrings: - def train(self, path): Load trainset. - def test(self, path): Load testset. - def infer(self, path): Load infer set. - def _parse_creator(self, path, mode): Parse dataset.
Implement the Python class `Dataset` described below. Class description: Implement the Dataset class. Method signatures and docstrings: - def train(self, path): Load trainset. - def test(self, path): Load testset. - def infer(self, path): Load infer set. - def _parse_creator(self, path, mode): Parse dataset. <|skele...
420527996b6da60ca401717a734329f126ed0680
<|skeleton|> class Dataset: def train(self, path): """Load trainset.""" <|body_0|> def test(self, path): """Load testset.""" <|body_1|> def infer(self, path): """Load infer set.""" <|body_2|> def _parse_creator(self, path, mode): """Parse datas...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataset: def train(self, path): """Load trainset.""" logger.info('load trainset from %s' % path) mode = TaskMode.create_train() return self._parse_creator(path, mode) def test(self, path): """Load testset.""" logger.info('load testset from %s' % path) ...
the_stack_v2_python_sparse
legacy/ctr/reader.py
chenbjin/models
train
3
46bd49f9fba63ef62991e2ff3c465c8048967684
[ "product = product_db.Product.get_by_key_name(product_id)\nif not product:\n self.error(httplib.NOT_FOUND)\n return\nif not client_id:\n clients = client_db.Client.all()\n clients.ancestor(product)\n clients_result = []\n for client in clients:\n clients_result.append({'client_id': client.k...
<|body_start_0|> product = product_db.Product.get_by_key_name(product_id) if not product: self.error(httplib.NOT_FOUND) return if not client_id: clients = client_db.Client.all() clients.ancestor(product) clients_result = [] ...
A class to handle creating, reading, updating and deleting clients. Handles GET, POST, PUT and DELETE requests for /clients/<product>/ and /clients/<product>/<client>. All functions have the same signature, even though they may not use all the parameters, so that a single route can be used for the handler.
ClientHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientHandler: """A class to handle creating, reading, updating and deleting clients. Handles GET, POST, PUT and DELETE requests for /clients/<product>/ and /clients/<product>/<client>. All functions have the same signature, even though they may not use all the parameters, so that a single route ...
stack_v2_sparse_classes_36k_train_003580
5,848
no_license
[ { "docstring": "Responds with information about all clients or a specific client. /clients/<product>/ Responds with a JSON encoded object that contains a list of client IDs for the given product. /clients/<product>/<client> Responds with a JSON encoded object of the product ID, client ID, description and child ...
4
stack_v2_sparse_classes_30k_train_017371
Implement the Python class `ClientHandler` described below. Class description: A class to handle creating, reading, updating and deleting clients. Handles GET, POST, PUT and DELETE requests for /clients/<product>/ and /clients/<product>/<client>. All functions have the same signature, even though they may not use all ...
Implement the Python class `ClientHandler` described below. Class description: A class to handle creating, reading, updating and deleting clients. Handles GET, POST, PUT and DELETE requests for /clients/<product>/ and /clients/<product>/<client>. All functions have the same signature, even though they may not use all ...
4fe608d3225f38e765928c137214428cb60c3cd1
<|skeleton|> class ClientHandler: """A class to handle creating, reading, updating and deleting clients. Handles GET, POST, PUT and DELETE requests for /clients/<product>/ and /clients/<product>/<client>. All functions have the same signature, even though they may not use all the parameters, so that a single route ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClientHandler: """A class to handle creating, reading, updating and deleting clients. Handles GET, POST, PUT and DELETE requests for /clients/<product>/ and /clients/<product>/<client>. All functions have the same signature, even though they may not use all the parameters, so that a single route can be used f...
the_stack_v2_python_sparse
syzygy/dashboard/handler/client.py
TheRyuu/sawbuck
train
4
94634b0729a07fe5baedd13edede14b272dc39d5
[ "if view.action in ['change_status']:\n return request.user.StaffProfileID.Name == 'Vente'\nreturn True", "if view.action in ['change_status']:\n return request.user in obj.get_staff_contact()\nreturn True" ]
<|body_start_0|> if view.action in ['change_status']: return request.user.StaffProfileID.Name == 'Vente' return True <|end_body_0|> <|body_start_1|> if view.action in ['change_status']: return request.user in obj.get_staff_contact() return True <|end_body_1|>
Permission checking if the staff contact.
IsStaffContact
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsStaffContact: """Permission checking if the staff contact.""" def has_permission(self, request, view): """Check the object permission.""" <|body_0|> def has_object_permission(self, request, view, obj): """Check the object permission.""" <|body_1|> <|en...
stack_v2_sparse_classes_36k_train_003581
3,875
no_license
[ { "docstring": "Check the object permission.", "name": "has_permission", "signature": "def has_permission(self, request, view)" }, { "docstring": "Check the object permission.", "name": "has_object_permission", "signature": "def has_object_permission(self, request, view, obj)" } ]
2
stack_v2_sparse_classes_30k_val_000279
Implement the Python class `IsStaffContact` described below. Class description: Permission checking if the staff contact. Method signatures and docstrings: - def has_permission(self, request, view): Check the object permission. - def has_object_permission(self, request, view, obj): Check the object permission.
Implement the Python class `IsStaffContact` described below. Class description: Permission checking if the staff contact. Method signatures and docstrings: - def has_permission(self, request, view): Check the object permission. - def has_object_permission(self, request, view, obj): Check the object permission. <|ske...
b76df0d62fc56e3c668827b18f0cce61124f0d53
<|skeleton|> class IsStaffContact: """Permission checking if the staff contact.""" def has_permission(self, request, view): """Check the object permission.""" <|body_0|> def has_object_permission(self, request, view, obj): """Check the object permission.""" <|body_1|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IsStaffContact: """Permission checking if the staff contact.""" def has_permission(self, request, view): """Check the object permission.""" if view.action in ['change_status']: return request.user.StaffProfileID.Name == 'Vente' return True def has_object_permissio...
the_stack_v2_python_sparse
settings/permissions.py
FortranVBA/DAP12
train
0
d3780d70e5a147f2bb59781c3b19ccfac1c3c115
[ "self.run_name = run_name\nself.experiments = experiments\nself.experiment_suffix = ''\nself.experiment_arg_name = experiment_arg_name\nself.experiment_dir_arg_name = experiment_dir_arg_name\nself.customize_experiment_name = customize_experiment_name\nself.param_prefix = param_prefix", "for experiment in self.exp...
<|body_start_0|> self.run_name = run_name self.experiments = experiments self.experiment_suffix = '' self.experiment_arg_name = experiment_arg_name self.experiment_dir_arg_name = experiment_dir_arg_name self.customize_experiment_name = customize_experiment_name se...
RunDescription
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunDescription: def __init__(self, run_name, experiments, experiment_arg_name='--experiment', experiment_dir_arg_name='--train_dir', customize_experiment_name=True, param_prefix='--'): """:param run_name: overall name of the experiment and the name of the root folder :param experiments: ...
stack_v2_sparse_classes_36k_train_003582
7,490
permissive
[ { "docstring": ":param run_name: overall name of the experiment and the name of the root folder :param experiments: a list of Experiment objects to run :param experiment_arg_name: CLI argument of the underlying experiment that determines it's unique name to be generated by the launcher. Default: --experiment :p...
2
stack_v2_sparse_classes_30k_train_020140
Implement the Python class `RunDescription` described below. Class description: Implement the RunDescription class. Method signatures and docstrings: - def __init__(self, run_name, experiments, experiment_arg_name='--experiment', experiment_dir_arg_name='--train_dir', customize_experiment_name=True, param_prefix='--'...
Implement the Python class `RunDescription` described below. Class description: Implement the RunDescription class. Method signatures and docstrings: - def __init__(self, run_name, experiments, experiment_arg_name='--experiment', experiment_dir_arg_name='--train_dir', customize_experiment_name=True, param_prefix='--'...
7e1e69550f4de4cdc003d8db5bb39e186803aee9
<|skeleton|> class RunDescription: def __init__(self, run_name, experiments, experiment_arg_name='--experiment', experiment_dir_arg_name='--train_dir', customize_experiment_name=True, param_prefix='--'): """:param run_name: overall name of the experiment and the name of the root folder :param experiments: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunDescription: def __init__(self, run_name, experiments, experiment_arg_name='--experiment', experiment_dir_arg_name='--train_dir', customize_experiment_name=True, param_prefix='--'): """:param run_name: overall name of the experiment and the name of the root folder :param experiments: a list of Expe...
the_stack_v2_python_sparse
sample_factory/launcher/run_description.py
alex-petrenko/sample-factory
train
644
63e1559c61f444ba44b65cb865dbcc3952a36d60
[ "self.msp = dict(host=config['MySQL']['host'], port=int(config['MySQL']['port']), user=config['MySQL']['user'], passwd=config['MySQL']['passwd'], db=config['MySQL']['db'])\nself.conn = pymysql.connect(**self.msp)\nself.cur = self.conn.cursor(pymysql.cursors.DictCursor)", "db = self.msp['db']\nuser = self.msp['use...
<|body_start_0|> self.msp = dict(host=config['MySQL']['host'], port=int(config['MySQL']['port']), user=config['MySQL']['user'], passwd=config['MySQL']['passwd'], db=config['MySQL']['db']) self.conn = pymysql.connect(**self.msp) self.cur = self.conn.cursor(pymysql.cursors.DictCursor) <|end_body_0...
This class consolidates a number of Database utilities for mySql, such as rebuild of the database or rebuild of a specific table.
mysqlUtils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mysqlUtils: """This class consolidates a number of Database utilities for mySql, such as rebuild of the database or rebuild of a specific table.""" def __init__(self, config): """The init procedure will set-up Connection to the Database Server. :param config: Link to the configuratio...
stack_v2_sparse_classes_36k_train_003583
23,547
no_license
[ { "docstring": "The init procedure will set-up Connection to the Database Server. :param config: Link to the configuration object.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "This function will drop and recreate the database. Then it will call SQLAlchemy to...
2
null
Implement the Python class `mysqlUtils` described below. Class description: This class consolidates a number of Database utilities for mySql, such as rebuild of the database or rebuild of a specific table. Method signatures and docstrings: - def __init__(self, config): The init procedure will set-up Connection to the...
Implement the Python class `mysqlUtils` described below. Class description: This class consolidates a number of Database utilities for mySql, such as rebuild of the database or rebuild of a specific table. Method signatures and docstrings: - def __init__(self, config): The init procedure will set-up Connection to the...
7725ebc01b3b981897f018a5e81bfd8a62dea11d
<|skeleton|> class mysqlUtils: """This class consolidates a number of Database utilities for mySql, such as rebuild of the database or rebuild of a specific table.""" def __init__(self, config): """The init procedure will set-up Connection to the Database Server. :param config: Link to the configuratio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class mysqlUtils: """This class consolidates a number of Database utilities for mySql, such as rebuild of the database or rebuild of a specific table.""" def __init__(self, config): """The init procedure will set-up Connection to the Database Server. :param config: Link to the configuration object.""" ...
the_stack_v2_python_sparse
lib/localstore.py
dirkhpe/bv
train
0
44ea795864673761fd463e40f0c9b58c594c0631
[ "self.dim = dim\nself.palette = palette\nself.sin = sin\nself.width = dim[0]\nself.height = dim[1]\nself.pixel_surface = pygame.Surface((dim[0] * 2, dim[1] * 2))\ncenter = (dim[0], dim[1])\nfor y in range(self.pixel_surface.get_height()):\n for x in range(self.pixel_surface.get_width()):\n x_dist = x - ce...
<|body_start_0|> self.dim = dim self.palette = palette self.sin = sin self.width = dim[0] self.height = dim[1] self.pixel_surface = pygame.Surface((dim[0] * 2, dim[1] * 2)) center = (dim[0], dim[1]) for y in range(self.pixel_surface.get_height()): ...
interfering circles
CircleInterference
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CircleInterference: """interfering circles""" def __init__(self, dim, palette=PALETTE, sin=SIN): """(pygame.Surface) surface - surface to draw on :param dim: dimesion of surface to generate in (x, y) :param palette: 256 color palette""" <|body_0|> def update(self): ...
stack_v2_sparse_classes_36k_train_003584
5,041
no_license
[ { "docstring": "(pygame.Surface) surface - surface to draw on :param dim: dimesion of surface to generate in (x, y) :param palette: 256 color palette", "name": "__init__", "signature": "def __init__(self, dim, palette=PALETTE, sin=SIN)" }, { "docstring": "blit on background surface", "name":...
2
stack_v2_sparse_classes_30k_train_003993
Implement the Python class `CircleInterference` described below. Class description: interfering circles Method signatures and docstrings: - def __init__(self, dim, palette=PALETTE, sin=SIN): (pygame.Surface) surface - surface to draw on :param dim: dimesion of surface to generate in (x, y) :param palette: 256 color p...
Implement the Python class `CircleInterference` described below. Class description: interfering circles Method signatures and docstrings: - def __init__(self, dim, palette=PALETTE, sin=SIN): (pygame.Surface) surface - surface to draw on :param dim: dimesion of surface to generate in (x, y) :param palette: 256 color p...
1fd421195a2888c0588a49f5a043a1110eedcdbf
<|skeleton|> class CircleInterference: """interfering circles""" def __init__(self, dim, palette=PALETTE, sin=SIN): """(pygame.Surface) surface - surface to draw on :param dim: dimesion of surface to generate in (x, y) :param palette: 256 color palette""" <|body_0|> def update(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CircleInterference: """interfering circles""" def __init__(self, dim, palette=PALETTE, sin=SIN): """(pygame.Surface) surface - surface to draw on :param dim: dimesion of surface to generate in (x, y) :param palette: 256 color palette""" self.dim = dim self.palette = palette ...
the_stack_v2_python_sparse
effects/Interference.py
gunny26/pygame
train
5
9b73c17c9b10bcc2f777a8ab1c07abc053f02a42
[ "identifier = identifiers.primary_identifier\nfor required_perm in permission_s:\n required_permission = CaseSensitivePermission(wildcard_string=required_perm)\n domain = next(iter(required_permission.domain))\n assigned_permission_s = self.get_authzd_permissions(identifier, domain)\n is_permitted = Fal...
<|body_start_0|> identifier = identifiers.primary_identifier for required_perm in permission_s: required_permission = CaseSensitivePermission(wildcard_string=required_perm) domain = next(iter(required_permission.domain)) assigned_permission_s = self.get_authzd_permiss...
Customized version of hte default AccountStoreRealm. This is required to get case-sensitive permission behavior, which is not supported by default.
AnchoreNativeRealm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnchoreNativeRealm: """Customized version of hte default AccountStoreRealm. This is required to get case-sensitive permission behavior, which is not supported by default.""" def is_permitted(self, identifiers, permission_s): """If the authorization info cannot be obtained from the ac...
stack_v2_sparse_classes_36k_train_003585
7,371
permissive
[ { "docstring": "If the authorization info cannot be obtained from the accountstore, permission check tuple yields False. :type identifiers: subject_abcs.IdentifierCollection :param permission_s: a collection of one or more permissions, represented as string-based permissions or Permission objects and NEVER comi...
2
stack_v2_sparse_classes_30k_train_012990
Implement the Python class `AnchoreNativeRealm` described below. Class description: Customized version of hte default AccountStoreRealm. This is required to get case-sensitive permission behavior, which is not supported by default. Method signatures and docstrings: - def is_permitted(self, identifiers, permission_s):...
Implement the Python class `AnchoreNativeRealm` described below. Class description: Customized version of hte default AccountStoreRealm. This is required to get case-sensitive permission behavior, which is not supported by default. Method signatures and docstrings: - def is_permitted(self, identifiers, permission_s):...
0f3c2a381febe1ab82918014fc421a54dedcdaeb
<|skeleton|> class AnchoreNativeRealm: """Customized version of hte default AccountStoreRealm. This is required to get case-sensitive permission behavior, which is not supported by default.""" def is_permitted(self, identifiers, permission_s): """If the authorization info cannot be obtained from the ac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnchoreNativeRealm: """Customized version of hte default AccountStoreRealm. This is required to get case-sensitive permission behavior, which is not supported by default.""" def is_permitted(self, identifiers, permission_s): """If the authorization info cannot be obtained from the accountstore, p...
the_stack_v2_python_sparse
anchore_engine/subsys/auth/realms.py
rkhozinov/anchore-engine
train
1
a838ba2ec4eeee88d4ef923642bc267dfc1ce4f7
[ "super().__init__(model_data, batch_size, batch_strategy, shuffle)\nif isinstance(batch_size, list):\n logger.debug('The provided batch size is a list, this data generator will use a linear increasing batch size.')\nself._epochs = epochs\nself._current_epoch = -1\nself._current_batch_size = 0\nself._data: Data =...
<|body_start_0|> super().__init__(model_data, batch_size, batch_strategy, shuffle) if isinstance(batch_size, list): logger.debug('The provided batch size is a list, this data generator will use a linear increasing batch size.') self._epochs = epochs self._current_epoch = -1 ...
Data generator with an optional increasing batch size.
RasaBatchDataGenerator
[ "LicenseRef-scancode-generic-cla", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RasaBatchDataGenerator: """Data generator with an optional increasing batch size.""" def __init__(self, model_data: RasaModelData, batch_size: Union[List[int], int], epochs: int=1, batch_strategy: Text=SEQUENCE, shuffle: bool=True): """Initializes the increasing batch size data gener...
stack_v2_sparse_classes_36k_train_003586
15,526
permissive
[ { "docstring": "Initializes the increasing batch size data generator. Args: model_data: The model data to use. batch_size: The batch size. epochs: The total number of epochs. batch_strategy: The batch strategy. shuffle: If 'True', data will be shuffled.", "name": "__init__", "signature": "def __init__(s...
5
null
Implement the Python class `RasaBatchDataGenerator` described below. Class description: Data generator with an optional increasing batch size. Method signatures and docstrings: - def __init__(self, model_data: RasaModelData, batch_size: Union[List[int], int], epochs: int=1, batch_strategy: Text=SEQUENCE, shuffle: boo...
Implement the Python class `RasaBatchDataGenerator` described below. Class description: Data generator with an optional increasing batch size. Method signatures and docstrings: - def __init__(self, model_data: RasaModelData, batch_size: Union[List[int], int], epochs: int=1, batch_strategy: Text=SEQUENCE, shuffle: boo...
50857610bdf0c26dc61f3203a6cbb4bcf193768c
<|skeleton|> class RasaBatchDataGenerator: """Data generator with an optional increasing batch size.""" def __init__(self, model_data: RasaModelData, batch_size: Union[List[int], int], epochs: int=1, batch_strategy: Text=SEQUENCE, shuffle: bool=True): """Initializes the increasing batch size data gener...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RasaBatchDataGenerator: """Data generator with an optional increasing batch size.""" def __init__(self, model_data: RasaModelData, batch_size: Union[List[int], int], epochs: int=1, batch_strategy: Text=SEQUENCE, shuffle: bool=True): """Initializes the increasing batch size data generator. Args: m...
the_stack_v2_python_sparse
rasa/utils/tensorflow/data_generator.py
RasaHQ/rasa
train
13,167
017c1262c297ecd645b8fb56c09a3f44b2834bc1
[ "if not grid:\n return 0\nrow = len(grid)\ncol = len(grid[0])\ndp = [[0 for i in range(col)] for i in range(row)]\ndp[0][0] = grid[0][0]\nfor i in range(1, col):\n dp[0][i] = dp[0][i - 1] + grid[0][i]\nfor i in range(1, row):\n dp[i][0] = dp[i - 1][0] + grid[i][0]\nfor i in range(1, row):\n for j in ran...
<|body_start_0|> if not grid: return 0 row = len(grid) col = len(grid[0]) dp = [[0 for i in range(col)] for i in range(row)] dp[0][0] = grid[0][0] for i in range(1, col): dp[0][i] = dp[0][i - 1] + grid[0][i] for i in range(1, row): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minPathSum(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def minPathSum_self(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not grid: retur...
stack_v2_sparse_classes_36k_train_003587
1,276
no_license
[ { "docstring": ":type grid: List[List[int]] :rtype: int", "name": "minPathSum", "signature": "def minPathSum(self, grid)" }, { "docstring": ":type grid: List[List[int]] :rtype: int", "name": "minPathSum_self", "signature": "def minPathSum_self(self, grid)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, grid): :type grid: List[List[int]] :rtype: int - def minPathSum_self(self, grid): :type grid: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, grid): :type grid: List[List[int]] :rtype: int - def minPathSum_self(self, grid): :type grid: List[List[int]] :rtype: int <|skeleton|> class Solution: ...
ea492ec864b50547214ecbbb2cdeeac21e70229b
<|skeleton|> class Solution: def minPathSum(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def minPathSum_self(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minPathSum(self, grid): """:type grid: List[List[int]] :rtype: int""" if not grid: return 0 row = len(grid) col = len(grid[0]) dp = [[0 for i in range(col)] for i in range(row)] dp[0][0] = grid[0][0] for i in range(1, col): ...
the_stack_v2_python_sparse
64_minimum_path_sum/sol.py
lianke123321/leetcode_sol
train
0
5827242b1c8b8732d4d5853479238a16e0236865
[ "unique = set()\ncurr = copy = ListNode(0)\nwhile head:\n if head.val not in unique:\n print(unique, curr.val, head.val)\n curr.next = ListNode(head.val)\n curr = curr.next\n unique.add(head.val)\n head = head.next\nreturn copy.next", "memo = set()\ncopy = head\npre = ListNode(0)\npr...
<|body_start_0|> unique = set() curr = copy = ListNode(0) while head: if head.val not in unique: print(unique, curr.val, head.val) curr.next = ListNode(head.val) curr = curr.next unique.add(head.val) head = head....
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> unique = set() curr...
stack_v2_sparse_classes_36k_train_003588
1,644
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "deleteDuplicates", "signature": "def deleteDuplicates(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "deleteDuplicates", "signature": "def deleteDuplicates(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: ...
f3fc71f344cd758cfce77f16ab72992c99ab288e
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" unique = set() curr = copy = ListNode(0) while head: if head.val not in unique: print(unique, curr.val, head.val) curr.next = ListNode(head.val) ...
the_stack_v2_python_sparse
83_deleteDuplicates.py
jennyChing/leetCode
train
2
a9369f7752b7c0accd4a25ed8cfbcfc03752e92c
[ "self.machines = []\nself.numberOfCranes = 0\nself.craneMoveTime = 0\nself.zincBreakTime = 0", "plant = Plant()\nelement = xmlDoc.getElementsByTagName('plant')\nassert len(element) == 1\nelement = element[0]\nplant.zincBreakTime = int(element.getAttribute('zincBreakTime'))\nplant.craneMoveTime = int(element.getAt...
<|body_start_0|> self.machines = [] self.numberOfCranes = 0 self.craneMoveTime = 0 self.zincBreakTime = 0 <|end_body_0|> <|body_start_1|> plant = Plant() element = xmlDoc.getElementsByTagName('plant') assert len(element) == 1 element = element[0] ...
Provides the implementation of a Plant (factory) with a list of Machine instances.
Plant
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Plant: """Provides the implementation of a Plant (factory) with a list of Machine instances.""" def __init__(self): """machines is a list of ordered Machine instances (by sequence in Plant). minProcTime is the minimum (constant) processing time for any Order going through the Plant. ...
stack_v2_sparse_classes_36k_train_003589
2,021
permissive
[ { "docstring": "machines is a list of ordered Machine instances (by sequence in Plant). minProcTime is the minimum (constant) processing time for any Order going through the Plant. This is the summation of all the times between every two Machine instances in the Plant.", "name": "__init__", "signature":...
4
null
Implement the Python class `Plant` described below. Class description: Provides the implementation of a Plant (factory) with a list of Machine instances. Method signatures and docstrings: - def __init__(self): machines is a list of ordered Machine instances (by sequence in Plant). minProcTime is the minimum (constant...
Implement the Python class `Plant` described below. Class description: Provides the implementation of a Plant (factory) with a list of Machine instances. Method signatures and docstrings: - def __init__(self): machines is a list of ordered Machine instances (by sequence in Plant). minProcTime is the minimum (constant...
36d5891a959cfc83f9eeef003b4e0b574dd7d7e1
<|skeleton|> class Plant: """Provides the implementation of a Plant (factory) with a list of Machine instances.""" def __init__(self): """machines is a list of ordered Machine instances (by sequence in Plant). minProcTime is the minimum (constant) processing time for any Order going through the Plant. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Plant: """Provides the implementation of a Plant (factory) with a list of Machine instances.""" def __init__(self): """machines is a list of ordered Machine instances (by sequence in Plant). minProcTime is the minimum (constant) processing time for any Order going through the Plant. This is the s...
the_stack_v2_python_sparse
Projects/PlantMaker/plantmaker-2/src/plant/plant.py
fredmorcos/attic
train
4
6fd1dbbaca8dc84007b0cecde498aff826d53f26
[ "if torch.cuda.is_available():\n device = torch.device('cuda')\nelse:\n device = torch.device('cpu')\nnot_A = (~torch.eq(cell_label.reshape(-1, 1), cell_label.reshape(1, -1))).float().to(device)\nBETA = torch.tensor(0.1).to(device)\nnot_A = (~torch.eq(cell_label.reshape(-1, 1), cell_label.reshape(1, -1))).flo...
<|body_start_0|> if torch.cuda.is_available(): device = torch.device('cuda') else: device = torch.device('cpu') not_A = (~torch.eq(cell_label.reshape(-1, 1), cell_label.reshape(1, -1))).float().to(device) BETA = torch.tensor(0.1).to(device) not_A = (~torch...
NodeHomophily
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeHomophily: def forward(ctx, input, cell_label): """In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use the context object to cache objects for use in the backward pass. Specifically, ctx is a...
stack_v2_sparse_classes_36k_train_003590
12,276
permissive
[ { "docstring": "In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use the context object to cache objects for use in the backward pass. Specifically, ctx is a context object that can be used to stash information for backw...
2
stack_v2_sparse_classes_30k_train_019642
Implement the Python class `NodeHomophily` described below. Class description: Implement the NodeHomophily class. Method signatures and docstrings: - def forward(ctx, input, cell_label): In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, a...
Implement the Python class `NodeHomophily` described below. Class description: Implement the NodeHomophily class. Method signatures and docstrings: - def forward(ctx, input, cell_label): In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, a...
4d56d5174c7ce4b15157d112083eb92e57288b04
<|skeleton|> class NodeHomophily: def forward(ctx, input, cell_label): """In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use the context object to cache objects for use in the backward pass. Specifically, ctx is a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NodeHomophily: def forward(ctx, input, cell_label): """In the forward pass we receive a context object and a Tensor containing the input; we must return a Tensor containing the output, and we can use the context object to cache objects for use in the backward pass. Specifically, ctx is a context objec...
the_stack_v2_python_sparse
MultiDCP/models/loss_utils.py
qiaoliuhub/MultiDCP
train
3
8e51d2c74dde536203c5c9ae13e5cd4376c14322
[ "user = request.user\nif self._should_redirect(request, user):\n return TOSPage.as_view()(request, *view_args, **view_kwarg)\nelse:\n return None", "if request.method != 'GET' or user.is_anonymous() or any((request.path.startswith(p) for p in self.UNPROTECTED_PATHS)):\n return False\naccepted_tos = reque...
<|body_start_0|> user = request.user if self._should_redirect(request, user): return TOSPage.as_view()(request, *view_args, **view_kwarg) else: return None <|end_body_0|> <|body_start_1|> if request.method != 'GET' or user.is_anonymous() or any((request.path.star...
ElvisTermsOfServiceMiddleware
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElvisTermsOfServiceMiddleware: def process_view(self, request, view_func, view_args, view_kwarg): """Redirect request to TOS page if user has not accepted yet.""" <|body_0|> def _should_redirect(self, request, user): """Figure out if user should be redirected to TOS ...
stack_v2_sparse_classes_36k_train_003591
1,219
no_license
[ { "docstring": "Redirect request to TOS page if user has not accepted yet.", "name": "process_view", "signature": "def process_view(self, request, view_func, view_args, view_kwarg)" }, { "docstring": "Figure out if user should be redirected to TOS screen.", "name": "_should_redirect", "s...
2
null
Implement the Python class `ElvisTermsOfServiceMiddleware` described below. Class description: Implement the ElvisTermsOfServiceMiddleware class. Method signatures and docstrings: - def process_view(self, request, view_func, view_args, view_kwarg): Redirect request to TOS page if user has not accepted yet. - def _sho...
Implement the Python class `ElvisTermsOfServiceMiddleware` described below. Class description: Implement the ElvisTermsOfServiceMiddleware class. Method signatures and docstrings: - def process_view(self, request, view_func, view_args, view_kwarg): Redirect request to TOS page if user has not accepted yet. - def _sho...
3df64dd8d257af33984fe133be0e4170330a713a
<|skeleton|> class ElvisTermsOfServiceMiddleware: def process_view(self, request, view_func, view_args, view_kwarg): """Redirect request to TOS page if user has not accepted yet.""" <|body_0|> def _should_redirect(self, request, user): """Figure out if user should be redirected to TOS ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElvisTermsOfServiceMiddleware: def process_view(self, request, view_func, view_args, view_kwarg): """Redirect request to TOS page if user has not accepted yet.""" user = request.user if self._should_redirect(request, user): return TOSPage.as_view()(request, *view_args, **vi...
the_stack_v2_python_sparse
elvis/middleware/terms_of_service.py
ELVIS-Project/elvis-database
train
15
0d76b5f9715bf14e6c439a8fe2f963f4bee9a02c
[ "self.rotation_factor = rotation_factor\nself.border_value = border_value\nself.fill_label = fill_label", "_rotation = random.uniform(*self.rotation_factor)\ntmp_h, tmp_w = image.shape[:2]\nrotate_mat = cv2.getRotationMatrix2D((tmp_w / 2, tmp_h / 2), _rotation, 1)\nreturn (cv2.warpAffine(image, rotate_mat, (tmp_w...
<|body_start_0|> self.rotation_factor = rotation_factor self.border_value = border_value self.fill_label = fill_label <|end_body_0|> <|body_start_1|> _rotation = random.uniform(*self.rotation_factor) tmp_h, tmp_w = image.shape[:2] rotate_mat = cv2.getRotationMatrix2D((tm...
Random rotate image and label.
RandomRotate_pair
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomRotate_pair: """Random rotate image and label.""" def __init__(self, rotation_factor, border_value, fill_label=0): """Construct RandomRotate_pair class. :param rotation_factor: range of rotate degree :param border_value: value of padded border in image :param fill_label: value ...
stack_v2_sparse_classes_36k_train_003592
1,942
permissive
[ { "docstring": "Construct RandomRotate_pair class. :param rotation_factor: range of rotate degree :param border_value: value of padded border in image :param fill_label: value of the padded border in label", "name": "__init__", "signature": "def __init__(self, rotation_factor, border_value, fill_label=0...
2
stack_v2_sparse_classes_30k_val_000914
Implement the Python class `RandomRotate_pair` described below. Class description: Random rotate image and label. Method signatures and docstrings: - def __init__(self, rotation_factor, border_value, fill_label=0): Construct RandomRotate_pair class. :param rotation_factor: range of rotate degree :param border_value: ...
Implement the Python class `RandomRotate_pair` described below. Class description: Random rotate image and label. Method signatures and docstrings: - def __init__(self, rotation_factor, border_value, fill_label=0): Construct RandomRotate_pair class. :param rotation_factor: range of rotate degree :param border_value: ...
12e37a1991eb6771a2999fe0a46ddda920c47948
<|skeleton|> class RandomRotate_pair: """Random rotate image and label.""" def __init__(self, rotation_factor, border_value, fill_label=0): """Construct RandomRotate_pair class. :param rotation_factor: range of rotate degree :param border_value: value of padded border in image :param fill_label: value ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomRotate_pair: """Random rotate image and label.""" def __init__(self, rotation_factor, border_value, fill_label=0): """Construct RandomRotate_pair class. :param rotation_factor: range of rotate degree :param border_value: value of padded border in image :param fill_label: value of the padded...
the_stack_v2_python_sparse
vega/datasets/transforms/RandomRotate_pair.py
huawei-noah/vega
train
850
d96f2c9b00935dff866ce53f4ca31782a9d4f01b
[ "if rowIndex == 0:\n return [1]\nif rowIndex == 1:\n return [1, 1]\nres = [1 for i in range(rowIndex + 1)]\nfor i in range(2, rowIndex + 1):\n for j in range(i - 1, 0, -1):\n res[j] = res[j - 1] + res[j]\nreturn res", "row = [1]\nfor _ in range(rowIndex):\n row = [x + y for x, y in zip([0] + ro...
<|body_start_0|> if rowIndex == 0: return [1] if rowIndex == 1: return [1, 1] res = [1 for i in range(rowIndex + 1)] for i in range(2, rowIndex + 1): for j in range(i - 1, 0, -1): res[j] = res[j - 1] + res[j] return res <|end_bo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_0|> def getRow2(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if rowIndex == 0: return [...
stack_v2_sparse_classes_36k_train_003593
658
no_license
[ { "docstring": ":type rowIndex: int :rtype: List[int]", "name": "getRow", "signature": "def getRow(self, rowIndex)" }, { "docstring": ":type rowIndex: int :rtype: List[int]", "name": "getRow2", "signature": "def getRow2(self, rowIndex)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int] - def getRow2(self, rowIndex): :type rowIndex: int :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int] - def getRow2(self, rowIndex): :type rowIndex: int :rtype: List[int] <|skeleton|> class Solution: def getR...
bd8df12c0d4afd048cf1b58b04c27fa1f3622769
<|skeleton|> class Solution: def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_0|> def getRow2(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getRow(self, rowIndex): """:type rowIndex: int :rtype: List[int]""" if rowIndex == 0: return [1] if rowIndex == 1: return [1, 1] res = [1 for i in range(rowIndex + 1)] for i in range(2, rowIndex + 1): for j in range(i - ...
the_stack_v2_python_sparse
119_Pascal's_triangle_II.py
aojugg/leetcode
train
0
f43b7e2a9852846fb936414fe1ed73ae2e8ae332
[ "self.apollo_io_preferential_tier = apollo_io_preferential_tier\nself.apollo_wal_io_preferential_tier = apollo_wal_io_preferential_tier\nself.athena_io_preferential_tier = athena_io_preferential_tier\nself.athena_slower_io_preferential_tier = athena_slower_io_preferential_tier\nself.cloud_chunk_repo_io_preferential...
<|body_start_0|> self.apollo_io_preferential_tier = apollo_io_preferential_tier self.apollo_wal_io_preferential_tier = apollo_wal_io_preferential_tier self.athena_io_preferential_tier = athena_io_preferential_tier self.athena_slower_io_preferential_tier = athena_slower_io_preferential_ti...
Implementation of the 'IoPreferentialTier' model. Specifies the preferred storage tier for IO operations. Attributes: apollo_io_preferential_tier (list of ApolloIOPreferentialTierEnum): Specifies the preferred storage tier used by Apollo as its working directory. apollo_wal_io_preferential_tier (list of ApolloWalIOPref...
IoPreferentialTier
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IoPreferentialTier: """Implementation of the 'IoPreferentialTier' model. Specifies the preferred storage tier for IO operations. Attributes: apollo_io_preferential_tier (list of ApolloIOPreferentialTierEnum): Specifies the preferred storage tier used by Apollo as its working directory. apollo_wal...
stack_v2_sparse_classes_36k_train_003594
8,122
permissive
[ { "docstring": "Constructor for the IoPreferentialTier class", "name": "__init__", "signature": "def __init__(self, apollo_io_preferential_tier=None, apollo_wal_io_preferential_tier=None, athena_io_preferential_tier=None, athena_slower_io_preferential_tier=None, cloud_chunk_repo_io_preferential_tier=Non...
2
null
Implement the Python class `IoPreferentialTier` described below. Class description: Implementation of the 'IoPreferentialTier' model. Specifies the preferred storage tier for IO operations. Attributes: apollo_io_preferential_tier (list of ApolloIOPreferentialTierEnum): Specifies the preferred storage tier used by Apol...
Implement the Python class `IoPreferentialTier` described below. Class description: Implementation of the 'IoPreferentialTier' model. Specifies the preferred storage tier for IO operations. Attributes: apollo_io_preferential_tier (list of ApolloIOPreferentialTierEnum): Specifies the preferred storage tier used by Apol...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class IoPreferentialTier: """Implementation of the 'IoPreferentialTier' model. Specifies the preferred storage tier for IO operations. Attributes: apollo_io_preferential_tier (list of ApolloIOPreferentialTierEnum): Specifies the preferred storage tier used by Apollo as its working directory. apollo_wal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IoPreferentialTier: """Implementation of the 'IoPreferentialTier' model. Specifies the preferred storage tier for IO operations. Attributes: apollo_io_preferential_tier (list of ApolloIOPreferentialTierEnum): Specifies the preferred storage tier used by Apollo as its working directory. apollo_wal_io_preferent...
the_stack_v2_python_sparse
cohesity_management_sdk/models/io_preferential_tier.py
cohesity/management-sdk-python
train
24
dcad37a8101e1054ceb0404e5dcec42041a1f2a3
[ "BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise)\nself.veh_id = veh_id\nself.k_d = k_d\nself.k_v = k_v\nself.k_c = k_c\nself.d_des = d_des\nself.v_des = v_des", "lead_id = env.k.vehicle.get_leader(self.veh_id)\nif not lead_id:\n return self.max_ac...
<|body_start_0|> BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise) self.veh_id = veh_id self.k_d = k_d self.k_v = k_v self.k_c = k_c self.d_des = d_des self.v_des = v_des <|end_body_0|> <|body_start_1|...
Bilateral car-following model controller. This model looks ahead and behind when computing its acceleration. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class k_d : float...
BCMController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BCMController: """Bilateral car-following model controller. This model looks ahead and behind when computing its acceleration. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFol...
stack_v2_sparse_classes_36k_train_003595
17,548
permissive
[ { "docstring": "Instantiate a Bilateral car-following model controller.", "name": "__init__", "signature": "def __init__(self, veh_id, car_following_params, k_d=1, k_v=1, k_c=1, d_des=1, v_des=8, time_delay=0.0, noise=0, fail_safe=None)" }, { "docstring": "See parent class. From the paper: There...
2
stack_v2_sparse_classes_30k_train_019032
Implement the Python class `BCMController` described below. Class description: Bilateral car-following model controller. This model looks ahead and behind when computing its acceleration. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_followi...
Implement the Python class `BCMController` described below. Class description: Bilateral car-following model controller. This model looks ahead and behind when computing its acceleration. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_followi...
badac3da17f04d8d8ae5691ee8ba2af9d56fac35
<|skeleton|> class BCMController: """Bilateral car-following model controller. This model looks ahead and behind when computing its acceleration. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFol...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BCMController: """Bilateral car-following model controller. This model looks ahead and behind when computing its acceleration. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams ...
the_stack_v2_python_sparse
flow/controllers/car_following_models.py
parthjaggi/flow
train
6
3f88cf905fc7746190bb261a2a9c90965a2def0d
[ "self.resources_path = resources_path\nself.num_samples = num_samples\nself.beam_size = beam_size\nself.num_workers = num_workers\nself._seed = seed\nself.sigma = sigma\nself.seed_smiles = [smi for smi in seed_smiles.split('.') if Chem.MolFromSmiles(smi) is not None]\nself.scaffolds = [scaffold for scaffold in scaf...
<|body_start_0|> self.resources_path = resources_path self.num_samples = num_samples self.beam_size = beam_size self.num_workers = num_workers self._seed = seed self.sigma = sigma self.seed_smiles = [smi for smi in seed_smiles.split('.') if Chem.MolFromSmiles(smi)...
Interface for MoLeR generator.
MoLeRGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MoLeRGenerator: """Interface for MoLeR generator.""" def __init__(self, resources_path: str, scaffolds: str, num_samples: int, beam_size: int, seed: int, num_workers: int, seed_smiles: str, sigma: float) -> None: """Instantiate a MoLeR generator. Args: resources_path: path to the res...
stack_v2_sparse_classes_36k_train_003596
4,599
permissive
[ { "docstring": "Instantiate a MoLeR generator. Args: resources_path: path to the resources for model loading. scaffolds: scaffolds as '.'-separated SMILES. If empty, no scaffolds are used. num_samples: Number of molecules to sample per call. beam_size: beam size to use during decoding. seed: seed used for rando...
2
stack_v2_sparse_classes_30k_train_009997
Implement the Python class `MoLeRGenerator` described below. Class description: Interface for MoLeR generator. Method signatures and docstrings: - def __init__(self, resources_path: str, scaffolds: str, num_samples: int, beam_size: int, seed: int, num_workers: int, seed_smiles: str, sigma: float) -> None: Instantiate...
Implement the Python class `MoLeRGenerator` described below. Class description: Interface for MoLeR generator. Method signatures and docstrings: - def __init__(self, resources_path: str, scaffolds: str, num_samples: int, beam_size: int, seed: int, num_workers: int, seed_smiles: str, sigma: float) -> None: Instantiate...
0b69b7d5b261f2f9af3984793c1295b9b80cd01a
<|skeleton|> class MoLeRGenerator: """Interface for MoLeR generator.""" def __init__(self, resources_path: str, scaffolds: str, num_samples: int, beam_size: int, seed: int, num_workers: int, seed_smiles: str, sigma: float) -> None: """Instantiate a MoLeR generator. Args: resources_path: path to the res...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MoLeRGenerator: """Interface for MoLeR generator.""" def __init__(self, resources_path: str, scaffolds: str, num_samples: int, beam_size: int, seed: int, num_workers: int, seed_smiles: str, sigma: float) -> None: """Instantiate a MoLeR generator. Args: resources_path: path to the resources for mo...
the_stack_v2_python_sparse
src/gt4sd/algorithms/generation/moler/implementation.py
GT4SD/gt4sd-core
train
239
83b0a3f97de7481acb97e64e3b6a389c3f9b76b8
[ "super().__init__(coordinator, vehicle)\nself.entity_description = description\nself._attr_unique_id = f'{vehicle.vin}-{description.key}'\nif description.unit_type:\n self._attr_native_unit_of_measurement = coordinator.hass.config.units.as_dict().get(description.unit_type) or description.unit_type", "_LOGGER.d...
<|body_start_0|> super().__init__(coordinator, vehicle) self.entity_description = description self._attr_unique_id = f'{vehicle.vin}-{description.key}' if description.unit_type: self._attr_native_unit_of_measurement = coordinator.hass.config.units.as_dict().get(description.un...
Representation of a BMW vehicle sensor.
BMWSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BMWSensor: """Representation of a BMW vehicle sensor.""" def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWSensorEntityDescription) -> None: """Initialize BMW vehicle sensor.""" <|body_0|> def _handle_coordinator_update(self...
stack_v2_sparse_classes_36k_train_003597
7,206
permissive
[ { "docstring": "Initialize BMW vehicle sensor.", "name": "__init__", "signature": "def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWSensorEntityDescription) -> None" }, { "docstring": "Handle updated data from the coordinator.", "name": "_handl...
2
stack_v2_sparse_classes_30k_train_011853
Implement the Python class `BMWSensor` described below. Class description: Representation of a BMW vehicle sensor. Method signatures and docstrings: - def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWSensorEntityDescription) -> None: Initialize BMW vehicle sensor. - def...
Implement the Python class `BMWSensor` described below. Class description: Representation of a BMW vehicle sensor. Method signatures and docstrings: - def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWSensorEntityDescription) -> None: Initialize BMW vehicle sensor. - def...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class BMWSensor: """Representation of a BMW vehicle sensor.""" def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWSensorEntityDescription) -> None: """Initialize BMW vehicle sensor.""" <|body_0|> def _handle_coordinator_update(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BMWSensor: """Representation of a BMW vehicle sensor.""" def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWSensorEntityDescription) -> None: """Initialize BMW vehicle sensor.""" super().__init__(coordinator, vehicle) self.entity_descr...
the_stack_v2_python_sparse
homeassistant/components/bmw_connected_drive/sensor.py
home-assistant/core
train
35,501
56fb6cd8a74996931c872731685247cf68c183fa
[ "super().__init__(n_head, n_feat, dropout_rate)\nself.zero_triu = zero_triu\nself.linear_pos = nn.Linear(n_feat, n_feat, bias=False)\nself.pos_bias_u = nn.Parameter(torch.Tensor(self.h, self.d_k))\nself.pos_bias_v = nn.Parameter(torch.Tensor(self.h, self.d_k))\ntorch.nn.init.xavier_uniform_(self.pos_bias_u)\ntorch....
<|body_start_0|> super().__init__(n_head, n_feat, dropout_rate) self.zero_triu = zero_triu self.linear_pos = nn.Linear(n_feat, n_feat, bias=False) self.pos_bias_u = nn.Parameter(torch.Tensor(self.h, self.d_k)) self.pos_bias_v = nn.Parameter(torch.Tensor(self.h, self.d_k)) ...
Multi-Head Attention layer with relative position encoding (new implementation). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate. zero_triu (bool)...
RelPositionMultiHeadedAttention
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelPositionMultiHeadedAttention: """Multi-Head Attention layer with relative position encoding (new implementation). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of fea...
stack_v2_sparse_classes_36k_train_003598
7,675
permissive
[ { "docstring": "Construct an RelPositionMultiHeadedAttention object.", "name": "__init__", "signature": "def __init__(self, n_head, n_feat, dropout_rate, zero_triu=False)" }, { "docstring": "Compute relative positional encoding. Args: x (torch.Tensor): Input tensor (batch, head, time1, 2*time1-1...
3
null
Implement the Python class `RelPositionMultiHeadedAttention` described below. Class description: Multi-Head Attention layer with relative position encoding (new implementation). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of...
Implement the Python class `RelPositionMultiHeadedAttention` described below. Class description: Multi-Head Attention layer with relative position encoding (new implementation). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of...
e2f834dd60e7939672c1795b4ac62e89ad0bca49
<|skeleton|> class RelPositionMultiHeadedAttention: """Multi-Head Attention layer with relative position encoding (new implementation). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of fea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RelPositionMultiHeadedAttention: """Multi-Head Attention layer with relative position encoding (new implementation). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of features. dropou...
the_stack_v2_python_sparse
speech/conformer/pytorch/src/layers/attention.py
graphcore/examples
train
311
a314e9d42e749bc9a4413b8e445c96c4ab1a3ace
[ "super(InTriggerRegion, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._actor = actor\nself._min_x = min_x\nself._max_x = max_x\nself._min_y = min_y\nself._max_y = max_y", "new_status = py_trees.common.Status.RUNNING\nlocation = CarlaDataProvider.get_location(self._actor)...
<|body_start_0|> super(InTriggerRegion, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._actor = actor self._min_x = min_x self._max_x = max_x self._min_y = min_y self._max_y = max_y <|end_body_0|> <|body_start_1|> n...
This class contains the trigger region (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - min_x, max_x, min_y, max_y: bounding box of the trigger region The condition terminates with SUCCESS, when the actor reached the target region
InTriggerRegion
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InTriggerRegion: """This class contains the trigger region (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - min_x, max_x, min_y, max_y: bounding box of the trigger region The condition terminates with SUCCESS, when the ac...
stack_v2_sparse_classes_36k_train_003599
18,494
permissive
[ { "docstring": "Setup trigger region (rectangle provided by [min_x,min_y] and [max_x,max_y]", "name": "__init__", "signature": "def __init__(self, actor, min_x, max_x, min_y, max_y, name='TriggerRegion')" }, { "docstring": "Check if the _actor location is within trigger region", "name": "upd...
2
stack_v2_sparse_classes_30k_train_011016
Implement the Python class `InTriggerRegion` described below. Class description: This class contains the trigger region (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - min_x, max_x, min_y, max_y: bounding box of the trigger region The conditi...
Implement the Python class `InTriggerRegion` described below. Class description: This class contains the trigger region (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - min_x, max_x, min_y, max_y: bounding box of the trigger region The conditi...
8ab0894b92e1f994802a218002021ee075c405bf
<|skeleton|> class InTriggerRegion: """This class contains the trigger region (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - min_x, max_x, min_y, max_y: bounding box of the trigger region The condition terminates with SUCCESS, when the ac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InTriggerRegion: """This class contains the trigger region (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - min_x, max_x, min_y, max_y: bounding box of the trigger region The condition terminates with SUCCESS, when the actor reached t...
the_stack_v2_python_sparse
carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_trigger_conditions.py
TinaMenke/Deep-Reinforcement-Learning
train
9