blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
ea97491740fdb756629ae14602b1db028a3c93fa
[ "leoTkinterDialog.__init__(self, title, resizeable)\nself.text = text\nself.createTopFrame()\nself.top.bind('<Key>', self.onKey)\nif message:\n self.createMessageFrame(message)\nbuttons = ({'text': text, 'command': self.okButton, 'default': True},)\nself.createButtons(buttons)", "ch = event.char.lower()\nif ch...
<|body_start_0|> leoTkinterDialog.__init__(self, title, resizeable) self.text = text self.createTopFrame() self.top.bind('<Key>', self.onKey) if message: self.createMessageFrame(message) buttons = ({'text': text, 'command': self.okButton, 'default': True},) ...
A class that creates a Tkinter dialog with a single OK button.
tkinterAskOk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tkinterAskOk: """A class that creates a Tkinter dialog with a single OK button.""" def __init__(self, title, message=None, text='Ok', resizeable=False): """Create a dialog with one button""" <|body_0|> def onKey(self, event): """Handle Key events in askOk dialogs...
stack_v2_sparse_classes_75kplus_train_068000
25,997
no_license
[ { "docstring": "Create a dialog with one button", "name": "__init__", "signature": "def __init__(self, title, message=None, text='Ok', resizeable=False)" }, { "docstring": "Handle Key events in askOk dialogs.", "name": "onKey", "signature": "def onKey(self, event)" } ]
2
stack_v2_sparse_classes_30k_test_001404
Implement the Python class `tkinterAskOk` described below. Class description: A class that creates a Tkinter dialog with a single OK button. Method signatures and docstrings: - def __init__(self, title, message=None, text='Ok', resizeable=False): Create a dialog with one button - def onKey(self, event): Handle Key ev...
Implement the Python class `tkinterAskOk` described below. Class description: A class that creates a Tkinter dialog with a single OK button. Method signatures and docstrings: - def __init__(self, title, message=None, text='Ok', resizeable=False): Create a dialog with one button - def onKey(self, event): Handle Key ev...
28c22721e1bc313c120a8a6c288893bc566a5c67
<|skeleton|> class tkinterAskOk: """A class that creates a Tkinter dialog with a single OK button.""" def __init__(self, title, message=None, text='Ok', resizeable=False): """Create a dialog with one button""" <|body_0|> def onKey(self, event): """Handle Key events in askOk dialogs...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class tkinterAskOk: """A class that creates a Tkinter dialog with a single OK button.""" def __init__(self, title, message=None, text='Ok', resizeable=False): """Create a dialog with one button""" leoTkinterDialog.__init__(self, title, resizeable) self.text = text self.createTop...
the_stack_v2_python_sparse
Projects/jyleo/src/leoTkinterDialog.py
leo-editor/leo-editor-contrib
train
6
6c6712da86794eae8000ff786cab406e5e385eea
[ "pygame.sprite.Sprite.__init__(self)\nself.image = pygame.Surface([width, height])\nself.image.fill(color)\nself.rect = self.image.get_rect()\nnew_star = starfield.create_star(x=[0, WIDTH], y=[0, HEIGHT], s=[1, 2, 3])\nself.rect.centerx = new_star['x']\nself.rect.centery = new_star['y']\nself.speed = [-new_star['s'...
<|body_start_0|> pygame.sprite.Sprite.__init__(self) self.image = pygame.Surface([width, height]) self.image.fill(color) self.rect = self.image.get_rect() new_star = starfield.create_star(x=[0, WIDTH], y=[0, HEIGHT], s=[1, 2, 3]) self.rect.centerx = new_star['x'] ...
Test.
Starfield
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Starfield: """Test.""" def __init__(self, color, width, height): """Test.""" <|body_0|> def move_star(self, time): """Test.""" <|body_1|> <|end_skeleton|> <|body_start_0|> pygame.sprite.Sprite.__init__(self) self.image = pygame.Surface([...
stack_v2_sparse_classes_75kplus_train_068001
3,409
no_license
[ { "docstring": "Test.", "name": "__init__", "signature": "def __init__(self, color, width, height)" }, { "docstring": "Test.", "name": "move_star", "signature": "def move_star(self, time)" } ]
2
stack_v2_sparse_classes_30k_val_000778
Implement the Python class `Starfield` described below. Class description: Test. Method signatures and docstrings: - def __init__(self, color, width, height): Test. - def move_star(self, time): Test.
Implement the Python class `Starfield` described below. Class description: Test. Method signatures and docstrings: - def __init__(self, color, width, height): Test. - def move_star(self, time): Test. <|skeleton|> class Starfield: """Test.""" def __init__(self, color, width, height): """Test.""" ...
4ac8d5bd3aac16ef50bdef56f43f153483bc4d09
<|skeleton|> class Starfield: """Test.""" def __init__(self, color, width, height): """Test.""" <|body_0|> def move_star(self, time): """Test.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Starfield: """Test.""" def __init__(self, color, width, height): """Test.""" pygame.sprite.Sprite.__init__(self) self.image = pygame.Surface([width, height]) self.image.fill(color) self.rect = self.image.get_rect() new_star = starfield.create_star(x=[0, WID...
the_stack_v2_python_sparse
aula-06/pygame_starfield_planC.py
rodrigo-palermo/algoritmos2-2018-2
train
1
61a207b4fcc9ad4920cc3dce5e1517a9bfda113c
[ "self.avg_logical_transfer_rate_bps = avg_logical_transfer_rate_bps\nself.bytes_transferred = bytes_transferred\nself.end_time_usecs = end_time_usecs\nself.error = error\nself.logical_bytes_transferred = logical_bytes_transferred\nself.logical_size_bytes = logical_size_bytes\nself.progress_monitor_task_path = progr...
<|body_start_0|> self.avg_logical_transfer_rate_bps = avg_logical_transfer_rate_bps self.bytes_transferred = bytes_transferred self.end_time_usecs = end_time_usecs self.error = error self.logical_bytes_transferred = logical_bytes_transferred self.logical_size_bytes = logi...
Implementation of the 'RetrieveArchiveInfo' model. Proto to describe information about the retrieval of an archive task as provided by Icebox. Attributes: avg_logical_transfer_rate_bps (long|int): Average logical bytes transfer rate in bytes per second as seen by Icebox. bytes_transferred (long|int): Number of physical...
RetrieveArchiveInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetrieveArchiveInfo: """Implementation of the 'RetrieveArchiveInfo' model. Proto to describe information about the retrieval of an archive task as provided by Icebox. Attributes: avg_logical_transfer_rate_bps (long|int): Average logical bytes transfer rate in bytes per second as seen by Icebox. b...
stack_v2_sparse_classes_75kplus_train_068002
7,377
permissive
[ { "docstring": "Constructor for the RetrieveArchiveInfo class", "name": "__init__", "signature": "def __init__(self, avg_logical_transfer_rate_bps=None, bytes_transferred=None, end_time_usecs=None, error=None, logical_bytes_transferred=None, logical_size_bytes=None, progress_monitor_task_path=None, retr...
2
stack_v2_sparse_classes_30k_train_032133
Implement the Python class `RetrieveArchiveInfo` described below. Class description: Implementation of the 'RetrieveArchiveInfo' model. Proto to describe information about the retrieval of an archive task as provided by Icebox. Attributes: avg_logical_transfer_rate_bps (long|int): Average logical bytes transfer rate i...
Implement the Python class `RetrieveArchiveInfo` described below. Class description: Implementation of the 'RetrieveArchiveInfo' model. Proto to describe information about the retrieval of an archive task as provided by Icebox. Attributes: avg_logical_transfer_rate_bps (long|int): Average logical bytes transfer rate i...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RetrieveArchiveInfo: """Implementation of the 'RetrieveArchiveInfo' model. Proto to describe information about the retrieval of an archive task as provided by Icebox. Attributes: avg_logical_transfer_rate_bps (long|int): Average logical bytes transfer rate in bytes per second as seen by Icebox. b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RetrieveArchiveInfo: """Implementation of the 'RetrieveArchiveInfo' model. Proto to describe information about the retrieval of an archive task as provided by Icebox. Attributes: avg_logical_transfer_rate_bps (long|int): Average logical bytes transfer rate in bytes per second as seen by Icebox. bytes_transfer...
the_stack_v2_python_sparse
cohesity_management_sdk/models/retrieve_archive_info.py
cohesity/management-sdk-python
train
24
0f375f0f5bc5ff81b28b2302bee2d5b5a5954aac
[ "def preOrder(node):\n if not node:\n return ['None']\n return [str(node.val)] + preOrder(node.left) + preOrder(node.right)\nreturn ' '.join(preOrder(root))", "def preOrder(it):\n v = next(it)\n if v == 'None':\n return None\n node = TreeNode(int(v))\n node.left = preOrder(it)\n ...
<|body_start_0|> def preOrder(node): if not node: return ['None'] return [str(node.val)] + preOrder(node.left) + preOrder(node.right) return ' '.join(preOrder(root)) <|end_body_0|> <|body_start_1|> def preOrder(it): v = next(it) if...
Codec3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec3: 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_75kplus_train_068003
4,842
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_022044
Implement the Python class `Codec3` described below. Class description: Implement the Codec3 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 :rtyp...
Implement the Python class `Codec3` described below. Class description: Implement the Codec3 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 :rtyp...
63120dbaabd7c3c19633ebe952bcee4cf826b0e0
<|skeleton|> class Codec3: 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_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec3: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def preOrder(node): if not node: return ['None'] return [str(node.val)] + preOrder(node.left) + preOrder(node.right) return ' '.join(preO...
the_stack_v2_python_sparse
297. Serialize and Deserialize Binary Tree _ tee.py
CaizhiXu/LeetCode-Python-Solutions
train
0
63ff99ed1954ecf51ed8d2a905921bd2ae27429e
[ "SiteconfigBase.__init__(self, 'siteconfig.json')\nself.version = version\nself.gtfProvider = provider\nself.species = species", "if self.gtfProvider == 'ensembl' and self.version == 'GRCh37' and (self.species == 'human'):\n gtf = os.path.join(self.gtfBasePath, 'hg19/igenomes/Homo_sapiens/Ensembl/GRCh37/Annota...
<|body_start_0|> SiteconfigBase.__init__(self, 'siteconfig.json') self.version = version self.gtfProvider = provider self.species = species <|end_body_0|> <|body_start_1|> if self.gtfProvider == 'ensembl' and self.version == 'GRCh37' and (self.species == 'human'): gt...
This provides the GTF filer for featureCounts , etc. A basepath is defined for ease of migration if that becomes necessary.
Gtf
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Gtf: """This provides the GTF filer for featureCounts , etc. A basepath is defined for ease of migration if that becomes necessary.""" def __init__(self, version, provider, species): """Constructor version (str): reference index version (hg19, ensembl) program (str): name of aligner ...
stack_v2_sparse_classes_75kplus_train_068004
2,013
no_license
[ { "docstring": "Constructor version (str): reference index version (hg19, ensembl) program (str): name of aligner Sets self.appBasePath: base dir for applications self.indexBasePath: base dir for indexes", "name": "__init__", "signature": "def __init__(self, version, provider, species)" }, { "do...
2
null
Implement the Python class `Gtf` described below. Class description: This provides the GTF filer for featureCounts , etc. A basepath is defined for ease of migration if that becomes necessary. Method signatures and docstrings: - def __init__(self, version, provider, species): Constructor version (str): reference inde...
Implement the Python class `Gtf` described below. Class description: This provides the GTF filer for featureCounts , etc. A basepath is defined for ease of migration if that becomes necessary. Method signatures and docstrings: - def __init__(self, version, provider, species): Constructor version (str): reference inde...
78724da58a8d29ceff149e569ba5698ac91cbf8a
<|skeleton|> class Gtf: """This provides the GTF filer for featureCounts , etc. A basepath is defined for ease of migration if that becomes necessary.""" def __init__(self, version, provider, species): """Constructor version (str): reference index version (hg19, ensembl) program (str): name of aligner ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Gtf: """This provides the GTF filer for featureCounts , etc. A basepath is defined for ease of migration if that becomes necessary.""" def __init__(self, version, provider, species): """Constructor version (str): reference index version (hg19, ensembl) program (str): name of aligner Sets self.app...
the_stack_v2_python_sparse
scripts/gtf.py
anykine/rnaseq_tools
train
0
acb305d75598a41d1c46e4307bd4014847bacbd5
[ "if not identifier and (not location) or not parent:\n raise ValueError('Missing identifier and location, or parent value.')\nsuper(HFSPathSpec, self).__init__(parent=parent, **kwargs)\nself.data_stream = data_stream\nself.identifier = identifier\nself.location = location", "string_parts = []\nif self.data_str...
<|body_start_0|> if not identifier and (not location) or not parent: raise ValueError('Missing identifier and location, or parent value.') super(HFSPathSpec, self).__init__(parent=parent, **kwargs) self.data_stream = data_stream self.identifier = identifier self.locat...
HFS path specification implementation. Attributes: data_stream (str): data stream name, where None indicates the default data stream. identifier (int): catalog node identifier (CNID). location (str): location.
HFSPathSpec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HFSPathSpec: """HFS path specification implementation. Attributes: data_stream (str): data stream name, where None indicates the default data stream. identifier (int): catalog node identifier (CNID). location (str): location.""" def __init__(self, data_stream=None, identifier=None, location=...
stack_v2_sparse_classes_75kplus_train_068005
1,932
permissive
[ { "docstring": "Initializes a path specification. Note that an HFS path specification must have a parent. Args: data_stream (Optional[str]): data stream name, where None indicates the default data stream. identifier (Optional[int]): catalog node identifier (CNID). location (Optional[str]): location. parent (Opt...
2
stack_v2_sparse_classes_30k_train_018660
Implement the Python class `HFSPathSpec` described below. Class description: HFS path specification implementation. Attributes: data_stream (str): data stream name, where None indicates the default data stream. identifier (int): catalog node identifier (CNID). location (str): location. Method signatures and docstring...
Implement the Python class `HFSPathSpec` described below. Class description: HFS path specification implementation. Attributes: data_stream (str): data stream name, where None indicates the default data stream. identifier (int): catalog node identifier (CNID). location (str): location. Method signatures and docstring...
28756d910e951a22c5f0b2bcf5184f055a19d544
<|skeleton|> class HFSPathSpec: """HFS path specification implementation. Attributes: data_stream (str): data stream name, where None indicates the default data stream. identifier (int): catalog node identifier (CNID). location (str): location.""" def __init__(self, data_stream=None, identifier=None, location=...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HFSPathSpec: """HFS path specification implementation. Attributes: data_stream (str): data stream name, where None indicates the default data stream. identifier (int): catalog node identifier (CNID). location (str): location.""" def __init__(self, data_stream=None, identifier=None, location=None, parent=...
the_stack_v2_python_sparse
dfvfs/path/hfs_path_spec.py
log2timeline/dfvfs
train
197
e51e966d8f81dec7292f72803b5a98978663d81c
[ "year = self.get_year()\nmonth = self.get_month()\ndate = _date_from_string(year, self.get_year_format(), month, self.get_month_format())\nif queryset is None:\n queryset = self.get_queryset()\nif not self.allow_future and date > date.today():\n raise Http404('Future {} not available because{}. allow_future i...
<|body_start_0|> year = self.get_year() month = self.get_month() date = _date_from_string(year, self.get_year_format(), month, self.get_month_format()) if queryset is None: queryset = self.get_queryset() if not self.allow_future and date > date.today(): ra...
DateObjectMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DateObjectMixin: def get_object(self, queryset=None): """In this method django builds the keyword arguments for the query(to find the object in the database) The method creates the date kwargs for queryset and then pass that query set to the super queryset that contains the slug. :param ...
stack_v2_sparse_classes_75kplus_train_068006
6,230
permissive
[ { "docstring": "In this method django builds the keyword arguments for the query(to find the object in the database) The method creates the date kwargs for queryset and then pass that query set to the super queryset that contains the slug. :param queryset: :return:", "name": "get_object", "signature": "...
2
stack_v2_sparse_classes_30k_train_026667
Implement the Python class `DateObjectMixin` described below. Class description: Implement the DateObjectMixin class. Method signatures and docstrings: - def get_object(self, queryset=None): In this method django builds the keyword arguments for the query(to find the object in the database) The method creates the dat...
Implement the Python class `DateObjectMixin` described below. Class description: Implement the DateObjectMixin class. Method signatures and docstrings: - def get_object(self, queryset=None): In this method django builds the keyword arguments for the query(to find the object in the database) The method creates the dat...
26f11c944c34cd11b5961ec1b5eeb5cb3a7acdf8
<|skeleton|> class DateObjectMixin: def get_object(self, queryset=None): """In this method django builds the keyword arguments for the query(to find the object in the database) The method creates the date kwargs for queryset and then pass that query set to the super queryset that contains the slug. :param ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DateObjectMixin: def get_object(self, queryset=None): """In this method django builds the keyword arguments for the query(to find the object in the database) The method creates the date kwargs for queryset and then pass that query set to the super queryset that contains the slug. :param queryset: :ret...
the_stack_v2_python_sparse
suorganizer/blogs/mixins.py
mohammadasim/suorganiser
train
0
aba4ef9775cd9ec434541eece407c374e7f0d07f
[ "if norm_std and norm_mean and (len(norm_std) != len(norm_mean)):\n raise ValueError(f'norm_mean and norm_std are expected to be the same dim. But got {len(norm_mean)} and {len(norm_std)}')\nif tensor_type is _schema_fb.TensorType.UINT8:\n min_values = [_MIN_UINT8]\n max_values = [_MAX_UINT8]\nelif tensor_...
<|body_start_0|> if norm_std and norm_mean and (len(norm_std) != len(norm_mean)): raise ValueError(f'norm_mean and norm_std are expected to be the same dim. But got {len(norm_mean)} and {len(norm_std)}') if tensor_type is _schema_fb.TensorType.UINT8: min_values = [_MIN_UINT8] ...
A container for input image tensor metadata information. Attributes: norm_mean: the mean value used in tensor normalization [1]. norm_std: the std value used in the tensor normalization [1]. norm_mean and norm_std must have the same dimension. color_space_type: the color space type of the input image [2]. [1]: https://...
InputImageTensorMd
[ "Apache-2.0", "dtoa" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputImageTensorMd: """A container for input image tensor metadata information. Attributes: norm_mean: the mean value used in tensor normalization [1]. norm_std: the std value used in the tensor normalization [1]. norm_mean and norm_std must have the same dimension. color_space_type: the color sp...
stack_v2_sparse_classes_75kplus_train_068007
45,392
permissive
[ { "docstring": "Initializes the instance of InputImageTensorMd. Args: name: name of the tensor. description: description of what the tensor is. norm_mean: the mean value used in tensor normalization [1]. norm_std: the std value used in the tensor normalization [1]. norm_mean and norm_std must have the same dime...
2
null
Implement the Python class `InputImageTensorMd` described below. Class description: A container for input image tensor metadata information. Attributes: norm_mean: the mean value used in tensor normalization [1]. norm_std: the std value used in the tensor normalization [1]. norm_mean and norm_std must have the same di...
Implement the Python class `InputImageTensorMd` described below. Class description: A container for input image tensor metadata information. Attributes: norm_mean: the mean value used in tensor normalization [1]. norm_std: the std value used in the tensor normalization [1]. norm_mean and norm_std must have the same di...
007824594bf1d07c7c1467df03a43886f8a4b3ad
<|skeleton|> class InputImageTensorMd: """A container for input image tensor metadata information. Attributes: norm_mean: the mean value used in tensor normalization [1]. norm_std: the std value used in the tensor normalization [1]. norm_mean and norm_std must have the same dimension. color_space_type: the color sp...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InputImageTensorMd: """A container for input image tensor metadata information. Attributes: norm_mean: the mean value used in tensor normalization [1]. norm_std: the std value used in the tensor normalization [1]. norm_mean and norm_std must have the same dimension. color_space_type: the color space type of t...
the_stack_v2_python_sparse
mediapipe/tasks/python/metadata/metadata_writers/metadata_info.py
google/mediapipe
train
23,940
72340638ade9752291fe9777c32a082104b07a78
[ "res = []\nqueue = []\nfor num in nums:\n if len(queue) < k:\n queue.append(num)\n if len(queue) == k:\n res.append(max(queue))\n queue.pop(0)\nreturn res", "res = []\nqueue = []\nfor i, num in enumerate(nums):\n if queue and i - queue[0] == k:\n queue.pop(0)\n while queue ...
<|body_start_0|> res = [] queue = [] for num in nums: if len(queue) < k: queue.append(num) if len(queue) == k: res.append(max(queue)) queue.pop(0) return res <|end_body_0|> <|body_start_1|> res = [] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxInWindows(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_0|> def maxInWindows(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_068008
1,338
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: List[int]", "name": "maxInWindows", "signature": "def maxInWindows(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: List[int]", "name": "maxInWindows", "signature": "def maxInWindows(self, nums, k)" ...
2
stack_v2_sparse_classes_30k_train_010998
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxInWindows(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - def maxInWindows(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxInWindows(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - def maxInWindows(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] <|s...
967b0fbb40ae491b552bc3365a481e66324cb6f2
<|skeleton|> class Solution: def maxInWindows(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_0|> def maxInWindows(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxInWindows(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" res = [] queue = [] for num in nums: if len(queue) < k: queue.append(num) if len(queue) == k: res.append(max(queue)) ...
the_stack_v2_python_sparse
jianzhi_offer/57_滑动窗口的最大值.py
ryanatgz/data_structure_and_algorithm
train
0
8ecf5add67c60fb59576011ce325313965eb470d
[ "full_path = os.path.join(cls.sql_rules_path, filename + '.sql')\nwith open(full_path, 'r') as f:\n return f.read()", "with create_app().app_context():\n sess = GlobalDB.db().session\n filename = os.path.join(cls.sql_rules_path, filename)\n sql_data = pd.read_csv(filename, dtype=str, usecols=cls.heade...
<|body_start_0|> full_path = os.path.join(cls.sql_rules_path, filename + '.sql') with open(full_path, 'r') as f: return f.read() <|end_body_0|> <|body_start_1|> with create_app().app_context(): sess = GlobalDB.db().session filename = os.path.join(cls.sql_rule...
SQLLoader
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SQLLoader: def read_sql_str(cls, filename): """Read and clean lines from a .sql file""" <|body_0|> def load_sql(cls, filename): """Load SQL-based validation rules to db.""" <|body_1|> <|end_skeleton|> <|body_start_0|> full_path = os.path.join(cls.sq...
stack_v2_sparse_classes_75kplus_train_068009
4,204
permissive
[ { "docstring": "Read and clean lines from a .sql file", "name": "read_sql_str", "signature": "def read_sql_str(cls, filename)" }, { "docstring": "Load SQL-based validation rules to db.", "name": "load_sql", "signature": "def load_sql(cls, filename)" } ]
2
stack_v2_sparse_classes_30k_test_000649
Implement the Python class `SQLLoader` described below. Class description: Implement the SQLLoader class. Method signatures and docstrings: - def read_sql_str(cls, filename): Read and clean lines from a .sql file - def load_sql(cls, filename): Load SQL-based validation rules to db.
Implement the Python class `SQLLoader` described below. Class description: Implement the SQLLoader class. Method signatures and docstrings: - def read_sql_str(cls, filename): Read and clean lines from a .sql file - def load_sql(cls, filename): Load SQL-based validation rules to db. <|skeleton|> class SQLLoader: ...
b12c73976fd7eb5728eda90e56e053759c733c35
<|skeleton|> class SQLLoader: def read_sql_str(cls, filename): """Read and clean lines from a .sql file""" <|body_0|> def load_sql(cls, filename): """Load SQL-based validation rules to db.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SQLLoader: def read_sql_str(cls, filename): """Read and clean lines from a .sql file""" full_path = os.path.join(cls.sql_rules_path, filename + '.sql') with open(full_path, 'r') as f: return f.read() def load_sql(cls, filename): """Load SQL-based validation rul...
the_stack_v2_python_sparse
dataactvalidator/filestreaming/sqlLoader.py
fedspendingtransparency/data-act-broker-backend
train
55
d24bf225a45e73ad6f2c9d37b4ac283ec80e9302
[ "data = {'username': 'joseperez', 'email': 'jose@gmail.com', 'password': '123abc'}\nr = self.client.post(self.url, data)\nself.assertEqual(r.status_code, 201)", "CustomUser.objects.create(username='joseperez', password=make_password('123abc'))\ndata = {'username': 'joseperez', 'password': '123abc'}\nr = self.clie...
<|body_start_0|> data = {'username': 'joseperez', 'email': 'jose@gmail.com', 'password': '123abc'} r = self.client.post(self.url, data) self.assertEqual(r.status_code, 201) <|end_body_0|> <|body_start_1|> CustomUser.objects.create(username='joseperez', password=make_password('123abc')) ...
SSO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SSO: def test_postRegister(self): """Este test compueba que el usuario nuevo sea creado correctamente""" <|body_0|> def test_getJwtToken(self): """Este test nos ayuda a verificar que la url para login nos regrese un access token y refresh token, de acuerdo a si el us...
stack_v2_sparse_classes_75kplus_train_068010
1,157
no_license
[ { "docstring": "Este test compueba que el usuario nuevo sea creado correctamente", "name": "test_postRegister", "signature": "def test_postRegister(self)" }, { "docstring": "Este test nos ayuda a verificar que la url para login nos regrese un access token y refresh token, de acuerdo a si el usua...
2
stack_v2_sparse_classes_30k_train_053313
Implement the Python class `SSO` described below. Class description: Implement the SSO class. Method signatures and docstrings: - def test_postRegister(self): Este test compueba que el usuario nuevo sea creado correctamente - def test_getJwtToken(self): Este test nos ayuda a verificar que la url para login nos regres...
Implement the Python class `SSO` described below. Class description: Implement the SSO class. Method signatures and docstrings: - def test_postRegister(self): Este test compueba que el usuario nuevo sea creado correctamente - def test_getJwtToken(self): Este test nos ayuda a verificar que la url para login nos regres...
0ce36ac6e9d259cf631c6d43230641d4811cb54f
<|skeleton|> class SSO: def test_postRegister(self): """Este test compueba que el usuario nuevo sea creado correctamente""" <|body_0|> def test_getJwtToken(self): """Este test nos ayuda a verificar que la url para login nos regrese un access token y refresh token, de acuerdo a si el us...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SSO: def test_postRegister(self): """Este test compueba que el usuario nuevo sea creado correctamente""" data = {'username': 'joseperez', 'email': 'jose@gmail.com', 'password': '123abc'} r = self.client.post(self.url, data) self.assertEqual(r.status_code, 201) def test_get...
the_stack_v2_python_sparse
administrador/Aplicaciones/SSO/tests.py
mora-david/Favs-api
train
0
3c94feec86e1352f793c633e31cfd0c4d7ce0313
[ "self.driver.get(sellcar_url)\nsellcar_title = self.driver.find_element(SellCar_Locator.SELL_CAR_TITLE).text\ntt_check.assertEqual('卖车', sellcar_title, '我要卖车区域的title,期望是卖车,实际是%s' % sellcar_title)", "test_login.Login.login(self)\nsleep(3)\nself.driver.find_element(SellCar_Locator.SELL_CAR_TAB).click()\nsleep(2)\ns...
<|body_start_0|> self.driver.get(sellcar_url) sellcar_title = self.driver.find_element(SellCar_Locator.SELL_CAR_TITLE).text tt_check.assertEqual('卖车', sellcar_title, '我要卖车区域的title,期望是卖车,实际是%s' % sellcar_title) <|end_body_0|> <|body_start_1|> test_login.Login.login(self) sleep(3)...
SellCar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SellCar: def test_sellcar_title(self): """测试我要卖车区域Title显示的是否正确@author:zhangyanli""" <|body_0|> def test_sellcar_submitclue(self): """测试提交卖车线索是否成功@author:zhangyanli""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.driver.get(sellcar_url) ...
stack_v2_sparse_classes_75kplus_train_068011
1,612
no_license
[ { "docstring": "测试我要卖车区域Title显示的是否正确@author:zhangyanli", "name": "test_sellcar_title", "signature": "def test_sellcar_title(self)" }, { "docstring": "测试提交卖车线索是否成功@author:zhangyanli", "name": "test_sellcar_submitclue", "signature": "def test_sellcar_submitclue(self)" } ]
2
stack_v2_sparse_classes_30k_train_039926
Implement the Python class `SellCar` described below. Class description: Implement the SellCar class. Method signatures and docstrings: - def test_sellcar_title(self): 测试我要卖车区域Title显示的是否正确@author:zhangyanli - def test_sellcar_submitclue(self): 测试提交卖车线索是否成功@author:zhangyanli
Implement the Python class `SellCar` described below. Class description: Implement the SellCar class. Method signatures and docstrings: - def test_sellcar_title(self): 测试我要卖车区域Title显示的是否正确@author:zhangyanli - def test_sellcar_submitclue(self): 测试提交卖车线索是否成功@author:zhangyanli <|skeleton|> class SellCar: def test_...
204856bd33c06d25f2970eba13799db75d4fd4fe
<|skeleton|> class SellCar: def test_sellcar_title(self): """测试我要卖车区域Title显示的是否正确@author:zhangyanli""" <|body_0|> def test_sellcar_submitclue(self): """测试提交卖车线索是否成功@author:zhangyanli""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SellCar: def test_sellcar_title(self): """测试我要卖车区域Title显示的是否正确@author:zhangyanli""" self.driver.get(sellcar_url) sellcar_title = self.driver.find_element(SellCar_Locator.SELL_CAR_TITLE).text tt_check.assertEqual('卖车', sellcar_title, '我要卖车区域的title,期望是卖车,实际是%s' % sellcar_title) ...
the_stack_v2_python_sparse
mc/taocheM/test_sellcar/test_sellcar.py
boeai/mc
train
0
793e9053b218a4c4ece4d609e02a50cd685bfa1b
[ "super(LabelSmoothingLoss, self).__init__()\nself.criterion = criterion\nself.padding_idx = padding_idx\nassert 0.0 < smoothing <= 1.0\nself.confidence = 1.0 - smoothing\nself.smoothing = smoothing\nself.size = size\nself.true_dist = None\nself.normalize_length = normalize_length", "assert x.size(2) == self.size\...
<|body_start_0|> super(LabelSmoothingLoss, self).__init__() self.criterion = criterion self.padding_idx = padding_idx assert 0.0 < smoothing <= 1.0 self.confidence = 1.0 - smoothing self.smoothing = smoothing self.size = size self.true_dist = None ...
Label-smoothing loss. KL-divergence between q_{smoothed ground truth prob.}(w) and p_{prob. computed by model}(w) is minimized. Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/label_smoothing_loss.py Args: size: the number of class padding_idx: padding_idx: ignored cla...
LabelSmoothingLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelSmoothingLoss: """Label-smoothing loss. KL-divergence between q_{smoothed ground truth prob.}(w) and p_{prob. computed by model}(w) is minimized. Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/label_smoothing_loss.py Args: size: the number ...
stack_v2_sparse_classes_75kplus_train_068012
33,189
permissive
[ { "docstring": "Construct an LabelSmoothingLoss object.", "name": "__init__", "signature": "def __init__(self, size: int, padding_idx: int=-1, smoothing: float=0.1, normalize_length: bool=False, criterion: nn.Module=nn.KLDivLoss(reduction='none')) -> None" }, { "docstring": "Compute loss between...
2
stack_v2_sparse_classes_30k_train_016458
Implement the Python class `LabelSmoothingLoss` described below. Class description: Label-smoothing loss. KL-divergence between q_{smoothed ground truth prob.}(w) and p_{prob. computed by model}(w) is minimized. Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/label_sm...
Implement the Python class `LabelSmoothingLoss` described below. Class description: Label-smoothing loss. KL-divergence between q_{smoothed ground truth prob.}(w) and p_{prob. computed by model}(w) is minimized. Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/label_sm...
2dda31e14039a79b77c89bcd3bb96d52cbf60c8a
<|skeleton|> class LabelSmoothingLoss: """Label-smoothing loss. KL-divergence between q_{smoothed ground truth prob.}(w) and p_{prob. computed by model}(w) is minimized. Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/label_smoothing_loss.py Args: size: the number ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LabelSmoothingLoss: """Label-smoothing loss. KL-divergence between q_{smoothed ground truth prob.}(w) and p_{prob. computed by model}(w) is minimized. Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/label_smoothing_loss.py Args: size: the number of class padd...
the_stack_v2_python_sparse
snowfall/models/transformer.py
csukuangfj/snowfall
train
0
67fd831f1197a211997631f61c2245784e5b6891
[ "self.initial = initial\nif goal is not None:\n self.goal = goal\nelse:\n self.goal = sorted(self.initial[0], reverse=True)\nassert len(initial) == 3\nself.pegs = [i for i in range(0, len(initial))]\nself.sentinel = self.initial[0][0] + 1\nfor peg in self.initial:\n peg.insert(0, self.sentinel)\nself.goal....
<|body_start_0|> self.initial = initial if goal is not None: self.goal = goal else: self.goal = sorted(self.initial[0], reverse=True) assert len(initial) == 3 self.pegs = [i for i in range(0, len(initial))] self.sentinel = self.initial[0][0] + 1 ...
This is where the problem is defined. Initial state, goal state and other information that can be got from the problem
Problem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Problem: """This is where the problem is defined. Initial state, goal state and other information that can be got from the problem""" def __init__(self, initial, goal=None): """This is the constructor for the Problem class. It specifies the initial state, and possibly a goal state, i...
stack_v2_sparse_classes_75kplus_train_068013
21,082
no_license
[ { "docstring": "This is the constructor for the Problem class. It specifies the initial state, and possibly a goal state, if there is a unique goal. You can add other arguments if the need arises", "name": "__init__", "signature": "def __init__(self, initial, goal=None)" }, { "docstring": "Retur...
4
stack_v2_sparse_classes_30k_train_032285
Implement the Python class `Problem` described below. Class description: This is where the problem is defined. Initial state, goal state and other information that can be got from the problem Method signatures and docstrings: - def __init__(self, initial, goal=None): This is the constructor for the Problem class. It ...
Implement the Python class `Problem` described below. Class description: This is where the problem is defined. Initial state, goal state and other information that can be got from the problem Method signatures and docstrings: - def __init__(self, initial, goal=None): This is the constructor for the Problem class. It ...
a283d50eff1d0e7c158479ddc8e17932d518104a
<|skeleton|> class Problem: """This is where the problem is defined. Initial state, goal state and other information that can be got from the problem""" def __init__(self, initial, goal=None): """This is the constructor for the Problem class. It specifies the initial state, and possibly a goal state, i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Problem: """This is where the problem is defined. Initial state, goal state and other information that can be got from the problem""" def __init__(self, initial, goal=None): """This is the constructor for the Problem class. It specifies the initial state, and possibly a goal state, if there is a ...
the_stack_v2_python_sparse
4511W-Intro_To_Artificial_Intelligence/Course_Project_Towers_of_Hanoi/hanoi.py
marvintv/apollo-academia-umn
train
0
9683ccf32244172450491a5094d50d75ffbc132d
[ "memo = {}\nl = len(A)\ncount = len(A[0])\n\ndef dfs(i, cur_state, ans):\n if i >= count:\n return ans\n if (i, cur_state) in memo:\n return memo[i, cur_state]\n next_state = ''.join([A[k][i] for k in range(l)])\n ans_temp = ans\n if all([ord(cur_state[k]) <= ord(next_state[k]) for k in...
<|body_start_0|> memo = {} l = len(A) count = len(A[0]) def dfs(i, cur_state, ans): if i >= count: return ans if (i, cur_state) in memo: return memo[i, cur_state] next_state = ''.join([A[k][i] for k in range(l)]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDeletionSize(self, A): """:type A: List[str] :rtype: int""" <|body_0|> def minDeletionSize_1(self, A): """:type A: List[str] :rtype: int 1352 ms""" <|body_1|> def minDeletionSize_2(self, A): """:type A: List[str] :rtype: int 112m...
stack_v2_sparse_classes_75kplus_train_068014
5,098
no_license
[ { "docstring": ":type A: List[str] :rtype: int", "name": "minDeletionSize", "signature": "def minDeletionSize(self, A)" }, { "docstring": ":type A: List[str] :rtype: int 1352 ms", "name": "minDeletionSize_1", "signature": "def minDeletionSize_1(self, A)" }, { "docstring": ":type ...
3
stack_v2_sparse_classes_30k_train_013305
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDeletionSize(self, A): :type A: List[str] :rtype: int - def minDeletionSize_1(self, A): :type A: List[str] :rtype: int 1352 ms - def minDeletionSize_2(self, A): :type A: L...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDeletionSize(self, A): :type A: List[str] :rtype: int - def minDeletionSize_1(self, A): :type A: List[str] :rtype: int 1352 ms - def minDeletionSize_2(self, A): :type A: L...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def minDeletionSize(self, A): """:type A: List[str] :rtype: int""" <|body_0|> def minDeletionSize_1(self, A): """:type A: List[str] :rtype: int 1352 ms""" <|body_1|> def minDeletionSize_2(self, A): """:type A: List[str] :rtype: int 112m...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minDeletionSize(self, A): """:type A: List[str] :rtype: int""" memo = {} l = len(A) count = len(A[0]) def dfs(i, cur_state, ans): if i >= count: return ans if (i, cur_state) in memo: return memo[i, c...
the_stack_v2_python_sparse
DeleteColumnsToMakeSortedIII_HARD_960.py
953250587/leetcode-python
train
2
4e5f88b3181441926f185b19990832d59ece89e4
[ "super().__init__()\nself.init_ui(self)\nself.__retranslate_ui()\nself.img_data = parent.data.copy()\nself.current_img_data = None\nif self.img_data.dtype.itemsize > 1:\n self.img_data = normalize(abs(self.img_data), None, 0, 255, NORM_MINMAX, dtype=0)\nself.cb_border_type.activated[str].connect(self.update_img_...
<|body_start_0|> super().__init__() self.init_ui(self) self.__retranslate_ui() self.img_data = parent.data.copy() self.current_img_data = None if self.img_data.dtype.itemsize > 1: self.img_data = normalize(abs(self.img_data), None, 0, 255, NORM_MINMAX, dtype=0...
The DirectionalEdgeDetection class implements a local direction edge detection operation.
DirectionalEdgeDetection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DirectionalEdgeDetection: """The DirectionalEdgeDetection class implements a local direction edge detection operation.""" def __init__(self, parent): """Create a new dialog window to perform direction edge detection. Get image data from :param:`parent`. Convert to uint8 data type. :p...
stack_v2_sparse_classes_75kplus_train_068015
9,448
permissive
[ { "docstring": "Create a new dialog window to perform direction edge detection. Get image data from :param:`parent`. Convert to uint8 data type. :param parent: The image to detect edges :type parent: :class:`image.Image`", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docst...
4
stack_v2_sparse_classes_30k_train_035279
Implement the Python class `DirectionalEdgeDetection` described below. Class description: The DirectionalEdgeDetection class implements a local direction edge detection operation. Method signatures and docstrings: - def __init__(self, parent): Create a new dialog window to perform direction edge detection. Get image ...
Implement the Python class `DirectionalEdgeDetection` described below. Class description: The DirectionalEdgeDetection class implements a local direction edge detection operation. Method signatures and docstrings: - def __init__(self, parent): Create a new dialog window to perform direction edge detection. Get image ...
5613440dc04140845600b8c37a2b28786d504815
<|skeleton|> class DirectionalEdgeDetection: """The DirectionalEdgeDetection class implements a local direction edge detection operation.""" def __init__(self, parent): """Create a new dialog window to perform direction edge detection. Get image data from :param:`parent`. Convert to uint8 data type. :p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DirectionalEdgeDetection: """The DirectionalEdgeDetection class implements a local direction edge detection operation.""" def __init__(self, parent): """Create a new dialog window to perform direction edge detection. Get image data from :param:`parent`. Convert to uint8 data type. :param parent: ...
the_stack_v2_python_sparse
src/operations/local/edge_detection.py
vmariiechko/python-image-processing
train
2
18d06109c15b51173d876e3369f003a6570b10cc
[ "super(ExtentPositionEncoder, self).__init__()\nself.spa_enc_type = spa_enc_type\nself.id2geo = id2geo\nself.id2extent = id2extent\nself.spa_embed_dim = spa_enc.spa_embed_dim\nself.spa_enc = spa_enc\nself.graph = graph\nself.spa_enc_embed_norm = spa_enc_embed_norm\nself.device = device\nself.nogeo_idmap = self.make...
<|body_start_0|> super(ExtentPositionEncoder, self).__init__() self.spa_enc_type = spa_enc_type self.id2geo = id2geo self.id2extent = id2extent self.spa_embed_dim = spa_enc.spa_embed_dim self.spa_enc = spa_enc self.graph = graph self.spa_enc_embed_norm = s...
This is position encoder, a wrapper for different space encoder, Given a list of node ids, return their embedding
ExtentPositionEncoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtentPositionEncoder: """This is position encoder, a wrapper for different space encoder, Given a list of node ids, return their embedding""" def __init__(self, spa_enc_type, id2geo, id2extent, spa_enc, graph, spa_enc_embed_norm, device='cpu'): """Args: out_dims: a dict() key: node ...
stack_v2_sparse_classes_75kplus_train_068016
34,194
permissive
[ { "docstring": "Args: out_dims: a dict() key: node type value: embedding dimention spa_enc_type: the type of space encoder id2geo: a dict(): node id -> [longitude, latitude] id2extent: a dict(): node id -> (xmin, xmax, ymin, ymax) spa_enc: one space encoder graph: Graph() spa_enc_embed_norm: whether to do posit...
4
null
Implement the Python class `ExtentPositionEncoder` described below. Class description: This is position encoder, a wrapper for different space encoder, Given a list of node ids, return their embedding Method signatures and docstrings: - def __init__(self, spa_enc_type, id2geo, id2extent, spa_enc, graph, spa_enc_embed...
Implement the Python class `ExtentPositionEncoder` described below. Class description: This is position encoder, a wrapper for different space encoder, Given a list of node ids, return their embedding Method signatures and docstrings: - def __init__(self, spa_enc_type, id2geo, id2extent, spa_enc, graph, spa_enc_embed...
0e5a630a8403d4c7965de0f71e2e22b95f7be7bd
<|skeleton|> class ExtentPositionEncoder: """This is position encoder, a wrapper for different space encoder, Given a list of node ids, return their embedding""" def __init__(self, spa_enc_type, id2geo, id2extent, spa_enc, graph, spa_enc_embed_norm, device='cpu'): """Args: out_dims: a dict() key: node ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExtentPositionEncoder: """This is position encoder, a wrapper for different space encoder, Given a list of node ids, return their embedding""" def __init__(self, spa_enc_type, id2geo, id2extent, spa_enc, graph, spa_enc_embed_norm, device='cpu'): """Args: out_dims: a dict() key: node type value: e...
the_stack_v2_python_sparse
graphqa/netquery/encoders.py
Moon-xm/se-kge
train
0
6ba37f844aafe25216c328a80324aa8a695997fb
[ "if not hasattr(self, 'allEvents'):\n self.allEvents = Event.objects.filter(Q(instance_of=PublicEvent) | Q(instance_of=Series)).annotate(**self.get_annotations()).exclude(Q(status=Event.RegStatus.hidden) | Q(status=Event.RegStatus.regHidden) | Q(status=Event.RegStatus.linkOnly)).order_by(*self.get_ordering()).di...
<|body_start_0|> if not hasattr(self, 'allEvents'): self.allEvents = Event.objects.filter(Q(instance_of=PublicEvent) | Q(instance_of=Series)).annotate(**self.get_annotations()).exclude(Q(status=Event.RegStatus.hidden) | Q(status=Event.RegStatus.regHidden) | Q(status=Event.RegStatus.linkOnly)).order_...
RegisterView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterView: def get_allEvents(self): """Exclude hidden and link-only events by default, as well as private events, etc. Additional restrictions are made on a per-plugin basis.""" <|body_0|> def get_context_data(self, **kwargs): """Add the event and series listing d...
stack_v2_sparse_classes_75kplus_train_068017
3,366
permissive
[ { "docstring": "Exclude hidden and link-only events by default, as well as private events, etc. Additional restrictions are made on a per-plugin basis.", "name": "get_allEvents", "signature": "def get_allEvents(self)" }, { "docstring": "Add the event and series listing data. If If \"today\" is s...
2
stack_v2_sparse_classes_30k_train_030636
Implement the Python class `RegisterView` described below. Class description: Implement the RegisterView class. Method signatures and docstrings: - def get_allEvents(self): Exclude hidden and link-only events by default, as well as private events, etc. Additional restrictions are made on a per-plugin basis. - def get...
Implement the Python class `RegisterView` described below. Class description: Implement the RegisterView class. Method signatures and docstrings: - def get_allEvents(self): Exclude hidden and link-only events by default, as well as private events, etc. Additional restrictions are made on a per-plugin basis. - def get...
19db3e83e76ea2002ee841989410d12d1e601023
<|skeleton|> class RegisterView: def get_allEvents(self): """Exclude hidden and link-only events by default, as well as private events, etc. Additional restrictions are made on a per-plugin basis.""" <|body_0|> def get_context_data(self, **kwargs): """Add the event and series listing d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RegisterView: def get_allEvents(self): """Exclude hidden and link-only events by default, as well as private events, etc. Additional restrictions are made on a per-plugin basis.""" if not hasattr(self, 'allEvents'): self.allEvents = Event.objects.filter(Q(instance_of=PublicEvent) |...
the_stack_v2_python_sparse
danceschool/register/views.py
django-danceschool/django-danceschool
train
40
f4d7ef0a69dcd9d66018da5c73adc6338a00e4d4
[ "super().__init__()\nself.ignore_index = ignore_index\nself.reduction = reduction\nself.smooth_factor = smooth_factor\nself.register_buffer('weight', weight)\nself.register_buffer('pos_weight', pos_weight)", "if self.smooth_factor is not None:\n soft_targets = (1 - y_true) * self.smooth_factor + y_true * (1 - ...
<|body_start_0|> super().__init__() self.ignore_index = ignore_index self.reduction = reduction self.smooth_factor = smooth_factor self.register_buffer('weight', weight) self.register_buffer('pos_weight', pos_weight) <|end_body_0|> <|body_start_1|> if self.smooth...
SoftBCEWithLogitsLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftBCEWithLogitsLoss: def __init__(self, weight: Optional[torch.Tensor]=None, ignore_index: Optional[int]=-100, reduction: str='mean', smooth_factor: Optional[float]=None, pos_weight: Optional[torch.Tensor]=None): """Drop-in replacement for torch.nn.BCEWithLogitsLoss with few additions:...
stack_v2_sparse_classes_75kplus_train_068018
2,414
permissive
[ { "docstring": "Drop-in replacement for torch.nn.BCEWithLogitsLoss with few additions: ignore_index and label_smoothing Args: ignore_index: Specifies a target value that is ignored and does not contribute to the input gradient. smooth_factor: Factor to smooth target (e.g. if smooth_factor=0.1 then [1, 0, 1] -> ...
2
stack_v2_sparse_classes_30k_train_053411
Implement the Python class `SoftBCEWithLogitsLoss` described below. Class description: Implement the SoftBCEWithLogitsLoss class. Method signatures and docstrings: - def __init__(self, weight: Optional[torch.Tensor]=None, ignore_index: Optional[int]=-100, reduction: str='mean', smooth_factor: Optional[float]=None, po...
Implement the Python class `SoftBCEWithLogitsLoss` described below. Class description: Implement the SoftBCEWithLogitsLoss class. Method signatures and docstrings: - def __init__(self, weight: Optional[torch.Tensor]=None, ignore_index: Optional[int]=-100, reduction: str='mean', smooth_factor: Optional[float]=None, po...
6db76a1106426ac5b55f39fba68168f3bccae7f8
<|skeleton|> class SoftBCEWithLogitsLoss: def __init__(self, weight: Optional[torch.Tensor]=None, ignore_index: Optional[int]=-100, reduction: str='mean', smooth_factor: Optional[float]=None, pos_weight: Optional[torch.Tensor]=None): """Drop-in replacement for torch.nn.BCEWithLogitsLoss with few additions:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SoftBCEWithLogitsLoss: def __init__(self, weight: Optional[torch.Tensor]=None, ignore_index: Optional[int]=-100, reduction: str='mean', smooth_factor: Optional[float]=None, pos_weight: Optional[torch.Tensor]=None): """Drop-in replacement for torch.nn.BCEWithLogitsLoss with few additions: ignore_index ...
the_stack_v2_python_sparse
segmentation_models_pytorch/losses/soft_bce.py
qubvel/segmentation_models.pytorch
train
8,150
20aed971f3bb7445ad2c9a3e20d95781008e47a3
[ "if 'comm' not in problem_params:\n problem_params['comm'] = None\nessential_keys = ['nvars', 'nu', 'freq', 'comm']\nfor key in essential_keys:\n if key not in problem_params:\n msg = 'need %s to instantiate problem, only got %s' % (key, str(problem_params.keys()))\n raise ParameterError(msg)\ni...
<|body_start_0|> if 'comm' not in problem_params: problem_params['comm'] = None essential_keys = ['nvars', 'nu', 'freq', 'comm'] for key in essential_keys: if key not in problem_params: msg = 'need %s to instantiate problem, only got %s' % (key, str(proble...
Example implementing the forced 2D heat equation with periodic BC in [0,1], discretized using Dedalus
heat2d_dedalus_forced
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class heat2d_dedalus_forced: """Example implementing the forced 2D heat equation with periodic BC in [0,1], discretized using Dedalus""" def __init__(self, problem_params, dtype_u=dedalus_field, dtype_f=rhs_imex_dedalus_field): """Initialization routine Args: problem_params (dict): custom ...
stack_v2_sparse_classes_75kplus_train_068019
4,280
permissive
[ { "docstring": "Initialization routine Args: problem_params (dict): custom parameters for the example dtype_u: mesh data type (will be passed parent class) dtype_f: mesh data type (will be passed parent class)", "name": "__init__", "signature": "def __init__(self, problem_params, dtype_u=dedalus_field, ...
4
stack_v2_sparse_classes_30k_train_003788
Implement the Python class `heat2d_dedalus_forced` described below. Class description: Example implementing the forced 2D heat equation with periodic BC in [0,1], discretized using Dedalus Method signatures and docstrings: - def __init__(self, problem_params, dtype_u=dedalus_field, dtype_f=rhs_imex_dedalus_field): In...
Implement the Python class `heat2d_dedalus_forced` described below. Class description: Example implementing the forced 2D heat equation with periodic BC in [0,1], discretized using Dedalus Method signatures and docstrings: - def __init__(self, problem_params, dtype_u=dedalus_field, dtype_f=rhs_imex_dedalus_field): In...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class heat2d_dedalus_forced: """Example implementing the forced 2D heat equation with periodic BC in [0,1], discretized using Dedalus""" def __init__(self, problem_params, dtype_u=dedalus_field, dtype_f=rhs_imex_dedalus_field): """Initialization routine Args: problem_params (dict): custom ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class heat2d_dedalus_forced: """Example implementing the forced 2D heat equation with periodic BC in [0,1], discretized using Dedalus""" def __init__(self, problem_params, dtype_u=dedalus_field, dtype_f=rhs_imex_dedalus_field): """Initialization routine Args: problem_params (dict): custom parameters fo...
the_stack_v2_python_sparse
pySDC/playgrounds/deprecated/Dedalus/HeatEquation_2D_Dedalus_forced.py
Parallel-in-Time/pySDC
train
30
d63a3685e50ed01a6145c056141f616b00f94c83
[ "sum = []\nself.getSum(root, sum)\nprint(sum)\nreturn max(sum)", "if not root:\n return 0\nleft = self.getSum(root.left, sum)\nright = self.getSum(root.right, sum)\nsideSum = max(root.val, root.val + left, root.val + right)\npathSum = max(sideSum, root.val + left + right)\nsum.append(pathSum)\nreturn sideSum" ...
<|body_start_0|> sum = [] self.getSum(root, sum) print(sum) return max(sum) <|end_body_0|> <|body_start_1|> if not root: return 0 left = self.getSum(root.left, sum) right = self.getSum(root.right, sum) sideSum = max(root.val, root.val + left, ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxPathSum(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def getSum(self, root, sum): """:type root: TreeNode :type sum: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> sum = [] self.getSu...
stack_v2_sparse_classes_75kplus_train_068020
1,329
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "maxPathSum", "signature": "def maxPathSum(self, root)" }, { "docstring": ":type root: TreeNode :type sum: List[int] :rtype: int", "name": "getSum", "signature": "def getSum(self, root, sum)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxPathSum(self, root): :type root: TreeNode :rtype: int - def getSum(self, root, sum): :type root: TreeNode :type sum: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxPathSum(self, root): :type root: TreeNode :rtype: int - def getSum(self, root, sum): :type root: TreeNode :type sum: List[int] :rtype: int <|skeleton|> class Solution: ...
0584b86642dff667f5bf6b7acfbbce86a41a55b6
<|skeleton|> class Solution: def maxPathSum(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def getSum(self, root, sum): """:type root: TreeNode :type sum: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxPathSum(self, root): """:type root: TreeNode :rtype: int""" sum = [] self.getSum(root, sum) print(sum) return max(sum) def getSum(self, root, sum): """:type root: TreeNode :type sum: List[int] :rtype: int""" if not root: ...
the_stack_v2_python_sparse
python_solution/121_130/BinaryTreeMaxPathSum.py
CescWang1991/LeetCode-Python
train
1
bdce516f59f47a42afd3ae5704e357e2090e40fb
[ "argv = ['--help']\nwith self.OutputCapturer() as output:\n self.AssertFuncSystemExitZero(cgt.main, argv)\nstdout = output.GetStdout()\nself.assertTrue(stdout.startswith('usage: '))", "argv = []\nmocked_outsidechroot = self.mox.CreateMock(cgt.OutsideChroot)\nself.mox.StubOutWithMock(build_lib, 'IsInsideChroot'...
<|body_start_0|> argv = ['--help'] with self.OutputCapturer() as output: self.AssertFuncSystemExitZero(cgt.main, argv) stdout = output.GetStdout() self.assertTrue(stdout.startswith('usage: ')) <|end_body_0|> <|body_start_1|> argv = [] mocked_outsidechroot = s...
Test argument handling at the main method level.
MainTest
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainTest: """Test argument handling at the main method level.""" def testHelp(self): """Test that --help is functioning""" <|body_0|> def testMainOutsideChroot(self): """Test flow outside chroot""" <|body_1|> def testMainInsideChroot(self): "...
stack_v2_sparse_classes_75kplus_train_068021
18,421
permissive
[ { "docstring": "Test that --help is functioning", "name": "testHelp", "signature": "def testHelp(self)" }, { "docstring": "Test flow outside chroot", "name": "testMainOutsideChroot", "signature": "def testMainOutsideChroot(self)" }, { "docstring": "Test flow inside chroot", "...
3
stack_v2_sparse_classes_30k_train_008579
Implement the Python class `MainTest` described below. Class description: Test argument handling at the main method level. Method signatures and docstrings: - def testHelp(self): Test that --help is functioning - def testMainOutsideChroot(self): Test flow outside chroot - def testMainInsideChroot(self): Test flow ins...
Implement the Python class `MainTest` described below. Class description: Test argument handling at the main method level. Method signatures and docstrings: - def testHelp(self): Test that --help is functioning - def testMainOutsideChroot(self): Test flow outside chroot - def testMainInsideChroot(self): Test flow ins...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class MainTest: """Test argument handling at the main method level.""" def testHelp(self): """Test that --help is functioning""" <|body_0|> def testMainOutsideChroot(self): """Test flow outside chroot""" <|body_1|> def testMainInsideChroot(self): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MainTest: """Test argument handling at the main method level.""" def testHelp(self): """Test that --help is functioning""" argv = ['--help'] with self.OutputCapturer() as output: self.AssertFuncSystemExitZero(cgt.main, argv) stdout = output.GetStdout() ...
the_stack_v2_python_sparse
third_party/chromite/scripts/check_gdata_token_unittest.py
metux/chromium-suckless
train
5
c54acc25dc59c76968832f307ed9334ae1e10a16
[ "super().__init__(qubits)\nself.set_experiment_options(trials=trials)\nif not isinstance(seed, Generator):\n self._rng = default_rng(seed=seed)\nelse:\n self._rng = seed\nif not simulation_backend and HAS_SIMULATION_BACKEND:\n self._simulation_backend = Aer.get_backend('aer_simulator')\nelse:\n self._si...
<|body_start_0|> super().__init__(qubits) self.set_experiment_options(trials=trials) if not isinstance(seed, Generator): self._rng = default_rng(seed=seed) else: self._rng = seed if not simulation_backend and HAS_SIMULATION_BACKEND: self._simul...
Quantum Volume Experiment class. # section: overview Quantum Volume (QV) is a single-number metric that can be measured using a concrete protocol on near-term quantum computers of modest size. The QV method quantifies the largest random circuit of equal width and depth that the computer successfully implements. Quantum...
QuantumVolume
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuantumVolume: """Quantum Volume Experiment class. # section: overview Quantum Volume (QV) is a single-number metric that can be measured using a concrete protocol on near-term quantum computers of modest size. The QV method quantifies the largest random circuit of equal width and depth that the ...
stack_v2_sparse_classes_75kplus_train_068022
7,130
permissive
[ { "docstring": "Initialize a quantum volume experiment. Args: qubits: The number of qubits or list of physical qubits for the experiment. trials: The number of trials to run the quantum volume circuit. seed: Seed or generator object for random number generation. If None default_rng will be used. simulation_back...
4
stack_v2_sparse_classes_30k_train_053356
Implement the Python class `QuantumVolume` described below. Class description: Quantum Volume Experiment class. # section: overview Quantum Volume (QV) is a single-number metric that can be measured using a concrete protocol on near-term quantum computers of modest size. The QV method quantifies the largest random cir...
Implement the Python class `QuantumVolume` described below. Class description: Quantum Volume Experiment class. # section: overview Quantum Volume (QV) is a single-number metric that can be measured using a concrete protocol on near-term quantum computers of modest size. The QV method quantifies the largest random cir...
22b1598b290464e59a12853efa1eb99b1b36513a
<|skeleton|> class QuantumVolume: """Quantum Volume Experiment class. # section: overview Quantum Volume (QV) is a single-number metric that can be measured using a concrete protocol on near-term quantum computers of modest size. The QV method quantifies the largest random circuit of equal width and depth that the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuantumVolume: """Quantum Volume Experiment class. # section: overview Quantum Volume (QV) is a single-number metric that can be measured using a concrete protocol on near-term quantum computers of modest size. The QV method quantifies the largest random circuit of equal width and depth that the computer succ...
the_stack_v2_python_sparse
qiskit_experiments/library/quantum_volume/qv_experiment.py
huggingworld/qiskit-experiments
train
0
3d5d284654253bd4020ed427e303f3ad58e60266
[ "if user_input is None:\n return self.async_show_form(step_id='user', data_schema=user_form_schema(user_input))\nself._async_abort_entries_match({CONF_HOST: user_input[CONF_HOST]})\nerrors = {}\ntry:\n info = await validate_input(self.hass, user_input)\nexcept CannotConnect:\n errors['base'] = 'cannot_conn...
<|body_start_0|> if user_input is None: return self.async_show_form(step_id='user', data_schema=user_form_schema(user_input)) self._async_abort_entries_match({CONF_HOST: user_input[CONF_HOST]}) errors = {} try: info = await validate_input(self.hass, user_input) ...
Handle a config flow for Comelit.
ComelitConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComelitConfigFlow: """Handle a config flow for Comelit.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle the initial step.""" <|body_0|> async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult: ...
stack_v2_sparse_classes_75kplus_train_068023
4,775
permissive
[ { "docstring": "Handle the initial step.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult" }, { "docstring": "Handle reauth flow.", "name": "async_step_reauth", "signature": "async def async_step_reauth(self,...
3
null
Implement the Python class `ComelitConfigFlow` described below. Class description: Handle a config flow for Comelit. Method signatures and docstrings: - async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Handle the initial step. - async def async_step_reauth(self, entry_data: Mappi...
Implement the Python class `ComelitConfigFlow` described below. Class description: Handle a config flow for Comelit. Method signatures and docstrings: - async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Handle the initial step. - async def async_step_reauth(self, entry_data: Mappi...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ComelitConfigFlow: """Handle a config flow for Comelit.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle the initial step.""" <|body_0|> async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ComelitConfigFlow: """Handle a config flow for Comelit.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle the initial step.""" if user_input is None: return self.async_show_form(step_id='user', data_schema=user_form_schema(user...
the_stack_v2_python_sparse
homeassistant/components/comelit/config_flow.py
home-assistant/core
train
35,501
ea205e21e426867aec17ff27284e81b5ed203b74
[ "self.cop = cop\nself.flow_temp_spec = flow_temp_spec\nself.return_temp_spec = return_temp_spec\nself.ambient_temp_in_spec = ambient_temp_in_spec\nself.ambient_temp_out_spec = ambient_temp_out_spec\nself.elec_capacity = elec_capacity", "t_high_mean = (self.flow_temp_spec - self.return_temp_spec) / math.log((self....
<|body_start_0|> self.cop = cop self.flow_temp_spec = flow_temp_spec self.return_temp_spec = return_temp_spec self.ambient_temp_in_spec = ambient_temp_in_spec self.ambient_temp_out_spec = ambient_temp_out_spec self.elec_capacity = elec_capacity <|end_body_0|> <|body_star...
Lorentz
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Lorentz: def __init__(self, cop, flow_temp_spec, return_temp_spec, ambient_temp_in_spec, ambient_temp_out_spec, elec_capacity): """lorentz calculations and attributes based on EnergyPRO method Arguments: cop {float} -- cop at specified conditions flow_temp_spec {float} -- temperature fro...
stack_v2_sparse_classes_75kplus_train_068024
28,337
permissive
[ { "docstring": "lorentz calculations and attributes based on EnergyPRO method Arguments: cop {float} -- cop at specified conditions flow_temp_spec {float} -- temperature from HP spec return_temp_spec {float} -- tempature to HP spec ambient_temp_in_spec {float} -- specificed ambient_temp_out_spec {float} -- spec...
4
stack_v2_sparse_classes_30k_train_041724
Implement the Python class `Lorentz` described below. Class description: Implement the Lorentz class. Method signatures and docstrings: - def __init__(self, cop, flow_temp_spec, return_temp_spec, ambient_temp_in_spec, ambient_temp_out_spec, elec_capacity): lorentz calculations and attributes based on EnergyPRO method...
Implement the Python class `Lorentz` described below. Class description: Implement the Lorentz class. Method signatures and docstrings: - def __init__(self, cop, flow_temp_spec, return_temp_spec, ambient_temp_in_spec, ambient_temp_out_spec, elec_capacity): lorentz calculations and attributes based on EnergyPRO method...
dac052764d6d6f77c8e8c12077520e50ea0ad2f5
<|skeleton|> class Lorentz: def __init__(self, cop, flow_temp_spec, return_temp_spec, ambient_temp_in_spec, ambient_temp_out_spec, elec_capacity): """lorentz calculations and attributes based on EnergyPRO method Arguments: cop {float} -- cop at specified conditions flow_temp_spec {float} -- temperature fro...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Lorentz: def __init__(self, cop, flow_temp_spec, return_temp_spec, ambient_temp_in_spec, ambient_temp_out_spec, elec_capacity): """lorentz calculations and attributes based on EnergyPRO method Arguments: cop {float} -- cop at specified conditions flow_temp_spec {float} -- temperature from HP spec retu...
the_stack_v2_python_sparse
PyLESA/heatpump.py
ElsevierSoftwareX/SOFTX-D-21-00013
train
2
b4ecaf76d184aa68e3b715f653dbb78741c8ef69
[ "article = get_object_or_404(Article, slug=self.kwargs['slug'])\ndata = request.data\nserializer = self.serializer_class(data=data)\nif serializer.is_valid():\n serializer.save(author=self.request.user, article=article)\n return Response(serializer.data, status=status.HTTP_201_CREATED)\nreturn Response(serial...
<|body_start_0|> article = get_object_or_404(Article, slug=self.kwargs['slug']) data = request.data serializer = self.serializer_class(data=data) if serializer.is_valid(): serializer.save(author=self.request.user, article=article) return Response(serializer.data, ...
A user can comment on an article
ArticleCommentAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleCommentAPIView: """A user can comment on an article""" def post(self, request, slug=None): """Comment on an article in the application""" <|body_0|> def get(self, request, slug=None): """Get all the comments of an article""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus_train_068025
8,748
permissive
[ { "docstring": "Comment on an article in the application", "name": "post", "signature": "def post(self, request, slug=None)" }, { "docstring": "Get all the comments of an article", "name": "get", "signature": "def get(self, request, slug=None)" } ]
2
stack_v2_sparse_classes_30k_train_007947
Implement the Python class `ArticleCommentAPIView` described below. Class description: A user can comment on an article Method signatures and docstrings: - def post(self, request, slug=None): Comment on an article in the application - def get(self, request, slug=None): Get all the comments of an article
Implement the Python class `ArticleCommentAPIView` described below. Class description: A user can comment on an article Method signatures and docstrings: - def post(self, request, slug=None): Comment on an article in the application - def get(self, request, slug=None): Get all the comments of an article <|skeleton|>...
e8438b78b88c52d108520429d0b67cd3d13e0824
<|skeleton|> class ArticleCommentAPIView: """A user can comment on an article""" def post(self, request, slug=None): """Comment on an article in the application""" <|body_0|> def get(self, request, slug=None): """Get all the comments of an article""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArticleCommentAPIView: """A user can comment on an article""" def post(self, request, slug=None): """Comment on an article in the application""" article = get_object_or_404(Article, slug=self.kwargs['slug']) data = request.data serializer = self.serializer_class(data=data)...
the_stack_v2_python_sparse
authors/apps/comments/views.py
andela/ah-sealteam
train
1
1d6a1395cb5d1bb1c0de2d69f4908aaed6a15d2d
[ "uid = str(request.user.id)\ntoken = auth_service.refresh_user_token(uid)\nreturn APIResponse({'user_id': uid, 'new_token': token})", "valid = auth_service.check_auth_token(request.user.id, code)\ndata = {'valid': valid}\nreturn SimpleResponse(data)" ]
<|body_start_0|> uid = str(request.user.id) token = auth_service.refresh_user_token(uid) return APIResponse({'user_id': uid, 'new_token': token}) <|end_body_0|> <|body_start_1|> valid = auth_service.check_auth_token(request.user.id, code) data = {'valid': valid} return S...
TokenViewSet
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokenViewSet: def refresh(self, request): """### Example Request { "user_id": "user_id", "token": "old token" }""" <|body_0|> def valid(self, request, code): """GET: check token if valid. ## Example Request: {URL}/token/{code}/valid/ --- omit_serializer: true omit_pa...
stack_v2_sparse_classes_75kplus_train_068026
9,704
permissive
[ { "docstring": "### Example Request { \"user_id\": \"user_id\", \"token\": \"old token\" }", "name": "refresh", "signature": "def refresh(self, request)" }, { "docstring": "GET: check token if valid. ## Example Request: {URL}/token/{code}/valid/ --- omit_serializer: true omit_parameters: - form ...
2
stack_v2_sparse_classes_30k_train_035296
Implement the Python class `TokenViewSet` described below. Class description: Implement the TokenViewSet class. Method signatures and docstrings: - def refresh(self, request): ### Example Request { "user_id": "user_id", "token": "old token" } - def valid(self, request, code): GET: check token if valid. ## Example Req...
Implement the Python class `TokenViewSet` described below. Class description: Implement the TokenViewSet class. Method signatures and docstrings: - def refresh(self, request): ### Example Request { "user_id": "user_id", "token": "old token" } - def valid(self, request, code): GET: check token if valid. ## Example Req...
31ac08148fbe67ab166faa897c0cbe72cd7f62db
<|skeleton|> class TokenViewSet: def refresh(self, request): """### Example Request { "user_id": "user_id", "token": "old token" }""" <|body_0|> def valid(self, request, code): """GET: check token if valid. ## Example Request: {URL}/token/{code}/valid/ --- omit_serializer: true omit_pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TokenViewSet: def refresh(self, request): """### Example Request { "user_id": "user_id", "token": "old token" }""" uid = str(request.user.id) token = auth_service.refresh_user_token(uid) return APIResponse({'user_id': uid, 'new_token': token}) def valid(self, request, code...
the_stack_v2_python_sparse
wheat/apps/user/apis.py
fortyMiles/moment-note
train
2
e5e8e52d6da9c66eab03583270142fb91e866792
[ "super().__init__(filename=filename)\ntry:\n if not isinstance(days, int):\n raise Exception(\"Error: Invalid value passed to argument 'days'\")\n if days < 0:\n raise Exception(\"Error: Value of 'days' argument must be >= 0\")\n if not isinstance(hours, int):\n raise Exception(\"Error...
<|body_start_0|> super().__init__(filename=filename) try: if not isinstance(days, int): raise Exception("Error: Invalid value passed to argument 'days'") if days < 0: raise Exception("Error: Value of 'days' argument must be >= 0") if no...
Sub-Class of DeleteBot class, uses the no of days or hours as a threshold to filter tweets
DeleteOld
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeleteOld: """Sub-Class of DeleteBot class, uses the no of days or hours as a threshold to filter tweets""" def __init__(self, filename=None, days=1, hours=1): """Class to delete the tweets based on the time of tweet relative to current time Keyword Arguments: days: No of days to con...
stack_v2_sparse_classes_75kplus_train_068027
14,888
permissive
[ { "docstring": "Class to delete the tweets based on the time of tweet relative to current time Keyword Arguments: days: No of days to consider while filtering tweets (Default 1) hours: No of hours to consider while filtering tweets (Default 1)", "name": "__init__", "signature": "def __init__(self, filen...
4
stack_v2_sparse_classes_30k_train_015083
Implement the Python class `DeleteOld` described below. Class description: Sub-Class of DeleteBot class, uses the no of days or hours as a threshold to filter tweets Method signatures and docstrings: - def __init__(self, filename=None, days=1, hours=1): Class to delete the tweets based on the time of tweet relative t...
Implement the Python class `DeleteOld` described below. Class description: Sub-Class of DeleteBot class, uses the no of days or hours as a threshold to filter tweets Method signatures and docstrings: - def __init__(self, filename=None, days=1, hours=1): Class to delete the tweets based on the time of tweet relative t...
31fd3fb1233f39ea2252a7a44160ff8a2140f7bd
<|skeleton|> class DeleteOld: """Sub-Class of DeleteBot class, uses the no of days or hours as a threshold to filter tweets""" def __init__(self, filename=None, days=1, hours=1): """Class to delete the tweets based on the time of tweet relative to current time Keyword Arguments: days: No of days to con...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeleteOld: """Sub-Class of DeleteBot class, uses the no of days or hours as a threshold to filter tweets""" def __init__(self, filename=None, days=1, hours=1): """Class to delete the tweets based on the time of tweet relative to current time Keyword Arguments: days: No of days to consider while f...
the_stack_v2_python_sparse
Python/Delete_Tweets/helper.py
HarshCasper/Rotten-Scripts
train
1,474
ed41bfc5515008d62eee2b4e11ec55f39c8710c4
[ "query = request.GET.get('q')\nsort = request.GET.get('sort', 'name')\nform = AsignacionForm()\nlist_assign = None\nif query:\n list_assign = Asignacion.objects.filter(Q(server__name__icontains=query) | Q(interface__name_interface__icontains=query) | Q(client__name__icontains=query))\nelse:\n list_assign = As...
<|body_start_0|> query = request.GET.get('q') sort = request.GET.get('sort', 'name') form = AsignacionForm() list_assign = None if query: list_assign = Asignacion.objects.filter(Q(server__name__icontains=query) | Q(interface__name_interface__icontains=query) | Q(clien...
Clase para crear una asignacion
NewAssignView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewAssignView: """Clase para crear una asignacion""" def get(self, request, *args, **kwargs): """Método get""" <|body_0|> def post(self, request, *args, **kwargs): """Método post""" <|body_1|> <|end_skeleton|> <|body_start_0|> query = request.GE...
stack_v2_sparse_classes_75kplus_train_068028
22,221
no_license
[ { "docstring": "Método get", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Método post", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_050469
Implement the Python class `NewAssignView` described below. Class description: Clase para crear una asignacion Method signatures and docstrings: - def get(self, request, *args, **kwargs): Método get - def post(self, request, *args, **kwargs): Método post
Implement the Python class `NewAssignView` described below. Class description: Clase para crear una asignacion Method signatures and docstrings: - def get(self, request, *args, **kwargs): Método get - def post(self, request, *args, **kwargs): Método post <|skeleton|> class NewAssignView: """Clase para crear una ...
e28e2d968372609ad396c42fb572a00c2410a117
<|skeleton|> class NewAssignView: """Clase para crear una asignacion""" def get(self, request, *args, **kwargs): """Método get""" <|body_0|> def post(self, request, *args, **kwargs): """Método post""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NewAssignView: """Clase para crear una asignacion""" def get(self, request, *args, **kwargs): """Método get""" query = request.GET.get('q') sort = request.GET.get('sort', 'name') form = AsignacionForm() list_assign = None if query: list_assign =...
the_stack_v2_python_sparse
list/views.py
damaos/server_list2
train
0
0cbf4232800470d2477ac3b8f1114857ef98dcc9
[ "self.template = template\nself.origin = DebugInfo(name=template.filename, template_name=template.uri)\nself.context_processors = context_processors", "output_context = context or dict()\noutput_context.update(MakoTemplates.base_template_context)\nif request is not None:\n for processor in self.context_process...
<|body_start_0|> self.template = template self.origin = DebugInfo(name=template.filename, template_name=template.uri) self.context_processors = context_processors <|end_body_0|> <|body_start_1|> output_context = context or dict() output_context.update(MakoTemplates.base_template...
Template information. It could have any name, but Django requires it to have the following attributes: - template (which is always a MakoTemplate here) - origin: an object with <name> and <template_name> for debug purposes - render(context, request)
Template
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Template: """Template information. It could have any name, but Django requires it to have the following attributes: - template (which is always a MakoTemplate here) - origin: an object with <name> and <template_name> for debug purposes - render(context, request)""" def __init__(self, templat...
stack_v2_sparse_classes_75kplus_train_068029
5,073
no_license
[ { "docstring": "Initializer", "name": "__init__", "signature": "def __init__(self, template, context_processors)" }, { "docstring": "Render the template", "name": "render", "signature": "def render(self, context=None, request=None)" } ]
2
null
Implement the Python class `Template` described below. Class description: Template information. It could have any name, but Django requires it to have the following attributes: - template (which is always a MakoTemplate here) - origin: an object with <name> and <template_name> for debug purposes - render(context, requ...
Implement the Python class `Template` described below. Class description: Template information. It could have any name, but Django requires it to have the following attributes: - template (which is always a MakoTemplate here) - origin: an object with <name> and <template_name> for debug purposes - render(context, requ...
7c6507d671653fc0ccf35b5305f960eb32e7159f
<|skeleton|> class Template: """Template information. It could have any name, but Django requires it to have the following attributes: - template (which is always a MakoTemplate here) - origin: an object with <name> and <template_name> for debug purposes - render(context, request)""" def __init__(self, templat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Template: """Template information. It could have any name, but Django requires it to have the following attributes: - template (which is always a MakoTemplate here) - origin: an object with <name> and <template_name> for debug purposes - render(context, request)""" def __init__(self, template, context_pr...
the_stack_v2_python_sparse
openedu/mako_templates.py
ITOO-UrFU/openedu
train
1
be22fcaad797a15fd9b4aaa5046ca25b75b69162
[ "result = []\nfor i in range(len(nums)):\n if target - nums[i] in nums and nums.index(target - nums[i]) != i:\n result.append(i)\n result.append(nums.index(target - nums[i]))\n break\nreturn result", "if not nums:\n return None\nresult = []\nfor i in range(len(nums)):\n remain = targ...
<|body_start_0|> result = [] for i in range(len(nums)): if target - nums[i] in nums and nums.index(target - nums[i]) != i: result.append(i) result.append(nums.index(target - nums[i])) break return result <|end_body_0|> <|body_start_1|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum_0929(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_75kplus_train_068030
1,551
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum_0929", "signature": "def twoSum_0929(self, nums, targ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSum_0929(self, nums, target): :type nums: List[int] :type target: int :rtype: L...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSum_0929(self, nums, target): :type nums: List[int] :type target: int :rtype: L...
aa285d16bc96d30a632fae5c7578d0e7a5f51e7c
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum_0929(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" result = [] for i in range(len(nums)): if target - nums[i] in nums and nums.index(target - nums[i]) != i: result.append(i) result.append...
the_stack_v2_python_sparse
package_1_100/package_1_20/1. Two Sum.py
morindaz/leecode_morindaz
train
4
538a4b65254fe56583d9c33418762bbaa6c5e88f
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the keyword plan keyword service. Service to manage Keyword Plan ad group keywords.
KeywordPlanKeywordServiceServicer
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeywordPlanKeywordServiceServicer: """Proto file describing the keyword plan keyword service. Service to manage Keyword Plan ad group keywords.""" def GetKeywordPlanKeyword(self, request, context): """Returns the requested Keyword Plan keyword in full detail.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_068031
3,710
permissive
[ { "docstring": "Returns the requested Keyword Plan keyword in full detail.", "name": "GetKeywordPlanKeyword", "signature": "def GetKeywordPlanKeyword(self, request, context)" }, { "docstring": "Creates, updates, or removes Keyword Plan keywords. Operation statuses are returned.", "name": "Mu...
2
null
Implement the Python class `KeywordPlanKeywordServiceServicer` described below. Class description: Proto file describing the keyword plan keyword service. Service to manage Keyword Plan ad group keywords. Method signatures and docstrings: - def GetKeywordPlanKeyword(self, request, context): Returns the requested Keyw...
Implement the Python class `KeywordPlanKeywordServiceServicer` described below. Class description: Proto file describing the keyword plan keyword service. Service to manage Keyword Plan ad group keywords. Method signatures and docstrings: - def GetKeywordPlanKeyword(self, request, context): Returns the requested Keyw...
0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a
<|skeleton|> class KeywordPlanKeywordServiceServicer: """Proto file describing the keyword plan keyword service. Service to manage Keyword Plan ad group keywords.""" def GetKeywordPlanKeyword(self, request, context): """Returns the requested Keyword Plan keyword in full detail.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KeywordPlanKeywordServiceServicer: """Proto file describing the keyword plan keyword service. Service to manage Keyword Plan ad group keywords.""" def GetKeywordPlanKeyword(self, request, context): """Returns the requested Keyword Plan keyword in full detail.""" context.set_code(grpc.Stat...
the_stack_v2_python_sparse
google/ads/google_ads/v1/proto/services/keyword_plan_keyword_service_pb2_grpc.py
juanmacugat/google-ads-python
train
1
85f82fd233c92a6959977eda259030bfddc12bc5
[ "self.out = None\nself.in_shape = None\nself.work_shape = None", "assert x.ndim > 1, \"prysm's softmax is meant for use with multiple independent variables at once\"\nxx = x.reshape((-1, x.shape[-1]))\nself.in_shape = x.shape\nself.work_shape = xx.shape\nxnorm = xx - xx.max(axis=1)[:, np.newaxis]\ne_x = np.exp(xn...
<|body_start_0|> self.out = None self.in_shape = None self.work_shape = None <|end_body_0|> <|body_start_1|> assert x.ndim > 1, "prysm's softmax is meant for use with multiple independent variables at once" xx = x.reshape((-1, x.shape[-1])) self.in_shape = x.shape ...
Softmax activation function. Softmax is a soft, differntiable alternative to argmax. It is used as a component of GumbelSoftmaxEncoder to ecourage / softly force variables to take on one of K discrete states. The arrays passed to forward() and reverse() may take any number of dimensions. The understanding of the inputs...
Softmax
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Softmax: """Softmax activation function. Softmax is a soft, differntiable alternative to argmax. It is used as a component of GumbelSoftmaxEncoder to ecourage / softly force variables to take on one of K discrete states. The arrays passed to forward() and reverse() may take any number of dimensio...
stack_v2_sparse_classes_75kplus_train_068032
7,697
permissive
[ { "docstring": "Create a new Softmax node.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Perform Softmax activation on logits. Parameters ---------- x : numpy.ndarray, shape (A,B,C, ... K) any number of leading dimensions, required trailing dimension of size K, where...
3
stack_v2_sparse_classes_30k_train_030997
Implement the Python class `Softmax` described below. Class description: Softmax activation function. Softmax is a soft, differntiable alternative to argmax. It is used as a component of GumbelSoftmaxEncoder to ecourage / softly force variables to take on one of K discrete states. The arrays passed to forward() and re...
Implement the Python class `Softmax` described below. Class description: Softmax activation function. Softmax is a soft, differntiable alternative to argmax. It is used as a component of GumbelSoftmaxEncoder to ecourage / softly force variables to take on one of K discrete states. The arrays passed to forward() and re...
af89c94d500a274eda664188ddb97fcae30c6ac5
<|skeleton|> class Softmax: """Softmax activation function. Softmax is a soft, differntiable alternative to argmax. It is used as a component of GumbelSoftmaxEncoder to ecourage / softly force variables to take on one of K discrete states. The arrays passed to forward() and reverse() may take any number of dimensio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Softmax: """Softmax activation function. Softmax is a soft, differntiable alternative to argmax. It is used as a component of GumbelSoftmaxEncoder to ecourage / softly force variables to take on one of K discrete states. The arrays passed to forward() and reverse() may take any number of dimensions. The under...
the_stack_v2_python_sparse
prysm/x/optym/activation.py
brandondube/prysm
train
192
1efff66c11c295db6dae1e837ce4e2d7f367676b
[ "self.host = host = str(host)\nself.port = port = int(port)\nsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nsock.connect((host, port))\nio = inputoutput.SocketIO(sock)\nsuper(SocketGateway, self).__init__(io=io)\nself.remoteaddress = '%s:%d' % (self.host, self.port)", "if hostport is None:\n host, p...
<|body_start_0|> self.host = host = str(host) self.port = port = int(port) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((host, port)) io = inputoutput.SocketIO(sock) super(SocketGateway, self).__init__(io=io) self.remoteaddress = '%s:%d' %...
This Gateway provides interaction with a remote process by connecting to a specified socket. On the remote side you need to manually start a small script (py/execnet/script/socketserver.py) that accepts SocketGateway connections.
SocketGateway
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SocketGateway: """This Gateway provides interaction with a remote process by connecting to a specified socket. On the remote side you need to manually start a small script (py/execnet/script/socketserver.py) that accepts SocketGateway connections.""" def __init__(self, host, port): "...
stack_v2_sparse_classes_75kplus_train_068033
7,787
permissive
[ { "docstring": "instantiate a gateway to a process accessed via a host/port specified socket.", "name": "__init__", "signature": "def __init__(self, host, port)" }, { "docstring": "return a new (connected) socket gateway, instatiated indirectly through the given 'gateway'.", "name": "new_rem...
2
stack_v2_sparse_classes_30k_train_031407
Implement the Python class `SocketGateway` described below. Class description: This Gateway provides interaction with a remote process by connecting to a specified socket. On the remote side you need to manually start a small script (py/execnet/script/socketserver.py) that accepts SocketGateway connections. Method si...
Implement the Python class `SocketGateway` described below. Class description: This Gateway provides interaction with a remote process by connecting to a specified socket. On the remote side you need to manually start a small script (py/execnet/script/socketserver.py) that accepts SocketGateway connections. Method si...
0cd8d094fcaf60a48a3b32f15e836fcb48d93e74
<|skeleton|> class SocketGateway: """This Gateway provides interaction with a remote process by connecting to a specified socket. On the remote side you need to manually start a small script (py/execnet/script/socketserver.py) that accepts SocketGateway connections.""" def __init__(self, host, port): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SocketGateway: """This Gateway provides interaction with a remote process by connecting to a specified socket. On the remote side you need to manually start a small script (py/execnet/script/socketserver.py) that accepts SocketGateway connections.""" def __init__(self, host, port): """instantiate...
the_stack_v2_python_sparse
InvTL/lm_py/py/execnet/register.py
mickg10/DARLAB
train
4
cf9815cf0552b0e5bc99c26c8ee34fcbc349c3ee
[ "Inventory.__init__(self, productcode, description, marketprice, rentalprice)\nself.material = material\nself.size = size", "outputdict = Inventory.returnasdictionary(self)\noutputdict['Material'] = self.material\noutputdict['Size'] = self.size\nreturn outputdict" ]
<|body_start_0|> Inventory.__init__(self, productcode, description, marketprice, rentalprice) self.material = material self.size = size <|end_body_0|> <|body_start_1|> outputdict = Inventory.returnasdictionary(self) outputdict['Material'] = self.material outputdict['Size...
doc string
Furniture
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Furniture: """doc string""" def __init__(self, productcode, description, marketprice, rentalprice, material, size): """doc string""" <|body_0|> def returnasdictionary(self): """doc string""" <|body_1|> <|end_skeleton|> <|body_start_0|> Inventory...
stack_v2_sparse_classes_75kplus_train_068034
723
no_license
[ { "docstring": "doc string", "name": "__init__", "signature": "def __init__(self, productcode, description, marketprice, rentalprice, material, size)" }, { "docstring": "doc string", "name": "returnasdictionary", "signature": "def returnasdictionary(self)" } ]
2
stack_v2_sparse_classes_30k_train_026549
Implement the Python class `Furniture` described below. Class description: doc string Method signatures and docstrings: - def __init__(self, productcode, description, marketprice, rentalprice, material, size): doc string - def returnasdictionary(self): doc string
Implement the Python class `Furniture` described below. Class description: doc string Method signatures and docstrings: - def __init__(self, productcode, description, marketprice, rentalprice, material, size): doc string - def returnasdictionary(self): doc string <|skeleton|> class Furniture: """doc string""" ...
ac12beeae8aa57135bbcd03ac7a4f977fa3bdb56
<|skeleton|> class Furniture: """doc string""" def __init__(self, productcode, description, marketprice, rentalprice, material, size): """doc string""" <|body_0|> def returnasdictionary(self): """doc string""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Furniture: """doc string""" def __init__(self, productcode, description, marketprice, rentalprice, material, size): """doc string""" Inventory.__init__(self, productcode, description, marketprice, rentalprice) self.material = material self.size = size def returnasdict...
the_stack_v2_python_sparse
students/elaine_x/lesson01/assignment/inventory_management/FurnitureClass.py
UWPCE-PythonCert-ClassRepos/py220-online-201904-V2
train
1
a0ec762e7ad34c70bf99512d247f61f701998161
[ "super(BottleNeck, self).__init__()\nself.filter_num = filter_num\nself.l2_regularization = tf.keras.regularizers.l2(l2_amount)\nself.conv1 = tf.keras.layers.Conv2D(filters=filter_num, kernel_size=(1, 1), strides=1, padding='same', bias_regularizer=self.l2_regularization, kernel_regularizer=self.l2_regularization)\...
<|body_start_0|> super(BottleNeck, self).__init__() self.filter_num = filter_num self.l2_regularization = tf.keras.regularizers.l2(l2_amount) self.conv1 = tf.keras.layers.Conv2D(filters=filter_num, kernel_size=(1, 1), strides=1, padding='same', bias_regularizer=self.l2_regularization, ke...
Implementation of a bottle neck layer used for the ResNet type II model.
BottleNeck
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BottleNeck: """Implementation of a bottle neck layer used for the ResNet type II model.""" def __init__(self, filter_num, stride=1, l2_amount=0.1): """Initialises the bottle neck layer by providing the number of filter, strides and l2 regularisation amount. :param filter_num: the num...
stack_v2_sparse_classes_75kplus_train_068035
6,270
permissive
[ { "docstring": "Initialises the bottle neck layer by providing the number of filter, strides and l2 regularisation amount. :param filter_num: the number of filters in both of the two dimensional convolution layers. :param stride: the stride for the two dimensional convolution layers. :param l2_amount: the l2 re...
2
stack_v2_sparse_classes_30k_train_006799
Implement the Python class `BottleNeck` described below. Class description: Implementation of a bottle neck layer used for the ResNet type II model. Method signatures and docstrings: - def __init__(self, filter_num, stride=1, l2_amount=0.1): Initialises the bottle neck layer by providing the number of filter, strides...
Implement the Python class `BottleNeck` described below. Class description: Implementation of a bottle neck layer used for the ResNet type II model. Method signatures and docstrings: - def __init__(self, filter_num, stride=1, l2_amount=0.1): Initialises the bottle neck layer by providing the number of filter, strides...
084a0ab5807e912bee80ae2dcf5f22b7ef8579a1
<|skeleton|> class BottleNeck: """Implementation of a bottle neck layer used for the ResNet type II model.""" def __init__(self, filter_num, stride=1, l2_amount=0.1): """Initialises the bottle neck layer by providing the number of filter, strides and l2 regularisation amount. :param filter_num: the num...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BottleNeck: """Implementation of a bottle neck layer used for the ResNet type II model.""" def __init__(self, filter_num, stride=1, l2_amount=0.1): """Initialises the bottle neck layer by providing the number of filter, strides and l2 regularisation amount. :param filter_num: the number of filter...
the_stack_v2_python_sparse
src/models/resnet/residual_block.py
FabianGroeger96/semantic-segmentation-dtd
train
3
1b16ad67ef6a32b8ae52a07658e5d902da79c872
[ "username = self.request.user.get_username()\nalbums = Album.objects.filter(user__username=username)\nphotos = Photo.objects.filter(user__username=username)\nreturn (albums, photos)", "context = super().get_context_data(**kwargs)\nalbums = context['albums_and_photos'][0]\nphotos = context['albums_and_photos'][1]\...
<|body_start_0|> username = self.request.user.get_username() albums = Album.objects.filter(user__username=username) photos = Photo.objects.filter(user__username=username) return (albums, photos) <|end_body_0|> <|body_start_1|> context = super().get_context_data(**kwargs) ...
Define the library view class.
LibraryView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LibraryView: """Define the library view class.""" def get_queryset(self): """Get the context to display.""" <|body_0|> def get_context_data(self, **kwargs): """Filter the context for display.""" <|body_1|> <|end_skeleton|> <|body_start_0|> usern...
stack_v2_sparse_classes_75kplus_train_068036
4,522
permissive
[ { "docstring": "Get the context to display.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Filter the context for display.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_015855
Implement the Python class `LibraryView` described below. Class description: Define the library view class. Method signatures and docstrings: - def get_queryset(self): Get the context to display. - def get_context_data(self, **kwargs): Filter the context for display.
Implement the Python class `LibraryView` described below. Class description: Define the library view class. Method signatures and docstrings: - def get_queryset(self): Get the context to display. - def get_context_data(self, **kwargs): Filter the context for display. <|skeleton|> class LibraryView: """Define the...
bd78a0c7442d90db8af26bdd93f6170d36dd2385
<|skeleton|> class LibraryView: """Define the library view class.""" def get_queryset(self): """Get the context to display.""" <|body_0|> def get_context_data(self, **kwargs): """Filter the context for display.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LibraryView: """Define the library view class.""" def get_queryset(self): """Get the context to display.""" username = self.request.user.get_username() albums = Album.objects.filter(user__username=username) photos = Photo.objects.filter(user__username=username) ret...
the_stack_v2_python_sparse
imagersite/imager_images/views.py
ShannonTully/django-imager
train
1
86606bc769437f84b37de8eb1be2a52e0111826a
[ "for key in inconfigs:\n if not key.startswith('text search configuration '):\n raise KeyError('Unrecognized object type: %s' % key)\n tsc = key[26:]\n self[schema.name, tsc] = config = TSConfiguration(schema=schema.name, name=tsc)\n inconfig = inconfigs[key]\n if inconfig:\n for attr, ...
<|body_start_0|> for key in inconfigs: if not key.startswith('text search configuration '): raise KeyError('Unrecognized object type: %s' % key) tsc = key[26:] self[schema.name, tsc] = config = TSConfiguration(schema=schema.name, name=tsc) inconfig...
The collection of text search configurations in a database
TSConfigurationDict
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TSConfigurationDict: """The collection of text search configurations in a database""" def from_map(self, schema, inconfigs): """Initialize the dictionary of configs by examining the input map :param schema: schema owning the configurations :param inconfigs: input YAML map defining th...
stack_v2_sparse_classes_75kplus_train_068037
15,925
permissive
[ { "docstring": "Initialize the dictionary of configs by examining the input map :param schema: schema owning the configurations :param inconfigs: input YAML map defining the configurations", "name": "from_map", "signature": "def from_map(self, schema, inconfigs)" }, { "docstring": "Generate SQL ...
2
stack_v2_sparse_classes_30k_train_049219
Implement the Python class `TSConfigurationDict` described below. Class description: The collection of text search configurations in a database Method signatures and docstrings: - def from_map(self, schema, inconfigs): Initialize the dictionary of configs by examining the input map :param schema: schema owning the co...
Implement the Python class `TSConfigurationDict` described below. Class description: The collection of text search configurations in a database Method signatures and docstrings: - def from_map(self, schema, inconfigs): Initialize the dictionary of configs by examining the input map :param schema: schema owning the co...
0133f3bc522890e0564d27de6791824acb4d2773
<|skeleton|> class TSConfigurationDict: """The collection of text search configurations in a database""" def from_map(self, schema, inconfigs): """Initialize the dictionary of configs by examining the input map :param schema: schema owning the configurations :param inconfigs: input YAML map defining th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TSConfigurationDict: """The collection of text search configurations in a database""" def from_map(self, schema, inconfigs): """Initialize the dictionary of configs by examining the input map :param schema: schema owning the configurations :param inconfigs: input YAML map defining the configurati...
the_stack_v2_python_sparse
pyrseas/dbobject/textsearch.py
vayerx/Pyrseas
train
1
aff24664b06e3ba0f2e12f2a4f985279d59adada
[ "self._traces_tree = Node('')\nfor trace in traces:\n node = self._traces_tree\n for func in trace:\n if func in node.childs:\n node.childs[func].times += 1\n else:\n node.childs[func] = Node(func)\n node = node.childs[func]", "if node is None:\n node = self._tr...
<|body_start_0|> self._traces_tree = Node('') for trace in traces: node = self._traces_tree for func in trace: if func in node.childs: node.childs[func].times += 1 else: node.childs[func] = Node(func) ...
TracesProcessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TracesProcessor: def __init__(self, traces): """Initializes the tree that contains the traces using the specified traces on the second param Traces format example: [ ["main", "workloop", "select"], ["main", "parse_args"], ["main", "workloop", "parse_data", "parse_entry"], ["main", "workl...
stack_v2_sparse_classes_75kplus_train_068038
2,199
no_license
[ { "docstring": "Initializes the tree that contains the traces using the specified traces on the second param Traces format example: [ [\"main\", \"workloop\", \"select\"], [\"main\", \"parse_args\"], [\"main\", \"workloop\", \"parse_data\", \"parse_entry\"], [\"main\", \"workloop\", \"select\"] ]", "name": ...
2
stack_v2_sparse_classes_30k_train_033807
Implement the Python class `TracesProcessor` described below. Class description: Implement the TracesProcessor class. Method signatures and docstrings: - def __init__(self, traces): Initializes the tree that contains the traces using the specified traces on the second param Traces format example: [ ["main", "workloop...
Implement the Python class `TracesProcessor` described below. Class description: Implement the TracesProcessor class. Method signatures and docstrings: - def __init__(self, traces): Initializes the tree that contains the traces using the specified traces on the second param Traces format example: [ ["main", "workloop...
5e63e238950c2f6bdfd3ff48311d6c69a676d382
<|skeleton|> class TracesProcessor: def __init__(self, traces): """Initializes the tree that contains the traces using the specified traces on the second param Traces format example: [ ["main", "workloop", "select"], ["main", "parse_args"], ["main", "workloop", "parse_data", "parse_entry"], ["main", "workl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TracesProcessor: def __init__(self, traces): """Initializes the tree that contains the traces using the specified traces on the second param Traces format example: [ ["main", "workloop", "select"], ["main", "parse_args"], ["main", "workloop", "parse_data", "parse_entry"], ["main", "workloop", "select"...
the_stack_v2_python_sparse
uber.py
alonsovidales/interview_questions
train
6
3468f9f5462e745b72e0851d620c546908122a71
[ "self.entity_name = entity_name\nself.read_model_from_s3 = read_model_from_s3\nself.read_embeddings_from_remote_url = read_embeddings_from_remote_url\nself.live_crf_model_path = live_crf_model_path\ncrf_model = CrfModel(entity_name=self.entity_name)\nif self.read_model_from_s3:\n self.tagger = crf_model.load_mod...
<|body_start_0|> self.entity_name = entity_name self.read_model_from_s3 = read_model_from_s3 self.read_embeddings_from_remote_url = read_embeddings_from_remote_url self.live_crf_model_path = live_crf_model_path crf_model = CrfModel(entity_name=self.entity_name) if self.re...
This method is used to detect a text entity using the Crf model.
CrfDetection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrfDetection: """This method is used to detect a text entity using the Crf model.""" def __init__(self, entity_name, read_model_from_s3=False, read_embeddings_from_remote_url=False, live_crf_model_path=''): """This method is used to detect text entities using the Crf model Args: enti...
stack_v2_sparse_classes_75kplus_train_068039
2,897
no_license
[ { "docstring": "This method is used to detect text entities using the Crf model Args: entity_name (str): Name of the entity for which the entity has to be detected read_model_from_s3 (bool): To indicate if cloud storage settings is required. live_crf_model_path (str): Path for the model to be loaded. read_embed...
2
stack_v2_sparse_classes_30k_train_042495
Implement the Python class `CrfDetection` described below. Class description: This method is used to detect a text entity using the Crf model. Method signatures and docstrings: - def __init__(self, entity_name, read_model_from_s3=False, read_embeddings_from_remote_url=False, live_crf_model_path=''): This method is us...
Implement the Python class `CrfDetection` described below. Class description: This method is used to detect a text entity using the Crf model. Method signatures and docstrings: - def __init__(self, entity_name, read_model_from_s3=False, read_embeddings_from_remote_url=False, live_crf_model_path=''): This method is us...
b2ffe0413fd3622530779bedd103cca97ccbb1d6
<|skeleton|> class CrfDetection: """This method is used to detect a text entity using the Crf model.""" def __init__(self, entity_name, read_model_from_s3=False, read_embeddings_from_remote_url=False, live_crf_model_path=''): """This method is used to detect text entities using the Crf model Args: enti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CrfDetection: """This method is used to detect a text entity using the Crf model.""" def __init__(self, entity_name, read_model_from_s3=False, read_embeddings_from_remote_url=False, live_crf_model_path=''): """This method is used to detect text entities using the Crf model Args: entity_name (str)...
the_stack_v2_python_sparse
models/crf_v2/crf_detect_entity.py
saishashank85/chatbot_challengers
train
0
eb0b30bf221802038424252bb8254addc37523c0
[ "self.population = []\nfor i in range(simulation.population_size):\n person = Person()\n self.population.append(person)", "infected_count = int(round(simulation.infection_percent * simulation.population_size, 0))\nfor i in range(infected_count):\n self.population[i].is_infected = True\n self.populatio...
<|body_start_0|> self.population = [] for i in range(simulation.population_size): person = Person() self.population.append(person) <|end_body_0|> <|body_start_1|> infected_count = int(round(simulation.infection_percent * simulation.population_size, 0)) for i in r...
A class to model a whole population of Person objects
Population
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Population: """A class to model a whole population of Person objects""" def __init__(self, simulation): """Initialize attributes""" <|body_0|> def initial_infection(self, simulation): """Infect an initial portion of the population.""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus_train_068040
8,550
permissive
[ { "docstring": "Initialize attributes", "name": "__init__", "signature": "def __init__(self, simulation)" }, { "docstring": "Infect an initial portion of the population.", "name": "initial_infection", "signature": "def initial_infection(self, simulation)" }, { "docstring": "Sprea...
6
stack_v2_sparse_classes_30k_train_054109
Implement the Python class `Population` described below. Class description: A class to model a whole population of Person objects Method signatures and docstrings: - def __init__(self, simulation): Initialize attributes - def initial_infection(self, simulation): Infect an initial portion of the population. - def spre...
Implement the Python class `Population` described below. Class description: A class to model a whole population of Person objects Method signatures and docstrings: - def __init__(self, simulation): Initialize attributes - def initial_infection(self, simulation): Infect an initial portion of the population. - def spre...
a9f44d20ae212b5cbc190ac49ca7acc638ff4228
<|skeleton|> class Population: """A class to model a whole population of Person objects""" def __init__(self, simulation): """Initialize attributes""" <|body_0|> def initial_infection(self, simulation): """Infect an initial portion of the population.""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Population: """A class to model a whole population of Person objects""" def __init__(self, simulation): """Initialize attributes""" self.population = [] for i in range(simulation.population_size): person = Person() self.population.append(person) def in...
the_stack_v2_python_sparse
9_Classes/challenge_39_code.py
demoanddemo/The-Art-of-Doing-Code-40-Challenging-Python-Programs-Today
train
0
85c36fd25b4b991d9e7f274499cb7e05fdd74594
[ "self.key = key\nself.children = []\nself.end = None", "cur = self\nlen_word = len(word)\nj = 0\nwhile j < len_word:\n len_child = len(cur.children)\n i = 0\n while i < len_child:\n if word[j] == cur.children[i].key:\n cur = cur.children[i]\n break\n i += 1\n if i =...
<|body_start_0|> self.key = key self.children = [] self.end = None <|end_body_0|> <|body_start_1|> cur = self len_word = len(word) j = 0 while j < len_word: len_child = len(cur.children) i = 0 while i < len_child: ...
Trie
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trie: def __init__(self, key=None): """Initialize your data structure here.""" <|body_0|> def insert(self, word): """Inserts a word into the trie. :type word: str :rtype: void""" <|body_1|> def search(self, word): """Returns if the word is in the...
stack_v2_sparse_classes_75kplus_train_068041
2,365
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self, key=None)" }, { "docstring": "Inserts a word into the trie. :type word: str :rtype: void", "name": "insert", "signature": "def insert(self, word)" }, { "docstring": "Return...
4
stack_v2_sparse_classes_30k_train_018672
Implement the Python class `Trie` described below. Class description: Implement the Trie class. Method signatures and docstrings: - def __init__(self, key=None): Initialize your data structure here. - def insert(self, word): Inserts a word into the trie. :type word: str :rtype: void - def search(self, word): Returns ...
Implement the Python class `Trie` described below. Class description: Implement the Trie class. Method signatures and docstrings: - def __init__(self, key=None): Initialize your data structure here. - def insert(self, word): Inserts a word into the trie. :type word: str :rtype: void - def search(self, word): Returns ...
e16702d2b3ec4e5054baad56f4320bc3b31676ad
<|skeleton|> class Trie: def __init__(self, key=None): """Initialize your data structure here.""" <|body_0|> def insert(self, word): """Inserts a word into the trie. :type word: str :rtype: void""" <|body_1|> def search(self, word): """Returns if the word is in the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Trie: def __init__(self, key=None): """Initialize your data structure here.""" self.key = key self.children = [] self.end = None def insert(self, word): """Inserts a word into the trie. :type word: str :rtype: void""" cur = self len_word = len(word)...
the_stack_v2_python_sparse
CLRS/Trie/Trie_struct.py
SuperMartinYang/learning_algorithm
train
0
2cee45fee9f5157adcc3d25658527508e0281eb5
[ "next_service_obj = self.env['next.service.days']\nservice_obj = self.env['fleet.vehicle.log.services']\nincre_obj = self.env['next.increment.number']\nservice_active_id = service_obj.browse(self._context['active_id'])\nnext_service_obj.create({'vehicle_id': self.vehicle_id and self.vehicle_id.id or False, 'days': ...
<|body_start_0|> next_service_obj = self.env['next.service.days'] service_obj = self.env['fleet.vehicle.log.services'] incre_obj = self.env['next.increment.number'] service_active_id = service_obj.browse(self._context['active_id']) next_service_obj.create({'vehicle_id': self.vehi...
Added Next Service and Odometer Increment.
UpdateNextServiceConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNextServiceConfig: """Added Next Service and Odometer Increment.""" def action_done(self): """Method to set Next Service Day and Odometer Increment.""" <|body_0|> def default_get(self, default_fields): """Method is used to set Vehicle Id.""" <|body_...
stack_v2_sparse_classes_75kplus_train_068042
1,726
no_license
[ { "docstring": "Method to set Next Service Day and Odometer Increment.", "name": "action_done", "signature": "def action_done(self)" }, { "docstring": "Method is used to set Vehicle Id.", "name": "default_get", "signature": "def default_get(self, default_fields)" } ]
2
stack_v2_sparse_classes_30k_train_041948
Implement the Python class `UpdateNextServiceConfig` described below. Class description: Added Next Service and Odometer Increment. Method signatures and docstrings: - def action_done(self): Method to set Next Service Day and Odometer Increment. - def default_get(self, default_fields): Method is used to set Vehicle I...
Implement the Python class `UpdateNextServiceConfig` described below. Class description: Added Next Service and Odometer Increment. Method signatures and docstrings: - def action_done(self): Method to set Next Service Day and Odometer Increment. - def default_get(self, default_fields): Method is used to set Vehicle I...
7618a365ac78c0f59390a3a6b5fcdd9f76a5ddec
<|skeleton|> class UpdateNextServiceConfig: """Added Next Service and Odometer Increment.""" def action_done(self): """Method to set Next Service Day and Odometer Increment.""" <|body_0|> def default_get(self, default_fields): """Method is used to set Vehicle Id.""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateNextServiceConfig: """Added Next Service and Odometer Increment.""" def action_done(self): """Method to set Next Service Day and Odometer Increment.""" next_service_obj = self.env['next.service.days'] service_obj = self.env['fleet.vehicle.log.services'] incre_obj = s...
the_stack_v2_python_sparse
fleet_operations/wizard/update_next_service.py
JayVora-SerpentCS/fleet_management
train
29
5c8312e9e7718cbbd74017e1e7eafacbb639016b
[ "fsa_filename = './TestFiles/fsa1'\nwith open(fsa_filename, 'r') as fsa_file:\n fsa_rules = fsa_file.readlines()\nacceptor = FSAAcceptor(fsa_rules)\nself.assertTrue(acceptor.can_accept_string(self.test_string1))\nself.assertTrue(acceptor.can_accept_string(self.test_string2))\nself.assertTrue(acceptor.can_accept_...
<|body_start_0|> fsa_filename = './TestFiles/fsa1' with open(fsa_filename, 'r') as fsa_file: fsa_rules = fsa_file.readlines() acceptor = FSAAcceptor(fsa_rules) self.assertTrue(acceptor.can_accept_string(self.test_string1)) self.assertTrue(acceptor.can_accept_string(se...
This class contains tests for the FSAAcceptor class
TestFSAAcceptor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFSAAcceptor: """This class contains tests for the FSAAcceptor class""" def test_fsa1(self): """Tests for FSA1 :return: void""" <|body_0|> def test_fsa2(self): """Tests for FSA2 :return: void""" <|body_1|> def test_fsa3(self): """Tests for...
stack_v2_sparse_classes_75kplus_train_068043
6,573
no_license
[ { "docstring": "Tests for FSA1 :return: void", "name": "test_fsa1", "signature": "def test_fsa1(self)" }, { "docstring": "Tests for FSA2 :return: void", "name": "test_fsa2", "signature": "def test_fsa2(self)" }, { "docstring": "Tests for FSA3 :return: void", "name": "test_fsa...
4
stack_v2_sparse_classes_30k_train_012942
Implement the Python class `TestFSAAcceptor` described below. Class description: This class contains tests for the FSAAcceptor class Method signatures and docstrings: - def test_fsa1(self): Tests for FSA1 :return: void - def test_fsa2(self): Tests for FSA2 :return: void - def test_fsa3(self): Tests for FSA3 :return: ...
Implement the Python class `TestFSAAcceptor` described below. Class description: This class contains tests for the FSAAcceptor class Method signatures and docstrings: - def test_fsa1(self): Tests for FSA1 :return: void - def test_fsa2(self): Tests for FSA2 :return: void - def test_fsa3(self): Tests for FSA3 :return: ...
7af7b357347ed526de7a3d6f16652843d214dcbf
<|skeleton|> class TestFSAAcceptor: """This class contains tests for the FSAAcceptor class""" def test_fsa1(self): """Tests for FSA1 :return: void""" <|body_0|> def test_fsa2(self): """Tests for FSA2 :return: void""" <|body_1|> def test_fsa3(self): """Tests for...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestFSAAcceptor: """This class contains tests for the FSAAcceptor class""" def test_fsa1(self): """Tests for FSA1 :return: void""" fsa_filename = './TestFiles/fsa1' with open(fsa_filename, 'r') as fsa_file: fsa_rules = fsa_file.readlines() acceptor = FSAAccepto...
the_stack_v2_python_sparse
FiniteStateMachines/FSAAcceptor/fsa_acceptor.py
zoew2/Projects
train
0
96cc7420b3d25dc25f1b1cbca43d80ddf496ae94
[ "try:\n request_info = json.loads(str(request.body, 'utf-8'))\n result = netconf.create_new_network(request_info)\n if request_info['type'] == 'wdnn':\n JobStateLoader().check_exist(request_info['nn_id'], '1')\n else:\n JobStateLoader().check_exist(request_info['nn_id'], '2')\n return_d...
<|body_start_0|> try: request_info = json.loads(str(request.body, 'utf-8')) result = netconf.create_new_network(request_info) if request_info['type'] == 'wdnn': JobStateLoader().check_exist(request_info['nn_id'], '1') else: JobState...
1. Name : CommonNetInfo (step 2) 2. Steps - WDNN essential steps - post /api/v1/type/common/env/ - post /api/v1/type/common/job/{nnid}/ - post /api/v1/type/dataframe/base/{baseid}/table/{tb}/ - post /api/v1/type/dataframe/base/{baseid}/table/{tb}/data/ - post /api/v1/type/dataframe/base/{baseid}/table/{tb}/data/{args}/...
CommonNetInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonNetInfo: """1. Name : CommonNetInfo (step 2) 2. Steps - WDNN essential steps - post /api/v1/type/common/env/ - post /api/v1/type/common/job/{nnid}/ - post /api/v1/type/dataframe/base/{baseid}/table/{tb}/ - post /api/v1/type/dataframe/base/{baseid}/table/{tb}/data/ - post /api/v1/type/datafr...
stack_v2_sparse_classes_75kplus_train_068044
4,036
no_license
[ { "docstring": "- Request json data example <texfied> <font size = 1> { \"nn_id\": \"nn0000012\", \"category\": \"MES\", \"subcate\" : \"M60\", \"name\": \"evaluation\", \"desc\" : \"wdnn_protoType\" } </font> </textfield> --- parameters: - name: body paramType: body pytype: json", "name": "post", "sign...
4
stack_v2_sparse_classes_30k_train_051110
Implement the Python class `CommonNetInfo` described below. Class description: 1. Name : CommonNetInfo (step 2) 2. Steps - WDNN essential steps - post /api/v1/type/common/env/ - post /api/v1/type/common/job/{nnid}/ - post /api/v1/type/dataframe/base/{baseid}/table/{tb}/ - post /api/v1/type/dataframe/base/{baseid}/tabl...
Implement the Python class `CommonNetInfo` described below. Class description: 1. Name : CommonNetInfo (step 2) 2. Steps - WDNN essential steps - post /api/v1/type/common/env/ - post /api/v1/type/common/job/{nnid}/ - post /api/v1/type/dataframe/base/{baseid}/table/{tb}/ - post /api/v1/type/dataframe/base/{baseid}/tabl...
ef058737f391de817c74398ef9a5d3a28f973c98
<|skeleton|> class CommonNetInfo: """1. Name : CommonNetInfo (step 2) 2. Steps - WDNN essential steps - post /api/v1/type/common/env/ - post /api/v1/type/common/job/{nnid}/ - post /api/v1/type/dataframe/base/{baseid}/table/{tb}/ - post /api/v1/type/dataframe/base/{baseid}/table/{tb}/data/ - post /api/v1/type/datafr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommonNetInfo: """1. Name : CommonNetInfo (step 2) 2. Steps - WDNN essential steps - post /api/v1/type/common/env/ - post /api/v1/type/common/job/{nnid}/ - post /api/v1/type/dataframe/base/{baseid}/table/{tb}/ - post /api/v1/type/dataframe/base/{baseid}/table/{tb}/data/ - post /api/v1/type/dataframe/base/{bas...
the_stack_v2_python_sparse
tfmsarest/views/common_nninfo.py
TensorMSA/tensormsa_old
train
6
4cd47ccda052bd21ddb821da7d775c334df3098f
[ "self._vertex = vertex\nself._edges = edges\nself._building_block = building_block", "position_matrix = self._vertex.place_building_block(building_block=self._building_block, edges=self._edges)\nposition_matrix.setflags(write=False)\nbuilding_block = self._building_block.with_position_matrix(position_matrix=posit...
<|body_start_0|> self._vertex = vertex self._edges = edges self._building_block = building_block <|end_body_0|> <|body_start_1|> position_matrix = self._vertex.place_building_block(building_block=self._building_block, edges=self._edges) position_matrix.setflags(write=False) ...
Represents placement of a building block on a vertex. It represents a computation which carries out the placement of the building block on the vertex and the mapping of its functional group to edges.
_Placement
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Placement: """Represents placement of a building block on a vertex. It represents a computation which carries out the placement of the building block on the vertex and the mapping of its functional group to edges.""" def __init__(self, vertex, edges, building_block): """Initialize a...
stack_v2_sparse_classes_75kplus_train_068045
2,570
permissive
[ { "docstring": "Initialize a :class:`._Placement`. Parameters ---------- vertex : :class:`.Vertex` The vertex which does the placement. edges : :class:`tuple` of :class:`.Edge` The edges connected to `vertex`. building_block : :class:`.BuildingBlock` The building block to be placed on `vertex`.", "name": "_...
2
stack_v2_sparse_classes_30k_train_039062
Implement the Python class `_Placement` described below. Class description: Represents placement of a building block on a vertex. It represents a computation which carries out the placement of the building block on the vertex and the mapping of its functional group to edges. Method signatures and docstrings: - def __...
Implement the Python class `_Placement` described below. Class description: Represents placement of a building block on a vertex. It represents a computation which carries out the placement of the building block on the vertex and the mapping of its functional group to edges. Method signatures and docstrings: - def __...
46f70cd000890ca7c2312cc0fdbab306565f1400
<|skeleton|> class _Placement: """Represents placement of a building block on a vertex. It represents a computation which carries out the placement of the building block on the vertex and the mapping of its functional group to edges.""" def __init__(self, vertex, edges, building_block): """Initialize a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _Placement: """Represents placement of a building block on a vertex. It represents a computation which carries out the placement of the building block on the vertex and the mapping of its functional group to edges.""" def __init__(self, vertex, edges, building_block): """Initialize a :class:`._Pl...
the_stack_v2_python_sparse
src/stk/molecular/topology_graphs/topology_graph/topology_graph/implementations/utilities.py
supramolecular-toolkit/stk
train
22
5e62db1c07476e018c583309e11eb839248224db
[ "if len(nums) < 2:\n return\neor = 0\nfor num in nums:\n eor ^= num\nfirstBitis1 = 0\nwhile eor & 1 == 0:\n eor >>= 1\n firstBitis1 += 1\njudgegroup = lambda x, n: x >> n & 1\nr1, r2 = (0, 0)\nfor num in nums:\n if judgegroup(num, firstBitis1):\n r1 ^= num\n else:\n r2 ^= num\nreturn...
<|body_start_0|> if len(nums) < 2: return eor = 0 for num in nums: eor ^= num firstBitis1 = 0 while eor & 1 == 0: eor >>= 1 firstBitis1 += 1 judgegroup = lambda x, n: x >> n & 1 r1, r2 = (0, 0) for num in num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumbers(self, nums: List[int]) -> List[int]: """异或做法 56ms, 77.83%""" <|body_0|> def singleNumbers_hash(self, nums: List[int]) -> List[int]: """哈希表 + 删除 70+ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums) < 2: ...
stack_v2_sparse_classes_75kplus_train_068046
1,495
no_license
[ { "docstring": "异或做法 56ms, 77.83%", "name": "singleNumbers", "signature": "def singleNumbers(self, nums: List[int]) -> List[int]" }, { "docstring": "哈希表 + 删除 70+ms", "name": "singleNumbers_hash", "signature": "def singleNumbers_hash(self, nums: List[int]) -> List[int]" } ]
2
stack_v2_sparse_classes_30k_train_007667
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumbers(self, nums: List[int]) -> List[int]: 异或做法 56ms, 77.83% - def singleNumbers_hash(self, nums: List[int]) -> List[int]: 哈希表 + 删除 70+ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumbers(self, nums: List[int]) -> List[int]: 异或做法 56ms, 77.83% - def singleNumbers_hash(self, nums: List[int]) -> List[int]: 哈希表 + 删除 70+ms <|skeleton|> class Solution...
b6712c793bbfe443953e7186b5dbd876c01cd9a0
<|skeleton|> class Solution: def singleNumbers(self, nums: List[int]) -> List[int]: """异或做法 56ms, 77.83%""" <|body_0|> def singleNumbers_hash(self, nums: List[int]) -> List[int]: """哈希表 + 删除 70+ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def singleNumbers(self, nums: List[int]) -> List[int]: """异或做法 56ms, 77.83%""" if len(nums) < 2: return eor = 0 for num in nums: eor ^= num firstBitis1 = 0 while eor & 1 == 0: eor >>= 1 firstBitis1 += 1 ...
the_stack_v2_python_sparse
05_leetcode/Offer 56.I 数组中数字出现的次数.py
niceNASA/Python-Foundation-Suda
train
0
0d1378643bd856662849d4582ee8658479de385c
[ "l = [0] * 32\nn = len(nums)\nfor num in nums:\n t = 1\n for i in range(32):\n if t & num:\n l[i] += 1\n t <<= 1\nres = 0\nfor i in range(32):\n res += l[i] * (n - l[i])\nreturn res", "def hammingDistance(x, y):\n a = x ^ y\n c = 0\n while a:\n a = a & a - 1\n ...
<|body_start_0|> l = [0] * 32 n = len(nums) for num in nums: t = 1 for i in range(32): if t & num: l[i] += 1 t <<= 1 res = 0 for i in range(32): res += l[i] * (n - l[i]) return res <|e...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def totalHammingDistance(self, nums): """l[i] nums中第i位为1的个数 时间复杂度O(32n)=O(n) res = sum(l[i] * (n - l[i]) for i in range(32)) :param nums: :return:""" <|body_0|> def totalHammingDistance2(self, nums): """暴力做法 时间复杂度O(n^2) 应该会超时 :type nums: List[int] :rtype: i...
stack_v2_sparse_classes_75kplus_train_068047
9,819
no_license
[ { "docstring": "l[i] nums中第i位为1的个数 时间复杂度O(32n)=O(n) res = sum(l[i] * (n - l[i]) for i in range(32)) :param nums: :return:", "name": "totalHammingDistance", "signature": "def totalHammingDistance(self, nums)" }, { "docstring": "暴力做法 时间复杂度O(n^2) 应该会超时 :type nums: List[int] :rtype: int", "name"...
2
stack_v2_sparse_classes_30k_train_003561
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def totalHammingDistance(self, nums): l[i] nums中第i位为1的个数 时间复杂度O(32n)=O(n) res = sum(l[i] * (n - l[i]) for i in range(32)) :param nums: :return: - def totalHammingDistance2(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def totalHammingDistance(self, nums): l[i] nums中第i位为1的个数 时间复杂度O(32n)=O(n) res = sum(l[i] * (n - l[i]) for i in range(32)) :param nums: :return: - def totalHammingDistance2(self, ...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def totalHammingDistance(self, nums): """l[i] nums中第i位为1的个数 时间复杂度O(32n)=O(n) res = sum(l[i] * (n - l[i]) for i in range(32)) :param nums: :return:""" <|body_0|> def totalHammingDistance2(self, nums): """暴力做法 时间复杂度O(n^2) 应该会超时 :type nums: List[int] :rtype: i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def totalHammingDistance(self, nums): """l[i] nums中第i位为1的个数 时间复杂度O(32n)=O(n) res = sum(l[i] * (n - l[i]) for i in range(32)) :param nums: :return:""" l = [0] * 32 n = len(nums) for num in nums: t = 1 for i in range(32): if t & n...
the_stack_v2_python_sparse
477_汉明距离总和.py
lovehhf/LeetCode
train
0
16cc7584e376ca79edc9f9970a09cfb46c4fe1ec
[ "review_request = context['review_request']\ndraft = review_request.get_draft(context['request'].user)\nif draft and draft.diffset or review_request.has_diffsets:\n return _('Update Diff')\nelse:\n return _('Upload Diff')", "request = context['request']\nreview_request = context.get('review_request')\nperms...
<|body_start_0|> review_request = context['review_request'] draft = review_request.get_draft(context['request'].user) if draft and draft.diffset or review_request.has_diffsets: return _('Update Diff') else: return _('Upload Diff') <|end_body_0|> <|body_start_1|> ...
The action to update or upload a diff. Version Added: 6.0
UploadDiffAction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UploadDiffAction: """The action to update or upload a diff. Version Added: 6.0""" def get_label(self, *, context: Context) -> _StrOrPromise: """Return the label for the action. Args: context (django.template.Context): The current rendering context. Returns: str: The label to use for ...
stack_v2_sparse_classes_75kplus_train_068048
36,416
permissive
[ { "docstring": "Return the label for the action. Args: context (django.template.Context): The current rendering context. Returns: str: The label to use for the action.", "name": "get_label", "signature": "def get_label(self, *, context: Context) -> _StrOrPromise" }, { "docstring": "Return whethe...
2
stack_v2_sparse_classes_30k_train_023784
Implement the Python class `UploadDiffAction` described below. Class description: The action to update or upload a diff. Version Added: 6.0 Method signatures and docstrings: - def get_label(self, *, context: Context) -> _StrOrPromise: Return the label for the action. Args: context (django.template.Context): The curre...
Implement the Python class `UploadDiffAction` described below. Class description: The action to update or upload a diff. Version Added: 6.0 Method signatures and docstrings: - def get_label(self, *, context: Context) -> _StrOrPromise: Return the label for the action. Args: context (django.template.Context): The curre...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class UploadDiffAction: """The action to update or upload a diff. Version Added: 6.0""" def get_label(self, *, context: Context) -> _StrOrPromise: """Return the label for the action. Args: context (django.template.Context): The current rendering context. Returns: str: The label to use for ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UploadDiffAction: """The action to update or upload a diff. Version Added: 6.0""" def get_label(self, *, context: Context) -> _StrOrPromise: """Return the label for the action. Args: context (django.template.Context): The current rendering context. Returns: str: The label to use for the action.""...
the_stack_v2_python_sparse
reviewboard/reviews/actions.py
reviewboard/reviewboard
train
1,141
295a9f07cc73b6d6b3bff355e50d4709e6b0b662
[ "model_config = self.task_config.model\nmodel_params = model_config.model_params.as_dict()\nmodel = AutosegEdgeTPU(model_params, min_level=model_config.head.min_level, max_level=model_config.head.max_level, fpn_num_filters=model_config.head.fpn_num_filters, num_classes=model_config.num_classes)\nlogging.info(model_...
<|body_start_0|> model_config = self.task_config.model model_params = model_config.model_params.as_dict() model = AutosegEdgeTPU(model_params, min_level=model_config.head.min_level, max_level=model_config.head.max_level, fpn_num_filters=model_config.head.fpn_num_filters, num_classes=model_config...
A task for training the AutosegEdgeTPU models.
AutosegEdgeTPUTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutosegEdgeTPUTask: """A task for training the AutosegEdgeTPU models.""" def build_model(self): """Builds model for training task.""" <|body_0|> def build_inputs(self, params: cfg.DataConfig, input_context: Optional[tf.distribute.InputContext]=None): """Builds in...
stack_v2_sparse_classes_75kplus_train_068049
11,868
permissive
[ { "docstring": "Builds model for training task.", "name": "build_model", "signature": "def build_model(self)" }, { "docstring": "Builds inputs for the segmentation task.", "name": "build_inputs", "signature": "def build_inputs(self, params: cfg.DataConfig, input_context: Optional[tf.dist...
2
stack_v2_sparse_classes_30k_train_042636
Implement the Python class `AutosegEdgeTPUTask` described below. Class description: A task for training the AutosegEdgeTPU models. Method signatures and docstrings: - def build_model(self): Builds model for training task. - def build_inputs(self, params: cfg.DataConfig, input_context: Optional[tf.distribute.InputCont...
Implement the Python class `AutosegEdgeTPUTask` described below. Class description: A task for training the AutosegEdgeTPU models. Method signatures and docstrings: - def build_model(self): Builds model for training task. - def build_inputs(self, params: cfg.DataConfig, input_context: Optional[tf.distribute.InputCont...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class AutosegEdgeTPUTask: """A task for training the AutosegEdgeTPU models.""" def build_model(self): """Builds model for training task.""" <|body_0|> def build_inputs(self, params: cfg.DataConfig, input_context: Optional[tf.distribute.InputContext]=None): """Builds in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AutosegEdgeTPUTask: """A task for training the AutosegEdgeTPU models.""" def build_model(self): """Builds model for training task.""" model_config = self.task_config.model model_params = model_config.model_params.as_dict() model = AutosegEdgeTPU(model_params, min_level=mod...
the_stack_v2_python_sparse
official/projects/edgetpu/vision/tasks/semantic_segmentation.py
jianzhnie/models
train
2
ded34f69ecb6bf3d1fef30d8389fa846e48654b1
[ "try:\n return Part.objects.get(id=id)\nexcept Part.DoesNotExist:\n return None", "part = self.get_object(id)\nserializer = PartSerializer(part)\nreturn Response(serializer.data)", "part = self.get_object(id)\nserializer = PartSerializer(part, data=request.data)\nif serializer.is_valid():\n serializer....
<|body_start_0|> try: return Part.objects.get(id=id) except Part.DoesNotExist: return None <|end_body_0|> <|body_start_1|> part = self.get_object(id) serializer = PartSerializer(part) return Response(serializer.data) <|end_body_1|> <|body_start_2|> ...
This class handles GET, PUT, and DELETE actions for the Part resource. GET - Retrieves a single part PUT - Updates a single parts information Delete - Removes a part from the list
PartObjectView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PartObjectView: """This class handles GET, PUT, and DELETE actions for the Part resource. GET - Retrieves a single part PUT - Updates a single parts information Delete - Removes a part from the list""" def get_object(self, id): """This method takes care of the get_object action for t...
stack_v2_sparse_classes_75kplus_train_068050
1,917
no_license
[ { "docstring": "This method takes care of the get_object action for the part resource.", "name": "get_object", "signature": "def get_object(self, id)" }, { "docstring": "This method takes care of the get action for the part resource.", "name": "get", "signature": "def get(self, request, ...
4
stack_v2_sparse_classes_30k_train_007721
Implement the Python class `PartObjectView` described below. Class description: This class handles GET, PUT, and DELETE actions for the Part resource. GET - Retrieves a single part PUT - Updates a single parts information Delete - Removes a part from the list Method signatures and docstrings: - def get_object(self, i...
Implement the Python class `PartObjectView` described below. Class description: This class handles GET, PUT, and DELETE actions for the Part resource. GET - Retrieves a single part PUT - Updates a single parts information Delete - Removes a part from the list Method signatures and docstrings: - def get_object(self, i...
3a768f37e14732b79f3f0d28e772cec38a6a9ed1
<|skeleton|> class PartObjectView: """This class handles GET, PUT, and DELETE actions for the Part resource. GET - Retrieves a single part PUT - Updates a single parts information Delete - Removes a part from the list""" def get_object(self, id): """This method takes care of the get_object action for t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PartObjectView: """This class handles GET, PUT, and DELETE actions for the Part resource. GET - Retrieves a single part PUT - Updates a single parts information Delete - Removes a part from the list""" def get_object(self, id): """This method takes care of the get_object action for the part resou...
the_stack_v2_python_sparse
redline/views/part_object_view.py
kevinbooth/redline
train
2
d517fc71f09fe5e4dabddad9218335a817d2a60e
[ "self.setMassFrac('CR', 0.07)\nself.setMassFrac('MO', 0.16)\nself.setMassFrac('FE', 0.04)\nself.setMassFrac('SI', 0.01)\nself.setMassFrac('MN', 0.008)\nself.setMassFrac('V', 0.0005)\nself.setMassFrac('C', 0.0006)\nself.setMassFrac('CO', 0.002)\nself.setMassFrac('CU', 0.0035)\nself.setMassFrac('W', 0.005)\nself.setM...
<|body_start_0|> self.setMassFrac('CR', 0.07) self.setMassFrac('MO', 0.16) self.setMassFrac('FE', 0.04) self.setMassFrac('SI', 0.01) self.setMassFrac('MN', 0.008) self.setMassFrac('V', 0.0005) self.setMassFrac('C', 0.0006) self.setMassFrac('CO', 0.002) ...
Hastelloy N alloy (UNS N10003). .. [Haynes] Haynes International, H-2052D 2020 (http://haynesintl.com/docs/default-source/pdfs/new-alloy-brochures/corrosion-resistant-alloys/brochures/n-brochure.pdf) .. [SAB] Sabharwall, et. al. Feasibility Study of Secondary Heat Exchanger Concepts for the Advanced High Temperature Re...
HastelloyN
[ "Apache-2.0", "GPL-1.0-or-later", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HastelloyN: """Hastelloy N alloy (UNS N10003). .. [Haynes] Haynes International, H-2052D 2020 (http://haynesintl.com/docs/default-source/pdfs/new-alloy-brochures/corrosion-resistant-alloys/brochures/n-brochure.pdf) .. [SAB] Sabharwall, et. al. Feasibility Study of Secondary Heat Exchanger Concept...
stack_v2_sparse_classes_75kplus_train_068051
5,052
permissive
[ { "docstring": "Hastelloy N mass fractions. From [Haynes]_.", "name": "setDefaultMassFracs", "signature": "def setDefaultMassFracs(self)" }, { "docstring": "Calculates the thermal conductivity of Hastelloy N. Second order polynomial fit to data from [Haynes]_. Parameters ---------- Tk : float Te...
5
stack_v2_sparse_classes_30k_train_022176
Implement the Python class `HastelloyN` described below. Class description: Hastelloy N alloy (UNS N10003). .. [Haynes] Haynes International, H-2052D 2020 (http://haynesintl.com/docs/default-source/pdfs/new-alloy-brochures/corrosion-resistant-alloys/brochures/n-brochure.pdf) .. [SAB] Sabharwall, et. al. Feasibility St...
Implement the Python class `HastelloyN` described below. Class description: Hastelloy N alloy (UNS N10003). .. [Haynes] Haynes International, H-2052D 2020 (http://haynesintl.com/docs/default-source/pdfs/new-alloy-brochures/corrosion-resistant-alloys/brochures/n-brochure.pdf) .. [SAB] Sabharwall, et. al. Feasibility St...
360791847227df3f3a337a996ef561e00f846a09
<|skeleton|> class HastelloyN: """Hastelloy N alloy (UNS N10003). .. [Haynes] Haynes International, H-2052D 2020 (http://haynesintl.com/docs/default-source/pdfs/new-alloy-brochures/corrosion-resistant-alloys/brochures/n-brochure.pdf) .. [SAB] Sabharwall, et. al. Feasibility Study of Secondary Heat Exchanger Concept...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HastelloyN: """Hastelloy N alloy (UNS N10003). .. [Haynes] Haynes International, H-2052D 2020 (http://haynesintl.com/docs/default-source/pdfs/new-alloy-brochures/corrosion-resistant-alloys/brochures/n-brochure.pdf) .. [SAB] Sabharwall, et. al. Feasibility Study of Secondary Heat Exchanger Concepts for the Adv...
the_stack_v2_python_sparse
armi/materials/hastelloyN.py
terrapower/armi
train
204
ebfe3525b7dd4f9ec0f5ee73aa2f050d288677ca
[ "assert all((len(c) == 2 and isinstance(c[0], str) and isinstance(c[1], int) for c in columns)), columns\nself.use_cr_only = True\nself.unfinished_commands = set()\nself.start = time.time()\nself._last_printed_line = ''\nself._columns = [c[1] for c in columns]\nself._columns_lookup = dict(((c[0], i) for i, c in enu...
<|body_start_0|> assert all((len(c) == 2 and isinstance(c[0], str) and isinstance(c[1], int) for c in columns)), columns self.use_cr_only = True self.unfinished_commands = set() self.start = time.time() self._last_printed_line = '' self._columns = [c[1] for c in columns] ...
Prints progress and accepts updates thread-safely.
Progress
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Progress: """Prints progress and accepts updates thread-safely.""" def __init__(self, columns): """Creates a Progress bar that will updates asynchronously from the worker threads. Arguments: columns: list of tuple(name, initialvalue), defines both the number of columns and their init...
stack_v2_sparse_classes_75kplus_train_068052
27,770
permissive
[ { "docstring": "Creates a Progress bar that will updates asynchronously from the worker threads. Arguments: columns: list of tuple(name, initialvalue), defines both the number of columns and their initial values.", "name": "__init__", "signature": "def __init__(self, columns)" }, { "docstring": ...
5
stack_v2_sparse_classes_30k_train_053382
Implement the Python class `Progress` described below. Class description: Prints progress and accepts updates thread-safely. Method signatures and docstrings: - def __init__(self, columns): Creates a Progress bar that will updates asynchronously from the worker threads. Arguments: columns: list of tuple(name, initial...
Implement the Python class `Progress` described below. Class description: Prints progress and accepts updates thread-safely. Method signatures and docstrings: - def __init__(self, columns): Creates a Progress bar that will updates asynchronously from the worker threads. Arguments: columns: list of tuple(name, initial...
10cc5fdcca53e2a1690867acbe6fce099273f092
<|skeleton|> class Progress: """Prints progress and accepts updates thread-safely.""" def __init__(self, columns): """Creates a Progress bar that will updates asynchronously from the worker threads. Arguments: columns: list of tuple(name, initialvalue), defines both the number of columns and their init...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Progress: """Prints progress and accepts updates thread-safely.""" def __init__(self, columns): """Creates a Progress bar that will updates asynchronously from the worker threads. Arguments: columns: list of tuple(name, initialvalue), defines both the number of columns and their initial values.""...
the_stack_v2_python_sparse
client/utils/threading_utils.py
luci/luci-py
train
84
6d6941d0a51b52544cf220fa4d7aafac0595a695
[ "self.server = server\nself.platformname = platformname\nself.devicename = devicename\nself.app_value = app_value", "desired_caps = {'platformName': self.platformname, 'deviceName': self.devicename, 'app': self.app_value}\ntry:\n driver = webdriver.Remote(self.server, desired_caps)\nexcept Exception as e:\n ...
<|body_start_0|> self.server = server self.platformname = platformname self.devicename = devicename self.app_value = app_value <|end_body_0|> <|body_start_1|> desired_caps = {'platformName': self.platformname, 'deviceName': self.devicename, 'app': self.app_value} try: ...
Install
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Install: def __init__(self, server=SERVER, platformname=PLANTFORM, devicename=DEVIDE_NAME, app_value=APP_VALUE): """初始化信息 :param server: Appium Server :param platformname: 手机类型:安卓 | IOS :param devicename: 设备名称 :param app_value: 安装路径""" <|body_0|> def install(self): "...
stack_v2_sparse_classes_75kplus_train_068053
1,508
no_license
[ { "docstring": "初始化信息 :param server: Appium Server :param platformname: 手机类型:安卓 | IOS :param devicename: 设备名称 :param app_value: 安装路径", "name": "__init__", "signature": "def __init__(self, server=SERVER, platformname=PLANTFORM, devicename=DEVIDE_NAME, app_value=APP_VALUE)" }, { "docstring": "从PC端...
2
stack_v2_sparse_classes_30k_train_040212
Implement the Python class `Install` described below. Class description: Implement the Install class. Method signatures and docstrings: - def __init__(self, server=SERVER, platformname=PLANTFORM, devicename=DEVIDE_NAME, app_value=APP_VALUE): 初始化信息 :param server: Appium Server :param platformname: 手机类型:安卓 | IOS :param...
Implement the Python class `Install` described below. Class description: Implement the Install class. Method signatures and docstrings: - def __init__(self, server=SERVER, platformname=PLANTFORM, devicename=DEVIDE_NAME, app_value=APP_VALUE): 初始化信息 :param server: Appium Server :param platformname: 手机类型:安卓 | IOS :param...
ca958c07ce007219914ca101f010d1d523dabb94
<|skeleton|> class Install: def __init__(self, server=SERVER, platformname=PLANTFORM, devicename=DEVIDE_NAME, app_value=APP_VALUE): """初始化信息 :param server: Appium Server :param platformname: 手机类型:安卓 | IOS :param devicename: 设备名称 :param app_value: 安装路径""" <|body_0|> def install(self): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Install: def __init__(self, server=SERVER, platformname=PLANTFORM, devicename=DEVIDE_NAME, app_value=APP_VALUE): """初始化信息 :param server: Appium Server :param platformname: 手机类型:安卓 | IOS :param devicename: 设备名称 :param app_value: 安装路径""" self.server = server self.platformname = platformn...
the_stack_v2_python_sparse
03-Install_App/Install_local.py
hyqgod/Sao_Operation
train
0
9ffb9b7e5752d2d18483bf11ef9f1427175fda91
[ "super(ListenService, self).__init__()\nself._fService = Factory()\nself.protocol = ListenProtocol\nself._fService.protocol = self.protocol\nself._name = Config.listen.name\nself._ports = Config.listen.ports\nself._transport = dict([])\nself._stop = True\nself._active = False", "try:\n self._stop = False\n ...
<|body_start_0|> super(ListenService, self).__init__() self._fService = Factory() self.protocol = ListenProtocol self._fService.protocol = self.protocol self._name = Config.listen.name self._ports = Config.listen.ports self._transport = dict([]) self._stop...
ListenService
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListenService: def __init__(self): """This service can open a lot of ports and starts listening and loggin on them.""" <|body_0|> def startService(self): """Start service on all ports defined in Config.py. Ignores ports where it can't listen. :return:""" <|bo...
stack_v2_sparse_classes_75kplus_train_068054
3,469
permissive
[ { "docstring": "This service can open a lot of ports and starts listening and loggin on them.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Start service on all ports defined in Config.py. Ignores ports where it can't listen. :return:", "name": "startService", ...
5
null
Implement the Python class `ListenService` described below. Class description: Implement the ListenService class. Method signatures and docstrings: - def __init__(self): This service can open a lot of ports and starts listening and loggin on them. - def startService(self): Start service on all ports defined in Config...
Implement the Python class `ListenService` described below. Class description: Implement the ListenService class. Method signatures and docstrings: - def __init__(self): This service can open a lot of ports and starts listening and loggin on them. - def startService(self): Start service on all ports defined in Config...
15009edbc39c83bac4585441fc0ac09c86d1de46
<|skeleton|> class ListenService: def __init__(self): """This service can open a lot of ports and starts listening and loggin on them.""" <|body_0|> def startService(self): """Start service on all ports defined in Config.py. Ignores ports where it can't listen. :return:""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ListenService: def __init__(self): """This service can open a lot of ports and starts listening and loggin on them.""" super(ListenService, self).__init__() self._fService = Factory() self.protocol = ListenProtocol self._fService.protocol = self.protocol self._n...
the_stack_v2_python_sparse
honeygrove/services/ListenService.py
ekaxis/honeygrove
train
1
53c60bcb36b042f6c2e6f18f238a16a79dae1d17
[ "res = []\ni, j, carry = (len(a) - 1, len(b) - 1, 0)\nwhile i >= 0 or j >= 0 or carry:\n val = carry\n if i >= 0:\n val += int(a[i])\n i -= 1\n if j >= 0:\n val += int(b[j])\n j -= 1\n carry = val >> 1\n res.append(str(val & 1))\nreturn ''.join(res[::-1])", "x = int(a, 2...
<|body_start_0|> res = [] i, j, carry = (len(a) - 1, len(b) - 1, 0) while i >= 0 or j >= 0 or carry: val = carry if i >= 0: val += int(a[i]) i -= 1 if j >= 0: val += int(b[j]) j -= 1 c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addBinary1(self, a: str, b: str) -> str: """add one by one""" <|body_0|> def addBinary2(self, a: str, b: str) -> str: """facebook variation: no addtion operation""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] i, j, ca...
stack_v2_sparse_classes_75kplus_train_068055
1,235
no_license
[ { "docstring": "add one by one", "name": "addBinary1", "signature": "def addBinary1(self, a: str, b: str) -> str" }, { "docstring": "facebook variation: no addtion operation", "name": "addBinary2", "signature": "def addBinary2(self, a: str, b: str) -> str" } ]
2
stack_v2_sparse_classes_30k_train_011747
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addBinary1(self, a: str, b: str) -> str: add one by one - def addBinary2(self, a: str, b: str) -> str: facebook variation: no addtion operation
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addBinary1(self, a: str, b: str) -> str: add one by one - def addBinary2(self, a: str, b: str) -> str: facebook variation: no addtion operation <|skeleton|> class Solution: ...
6ff1941ff213a843013100ac7033e2d4f90fbd6a
<|skeleton|> class Solution: def addBinary1(self, a: str, b: str) -> str: """add one by one""" <|body_0|> def addBinary2(self, a: str, b: str) -> str: """facebook variation: no addtion operation""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def addBinary1(self, a: str, b: str) -> str: """add one by one""" res = [] i, j, carry = (len(a) - 1, len(b) - 1, 0) while i >= 0 or j >= 0 or carry: val = carry if i >= 0: val += int(a[i]) i -= 1 if ...
the_stack_v2_python_sparse
Leetcode 0067. Add Binary.py
Chaoran-sjsu/leetcode
train
0
6a3d2f51687307b98ce071de0da9a4952066a91b
[ "result = []\nif not root:\n return result\nqueue = collections.deque()\nqueue.append(root)\nwhile queue:\n node = queue.popleft()\n if node:\n result.append(node.val)\n else:\n result.append('null')\n if node:\n queue.append(node.left)\n queue.append(node.right)\nreturn r...
<|body_start_0|> result = [] if not root: return result queue = collections.deque() queue.append(root) while queue: node = queue.popleft() if node: result.append(node.val) else: result.append('null') ...
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_75kplus_train_068056
1,470
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_033496
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:...
d8f96b0ec1a85abeef1ce8c0cc409ed501ce088b
<|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_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" result = [] if not root: return result queue = collections.deque() queue.append(root) while queue: node = queue.popleft() ...
the_stack_v2_python_sparse
Python/SerializeDeserializeBT.py
miaojiang1987/LeetCode
train
1
5c721f287edb7eb2fb8c6b39ec96021c772c3a5b
[ "for _key, _value in self.items():\n if isinstance(_key, Iterable) and (not isinstance(_key, str)):\n left, right = _key\n if left <= key <= right:\n self[key] = _value\n return _value\nraise KeyError('Cannot find {} in RangeDict'.format(key))", "if key in self:\n return ...
<|body_start_0|> for _key, _value in self.items(): if isinstance(_key, Iterable) and (not isinstance(_key, str)): left, right = _key if left <= key <= right: self[key] = _value return _value raise KeyError('Cannot find {...
Defines a dictionary that can use immutable iterables such as tuples, as keys so that anything in the range can be queried from the dictionary. Example: >>> range_dict = RangeDict() >>> range_dict[(100,105)] = 5 >>> range_dict[107] = 3 >>> range_dict[101] 5 >>> range_dict.get(101) 5 >>> range_dict.get(107) 3 >>> range_...
RangeDict
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RangeDict: """Defines a dictionary that can use immutable iterables such as tuples, as keys so that anything in the range can be queried from the dictionary. Example: >>> range_dict = RangeDict() >>> range_dict[(100,105)] = 5 >>> range_dict[107] = 3 >>> range_dict[101] 5 >>> range_dict.get(101) 5...
stack_v2_sparse_classes_75kplus_train_068057
5,460
no_license
[ { "docstring": "Method to override inbuilt :func:`__missing__`, check if `key` is part of `Iterable` range if if is insert `key` in the dict with value of `Iterable` range and return same value. . Parameters: key (:class:`int`): Key to be searched in the dict. Returns: :class:`int` or :class:`str` or :class:`tu...
2
stack_v2_sparse_classes_30k_train_023942
Implement the Python class `RangeDict` described below. Class description: Defines a dictionary that can use immutable iterables such as tuples, as keys so that anything in the range can be queried from the dictionary. Example: >>> range_dict = RangeDict() >>> range_dict[(100,105)] = 5 >>> range_dict[107] = 3 >>> rang...
Implement the Python class `RangeDict` described below. Class description: Defines a dictionary that can use immutable iterables such as tuples, as keys so that anything in the range can be queried from the dictionary. Example: >>> range_dict = RangeDict() >>> range_dict[(100,105)] = 5 >>> range_dict[107] = 3 >>> rang...
ffb2593ef79426e1a708c4c9f1464eb5a19e4a16
<|skeleton|> class RangeDict: """Defines a dictionary that can use immutable iterables such as tuples, as keys so that anything in the range can be queried from the dictionary. Example: >>> range_dict = RangeDict() >>> range_dict[(100,105)] = 5 >>> range_dict[107] = 3 >>> range_dict[101] 5 >>> range_dict.get(101) 5...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RangeDict: """Defines a dictionary that can use immutable iterables such as tuples, as keys so that anything in the range can be queried from the dictionary. Example: >>> range_dict = RangeDict() >>> range_dict[(100,105)] = 5 >>> range_dict[107] = 3 >>> range_dict[101] 5 >>> range_dict.get(101) 5 >>> range_di...
the_stack_v2_python_sparse
hdx_ahcd/utils/utils.py
vshia/hdx-data-extraction-ahcd
train
0
4b29436e94b709d7724cc042d22f0b6786cbffcd
[ "try:\n opid = self.get_argument('openid', None)\n if opid:\n client = WeChatClient(WX_PUBLIC['APP_ID'], WX_PUBLIC['APP_SECRET'])\n user = client.user.get(opid)\n if user:\n self.write(user)\n else:\n logging.debug('微信获取用户基本信息失败!')\nexcept Exception as e:\n ...
<|body_start_0|> try: opid = self.get_argument('openid', None) if opid: client = WeChatClient(WX_PUBLIC['APP_ID'], WX_PUBLIC['APP_SECRET']) user = client.user.get(opid) if user: self.write(user) else: ...
用户基本信息接口
WXUserInfoHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WXUserInfoHandler: """用户基本信息接口""" def do_get(self): """获取用户的基本信息 参考:http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html :return:""" <|body_0|> def do_post(self): """获取用户信息列表,最多支持一次拉取100条。 参考:http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71...
stack_v2_sparse_classes_75kplus_train_068058
8,866
no_license
[ { "docstring": "获取用户的基本信息 参考:http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html :return:", "name": "do_get", "signature": "def do_get(self)" }, { "docstring": "获取用户信息列表,最多支持一次拉取100条。 参考:http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html :return: user_info_li...
2
stack_v2_sparse_classes_30k_train_018878
Implement the Python class `WXUserInfoHandler` described below. Class description: 用户基本信息接口 Method signatures and docstrings: - def do_get(self): 获取用户的基本信息 参考:http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html :return: - def do_post(self): 获取用户信息列表,最多支持一次拉取100条。 参考:http://mp.weixin.qq.com/wiki/14/b...
Implement the Python class `WXUserInfoHandler` described below. Class description: 用户基本信息接口 Method signatures and docstrings: - def do_get(self): 获取用户的基本信息 参考:http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html :return: - def do_post(self): 获取用户信息列表,最多支持一次拉取100条。 参考:http://mp.weixin.qq.com/wiki/14/b...
9cbe81eea34039068c9d0771eae617791ccbdef9
<|skeleton|> class WXUserInfoHandler: """用户基本信息接口""" def do_get(self): """获取用户的基本信息 参考:http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html :return:""" <|body_0|> def do_post(self): """获取用户信息列表,最多支持一次拉取100条。 参考:http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WXUserInfoHandler: """用户基本信息接口""" def do_get(self): """获取用户的基本信息 参考:http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html :return:""" try: opid = self.get_argument('openid', None) if opid: client = WeChatClient(WX_PUBLIC['APP_ID'], W...
the_stack_v2_python_sparse
web/pay_api/wx_public/wx_client_user.py
cash2one/payment-1
train
0
be1a3360e199018c074786fff0a9b0beb8d19bbc
[ "if True in [k['active'] for k in self.__iter__()]:\n return Version([k for k in self.__iter__() if k['active']][0]['version'])\nelse:\n return None", "if False in [k['active'] for k in self.__iter__()]:\n return Version([k for k in self.__iter__() if not k['active']][0]['version'])\nelse:\n return No...
<|body_start_0|> if True in [k['active'] for k in self.__iter__()]: return Version([k for k in self.__iter__() if k['active']][0]['version']) else: return None <|end_body_0|> <|body_start_1|> if False in [k['active'] for k in self.__iter__()]: return Version(...
Versions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Versions: def active(self): """Returns first active version as Version obj :return:""" <|body_0|> def inactive(self): """Returns first inactive version as Version obj :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if True in [k['active'] f...
stack_v2_sparse_classes_75kplus_train_068059
2,549
no_license
[ { "docstring": "Returns first active version as Version obj :return:", "name": "active", "signature": "def active(self)" }, { "docstring": "Returns first inactive version as Version obj :return:", "name": "inactive", "signature": "def inactive(self)" } ]
2
stack_v2_sparse_classes_30k_train_037401
Implement the Python class `Versions` described below. Class description: Implement the Versions class. Method signatures and docstrings: - def active(self): Returns first active version as Version obj :return: - def inactive(self): Returns first inactive version as Version obj :return:
Implement the Python class `Versions` described below. Class description: Implement the Versions class. Method signatures and docstrings: - def active(self): Returns first active version as Version obj :return: - def inactive(self): Returns first inactive version as Version obj :return: <|skeleton|> class Versions: ...
c5ff207e2aa56fe67ff90057323151181842980c
<|skeleton|> class Versions: def active(self): """Returns first active version as Version obj :return:""" <|body_0|> def inactive(self): """Returns first inactive version as Version obj :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Versions: def active(self): """Returns first active version as Version obj :return:""" if True in [k['active'] for k in self.__iter__()]: return Version([k for k in self.__iter__() if k['active']][0]['version']) else: return None def inactive(self): ...
the_stack_v2_python_sparse
Common/Utilities/Version.py
srebrenica-jepa/automationRooser
train
0
9d68ed9e4700f56aaca3fef269dbf3168ecc1846
[ "if vote:\n try:\n vote = AuthorVote(vote_status, edit_id, vote, voter_id, timestamp, close_timestamp)\n self.error_response = vote.save()\n except:\n raise\n else:\n self.vote = vote.json_ready\n self.__dict__.update(self.vote)", "votes = AuthorVote.bulk_retrieve(vote_...
<|body_start_0|> if vote: try: vote = AuthorVote(vote_status, edit_id, vote, voter_id, timestamp, close_timestamp) self.error_response = vote.save() except: raise else: self.vote = vote.json_ready ...
VoteView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VoteView: def __init__(self, vote_status=None, edit_id=None, vote=None, voter_id=None, timestamp=None, close_timestamp=None): """Args: vote_status: String, accepts 'in-progress' or 'ended'. Defaults to None. edit_id: Integer. Defaults to None. vote: String, expects 'Y' or 'N'. Defaults t...
stack_v2_sparse_classes_75kplus_train_068060
1,901
no_license
[ { "docstring": "Args: vote_status: String, accepts 'in-progress' or 'ended'. Defaults to None. edit_id: Integer. Defaults to None. vote: String, expects 'Y' or 'N'. Defaults to None. voter_id: Integer. Defaults to None. timestamp: Datetime. Defaults to None. close_timestamp: Datetime. Defaults to None.", "n...
2
stack_v2_sparse_classes_30k_train_022040
Implement the Python class `VoteView` described below. Class description: Implement the VoteView class. Method signatures and docstrings: - def __init__(self, vote_status=None, edit_id=None, vote=None, voter_id=None, timestamp=None, close_timestamp=None): Args: vote_status: String, accepts 'in-progress' or 'ended'. D...
Implement the Python class `VoteView` described below. Class description: Implement the VoteView class. Method signatures and docstrings: - def __init__(self, vote_status=None, edit_id=None, vote=None, voter_id=None, timestamp=None, close_timestamp=None): Args: vote_status: String, accepts 'in-progress' or 'ended'. D...
1924e1545ed0626e144da92391438e0621ac6daa
<|skeleton|> class VoteView: def __init__(self, vote_status=None, edit_id=None, vote=None, voter_id=None, timestamp=None, close_timestamp=None): """Args: vote_status: String, accepts 'in-progress' or 'ended'. Defaults to None. edit_id: Integer. Defaults to None. vote: String, expects 'Y' or 'N'. Defaults t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VoteView: def __init__(self, vote_status=None, edit_id=None, vote=None, voter_id=None, timestamp=None, close_timestamp=None): """Args: vote_status: String, accepts 'in-progress' or 'ended'. Defaults to None. edit_id: Integer. Defaults to None. vote: String, expects 'Y' or 'N'. Defaults to None. voter_...
the_stack_v2_python_sparse
Knowledge_Database_App/content/vote_view.py
lnabergall/knowledge-database
train
0
0f5c16c543c9b9521738447c14fa975ea0974c11
[ "self.nOctaves = nOctaves\nself.nOctaveLayers = nOctaveLayers\nself.SURFdetector = cv2.xfeatures2d.SURF_create(nOctaves=self.nOctaves, nOctaveLayers=self.nOctaveLayers)", "gray = cv2.cvtColor(ima, cv2.COLOR_BGR2GRAY)\nkpt, des = self.SURFdetector.detectAndCompute(gray, None)\nreturn (kpt, des)", "start_time = t...
<|body_start_0|> self.nOctaves = nOctaves self.nOctaveLayers = nOctaveLayers self.SURFdetector = cv2.xfeatures2d.SURF_create(nOctaves=self.nOctaves, nOctaveLayers=self.nOctaveLayers) <|end_body_0|> <|body_start_1|> gray = cv2.cvtColor(ima, cv2.COLOR_BGR2GRAY) kpt, des = self.SUR...
SURF
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SURF: def __init__(self, nOctaves=4, nOctaveLayers=2): """:param nfeatures:""" <|body_0|> def image_features(self, ima): """:param ima: :return:""" <|body_1|> def extract_features(self, data_dictionary): """:param data: :return:""" <|body...
stack_v2_sparse_classes_75kplus_train_068061
4,731
no_license
[ { "docstring": ":param nfeatures:", "name": "__init__", "signature": "def __init__(self, nOctaves=4, nOctaveLayers=2)" }, { "docstring": ":param ima: :return:", "name": "image_features", "signature": "def image_features(self, ima)" }, { "docstring": ":param data: :return:", "...
3
stack_v2_sparse_classes_30k_train_013019
Implement the Python class `SURF` described below. Class description: Implement the SURF class. Method signatures and docstrings: - def __init__(self, nOctaves=4, nOctaveLayers=2): :param nfeatures: - def image_features(self, ima): :param ima: :return: - def extract_features(self, data_dictionary): :param data: :retu...
Implement the Python class `SURF` described below. Class description: Implement the SURF class. Method signatures and docstrings: - def __init__(self, nOctaves=4, nOctaveLayers=2): :param nfeatures: - def image_features(self, ima): :param ima: :return: - def extract_features(self, data_dictionary): :param data: :retu...
4b19c7fe039400b3107a0ba50fd3ecefe95a1f5d
<|skeleton|> class SURF: def __init__(self, nOctaves=4, nOctaveLayers=2): """:param nfeatures:""" <|body_0|> def image_features(self, ima): """:param ima: :return:""" <|body_1|> def extract_features(self, data_dictionary): """:param data: :return:""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SURF: def __init__(self, nOctaves=4, nOctaveLayers=2): """:param nfeatures:""" self.nOctaves = nOctaves self.nOctaveLayers = nOctaveLayers self.SURFdetector = cv2.xfeatures2d.SURF_create(nOctaves=self.nOctaves, nOctaveLayers=self.nOctaveLayers) def image_features(self, ima...
the_stack_v2_python_sparse
BasicImageClassification/Descriptors.py
marc-gorriz/M3-Project
train
1
d1a93cde8093d45d648091f2559eba00b8dc4626
[ "if self.query:\n kwargs.update(self.query)\nobj_query = self.connection.api.find(kwargs, sort=self.sort)\nquery_list = []\nfor item in obj_query:\n item_dict = {}\n item_as_kwargs = dict(item)\n item_dict.update(**item_as_kwargs)\n if self.show_id:\n item_dict['id'] = str(item['_id'])\n it...
<|body_start_0|> if self.query: kwargs.update(self.query) obj_query = self.connection.api.find(kwargs, sort=self.sort) query_list = [] for item in obj_query: item_dict = {} item_as_kwargs = dict(item) item_dict.update(**item_as_kwargs) ...
PagelessListView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PagelessListView: def get_list(self, *args, **kwargs): """Provides a list of JSON objects from a MongoConnection class.""" <|body_0|> def get(self, request, *args, **kwargs): """Overrides the built in get() function on the base View class. Gets the object and the con...
stack_v2_sparse_classes_75kplus_train_068062
9,417
no_license
[ { "docstring": "Provides a list of JSON objects from a MongoConnection class.", "name": "get_list", "signature": "def get_list(self, *args, **kwargs)" }, { "docstring": "Overrides the built in get() function on the base View class. Gets the object and the context. Returns a redirect if there's a...
2
stack_v2_sparse_classes_30k_train_015026
Implement the Python class `PagelessListView` described below. Class description: Implement the PagelessListView class. Method signatures and docstrings: - def get_list(self, *args, **kwargs): Provides a list of JSON objects from a MongoConnection class. - def get(self, request, *args, **kwargs): Overrides the built ...
Implement the Python class `PagelessListView` described below. Class description: Implement the PagelessListView class. Method signatures and docstrings: - def get_list(self, *args, **kwargs): Provides a list of JSON objects from a MongoConnection class. - def get(self, request, *args, **kwargs): Overrides the built ...
5aafda30b9fb61939fbbd66dcecb9135a77ead58
<|skeleton|> class PagelessListView: def get_list(self, *args, **kwargs): """Provides a list of JSON objects from a MongoConnection class.""" <|body_0|> def get(self, request, *args, **kwargs): """Overrides the built in get() function on the base View class. Gets the object and the con...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PagelessListView: def get_list(self, *args, **kwargs): """Provides a list of JSON objects from a MongoConnection class.""" if self.query: kwargs.update(self.query) obj_query = self.connection.api.find(kwargs, sort=self.sort) query_list = [] for item in obj_q...
the_stack_v2_python_sparse
mongolier/views.py
washingtonpost/django-mongolier
train
2
3f960fe2a344613289f1446834292f255a190827
[ "if specprod_dir is None:\n specprod_dir = specprod_root()\nself.specprod_dir = specprod_dir\nQA_MultiExp.__init__(self, specprod_dir=specprod_dir, **kwargs)\nnights = get_nights(specprod_dir=self.specprod_dir)\nfor night in nights:\n self.mexp_dict[night] = {}\n for exposure in get_exposures(night, specpr...
<|body_start_0|> if specprod_dir is None: specprod_dir = specprod_root() self.specprod_dir = specprod_dir QA_MultiExp.__init__(self, specprod_dir=specprod_dir, **kwargs) nights = get_nights(specprod_dir=self.specprod_dir) for night in nights: self.mexp_dic...
QA_Prod
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QA_Prod: def __init__(self, specprod_dir=None, **kwargs): """Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If the value is None, then the value of :func:`specprod_root` is used instead. Notes: Attributes: ...
stack_v2_sparse_classes_75kplus_train_068063
4,122
permissive
[ { "docstring": "Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If the value is None, then the value of :func:`specprod_root` is used instead. Notes: Attributes: qa_exps : list List of QA_Exposure classes, one per exposure in produ...
4
stack_v2_sparse_classes_30k_train_011930
Implement the Python class `QA_Prod` described below. Class description: Implement the QA_Prod class. Method signatures and docstrings: - def __init__(self, specprod_dir=None, **kwargs): Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If...
Implement the Python class `QA_Prod` described below. Class description: Implement the QA_Prod class. Method signatures and docstrings: - def __init__(self, specprod_dir=None, **kwargs): Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If...
d75d0540cd07df1bf46130338a33c2ced51fbead
<|skeleton|> class QA_Prod: def __init__(self, specprod_dir=None, **kwargs): """Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If the value is None, then the value of :func:`specprod_root` is used instead. Notes: Attributes: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QA_Prod: def __init__(self, specprod_dir=None, **kwargs): """Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If the value is None, then the value of :func:`specprod_root` is used instead. Notes: Attributes: qa_exps : list...
the_stack_v2_python_sparse
py/desispec/qa/qa_prod.py
desihub/desispec
train
33
a3af7de48b4c9f423874b5608c35eff88d3ce9da
[ "with open(file_path, 'rb') as f:\n md5obj = hashlib.md5()\n for line in f:\n md5obj.update(line)\n return md5obj.hexdigest()", "with open(settings.help_file, encoding='utf-8') as f:\n for i in f:\n i = i.rstrip()\n print(i)", "logger = logging.getLogger()\nfh = logging.FileHand...
<|body_start_0|> with open(file_path, 'rb') as f: md5obj = hashlib.md5() for line in f: md5obj.update(line) return md5obj.hexdigest() <|end_body_0|> <|body_start_1|> with open(settings.help_file, encoding='utf-8') as f: for i in f: ...
Public
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Public: def get_md5(file_path): """获取文件的md5值 :param file_path: 文件路径 :return:""" <|body_0|> def helper(): """帮助文档""" <|body_1|> def log(): """定义日志输出合格 :return: 返回一个可以直接使用的logger对象""" <|body_2|> def progress_bar(num, total): ""...
stack_v2_sparse_classes_75kplus_train_068064
1,525
no_license
[ { "docstring": "获取文件的md5值 :param file_path: 文件路径 :return:", "name": "get_md5", "signature": "def get_md5(file_path)" }, { "docstring": "帮助文档", "name": "helper", "signature": "def helper()" }, { "docstring": "定义日志输出合格 :return: 返回一个可以直接使用的logger对象", "name": "log", "signatur...
4
stack_v2_sparse_classes_30k_train_033708
Implement the Python class `Public` described below. Class description: Implement the Public class. Method signatures and docstrings: - def get_md5(file_path): 获取文件的md5值 :param file_path: 文件路径 :return: - def helper(): 帮助文档 - def log(): 定义日志输出合格 :return: 返回一个可以直接使用的logger对象 - def progress_bar(num, total): 进度条
Implement the Python class `Public` described below. Class description: Implement the Public class. Method signatures and docstrings: - def get_md5(file_path): 获取文件的md5值 :param file_path: 文件路径 :return: - def helper(): 帮助文档 - def log(): 定义日志输出合格 :return: 返回一个可以直接使用的logger对象 - def progress_bar(num, total): 进度条 <|skele...
d7fc68d3d23345df5bfb09d4a84686c8b49a5ad7
<|skeleton|> class Public: def get_md5(file_path): """获取文件的md5值 :param file_path: 文件路径 :return:""" <|body_0|> def helper(): """帮助文档""" <|body_1|> def log(): """定义日志输出合格 :return: 返回一个可以直接使用的logger对象""" <|body_2|> def progress_bar(num, total): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Public: def get_md5(file_path): """获取文件的md5值 :param file_path: 文件路径 :return:""" with open(file_path, 'rb') as f: md5obj = hashlib.md5() for line in f: md5obj.update(line) return md5obj.hexdigest() def helper(): """帮助文档""" ...
the_stack_v2_python_sparse
Homework/day08/ftp_client/core/Pubulic.py
214031230/Python21
train
0
d2d110a56ab5f5b37820503b5d0183fa7267e22e
[ "bak = set()\nfor num in nums:\n if num in bak:\n bak.remove(num)\n else:\n bak.add(num)\nreturn list(bak)[0]", "a = 0\nfor i in nums:\n a ^= i\nreturn a" ]
<|body_start_0|> bak = set() for num in nums: if num in bak: bak.remove(num) else: bak.add(num) return list(bak)[0] <|end_body_0|> <|body_start_1|> a = 0 for i in nums: a ^= i return a <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber_1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> bak = set() for num in nums: ...
stack_v2_sparse_classes_75kplus_train_068065
14,374
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber_1", "signature": "def singleNumber_1(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber_1(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 singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber_1(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def singleN...
7d2cae69930f381fe2029f58e977b55affb5e88b
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber_1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" bak = set() for num in nums: if num in bak: bak.remove(num) else: bak.add(num) return list(bak)[0] def singleNumber_1(self, nums): ...
the_stack_v2_python_sparse
python_test/python_leetcode.py
marchboy/python_machine_learning
train
1
aa046820e8fc249515cce130237f2fc992825129
[ "super(MyImageNet22K, self).__init__(root, *args, **kwargs)\nself.exclude_imagenet1k = exclude_imagenet1k\nself.shuffle_idxs = False\nself.size = size\nif exclude_imagenet1k:\n self.samples = [s for s in self.samples if not any([idx in s[0] for idx in self.imagenet1k_idxs])]", "path, target = self.samples[inde...
<|body_start_0|> super(MyImageNet22K, self).__init__(root, *args, **kwargs) self.exclude_imagenet1k = exclude_imagenet1k self.shuffle_idxs = False self.size = size if exclude_imagenet1k: self.samples = [s for s in self.samples if not any([idx in s[0] for idx in self.i...
MyImageNet22K
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyImageNet22K: def __init__(self, root: str, size: torch.Size, exclude_imagenet1k=True, *args, **kwargs): """Implements a torchvision style ImageNet22k dataset. The dataset needs to be downloaded manually and put in the according directory. Since the dataset is very large, it happens tha...
stack_v2_sparse_classes_75kplus_train_068066
13,359
permissive
[ { "docstring": "Implements a torchvision style ImageNet22k dataset. The dataset needs to be downloaded manually and put in the according directory. Since the dataset is very large, it happens that some of the image files are broken. In this case, a warning is logged during training and a black image is returned...
2
stack_v2_sparse_classes_30k_train_041599
Implement the Python class `MyImageNet22K` described below. Class description: Implement the MyImageNet22K class. Method signatures and docstrings: - def __init__(self, root: str, size: torch.Size, exclude_imagenet1k=True, *args, **kwargs): Implements a torchvision style ImageNet22k dataset. The dataset needs to be d...
Implement the Python class `MyImageNet22K` described below. Class description: Implement the MyImageNet22K class. Method signatures and docstrings: - def __init__(self, root: str, size: torch.Size, exclude_imagenet1k=True, *args, **kwargs): Implements a torchvision style ImageNet22k dataset. The dataset needs to be d...
7af3d8eadabee81ab8f7db5dea7f8389ef090213
<|skeleton|> class MyImageNet22K: def __init__(self, root: str, size: torch.Size, exclude_imagenet1k=True, *args, **kwargs): """Implements a torchvision style ImageNet22k dataset. The dataset needs to be downloaded manually and put in the according directory. Since the dataset is very large, it happens tha...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyImageNet22K: def __init__(self, root: str, size: torch.Size, exclude_imagenet1k=True, *args, **kwargs): """Implements a torchvision style ImageNet22k dataset. The dataset needs to be downloaded manually and put in the according directory. Since the dataset is very large, it happens that some of the ...
the_stack_v2_python_sparse
python/fcdd/datasets/outlier_exposure/imagenet.py
hkhaledmohamed/fcdd
train
0
8016ab8ec88e7fd8e3b377e204d83b4949469fb6
[ "self.server_is_running = server_is_running(port, hostname)\nself.viz = Visdom(port=port) if self.server_is_running else None\nself.env = env_name\nself.plots = {}\nself.plots_ic = defaultdict(int)", "if not self.server_is_running:\n return\nif x is None:\n x = self.plots_ic[var_name]\n self.plots_ic[var...
<|body_start_0|> self.server_is_running = server_is_running(port, hostname) self.viz = Visdom(port=port) if self.server_is_running else None self.env = env_name self.plots = {} self.plots_ic = defaultdict(int) <|end_body_0|> <|body_start_1|> if not self.server_is_running...
VisdomPlotter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisdomPlotter: def __init__(self, env_name='main', port=8097, hostname='localhost'): """Params: * env_name : str * port : int * hostname : str""" <|body_0|> def line_plot(self, var_name, split_name, title_name, x, y, x_label='Epochs'): """Params: * var_name : variabl...
stack_v2_sparse_classes_75kplus_train_068067
33,326
no_license
[ { "docstring": "Params: * env_name : str * port : int * hostname : str", "name": "__init__", "signature": "def __init__(self, env_name='main', port=8097, hostname='localhost')" }, { "docstring": "Params: * var_name : variable name (e.g. loss, acc) * split_name : split name (e.g. train, val) * ti...
5
stack_v2_sparse_classes_30k_train_003153
Implement the Python class `VisdomPlotter` described below. Class description: Implement the VisdomPlotter class. Method signatures and docstrings: - def __init__(self, env_name='main', port=8097, hostname='localhost'): Params: * env_name : str * port : int * hostname : str - def line_plot(self, var_name, split_name,...
Implement the Python class `VisdomPlotter` described below. Class description: Implement the VisdomPlotter class. Method signatures and docstrings: - def __init__(self, env_name='main', port=8097, hostname='localhost'): Params: * env_name : str * port : int * hostname : str - def line_plot(self, var_name, split_name,...
0eebc122396583eccb05fc2fd9a595cbb554b0de
<|skeleton|> class VisdomPlotter: def __init__(self, env_name='main', port=8097, hostname='localhost'): """Params: * env_name : str * port : int * hostname : str""" <|body_0|> def line_plot(self, var_name, split_name, title_name, x, y, x_label='Epochs'): """Params: * var_name : variabl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VisdomPlotter: def __init__(self, env_name='main', port=8097, hostname='localhost'): """Params: * env_name : str * port : int * hostname : str""" self.server_is_running = server_is_running(port, hostname) self.viz = Visdom(port=port) if self.server_is_running else None self.env...
the_stack_v2_python_sparse
apop/utils.py
thbeucher/ML_pytorch
train
0
8536e1a2ca2ccb98a19fbe1e4e3b4aa99108f6af
[ "def dfs(i, x):\n if x not in memo:\n memo[x] = False\n if x > 0:\n for j in range(i, n):\n if dfs(j + 1, x - nums[j]):\n memo[x] = True\n break\n return memo[x]\ns, n, memo = (sum(nums), len(nums), {0: True})\nif s % 2:\n return...
<|body_start_0|> def dfs(i, x): if x not in memo: memo[x] = False if x > 0: for j in range(i, n): if dfs(j + 1, x - nums[j]): memo[x] = True break return me...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canPartition(self, nums: List[int]) -> bool: """With backtracking, immediate return""" <|body_0|> def canPartition(self, nums: List[int]) -> bool: """naive without backtracking""" <|body_1|> <|end_skeleton|> <|body_start_0|> def dfs(i,...
stack_v2_sparse_classes_75kplus_train_068068
1,198
no_license
[ { "docstring": "With backtracking, immediate return", "name": "canPartition", "signature": "def canPartition(self, nums: List[int]) -> bool" }, { "docstring": "naive without backtracking", "name": "canPartition", "signature": "def canPartition(self, nums: List[int]) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_054386
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums: List[int]) -> bool: With backtracking, immediate return - def canPartition(self, nums: List[int]) -> bool: naive without backtracking
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums: List[int]) -> bool: With backtracking, immediate return - def canPartition(self, nums: List[int]) -> bool: naive without backtracking <|skeleton|> c...
e50dc0642f087f37ab3234390be3d8a0ed48fe62
<|skeleton|> class Solution: def canPartition(self, nums: List[int]) -> bool: """With backtracking, immediate return""" <|body_0|> def canPartition(self, nums: List[int]) -> bool: """naive without backtracking""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def canPartition(self, nums: List[int]) -> bool: """With backtracking, immediate return""" def dfs(i, x): if x not in memo: memo[x] = False if x > 0: for j in range(i, n): if dfs(j + 1, x - nums[j...
the_stack_v2_python_sparse
Leetcode/416. Partition Equal Subset Sum.py
brlala/Educative-Grokking-Coding-Exercise
train
3
0b8dcaa327bac41707bce4babb0197c8b961755e
[ "logger = node_handler.logger\nconfig = node_handler.config\nssh_clients = node_handler.ssh_clients\nscp_clients = node_handler.scp_clients", "logger = node_handler.logger\nconfig = node_handler.config\nssh_clients = node_handler.ssh_clients\nscp_clients = node_handler.scp_clients", "logger = node_handler.logge...
<|body_start_0|> logger = node_handler.logger config = node_handler.config ssh_clients = node_handler.ssh_clients scp_clients = node_handler.scp_clients <|end_body_0|> <|body_start_1|> logger = node_handler.logger config = node_handler.config ssh_clients = node_h...
Empty_Network
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Empty_Network: def shutdown(node_handler): """runs the emtpy specific shutdown operations (e.g. pulling the associated logs from the VMs) :return:""" <|body_0|> def startup(node_handler): """Runs the empty specific startup script :return:""" <|body_1|> d...
stack_v2_sparse_classes_75kplus_train_068069
1,580
permissive
[ { "docstring": "runs the emtpy specific shutdown operations (e.g. pulling the associated logs from the VMs) :return:", "name": "shutdown", "signature": "def shutdown(node_handler)" }, { "docstring": "Runs the empty specific startup script :return:", "name": "startup", "signature": "def s...
3
stack_v2_sparse_classes_30k_train_023659
Implement the Python class `Empty_Network` described below. Class description: Implement the Empty_Network class. Method signatures and docstrings: - def shutdown(node_handler): runs the emtpy specific shutdown operations (e.g. pulling the associated logs from the VMs) :return: - def startup(node_handler): Runs the e...
Implement the Python class `Empty_Network` described below. Class description: Implement the Empty_Network class. Method signatures and docstrings: - def shutdown(node_handler): runs the emtpy specific shutdown operations (e.g. pulling the associated logs from the VMs) :return: - def startup(node_handler): Runs the e...
57bd131518f18ad4fc27a1957881d27a29710b16
<|skeleton|> class Empty_Network: def shutdown(node_handler): """runs the emtpy specific shutdown operations (e.g. pulling the associated logs from the VMs) :return:""" <|body_0|> def startup(node_handler): """Runs the empty specific startup script :return:""" <|body_1|> d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Empty_Network: def shutdown(node_handler): """runs the emtpy specific shutdown operations (e.g. pulling the associated logs from the VMs) :return:""" logger = node_handler.logger config = node_handler.config ssh_clients = node_handler.ssh_clients scp_clients = node_hand...
the_stack_v2_python_sparse
BlockchainFormation/blockchain_specifics/empty/Empty_Network.py
rodrigofolha/BlockchainFormation
train
0
a64d01b85e8e1b6c8dac788147ac3079ebfef658
[ "self.yaml_dir = yaml_dir\nself.yaml_list = CaseSelect(self.yaml_dir).get_yaml_list(base_path=self.yaml_dir)\nself.testing = testing\nself.py_cmd = py_cmd\nself.report_dir = os.path.join(os.getcwd(), 'report')", "for yaml in self.yaml_list:\n for case in YamlLoader(yml=yaml).get_all_case_name():\n last_...
<|body_start_0|> self.yaml_dir = yaml_dir self.yaml_list = CaseSelect(self.yaml_dir).get_yaml_list(base_path=self.yaml_dir) self.testing = testing self.py_cmd = py_cmd self.report_dir = os.path.join(os.getcwd(), 'report') <|end_body_0|> <|body_start_1|> for yaml in self....
最终执行接口
Run
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Run: """最终执行接口""" def __init__(self, py_cmd, yaml_dir, testing): """:param yaml_dir: 所有layer.yml文件夹路径 :param testing: 单个testing.yml文件路径""" <|body_0|> def _test_run(self): """run some test""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.yaml...
stack_v2_sparse_classes_75kplus_train_068070
2,153
no_license
[ { "docstring": ":param yaml_dir: 所有layer.yml文件夹路径 :param testing: 单个testing.yml文件路径", "name": "__init__", "signature": "def __init__(self, py_cmd, yaml_dir, testing)" }, { "docstring": "run some test", "name": "_test_run", "signature": "def _test_run(self)" } ]
2
stack_v2_sparse_classes_30k_val_002516
Implement the Python class `Run` described below. Class description: 最终执行接口 Method signatures and docstrings: - def __init__(self, py_cmd, yaml_dir, testing): :param yaml_dir: 所有layer.yml文件夹路径 :param testing: 单个testing.yml文件路径 - def _test_run(self): run some test
Implement the Python class `Run` described below. Class description: 最终执行接口 Method signatures and docstrings: - def __init__(self, py_cmd, yaml_dir, testing): :param yaml_dir: 所有layer.yml文件夹路径 :param testing: 单个testing.yml文件路径 - def _test_run(self): run some test <|skeleton|> class Run: """最终执行接口""" def __i...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class Run: """最终执行接口""" def __init__(self, py_cmd, yaml_dir, testing): """:param yaml_dir: 所有layer.yml文件夹路径 :param testing: 单个testing.yml文件路径""" <|body_0|> def _test_run(self): """run some test""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Run: """最终执行接口""" def __init__(self, py_cmd, yaml_dir, testing): """:param yaml_dir: 所有layer.yml文件夹路径 :param testing: 单个testing.yml文件路径""" self.yaml_dir = yaml_dir self.yaml_list = CaseSelect(self.yaml_dir).get_yaml_list(base_path=self.yaml_dir) self.testing = testing ...
the_stack_v2_python_sparse
framework/e2e/paddleLT/run.py
PaddlePaddle/PaddleTest
train
42
747bc409a5907e3cfa5d2075ec593ba4f8b83eff
[ "self._session = session\nif environ is None:\n environ = os.environ\nself._environ = environ", "providers = []\nif instance_name is not None:\n providers.append(InstanceVarProvider(instance_var=instance_name, session=self._session))\nif env_var_names is not None:\n providers.append(EnvironmentProvider(n...
<|body_start_0|> self._session = session if environ is None: environ = os.environ self._environ = environ <|end_body_0|> <|body_start_1|> providers = [] if instance_name is not None: providers.append(InstanceVarProvider(instance_var=instance_name, session...
Factory class to create our most common configuration chain case. This is a convenience class to construct configuration chains that follow our most common pattern. This is to prevent ordering them incorrectly, and to make the config chain construction more readable.
ConfigChainFactory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigChainFactory: """Factory class to create our most common configuration chain case. This is a convenience class to construct configuration chains that follow our most common pattern. This is to prevent ordering them incorrectly, and to make the config chain construction more readable.""" ...
stack_v2_sparse_classes_75kplus_train_068071
17,033
permissive
[ { "docstring": "Initialize a ConfigChainFactory. :type session: :class:`botocore.session.Session` :param session: This is the session that should be used to look up values from the config file. :type environ: dict :param environ: A mapping to use for environment variables. If this is not provided it will defaul...
2
stack_v2_sparse_classes_30k_train_044558
Implement the Python class `ConfigChainFactory` described below. Class description: Factory class to create our most common configuration chain case. This is a convenience class to construct configuration chains that follow our most common pattern. This is to prevent ordering them incorrectly, and to make the config c...
Implement the Python class `ConfigChainFactory` described below. Class description: Factory class to create our most common configuration chain case. This is a convenience class to construct configuration chains that follow our most common pattern. This is to prevent ordering them incorrectly, and to make the config c...
2529ca149d7f584ede780de1cb695a2f55b7031f
<|skeleton|> class ConfigChainFactory: """Factory class to create our most common configuration chain case. This is a convenience class to construct configuration chains that follow our most common pattern. This is to prevent ordering them incorrectly, and to make the config chain construction more readable.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConfigChainFactory: """Factory class to create our most common configuration chain case. This is a convenience class to construct configuration chains that follow our most common pattern. This is to prevent ordering them incorrectly, and to make the config chain construction more readable.""" def __init_...
the_stack_v2_python_sparse
reinvent-2020/RhythmCloud/lambda/Greengrass_startSong/botocore/configprovider.py
aws-samples/aws-builders-fair-projects
train
89
52cc3921ca2f36049403d97a21b2eba8ed692c39
[ "if MongoDb.__instance is None:\n MongoDb()\nreturn MongoDb.__instance", "if MongoDb.__instance is not None:\n raise Exception('This class is a singleton!')\nelse:\n MongoDb.__instance = self\n client = MongoClient(config.MONGO_MANGA_HOST, config.MONGO_MANGA_PORT)\n self.db = client[config.MONGO_MA...
<|body_start_0|> if MongoDb.__instance is None: MongoDb() return MongoDb.__instance <|end_body_0|> <|body_start_1|> if MongoDb.__instance is not None: raise Exception('This class is a singleton!') else: MongoDb.__instance = self client = M...
MongoDb
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MongoDb: def getInstance(): """Static access method.""" <|body_0|> def __init__(self): """Virtually private constructor.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if MongoDb.__instance is None: MongoDb() return MongoDb.__in...
stack_v2_sparse_classes_75kplus_train_068072
1,468
no_license
[ { "docstring": "Static access method.", "name": "getInstance", "signature": "def getInstance()" }, { "docstring": "Virtually private constructor.", "name": "__init__", "signature": "def __init__(self)" } ]
2
stack_v2_sparse_classes_30k_train_003049
Implement the Python class `MongoDb` described below. Class description: Implement the MongoDb class. Method signatures and docstrings: - def getInstance(): Static access method. - def __init__(self): Virtually private constructor.
Implement the Python class `MongoDb` described below. Class description: Implement the MongoDb class. Method signatures and docstrings: - def getInstance(): Static access method. - def __init__(self): Virtually private constructor. <|skeleton|> class MongoDb: def getInstance(): """Static access method."...
c84a57c367a722b293ee947b6fcf0639fc8f295e
<|skeleton|> class MongoDb: def getInstance(): """Static access method.""" <|body_0|> def __init__(self): """Virtually private constructor.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MongoDb: def getInstance(): """Static access method.""" if MongoDb.__instance is None: MongoDb() return MongoDb.__instance def __init__(self): """Virtually private constructor.""" if MongoDb.__instance is not None: raise Exception('This clas...
the_stack_v2_python_sparse
database/db.py
DuyThangDecima/MangaWs
train
0
565c4ae3a93e56435975afca4d764d52a84cda7d
[ "self.name = name\nself._implementation = None\nself._schema_name = schema_name", "if not self._implementation:\n raise MissingImplementation(f'No implementation given for scalar < {self.name} >')\nscalar = schema.find_scalar(self.name)\nif not scalar:\n raise UnknownScalarDefinition(f'Unknown Scalar Defini...
<|body_start_0|> self.name = name self._implementation = None self._schema_name = schema_name <|end_body_0|> <|body_start_1|> if not self._implementation: raise MissingImplementation(f'No implementation given for scalar < {self.name} >') scalar = schema.find_scalar(s...
This decorator allows you to link a GraphQL Scalar to a Scalar class. For example, for the following SDL: scalar DateTime Use the Scalar decorator the following way: @Scalar("DateTime") class ScalarDateTime: def coerce_output(self, value): return value.isoformat() def coerce_input(self, value): return datetime.strptime...
Scalar
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scalar: """This decorator allows you to link a GraphQL Scalar to a Scalar class. For example, for the following SDL: scalar DateTime Use the Scalar decorator the following way: @Scalar("DateTime") class ScalarDateTime: def coerce_output(self, value): return value.isoformat() def coerce_input(self...
stack_v2_sparse_classes_75kplus_train_068073
2,756
permissive
[ { "docstring": ":param name: name of the scalar :param schema_name: name of the schema to which link the scalar :type name: str :type schema_name: str", "name": "__init__", "signature": "def __init__(self, name: str, schema_name: str='default') -> None" }, { "docstring": "Sets the scalar coercer...
3
null
Implement the Python class `Scalar` described below. Class description: This decorator allows you to link a GraphQL Scalar to a Scalar class. For example, for the following SDL: scalar DateTime Use the Scalar decorator the following way: @Scalar("DateTime") class ScalarDateTime: def coerce_output(self, value): return ...
Implement the Python class `Scalar` described below. Class description: This decorator allows you to link a GraphQL Scalar to a Scalar class. For example, for the following SDL: scalar DateTime Use the Scalar decorator the following way: @Scalar("DateTime") class ScalarDateTime: def coerce_output(self, value): return ...
421c1e937f553d6a5bf2f30154022c0d77053cfb
<|skeleton|> class Scalar: """This decorator allows you to link a GraphQL Scalar to a Scalar class. For example, for the following SDL: scalar DateTime Use the Scalar decorator the following way: @Scalar("DateTime") class ScalarDateTime: def coerce_output(self, value): return value.isoformat() def coerce_input(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Scalar: """This decorator allows you to link a GraphQL Scalar to a Scalar class. For example, for the following SDL: scalar DateTime Use the Scalar decorator the following way: @Scalar("DateTime") class ScalarDateTime: def coerce_output(self, value): return value.isoformat() def coerce_input(self, value): ret...
the_stack_v2_python_sparse
tartiflette/scalar/scalar.py
tartiflette/tartiflette
train
586
3e97a639e14dd96e69151acf2c663d770df2d5a2
[ "filters = {}\nif hasattr(request, 'GET'):\n filters = request.GET.copy()\nfilters.update(kwargs)\ntry:\n user = UserProfile.objects.filter(uuid=uuid_from_uri(filters['user']))\n sub_pk = sorted(chain(user[0].subscriptions(), user))\n im = Image.objects.filter(is_active=True, owner__in=sub_pk)\n wb =...
<|body_start_0|> filters = {} if hasattr(request, 'GET'): filters = request.GET.copy() filters.update(kwargs) try: user = UserProfile.objects.filter(uuid=uuid_from_uri(filters['user'])) sub_pk = sorted(chain(user[0].subscriptions(), user)) ...
NewsfeedResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewsfeedResource: def obj_get_list(self, request=None, **kwargs): """A ORM-specific implementation of ``obj_get_list``. Takes an optional ``request`` object, whose ``GET`` dictionary can be used to narrow the query.""" <|body_0|> def full_dehydrate(self, bundle): """...
stack_v2_sparse_classes_75kplus_train_068074
19,893
no_license
[ { "docstring": "A ORM-specific implementation of ``obj_get_list``. Takes an optional ``request`` object, whose ``GET`` dictionary can be used to narrow the query.", "name": "obj_get_list", "signature": "def obj_get_list(self, request=None, **kwargs)" }, { "docstring": "Given a bundle with an obj...
2
stack_v2_sparse_classes_30k_train_005896
Implement the Python class `NewsfeedResource` described below. Class description: Implement the NewsfeedResource class. Method signatures and docstrings: - def obj_get_list(self, request=None, **kwargs): A ORM-specific implementation of ``obj_get_list``. Takes an optional ``request`` object, whose ``GET`` dictionary ...
Implement the Python class `NewsfeedResource` described below. Class description: Implement the NewsfeedResource class. Method signatures and docstrings: - def obj_get_list(self, request=None, **kwargs): A ORM-specific implementation of ``obj_get_list``. Takes an optional ``request`` object, whose ``GET`` dictionary ...
698e027b7f6f4db5c2e9b9a899ba74f4ad4daf8e
<|skeleton|> class NewsfeedResource: def obj_get_list(self, request=None, **kwargs): """A ORM-specific implementation of ``obj_get_list``. Takes an optional ``request`` object, whose ``GET`` dictionary can be used to narrow the query.""" <|body_0|> def full_dehydrate(self, bundle): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NewsfeedResource: def obj_get_list(self, request=None, **kwargs): """A ORM-specific implementation of ``obj_get_list``. Takes an optional ``request`` object, whose ``GET`` dictionary can be used to narrow the query.""" filters = {} if hasattr(request, 'GET'): filters = requ...
the_stack_v2_python_sparse
back-end/website/api/v1/action_resources.py
dchang00/keekaa-back-end
train
0
ec53f19c80eb1e296e12949fc45f5cd3af31f792
[ "super().__init__()\nself.tade1 = TADELayer(in_channels=in_channels, aux_channels=aux_channels, kernel_size=kernel_size, bias=bias, upsample_factor=1, upsample_mode=upsample_mode)\nself.gated_conv1 = torch.nn.Conv1d(in_channels, in_channels * 2, kernel_size, 1, bias=bias, padding=(kernel_size - 1) // 2)\nself.tade2...
<|body_start_0|> super().__init__() self.tade1 = TADELayer(in_channels=in_channels, aux_channels=aux_channels, kernel_size=kernel_size, bias=bias, upsample_factor=1, upsample_mode=upsample_mode) self.gated_conv1 = torch.nn.Conv1d(in_channels, in_channels * 2, kernel_size, 1, bias=bias, padding=(...
TADEResBlock module.
TADEResBlock
[ "MIT", "LicenseRef-scancode-proprietary-license", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TADEResBlock: """TADEResBlock module.""" def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'): """Initialize TADEResBlock module.""" <|body_0|> def forward(self, x,...
stack_v2_sparse_classes_75kplus_train_068075
4,805
permissive
[ { "docstring": "Initialize TADEResBlock module.", "name": "__init__", "signature": "def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax')" }, { "docstring": "Calculate forward propagation. A...
2
stack_v2_sparse_classes_30k_train_052664
Implement the Python class `TADEResBlock` described below. Class description: TADEResBlock module. Method signatures and docstrings: - def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'): Initialize TADEResBloc...
Implement the Python class `TADEResBlock` described below. Class description: TADEResBlock module. Method signatures and docstrings: - def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'): Initialize TADEResBloc...
c68b4590ab20eaf55e0b96b82325a90177fffd5c
<|skeleton|> class TADEResBlock: """TADEResBlock module.""" def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'): """Initialize TADEResBlock module.""" <|body_0|> def forward(self, x,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TADEResBlock: """TADEResBlock module.""" def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'): """Initialize TADEResBlock module.""" super().__init__() self.tade1 = TADELayer...
the_stack_v2_python_sparse
parallel_wavegan/layers/tade_res_block.py
kan-bayashi/ParallelWaveGAN
train
1,405
db4e1415d1cf1a7936bd65e6596f2b81b50c9836
[ "delta = timedelta(seconds=60)\nif arrow.get(self.expiry_date) - delta < arrow.now():\n self._refresh_tokens()\nreturn self.access_token", "credentials = google.oauth2.credentials.Credentials(token=self.access_token, refresh_token=self.refresh_token, token_uri=settings.GOOGLEFIT_TOKEN_URI, client_id=settings.G...
<|body_start_0|> delta = timedelta(seconds=60) if arrow.get(self.expiry_date) - delta < arrow.now(): self._refresh_tokens() return self.access_token <|end_body_0|> <|body_start_1|> credentials = google.oauth2.credentials.Credentials(token=self.access_token, refresh_token=sel...
Store OAuth2 data for a GoogleFit Member. This is a one to one relationship with a OpenHumansMember object.
GoogleFitMember
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoogleFitMember: """Store OAuth2 data for a GoogleFit Member. This is a one to one relationship with a OpenHumansMember object.""" def get_access_token(self): """Return access token. Refresh first if necessary.""" <|body_0|> def _refresh_tokens(self): """Refresh ...
stack_v2_sparse_classes_75kplus_train_068076
6,339
permissive
[ { "docstring": "Return access token. Refresh first if necessary.", "name": "get_access_token", "signature": "def get_access_token(self)" }, { "docstring": "Refresh access token.", "name": "_refresh_tokens", "signature": "def _refresh_tokens(self)" } ]
2
stack_v2_sparse_classes_30k_train_041999
Implement the Python class `GoogleFitMember` described below. Class description: Store OAuth2 data for a GoogleFit Member. This is a one to one relationship with a OpenHumansMember object. Method signatures and docstrings: - def get_access_token(self): Return access token. Refresh first if necessary. - def _refresh_t...
Implement the Python class `GoogleFitMember` described below. Class description: Store OAuth2 data for a GoogleFit Member. This is a one to one relationship with a OpenHumansMember object. Method signatures and docstrings: - def get_access_token(self): Return access token. Refresh first if necessary. - def _refresh_t...
3ee9bdefbd567299b27bb22f0bf35d64f7764b3a
<|skeleton|> class GoogleFitMember: """Store OAuth2 data for a GoogleFit Member. This is a one to one relationship with a OpenHumansMember object.""" def get_access_token(self): """Return access token. Refresh first if necessary.""" <|body_0|> def _refresh_tokens(self): """Refresh ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GoogleFitMember: """Store OAuth2 data for a GoogleFit Member. This is a one to one relationship with a OpenHumansMember object.""" def get_access_token(self): """Return access token. Refresh first if necessary.""" delta = timedelta(seconds=60) if arrow.get(self.expiry_date) - delt...
the_stack_v2_python_sparse
import_data/models.py
OpenHumans/quantified-flu
train
18
995b384d13df3cb2bca7e521b8dbcc8f8523d7a6
[ "with self._lock:\n self._cache = {}\n self._logger = slog.getLogger('saga.utils.object_cache')", "with self._lock:\n oid = str(oid)\n if not oid in self._cache:\n obj = creator()\n self._cache[oid] = {}\n self._cache[oid]['cnt'] = 0\n self._cache[oid]['obj'] = obj\n sel...
<|body_start_0|> with self._lock: self._cache = {} self._logger = slog.getLogger('saga.utils.object_cache') <|end_body_0|> <|body_start_1|> with self._lock: oid = str(oid) if not oid in self._cache: obj = creator() self._ca...
This is a singleton object caching class -- it maintains a reference counted registry of existing objects.
ObjectCache
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectCache: """This is a singleton object caching class -- it maintains a reference counted registry of existing objects.""" def __init__(self): """Make sure the object cache dict is initialized, exactly once.""" <|body_0|> def get_obj(self, oid, creator): """Fo...
stack_v2_sparse_classes_75kplus_train_068077
3,040
permissive
[ { "docstring": "Make sure the object cache dict is initialized, exactly once.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "For a given object id, attempt to retrieve an existing object. If that object exists, increase the reference counter, as there is now one more ...
3
stack_v2_sparse_classes_30k_train_011094
Implement the Python class `ObjectCache` described below. Class description: This is a singleton object caching class -- it maintains a reference counted registry of existing objects. Method signatures and docstrings: - def __init__(self): Make sure the object cache dict is initialized, exactly once. - def get_obj(se...
Implement the Python class `ObjectCache` described below. Class description: This is a singleton object caching class -- it maintains a reference counted registry of existing objects. Method signatures and docstrings: - def __init__(self): Make sure the object cache dict is initialized, exactly once. - def get_obj(se...
18d0ef3ea9822df7877fbe39b191f56a6288ada5
<|skeleton|> class ObjectCache: """This is a singleton object caching class -- it maintains a reference counted registry of existing objects.""" def __init__(self): """Make sure the object cache dict is initialized, exactly once.""" <|body_0|> def get_obj(self, oid, creator): """Fo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ObjectCache: """This is a singleton object caching class -- it maintains a reference counted registry of existing objects.""" def __init__(self): """Make sure the object cache dict is initialized, exactly once.""" with self._lock: self._cache = {} self._logger = sl...
the_stack_v2_python_sparse
saga/utils/object_cache.py
GNUBrinux/pilot
train
0
a0a47d42a996d54f6389329cf75973f60f8c02a2
[ "v_email = self.validate_email(_email)\nv_nickname = self.validate_nickname(_nickname)\nv_realname = self.validate_realname(_realname)\nv_password = self.validate_password(_password1, _password2)\ne = Error()\ne.msg = {}\nif not v_email.status:\n e.msg['email'] = v_email\nif not v_nickname.status:\n e.msg['ni...
<|body_start_0|> v_email = self.validate_email(_email) v_nickname = self.validate_nickname(_nickname) v_realname = self.validate_realname(_realname) v_password = self.validate_password(_password1, _password2) e = Error() e.msg = {} if not v_email.status: ...
사용자 생성 데이터 검증 클래스
UserCreationValidator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserCreationValidator: """사용자 생성 데이터 검증 클래스""" def validate(self, _email, _nickname, _realname, _password1, _password2): """사용자 생성 validation""" <|body_0|> def validate_email(self, _email): """이메일 validation""" <|body_1|> def validate_nickname(self, ...
stack_v2_sparse_classes_75kplus_train_068078
3,598
no_license
[ { "docstring": "사용자 생성 validation", "name": "validate", "signature": "def validate(self, _email, _nickname, _realname, _password1, _password2)" }, { "docstring": "이메일 validation", "name": "validate_email", "signature": "def validate_email(self, _email)" }, { "docstring": "닉네임 val...
5
stack_v2_sparse_classes_30k_test_000420
Implement the Python class `UserCreationValidator` described below. Class description: 사용자 생성 데이터 검증 클래스 Method signatures and docstrings: - def validate(self, _email, _nickname, _realname, _password1, _password2): 사용자 생성 validation - def validate_email(self, _email): 이메일 validation - def validate_nickname(self, _nic...
Implement the Python class `UserCreationValidator` described below. Class description: 사용자 생성 데이터 검증 클래스 Method signatures and docstrings: - def validate(self, _email, _nickname, _realname, _password1, _password2): 사용자 생성 validation - def validate_email(self, _email): 이메일 validation - def validate_nickname(self, _nic...
3669b1d3c108c2aa64a7d0f11116adc0f385ce83
<|skeleton|> class UserCreationValidator: """사용자 생성 데이터 검증 클래스""" def validate(self, _email, _nickname, _realname, _password1, _password2): """사용자 생성 validation""" <|body_0|> def validate_email(self, _email): """이메일 validation""" <|body_1|> def validate_nickname(self, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserCreationValidator: """사용자 생성 데이터 검증 클래스""" def validate(self, _email, _nickname, _realname, _password1, _password2): """사용자 생성 validation""" v_email = self.validate_email(_email) v_nickname = self.validate_nickname(_nickname) v_realname = self.validate_realname(_realna...
the_stack_v2_python_sparse
user/validators.py
Son-GyeongSik/hanalum_web
train
1
de984d0702fe0b8e205afa8c9d34c4fabb328c66
[ "self.size = size\nself.mode = mode\nself.align_corners = align_corners", "if self.mode == 'nearest':\n y = nearest_interpolate_2d(self.size, align_corners=self.align_corners)(x)\nelse:\n x = x.unsqueeze(1).float()\n y = F.interpolate(x, self.size, mode=self.mode, align_corners=self.align_corners)\n y...
<|body_start_0|> self.size = size self.mode = mode self.align_corners = align_corners <|end_body_0|> <|body_start_1|> if self.mode == 'nearest': y = nearest_interpolate_2d(self.size, align_corners=self.align_corners)(x) else: x = x.unsqueeze(1).float() ...
This is new interpolate function. Backend of nearest is nearest_interpolate_2d (self-crafted) Backend of other interpolation is torch.nn.functional.interpolate
interpolate_2d
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class interpolate_2d: """This is new interpolate function. Backend of nearest is nearest_interpolate_2d (self-crafted) Backend of other interpolation is torch.nn.functional.interpolate""" def __init__(self, size, mode='nearest', align_corners=True, **kwargs): """Args: size: (int, int), (h,...
stack_v2_sparse_classes_75kplus_train_068079
15,122
no_license
[ { "docstring": "Args: size: (int, int), (h, w) of the target size. mode: str, mode of the interpolation, choose from: 'nearest', 'bilinear', etc... align_corners: bool, whether aligns the corner.", "name": "__init__", "signature": "def __init__(self, size, mode='nearest', align_corners=True, **kwargs)" ...
2
stack_v2_sparse_classes_30k_train_032150
Implement the Python class `interpolate_2d` described below. Class description: This is new interpolate function. Backend of nearest is nearest_interpolate_2d (self-crafted) Backend of other interpolation is torch.nn.functional.interpolate Method signatures and docstrings: - def __init__(self, size, mode='nearest', a...
Implement the Python class `interpolate_2d` described below. Class description: This is new interpolate function. Backend of nearest is nearest_interpolate_2d (self-crafted) Backend of other interpolation is torch.nn.functional.interpolate Method signatures and docstrings: - def __init__(self, size, mode='nearest', a...
f14b1eef7229ec3338b85531958d988ef26c2adc
<|skeleton|> class interpolate_2d: """This is new interpolate function. Backend of nearest is nearest_interpolate_2d (self-crafted) Backend of other interpolation is torch.nn.functional.interpolate""" def __init__(self, size, mode='nearest', align_corners=True, **kwargs): """Args: size: (int, int), (h,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class interpolate_2d: """This is new interpolate function. Backend of nearest is nearest_interpolate_2d (self-crafted) Backend of other interpolation is torch.nn.functional.interpolate""" def __init__(self, size, mode='nearest', align_corners=True, **kwargs): """Args: size: (int, int), (h, w) of the ta...
the_stack_v2_python_sparse
lib/torchutils.py
tanmayj000/Rethinking-Text-Segmentation
train
0
6c0abc2e2f0cbefc9e52a42b3ee4fcdd8625ddf0
[ "if request.user.is_superuser:\n my_departments = Department.objects.filter()\nelse:\n my_departments = Department.objects.filter(adminuserinformation__user=request.user)\nactivitys = [('none', 'Ikke inviteret til noget'), ('any', 'Alle inviterede')]\nfor activity in Activity.objects.filter(department__in=my_...
<|body_start_0|> if request.user.is_superuser: my_departments = Department.objects.filter() else: my_departments = Department.objects.filter(adminuserinformation__user=request.user) activitys = [('none', 'Ikke inviteret til noget'), ('any', 'Alle inviterede')] for...
PersonInvitedListFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersonInvitedListFilter: def lookups(self, request, model_admin): """Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right s...
stack_v2_sparse_classes_75kplus_train_068080
45,186
no_license
[ { "docstring": "Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.", "name": "lookups", "signature": "def lookups(self, request,...
2
stack_v2_sparse_classes_30k_train_026975
Implement the Python class `PersonInvitedListFilter` described below. Class description: Implement the PersonInvitedListFilter class. Method signatures and docstrings: - def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for the option that will appea...
Implement the Python class `PersonInvitedListFilter` described below. Class description: Implement the PersonInvitedListFilter class. Method signatures and docstrings: - def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for the option that will appea...
69dfbb0f2d947418112a1af631275ee598743fff
<|skeleton|> class PersonInvitedListFilter: def lookups(self, request, model_admin): """Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PersonInvitedListFilter: def lookups(self, request, model_admin): """Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.""" ...
the_stack_v2_python_sparse
members/admin.py
sunenilausen/forenings_medlemmer
train
0
78b4250a19b894f63a8d355391a57cc79574566a
[ "acceptance_text = self.cleaned_data['acceptance_text']\ntry:\n render_template(acceptance_text, context=SAMPLE_DECISION_TEMPLATE_CONTEXT)\nexcept TemplateSyntaxError as ex:\n raise ValidationError('Unable to render acceptance template text: %(exception)s', params={'exception': ex})\nreturn acceptance_text", ...
<|body_start_0|> acceptance_text = self.cleaned_data['acceptance_text'] try: render_template(acceptance_text, context=SAMPLE_DECISION_TEMPLATE_CONTEXT) except TemplateSyntaxError as ex: raise ValidationError('Unable to render acceptance template text: %(exception)s', para...
A form to do field validation of LetterTemplatePage
LetterTemplatePageForm
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LetterTemplatePageForm: """A form to do field validation of LetterTemplatePage""" def clean_acceptance_text(self): """Validate that the acceptance text is a valid Django template with no extra variables""" <|body_0|> def clean_rejection_text(self): """Validate th...
stack_v2_sparse_classes_75kplus_train_068081
1,468
permissive
[ { "docstring": "Validate that the acceptance text is a valid Django template with no extra variables", "name": "clean_acceptance_text", "signature": "def clean_acceptance_text(self)" }, { "docstring": "Validate that the rejection text is a valid Django template with no extra variables", "nam...
2
stack_v2_sparse_classes_30k_train_036039
Implement the Python class `LetterTemplatePageForm` described below. Class description: A form to do field validation of LetterTemplatePage Method signatures and docstrings: - def clean_acceptance_text(self): Validate that the acceptance text is a valid Django template with no extra variables - def clean_rejection_te...
Implement the Python class `LetterTemplatePageForm` described below. Class description: A form to do field validation of LetterTemplatePage Method signatures and docstrings: - def clean_acceptance_text(self): Validate that the acceptance text is a valid Django template with no extra variables - def clean_rejection_te...
339c67b84b661a37ffe32580da72383d95666c5c
<|skeleton|> class LetterTemplatePageForm: """A form to do field validation of LetterTemplatePage""" def clean_acceptance_text(self): """Validate that the acceptance text is a valid Django template with no extra variables""" <|body_0|> def clean_rejection_text(self): """Validate th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LetterTemplatePageForm: """A form to do field validation of LetterTemplatePage""" def clean_acceptance_text(self): """Validate that the acceptance text is a valid Django template with no extra variables""" acceptance_text = self.cleaned_data['acceptance_text'] try: ren...
the_stack_v2_python_sparse
cms/forms.py
mitodl/bootcamp-ecommerce
train
6
e3a2d212506b59b37efd258df0b7355e43697319
[ "_query_builder = Configuration.get_base_uri()\n_query_builder += '/information/businessregistry'\n_query_url = APIHelper.clean_url(_query_builder)\n_headers = {'accept': 'application/json'}\n_request = self.http_client.get(_query_url, headers=_headers)\nOAuth2.apply(_request)\n_context = self.execute_request(_requ...
<|body_start_0|> _query_builder = Configuration.get_base_uri() _query_builder += '/information/businessregistry' _query_url = APIHelper.clean_url(_query_builder) _headers = {'accept': 'application/json'} _request = self.http_client.get(_query_url, headers=_headers) OAuth2...
A Controller to access Endpoints in the idfy_rest_client API.
BusinessRegistryController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BusinessRegistryController: """A Controller to access Endpoints in the idfy_rest_client API.""" def list_registration_authorities(self): """Does a GET request to /information/businessregistry. Retrieves a list of business registration authorities globally Returns: mixed: Response fro...
stack_v2_sparse_classes_75kplus_train_068082
3,352
permissive
[ { "docstring": "Does a GET request to /information/businessregistry. Retrieves a list of business registration authorities globally Returns: mixed: Response from the API. OK Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an...
2
stack_v2_sparse_classes_30k_train_002486
Implement the Python class `BusinessRegistryController` described below. Class description: A Controller to access Endpoints in the idfy_rest_client API. Method signatures and docstrings: - def list_registration_authorities(self): Does a GET request to /information/businessregistry. Retrieves a list of business regis...
Implement the Python class `BusinessRegistryController` described below. Class description: A Controller to access Endpoints in the idfy_rest_client API. Method signatures and docstrings: - def list_registration_authorities(self): Does a GET request to /information/businessregistry. Retrieves a list of business regis...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class BusinessRegistryController: """A Controller to access Endpoints in the idfy_rest_client API.""" def list_registration_authorities(self): """Does a GET request to /information/businessregistry. Retrieves a list of business registration authorities globally Returns: mixed: Response fro...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BusinessRegistryController: """A Controller to access Endpoints in the idfy_rest_client API.""" def list_registration_authorities(self): """Does a GET request to /information/businessregistry. Retrieves a list of business registration authorities globally Returns: mixed: Response from the API. OK...
the_stack_v2_python_sparse
idfy_rest_client/controllers/business_registry_controller.py
dealflowteam/Idfy
train
0
66e630e77364289f9f034a3d49249de289415486
[ "res = 0\na = 1\nb = 1\nwhile n > 0:\n res += (n + 8) / 10 * a + (n % 10 == 1) * b\n b += n % 10 * a\n a *= 10\n n /= 10\nreturn res", "if n < 1:\n return 0\nif n >= 1 and n < 10:\n return 1\ny = 1\nx = n\nwhile x >= 10:\n x /= 10\n y *= 10\nif x == 1:\n return n - y + 1 + self.countDig...
<|body_start_0|> res = 0 a = 1 b = 1 while n > 0: res += (n + 8) / 10 * a + (n % 10 == 1) * b b += n % 10 * a a *= 10 n /= 10 return res <|end_body_0|> <|body_start_1|> if n < 1: return 0 if n >= 1 and n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countDigitOne(self, n): """:type n: int :rtype: int""" <|body_0|> def countDigitOne_1(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = 0 a = 1 b = 1 while n > 0: ...
stack_v2_sparse_classes_75kplus_train_068083
1,215
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "countDigitOne", "signature": "def countDigitOne(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "countDigitOne_1", "signature": "def countDigitOne_1(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_023559
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countDigitOne(self, n): :type n: int :rtype: int - def countDigitOne_1(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countDigitOne(self, n): :type n: int :rtype: int - def countDigitOne_1(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def countDigitOne(self, n): ...
ba58ac60b32e261e43482d7e71b32587700e3719
<|skeleton|> class Solution: def countDigitOne(self, n): """:type n: int :rtype: int""" <|body_0|> def countDigitOne_1(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def countDigitOne(self, n): """:type n: int :rtype: int""" res = 0 a = 1 b = 1 while n > 0: res += (n + 8) / 10 * a + (n % 10 == 1) * b b += n % 10 * a a *= 10 n /= 10 return res def countDigitOne_1(...
the_stack_v2_python_sparse
python/233_number_of_digit_one.py
lingng/Leetcode
train
0
96b379d5c612221440ccc2f4771032f02866c5f2
[ "super().__init__()\nself.n_features = n_features\nself.n_filters = n_filters\nself.n_classes = n_classes\nself.activation = activation\nself.dropout = dropout\nself.layers = nn.ModuleList([nn.Sequential(collections.OrderedDict([('gcn_0', DenseGraphConvolution(in_channels=n_features, out_channels=n_filters)), ('act...
<|body_start_0|> super().__init__() self.n_features = n_features self.n_filters = n_filters self.n_classes = n_classes self.activation = activation self.dropout = dropout self.layers = nn.ModuleList([nn.Sequential(collections.OrderedDict([('gcn_0', DenseGraphConvo...
Dense two layer GCN for the FGSM attack that requires a gradient towards the adjacency matrix.
DenseGCN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DenseGCN: """Dense two layer GCN for the FGSM attack that requires a gradient towards the adjacency matrix.""" def __init__(self, n_features: int, n_classes: int, n_filters: int=64, activation: nn.Module=nn.ReLU(), dropout: float=0.5, **kwargs): """Parameters ---------- n_features : ...
stack_v2_sparse_classes_75kplus_train_068084
23,587
no_license
[ { "docstring": "Parameters ---------- n_features : int Number of attributes for each node n_classes : int Number of classes for prediction n_filters : int, optional number of dimensions for the hidden units, by default 80 activation : nn.Module, optional Arbitrary activation function for the hidden layer, by de...
3
null
Implement the Python class `DenseGCN` described below. Class description: Dense two layer GCN for the FGSM attack that requires a gradient towards the adjacency matrix. Method signatures and docstrings: - def __init__(self, n_features: int, n_classes: int, n_filters: int=64, activation: nn.Module=nn.ReLU(), dropout: ...
Implement the Python class `DenseGCN` described below. Class description: Dense two layer GCN for the FGSM attack that requires a gradient towards the adjacency matrix. Method signatures and docstrings: - def __init__(self, n_features: int, n_classes: int, n_filters: int=64, activation: nn.Module=nn.ReLU(), dropout: ...
6ce9ebf7eb152e6dbc2e2c6fdab9348d2bd12987
<|skeleton|> class DenseGCN: """Dense two layer GCN for the FGSM attack that requires a gradient towards the adjacency matrix.""" def __init__(self, n_features: int, n_classes: int, n_filters: int=64, activation: nn.Module=nn.ReLU(), dropout: float=0.5, **kwargs): """Parameters ---------- n_features : ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DenseGCN: """Dense two layer GCN for the FGSM attack that requires a gradient towards the adjacency matrix.""" def __init__(self, n_features: int, n_classes: int, n_filters: int=64, activation: nn.Module=nn.ReLU(), dropout: float=0.5, **kwargs): """Parameters ---------- n_features : int Number of...
the_stack_v2_python_sparse
rgnn_at_scale/models/gcn.py
stjordanis/robustness_of_gnns_at_scale
train
0
a09f246871ea9ee863c1c38b107766e371933e16
[ "self.elements = []\nself.points = points\nself.length_of_row = length_of_row\nself.length_of_column = length_of_column\nself.padding = padding\nself.type = 'table'\nself.stroke_width = stroke_width\nself.parent_element = parent_element\nself.relative = relative\nself.type_of_element = 'table'\nself.id = 1 + RootEl...
<|body_start_0|> self.elements = [] self.points = points self.length_of_row = length_of_row self.length_of_column = length_of_column self.padding = padding self.type = 'table' self.stroke_width = stroke_width self.parent_element = parent_element se...
Table with code quality metrics.
Table
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Table: """Table with code quality metrics.""" def __init__(self, points, length_of_row, length_of_column, padding=5, stroke_width=2, parent_element=None, relative=True): """Initialize the table.""" <|body_0|> def build(self, dwg): """Build the table on drawing.""...
stack_v2_sparse_classes_75kplus_train_068085
15,115
permissive
[ { "docstring": "Initialize the table.", "name": "__init__", "signature": "def __init__(self, points, length_of_row, length_of_column, padding=5, stroke_width=2, parent_element=None, relative=True)" }, { "docstring": "Build the table on drawing.", "name": "build", "signature": "def build(...
2
stack_v2_sparse_classes_30k_train_002446
Implement the Python class `Table` described below. Class description: Table with code quality metrics. Method signatures and docstrings: - def __init__(self, points, length_of_row, length_of_column, padding=5, stroke_width=2, parent_element=None, relative=True): Initialize the table. - def build(self, dwg): Build th...
Implement the Python class `Table` described below. Class description: Table with code quality metrics. Method signatures and docstrings: - def __init__(self, points, length_of_row, length_of_column, padding=5, stroke_width=2, parent_element=None, relative=True): Initialize the table. - def build(self, dwg): Build th...
a763c5534d601f2f40a0f02c02914c49ea23669d
<|skeleton|> class Table: """Table with code quality metrics.""" def __init__(self, points, length_of_row, length_of_column, padding=5, stroke_width=2, parent_element=None, relative=True): """Initialize the table.""" <|body_0|> def build(self, dwg): """Build the table on drawing.""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Table: """Table with code quality metrics.""" def __init__(self, points, length_of_row, length_of_column, padding=5, stroke_width=2, parent_element=None, relative=True): """Initialize the table.""" self.elements = [] self.points = points self.length_of_row = length_of_row ...
the_stack_v2_python_sparse
dashboard/src/code_quality_label.py
fabric8-analytics/fabric8-analytics-common
train
6
6c1fffd29519f7f4db83dc8f8ab071b48e43a5b2
[ "lst = map(int, list(str(A)))\ni = 0\nwhile i + 1 < len(lst) and k > 0:\n if lst[i] > lst[i + 1]:\n del lst[i]\n i -= 1\n if i < 0:\n i = 0\n k -= 1\n else:\n i += 1\nif k > 0:\n lst = lst[:len(lst) - k]\nreturn ''.join(map(str, lst)).lstrip('0')", "lst = map...
<|body_start_0|> lst = map(int, list(str(A))) i = 0 while i + 1 < len(lst) and k > 0: if lst[i] > lst[i + 1]: del lst[i] i -= 1 if i < 0: i = 0 k -= 1 else: i += 1 ...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def DeleteDigits(self, A, k): """greedy algorithm: compare in pairs, if the 1st is larger than 2nd, then remove it be careful when index i becomes negative :param A: A positive integer which has N digits, A is a string. :param k: Remove k digits. :return: A string""" <|...
stack_v2_sparse_classes_75kplus_train_068086
2,022
permissive
[ { "docstring": "greedy algorithm: compare in pairs, if the 1st is larger than 2nd, then remove it be careful when index i becomes negative :param A: A positive integer which has N digits, A is a string. :param k: Remove k digits. :return: A string", "name": "DeleteDigits", "signature": "def DeleteDigits...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def DeleteDigits(self, A, k): greedy algorithm: compare in pairs, if the 1st is larger than 2nd, then remove it be careful when index i becomes negative :param A: A positive inte...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def DeleteDigits(self, A, k): greedy algorithm: compare in pairs, if the 1st is larger than 2nd, then remove it be careful when index i becomes negative :param A: A positive inte...
4629a3857b2c57418b86a3b3a7180ecb15e763e3
<|skeleton|> class Solution: def DeleteDigits(self, A, k): """greedy algorithm: compare in pairs, if the 1st is larger than 2nd, then remove it be careful when index i becomes negative :param A: A positive integer which has N digits, A is a string. :param k: Remove k digits. :return: A string""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def DeleteDigits(self, A, k): """greedy algorithm: compare in pairs, if the 1st is larger than 2nd, then remove it be careful when index i becomes negative :param A: A positive integer which has N digits, A is a string. :param k: Remove k digits. :return: A string""" lst = map(int, l...
the_stack_v2_python_sparse
Delete Digits.py
RijuDasgupta9116/LintCode
train
0
804ef266c4e69b8fcdb1af79a848ef9b14f3a4ea
[ "jobs = Job.objects.filter(status__in=['PENDING', 'QUEUED', 'RUNNING'])\njobs = jobs.values('job_type_id', 'status')\njobs = jobs.annotate(count=models.Count('job_type'))\njob_loads = {}\nmeasured = timezone.now()\nfor job in jobs.iterator():\n job_type_id = job['job_type_id']\n if job_type_id not in job_load...
<|body_start_0|> jobs = Job.objects.filter(status__in=['PENDING', 'QUEUED', 'RUNNING']) jobs = jobs.values('job_type_id', 'status') jobs = jobs.annotate(count=models.Count('job_type')) job_loads = {} measured = timezone.now() for job in jobs.iterator(): job_ty...
This class manages the JobLoad model.
JobLoadManager
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobLoadManager: """This class manages the JobLoad model.""" def calculate(self): """Calculates and saves new job load models grouped by job type based on a current jobs snapshot.""" <|body_0|> def get_job_loads(self, started=None, ended=None, job_type_ids=None, job_type_...
stack_v2_sparse_classes_75kplus_train_068087
25,435
permissive
[ { "docstring": "Calculates and saves new job load models grouped by job type based on a current jobs snapshot.", "name": "calculate", "signature": "def calculate(self)" }, { "docstring": "Returns a list of job loads within the given time range. :param started: Query jobs updated after this amoun...
3
null
Implement the Python class `JobLoadManager` described below. Class description: This class manages the JobLoad model. Method signatures and docstrings: - def calculate(self): Calculates and saves new job load models grouped by job type based on a current jobs snapshot. - def get_job_loads(self, started=None, ended=No...
Implement the Python class `JobLoadManager` described below. Class description: This class manages the JobLoad model. Method signatures and docstrings: - def calculate(self): Calculates and saves new job load models grouped by job type based on a current jobs snapshot. - def get_job_loads(self, started=None, ended=No...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class JobLoadManager: """This class manages the JobLoad model.""" def calculate(self): """Calculates and saves new job load models grouped by job type based on a current jobs snapshot.""" <|body_0|> def get_job_loads(self, started=None, ended=None, job_type_ids=None, job_type_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JobLoadManager: """This class manages the JobLoad model.""" def calculate(self): """Calculates and saves new job load models grouped by job type based on a current jobs snapshot.""" jobs = Job.objects.filter(status__in=['PENDING', 'QUEUED', 'RUNNING']) jobs = jobs.values('job_type...
the_stack_v2_python_sparse
scale/queue/models.py
kfconsultant/scale
train
0
0cabe2dc7962dd2da8c1dbe0cd495ded4f730ba8
[ "self.contents = contents\nself.source = source\nself.version = version\nself.templates = ConfigTemplates(template_paths)\nself.data: Union[dict, None] = None\nself.errors = []", "if self.data is not None and (not self.errors):\n return\ntry:\n self.data = yaml.safe_load(self.contents)\nexcept Exception as ...
<|body_start_0|> self.contents = contents self.source = source self.version = version self.templates = ConfigTemplates(template_paths) self.data: Union[dict, None] = None self.errors = [] <|end_body_0|> <|body_start_1|> if self.data is not None and (not self.erro...
ConfigSpec
[ "BSD-3-Clause", "MIT", "BSD-3-Clause-Modification", "Unlicense", "Apache-2.0", "LGPL-3.0-only", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "CC0-1.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigSpec: def __init__(self, contents: str, template_paths: List[str]=None, source: str=None, version: str=None): """Parameters: contents: the raw text contents of a spec template_paths: a sequence of directories that will take precedence when looking for templates source: a textual re...
stack_v2_sparse_classes_75kplus_train_068088
1,764
permissive
[ { "docstring": "Parameters: contents: the raw text contents of a spec template_paths: a sequence of directories that will take precedence when looking for templates source: a textual representation of what the spec refers to, usually an integration name version: the version of the spec to default to if the spec...
2
stack_v2_sparse_classes_30k_train_024824
Implement the Python class `ConfigSpec` described below. Class description: Implement the ConfigSpec class. Method signatures and docstrings: - def __init__(self, contents: str, template_paths: List[str]=None, source: str=None, version: str=None): Parameters: contents: the raw text contents of a spec template_paths: ...
Implement the Python class `ConfigSpec` described below. Class description: Implement the ConfigSpec class. Method signatures and docstrings: - def __init__(self, contents: str, template_paths: List[str]=None, source: str=None, version: str=None): Parameters: contents: the raw text contents of a spec template_paths: ...
406072e4294edff5b46b513f0cdf7c2c00fac9d2
<|skeleton|> class ConfigSpec: def __init__(self, contents: str, template_paths: List[str]=None, source: str=None, version: str=None): """Parameters: contents: the raw text contents of a spec template_paths: a sequence of directories that will take precedence when looking for templates source: a textual re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConfigSpec: def __init__(self, contents: str, template_paths: List[str]=None, source: str=None, version: str=None): """Parameters: contents: the raw text contents of a spec template_paths: a sequence of directories that will take precedence when looking for templates source: a textual representation o...
the_stack_v2_python_sparse
datadog_checks_dev/datadog_checks/dev/tooling/configuration/core.py
DataDog/integrations-core
train
852
a3f02c76cba4535bdd3f668f04bc5f482fb5468f
[ "if self.has_key(item):\n self[item].insert(nr, issue)\nelse:\n self[item] = [issue]\nreturn True", "if self.has_key(item):\n self[item].append(issue)\nelse:\n self[item] = [issue]\nreturn True", "if self.has_key(item):\n if issue in self[item]:\n return False\nself.add(item, issue)\nretur...
<|body_start_0|> if self.has_key(item): self[item].insert(nr, issue) else: self[item] = [issue] return True <|end_body_0|> <|body_start_1|> if self.has_key(item): self[item].append(issue) else: self[item] = [issue] return T...
dol is dict of lists
Dol
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dol: """dol is dict of lists""" def insert(self, nr, item, issue): """add issue to item entry""" <|body_0|> def add(self, item, issue): """add issue to item entry""" <|body_1|> def adduniq(self, item, issue): """only add issue to item if it i...
stack_v2_sparse_classes_75kplus_train_068089
1,361
permissive
[ { "docstring": "add issue to item entry", "name": "insert", "signature": "def insert(self, nr, item, issue)" }, { "docstring": "add issue to item entry", "name": "add", "signature": "def add(self, item, issue)" }, { "docstring": "only add issue to item if it is not already there"...
6
stack_v2_sparse_classes_30k_train_006930
Implement the Python class `Dol` described below. Class description: dol is dict of lists Method signatures and docstrings: - def insert(self, nr, item, issue): add issue to item entry - def add(self, item, issue): add issue to item entry - def adduniq(self, item, issue): only add issue to item if it is not already t...
Implement the Python class `Dol` described below. Class description: dol is dict of lists Method signatures and docstrings: - def insert(self, nr, item, issue): add issue to item entry - def add(self, item, issue): add issue to item entry - def adduniq(self, item, issue): only add issue to item if it is not already t...
4d9ba385555da03f881f6c4354c062f7f3c9949c
<|skeleton|> class Dol: """dol is dict of lists""" def insert(self, nr, item, issue): """add issue to item entry""" <|body_0|> def add(self, item, issue): """add issue to item entry""" <|body_1|> def adduniq(self, item, issue): """only add issue to item if it i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Dol: """dol is dict of lists""" def insert(self, nr, item, issue): """add issue to item entry""" if self.has_key(item): self[item].insert(nr, issue) else: self[item] = [issue] return True def add(self, item, issue): """add issue to item...
the_stack_v2_python_sparse
jsb/utils/dol.py
melmothx/jsonbot
train
9
26fc0086323210d04d7c3eb48e1d51c5bbf009bd
[ "with open(pyfile, 'r', encoding='utf-8') as f:\n statements = f.read()\ninstructions = dis.get_instructions(statements)\nimports = [i for i in instructions if 'IMPORT' in i.opname]\ngrouped: Dict[str, List[str]] = defaultdict(list)\nfor instr in imports:\n grouped[instr.opname].append(instr.argval)\nreturn g...
<|body_start_0|> with open(pyfile, 'r', encoding='utf-8') as f: statements = f.read() instructions = dis.get_instructions(statements) imports = [i for i in instructions if 'IMPORT' in i.opname] grouped: Dict[str, List[str]] = defaultdict(list) for instr in imports: ...
Tool to work with 3rd part imports in source code.
ImportsTool
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImportsTool: """Tool to work with 3rd part imports in source code.""" def get_imports_for_file(pyfile: Union[str, Path]) -> List[str]: """Get all imported modules for python source file.""" <|body_0|> def get_module_file(module_name: str) -> str: """Get module so...
stack_v2_sparse_classes_75kplus_train_068090
10,606
permissive
[ { "docstring": "Get all imported modules for python source file.", "name": "get_imports_for_file", "signature": "def get_imports_for_file(pyfile: Union[str, Path]) -> List[str]" }, { "docstring": "Get module source file name.", "name": "get_module_file", "signature": "def get_module_file...
5
stack_v2_sparse_classes_30k_train_025221
Implement the Python class `ImportsTool` described below. Class description: Tool to work with 3rd part imports in source code. Method signatures and docstrings: - def get_imports_for_file(pyfile: Union[str, Path]) -> List[str]: Get all imported modules for python source file. - def get_module_file(module_name: str) ...
Implement the Python class `ImportsTool` described below. Class description: Tool to work with 3rd part imports in source code. Method signatures and docstrings: - def get_imports_for_file(pyfile: Union[str, Path]) -> List[str]: Get all imported modules for python source file. - def get_module_file(module_name: str) ...
bec49adaeba661d8d0f03ac9935dc89f39d95a0d
<|skeleton|> class ImportsTool: """Tool to work with 3rd part imports in source code.""" def get_imports_for_file(pyfile: Union[str, Path]) -> List[str]: """Get all imported modules for python source file.""" <|body_0|> def get_module_file(module_name: str) -> str: """Get module so...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImportsTool: """Tool to work with 3rd part imports in source code.""" def get_imports_for_file(pyfile: Union[str, Path]) -> List[str]: """Get all imported modules for python source file.""" with open(pyfile, 'r', encoding='utf-8') as f: statements = f.read() instructio...
the_stack_v2_python_sparse
scripts/check_imports_and_dependencies.py
fetchai/agents-aea
train
192
e630f742f95bb2d1dfa31681427381424cfd1156
[ "super(BiFPN, self).__init__()\nself.epsilon = 0.0001\nself.input_layer_cnt = len(in_channels)\nin_wd, in_ch = zip(*in_channels)\nself.td_weights = []\nself.out_weights = []\nself.td_convs = []\nself.out_convs = []\nself.out_weights.append(tf.random.normal([3]))\nself.out_convs.append(tf.keras.Sequential([layers.Co...
<|body_start_0|> super(BiFPN, self).__init__() self.epsilon = 0.0001 self.input_layer_cnt = len(in_channels) in_wd, in_ch = zip(*in_channels) self.td_weights = [] self.out_weights = [] self.td_convs = [] self.out_convs = [] self.out_weights.append(...
BiFPN
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BiFPN: def __init__(self, in_channels): """Bi-directional feature pyramid network (BiFPN) Args: in_channels: (Variable) list of features' size of each layer from backbone with [(width, channel)]. e.g. if block 1,2,4,7,14 in MobileNetV2 is used, in_channels: [(10,160),(19,64),(38,32),(75,...
stack_v2_sparse_classes_75kplus_train_068091
4,367
permissive
[ { "docstring": "Bi-directional feature pyramid network (BiFPN) Args: in_channels: (Variable) list of features' size of each layer from backbone with [(width, channel)]. e.g. if block 1,2,4,7,14 in MobileNetV2 is used, in_channels: [(10,160),(19,64),(38,32),(75,24),(150,32)] (ascending of width size) I make 'in_...
2
stack_v2_sparse_classes_30k_train_011161
Implement the Python class `BiFPN` described below. Class description: Implement the BiFPN class. Method signatures and docstrings: - def __init__(self, in_channels): Bi-directional feature pyramid network (BiFPN) Args: in_channels: (Variable) list of features' size of each layer from backbone with [(width, channel)]...
Implement the Python class `BiFPN` described below. Class description: Implement the BiFPN class. Method signatures and docstrings: - def __init__(self, in_channels): Bi-directional feature pyramid network (BiFPN) Args: in_channels: (Variable) list of features' size of each layer from backbone with [(width, channel)]...
b37276bcee454b2c39b8fcc60e87b72ec8a6a5d4
<|skeleton|> class BiFPN: def __init__(self, in_channels): """Bi-directional feature pyramid network (BiFPN) Args: in_channels: (Variable) list of features' size of each layer from backbone with [(width, channel)]. e.g. if block 1,2,4,7,14 in MobileNetV2 is used, in_channels: [(10,160),(19,64),(38,32),(75,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BiFPN: def __init__(self, in_channels): """Bi-directional feature pyramid network (BiFPN) Args: in_channels: (Variable) list of features' size of each layer from backbone with [(width, channel)]. e.g. if block 1,2,4,7,14 in MobileNetV2 is used, in_channels: [(10,160),(19,64),(38,32),(75,24),(150,32)] ...
the_stack_v2_python_sparse
Layers/BiFPN.py
chenghuige/TF.Keras-Commonly-used-models
train
0
e7e6d240b05b9bf0ef84f731b08e13c4071ff961
[ "log.msg('connectionLost')\nlog.err(reason)\nreactor.callLater(30, shutdown)", "try:\n real_processor(data)\nexcept Exception as exp:\n common.email_error(exp, data, -1)" ]
<|body_start_0|> log.msg('connectionLost') log.err(reason) reactor.callLater(30, shutdown) <|end_body_0|> <|body_start_1|> try: real_processor(data) except Exception as exp: common.email_error(exp, data, -1) <|end_body_1|>
Our LDM pqact product receiver
MyProductIngestor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyProductIngestor: """Our LDM pqact product receiver""" def connectionLost(self, reason): """The connection was lost for some reason""" <|body_0|> def process_data(self, data): """Callback when we have data to process""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_75kplus_train_068092
5,738
permissive
[ { "docstring": "The connection was lost for some reason", "name": "connectionLost", "signature": "def connectionLost(self, reason)" }, { "docstring": "Callback when we have data to process", "name": "process_data", "signature": "def process_data(self, data)" } ]
2
stack_v2_sparse_classes_30k_train_016224
Implement the Python class `MyProductIngestor` described below. Class description: Our LDM pqact product receiver Method signatures and docstrings: - def connectionLost(self, reason): The connection was lost for some reason - def process_data(self, data): Callback when we have data to process
Implement the Python class `MyProductIngestor` described below. Class description: Our LDM pqact product receiver Method signatures and docstrings: - def connectionLost(self, reason): The connection was lost for some reason - def process_data(self, data): Callback when we have data to process <|skeleton|> class MyPr...
e9ca4c4ad0a6e5a6e6479a84d86fd21ad2a0be00
<|skeleton|> class MyProductIngestor: """Our LDM pqact product receiver""" def connectionLost(self, reason): """The connection was lost for some reason""" <|body_0|> def process_data(self, data): """Callback when we have data to process""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyProductIngestor: """Our LDM pqact product receiver""" def connectionLost(self, reason): """The connection was lost for some reason""" log.msg('connectionLost') log.err(reason) reactor.callLater(30, shutdown) def process_data(self, data): """Callback when we ...
the_stack_v2_python_sparse
parsers/metar_parser.py
xlia/pyWWA
train
0
ae0afd27f12dc0fd10cb9f518353aa69397b56e3
[ "super().__init__()\nextra_keys = kwargs.keys()\nfor extra_key in extra_keys:\n if extra_key not in ['model_name']:\n raise ValueError(f'{type(self).__name__} got key `{extra_key}` which is not supported.')\nself.forward_operator = forward_operator\nself.backward_operator = backward_operator\nself.no_para...
<|body_start_0|> super().__init__() extra_keys = kwargs.keys() for extra_key in extra_keys: if extra_key not in ['model_name']: raise ValueError(f'{type(self).__name__} got key `{extra_key}` which is not supported.') self.forward_operator = forward_operator ...
Cascades of Independently Recurrent Inference Machines implementation as presented in [1]_. References ---------- .. [1] Karkalousos, D. et al. (2021) ‘Assessment of Data Consistency through Cascades of Independently Recurrent Inference Machines for fast and robust accelerated MRI reconstruction’. Available at: https:/...
CIRIM
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CIRIM: """Cascades of Independently Recurrent Inference Machines implementation as presented in [1]_. References ---------- .. [1] Karkalousos, D. et al. (2021) ‘Assessment of Data Consistency through Cascades of Independently Recurrent Inference Machines for fast and robust accelerated MRI recon...
stack_v2_sparse_classes_75kplus_train_068093
17,965
permissive
[ { "docstring": "Parameters ---------- forward_operator : Callable Forward Operator. backward_operator : Callable Backward Operator. depth: int Number of layers. time_steps : int Number of iterations :math:`T`. in_channels : int Input channel number. Default is 2 for complex data. recurrent_hidden_channels : int...
2
stack_v2_sparse_classes_30k_train_040481
Implement the Python class `CIRIM` described below. Class description: Cascades of Independently Recurrent Inference Machines implementation as presented in [1]_. References ---------- .. [1] Karkalousos, D. et al. (2021) ‘Assessment of Data Consistency through Cascades of Independently Recurrent Inference Machines fo...
Implement the Python class `CIRIM` described below. Class description: Cascades of Independently Recurrent Inference Machines implementation as presented in [1]_. References ---------- .. [1] Karkalousos, D. et al. (2021) ‘Assessment of Data Consistency through Cascades of Independently Recurrent Inference Machines fo...
2a4c29342bc52a404aae097bc2654fb4323e1ac8
<|skeleton|> class CIRIM: """Cascades of Independently Recurrent Inference Machines implementation as presented in [1]_. References ---------- .. [1] Karkalousos, D. et al. (2021) ‘Assessment of Data Consistency through Cascades of Independently Recurrent Inference Machines for fast and robust accelerated MRI recon...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CIRIM: """Cascades of Independently Recurrent Inference Machines implementation as presented in [1]_. References ---------- .. [1] Karkalousos, D. et al. (2021) ‘Assessment of Data Consistency through Cascades of Independently Recurrent Inference Machines for fast and robust accelerated MRI reconstruction’. A...
the_stack_v2_python_sparse
direct/nn/cirim/cirim.py
NKI-AI/direct
train
151
123ebc0ec4f847942a4cc1bcdffdf9e5f418f679
[ "super(ResourceContainer, self).__init__()\nself.vocabularies = BTreeContainer()\nself.vocabularies.__parent__ = self", "self.unregisterVocabularies()\nlst = [x for x in self.vocabularies.keys()]\nif lst:\n for x in lst:\n del self.vocabularies[x]\nlst = getFieldNames(IContentClassResource)\nfor x in ls...
<|body_start_0|> super(ResourceContainer, self).__init__() self.vocabularies = BTreeContainer() self.vocabularies.__parent__ = self <|end_body_0|> <|body_start_1|> self.unregisterVocabularies() lst = [x for x in self.vocabularies.keys()] if lst: for x in lst:...
Реализация контейнера для ресурсов контент-класса
ResourceContainer
[ "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceContainer: """Реализация контейнера для ресурсов контент-класса""" def __init__(self, *kv, **kw): """Создаёт контейнер, в котором хранятся фабрики словарей""" <|body_0|> def regenerateVocabularies(self): """Создаёт/пересоздаёт и регистрирует словари, кажд...
stack_v2_sparse_classes_75kplus_train_068094
3,165
permissive
[ { "docstring": "Создаёт контейнер, в котором хранятся фабрики словарей", "name": "__init__", "signature": "def __init__(self, *kv, **kw)" }, { "docstring": "Создаёт/пересоздаёт и регистрирует словари, каждый из которых соответствует определённому полю IContentClassResource", "name": "regener...
4
stack_v2_sparse_classes_30k_train_003251
Implement the Python class `ResourceContainer` described below. Class description: Реализация контейнера для ресурсов контент-класса Method signatures and docstrings: - def __init__(self, *kv, **kw): Создаёт контейнер, в котором хранятся фабрики словарей - def regenerateVocabularies(self): Создаёт/пересоздаёт и регис...
Implement the Python class `ResourceContainer` described below. Class description: Реализация контейнера для ресурсов контент-класса Method signatures and docstrings: - def __init__(self, *kv, **kw): Создаёт контейнер, в котором хранятся фабрики словарей - def regenerateVocabularies(self): Создаёт/пересоздаёт и регис...
0fbd89f7a9dd50e2c13c53731b373f13b05d4602
<|skeleton|> class ResourceContainer: """Реализация контейнера для ресурсов контент-класса""" def __init__(self, *kv, **kw): """Создаёт контейнер, в котором хранятся фабрики словарей""" <|body_0|> def regenerateVocabularies(self): """Создаёт/пересоздаёт и регистрирует словари, кажд...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResourceContainer: """Реализация контейнера для ресурсов контент-класса""" def __init__(self, *kv, **kw): """Создаёт контейнер, в котором хранятся фабрики словарей""" super(ResourceContainer, self).__init__() self.vocabularies = BTreeContainer() self.vocabularies.__parent_...
the_stack_v2_python_sparse
contentclass2resource/trunk/resourcecontainer.py
xen/kscode
train
0
793b9f393ca69ed8fb8cd628d77684031e5174b5
[ "subsets_A = set()\nsubsets_B = set()\nused = set()\nfor i in range(len(graph)):\n if i not in used:\n subsets_A.add(i)\n cur_list = [i]\n count = 0\n while cur_list:\n next_list = []\n for j in cur_list:\n used.add(j)\n for opposite...
<|body_start_0|> subsets_A = set() subsets_B = set() used = set() for i in range(len(graph)): if i not in used: subsets_A.add(i) cur_list = [i] count = 0 while cur_list: next_list = [] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isBipartite(self, graph): """:type graph: List[List[int]] :rtype: bool 514ms""" <|body_0|> def isBipartite_1(self, graph): """:type graph: List[List[int]] :rtype: bool 50ms""" <|body_1|> def isBipartite_2(self, graph): """:type grap...
stack_v2_sparse_classes_75kplus_train_068095
4,734
no_license
[ { "docstring": ":type graph: List[List[int]] :rtype: bool 514ms", "name": "isBipartite", "signature": "def isBipartite(self, graph)" }, { "docstring": ":type graph: List[List[int]] :rtype: bool 50ms", "name": "isBipartite_1", "signature": "def isBipartite_1(self, graph)" }, { "do...
3
stack_v2_sparse_classes_30k_train_021707
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBipartite(self, graph): :type graph: List[List[int]] :rtype: bool 514ms - def isBipartite_1(self, graph): :type graph: List[List[int]] :rtype: bool 50ms - def isBipartite_2...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBipartite(self, graph): :type graph: List[List[int]] :rtype: bool 514ms - def isBipartite_1(self, graph): :type graph: List[List[int]] :rtype: bool 50ms - def isBipartite_2...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def isBipartite(self, graph): """:type graph: List[List[int]] :rtype: bool 514ms""" <|body_0|> def isBipartite_1(self, graph): """:type graph: List[List[int]] :rtype: bool 50ms""" <|body_1|> def isBipartite_2(self, graph): """:type grap...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isBipartite(self, graph): """:type graph: List[List[int]] :rtype: bool 514ms""" subsets_A = set() subsets_B = set() used = set() for i in range(len(graph)): if i not in used: subsets_A.add(i) cur_list = [i] ...
the_stack_v2_python_sparse
IsGraphBipartite_MID_785.py
953250587/leetcode-python
train
2
406dc7113431990851df61ca2f7846902a7b8cd7
[ "await self.register_unknown_repositories(repositories, category)\nfor entry, repo_data in repositories.items():\n if repo_data['full_name'] in removed:\n self.hacs.log.warning(\"Skipping %s as it's removed from HACS\", repo_data['full_name'])\n continue\n self.async_restore_repository(entry, re...
<|body_start_0|> await self.register_unknown_repositories(repositories, category) for entry, repo_data in repositories.items(): if repo_data['full_name'] in removed: self.hacs.log.warning("Skipping %s as it's removed from HACS", repo_data['full_name']) continu...
Extended HACS data.
AdjustedHacsData
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdjustedHacsData: """Extended HACS data.""" async def register_base_data(self, category: str, repositories: dict[str, dict[str, Any]], removed: list[str]): """Restore saved data.""" <|body_0|> def async_store_repository_data(self, repository: HacsRepository) -> dict: ...
stack_v2_sparse_classes_75kplus_train_068096
14,890
permissive
[ { "docstring": "Restore saved data.", "name": "register_base_data", "signature": "async def register_base_data(self, category: str, repositories: dict[str, dict[str, Any]], removed: list[str])" }, { "docstring": "Store the repository data.", "name": "async_store_repository_data", "signat...
2
stack_v2_sparse_classes_30k_train_011603
Implement the Python class `AdjustedHacsData` described below. Class description: Extended HACS data. Method signatures and docstrings: - async def register_base_data(self, category: str, repositories: dict[str, dict[str, Any]], removed: list[str]): Restore saved data. - def async_store_repository_data(self, reposito...
Implement the Python class `AdjustedHacsData` described below. Class description: Extended HACS data. Method signatures and docstrings: - async def register_base_data(self, category: str, repositories: dict[str, dict[str, Any]], removed: list[str]): Restore saved data. - def async_store_repository_data(self, reposito...
6a27b0a4b74ed4161185af438bcff5aec926f4d9
<|skeleton|> class AdjustedHacsData: """Extended HACS data.""" async def register_base_data(self, category: str, repositories: dict[str, dict[str, Any]], removed: list[str]): """Restore saved data.""" <|body_0|> def async_store_repository_data(self, repository: HacsRepository) -> dict: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdjustedHacsData: """Extended HACS data.""" async def register_base_data(self, category: str, repositories: dict[str, dict[str, Any]], removed: list[str]): """Restore saved data.""" await self.register_unknown_repositories(repositories, category) for entry, repo_data in repositori...
the_stack_v2_python_sparse
scripts/data/generate_category_data.py
hacs/integration
train
3,601
0423d50005aa7bb9dfb892783f08505164c0cbfd
[ "try:\n if not data:\n return {}\n return json.loads(data)\nexcept Exception as err:\n print('%%Error: parse data (%s...) error: %s' % (data, err))\nreturn {}", "try:\n return json.dumps(jdata, indent=4)\nexcept Exception as err:\n print('%%Error: dump data error: %s' % err)\nreturn ''" ]
<|body_start_0|> try: if not data: return {} return json.loads(data) except Exception as err: print('%%Error: parse data (%s...) error: %s' % (data, err)) return {} <|end_body_0|> <|body_start_1|> try: return json.dumps(jda...
BaseUtils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseUtils: def _json_parse(self, data): """parse json string""" <|body_0|> def _json_dumps4(self, jdata): """dump json string with pretty format""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: if not data: return {} ...
stack_v2_sparse_classes_75kplus_train_068097
28,833
no_license
[ { "docstring": "parse json string", "name": "_json_parse", "signature": "def _json_parse(self, data)" }, { "docstring": "dump json string with pretty format", "name": "_json_dumps4", "signature": "def _json_dumps4(self, jdata)" } ]
2
null
Implement the Python class `BaseUtils` described below. Class description: Implement the BaseUtils class. Method signatures and docstrings: - def _json_parse(self, data): parse json string - def _json_dumps4(self, jdata): dump json string with pretty format
Implement the Python class `BaseUtils` described below. Class description: Implement the BaseUtils class. Method signatures and docstrings: - def _json_parse(self, data): parse json string - def _json_dumps4(self, jdata): dump json string with pretty format <|skeleton|> class BaseUtils: def _json_parse(self, da...
dc01eef8ffee44e36c9ad988e4e2c09177252e69
<|skeleton|> class BaseUtils: def _json_parse(self, data): """parse json string""" <|body_0|> def _json_dumps4(self, jdata): """dump json string with pretty format""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseUtils: def _json_parse(self, data): """parse json string""" try: if not data: return {} return json.loads(data) except Exception as err: print('%%Error: parse data (%s...) error: %s' % (data, err)) return {} def _json...
the_stack_v2_python_sparse
AlarmDefinition/consul/tool/configdata.py
lindong4067/python-scripts
train
0
a9a573e919d561e51833e3167cab7b5ca9e4c5b1
[ "url = urlparse(file_or_url)\nif url.scheme:\n path = Path(url.path)\n self.url = file_or_url\n self.url_parsed = url\n self.path = None\n self.is_url = True\nelse:\n path = Path(file_or_url)\n self.url = None\n self.path = path\n self.is_url = False\nif self.is_url and cache_dir is not N...
<|body_start_0|> url = urlparse(file_or_url) if url.scheme: path = Path(url.path) self.url = file_or_url self.url_parsed = url self.path = None self.is_url = True else: path = Path(file_or_url) self.url = None ...
Loads data from an URL, optionally caching it.
CachedFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CachedFile: """Loads data from an URL, optionally caching it.""" def __init__(self, file_or_url: str, cache_dir: Optional[Path]=None): """Creates a cacheing file loader. Args: file_or_url: the url or path to the file to load cache_dir: if present, a directory where to cache the file....
stack_v2_sparse_classes_75kplus_train_068098
14,435
no_license
[ { "docstring": "Creates a cacheing file loader. Args: file_or_url: the url or path to the file to load cache_dir: if present, a directory where to cache the file. If absent, don’t cache.", "name": "__init__", "signature": "def __init__(self, file_or_url: str, cache_dir: Optional[Path]=None)" }, { ...
2
stack_v2_sparse_classes_30k_test_000271
Implement the Python class `CachedFile` described below. Class description: Loads data from an URL, optionally caching it. Method signatures and docstrings: - def __init__(self, file_or_url: str, cache_dir: Optional[Path]=None): Creates a cacheing file loader. Args: file_or_url: the url or path to the file to load ca...
Implement the Python class `CachedFile` described below. Class description: Loads data from an URL, optionally caching it. Method signatures and docstrings: - def __init__(self, file_or_url: str, cache_dir: Optional[Path]=None): Creates a cacheing file loader. Args: file_or_url: the url or path to the file to load ca...
118403f233e2ddd1f91da78dc73b45f19aa6e232
<|skeleton|> class CachedFile: """Loads data from an URL, optionally caching it.""" def __init__(self, file_or_url: str, cache_dir: Optional[Path]=None): """Creates a cacheing file loader. Args: file_or_url: the url or path to the file to load cache_dir: if present, a directory where to cache the file....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CachedFile: """Loads data from an URL, optionally caching it.""" def __init__(self, file_or_url: str, cache_dir: Optional[Path]=None): """Creates a cacheing file loader. Args: file_or_url: the url or path to the file to load cache_dir: if present, a directory where to cache the file. If absent, d...
the_stack_v2_python_sparse
src/macrogen/config.py
faustedition/faust-macrogen
train
0
956f9e60f465d4f1a98167191b3b818c37ad776d
[ "super().__init__(*args, **kwargs)\nif ext_args == {}:\n self._freq = 1\nelse:\n self._freq = ext_args.freq", "if engine.rank != 0:\n for k in engine.log_buffer:\n engine.log_buffer[k].clear()\n return\nfor k, v in engine.log_buffer['scalar'].items():\n setattr(engine.monitor, k, v)\nengine....
<|body_start_0|> super().__init__(*args, **kwargs) if ext_args == {}: self._freq = 1 else: self._freq = ext_args.freq <|end_body_0|> <|body_start_1|> if engine.rank != 0: for k in engine.log_buffer: engine.log_buffer[k].clear() ...
Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position
LogShowHook
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogShowHook: """Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position""" def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: """Overview: init LogShowHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_ar...
stack_v2_sparse_classes_75kplus_train_068099
15,244
permissive
[ { "docstring": "Overview: init LogShowHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_args.freq to set freq", "name": "__init__", "signature": "def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None" }, { "docstring": "Overview: Show log, update record an...
2
stack_v2_sparse_classes_30k_train_006005
Implement the Python class `LogShowHook` described below. Class description: Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position Method signatures and docstrings: - def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: Overview: init LogShowHook Arguments...
Implement the Python class `LogShowHook` described below. Class description: Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position Method signatures and docstrings: - def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: Overview: init LogShowHook Arguments...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class LogShowHook: """Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position""" def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: """Overview: init LogShowHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_ar...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LogShowHook: """Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position""" def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: """Overview: init LogShowHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_args.freq to se...
the_stack_v2_python_sparse
ding/worker/learner/learner_hook.py
shengxuesun/DI-engine
train
1