blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
83f4cf4434c7f1f39f73c79968fd883a11f70aff | [
"parser = parent.add_parser('rm', help='Delete pod and container(s)')\nparser.add_flag('--all', '-a', help='Remove all pods.')\nparser.add_flag('--force', '-f', help='Stop and remove container(s) then delete pod.')\nparser.add_argument('pod', nargs='*', help='Pod to remove. Or, use --all')\nparser.set_defaults(clas... | <|body_start_0|>
parser = parent.add_parser('rm', help='Delete pod and container(s)')
parser.add_flag('--all', '-a', help='Remove all pods.')
parser.add_flag('--force', '-f', help='Stop and remove container(s) then delete pod.')
parser.add_argument('pod', nargs='*', help='Pod to remove. ... | Class for removing pod and containers from storage. | RemovePod | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RemovePod:
"""Class for removing pod and containers from storage."""
def subparser(cls, parent):
"""Add Pod Rm command to parent parser."""
<|body_0|>
def __init__(self, args):
"""Construct RemovePod object."""
<|body_1|>
def remove(self):
""... | stack_v2_sparse_classes_36k_train_032200 | 1,791 | permissive | [
{
"docstring": "Add Pod Rm command to parent parser.",
"name": "subparser",
"signature": "def subparser(cls, parent)"
},
{
"docstring": "Construct RemovePod object.",
"name": "__init__",
"signature": "def __init__(self, args)"
},
{
"docstring": "Remove pod and container(s).",
... | 3 | stack_v2_sparse_classes_30k_train_005069 | Implement the Python class `RemovePod` described below.
Class description:
Class for removing pod and containers from storage.
Method signatures and docstrings:
- def subparser(cls, parent): Add Pod Rm command to parent parser.
- def __init__(self, args): Construct RemovePod object.
- def remove(self): Remove pod and... | Implement the Python class `RemovePod` described below.
Class description:
Class for removing pod and containers from storage.
Method signatures and docstrings:
- def subparser(cls, parent): Add Pod Rm command to parent parser.
- def __init__(self, args): Construct RemovePod object.
- def remove(self): Remove pod and... | 94a46127cb0db2b6187186788a941ec72af476dd | <|skeleton|>
class RemovePod:
"""Class for removing pod and containers from storage."""
def subparser(cls, parent):
"""Add Pod Rm command to parent parser."""
<|body_0|>
def __init__(self, args):
"""Construct RemovePod object."""
<|body_1|>
def remove(self):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RemovePod:
"""Class for removing pod and containers from storage."""
def subparser(cls, parent):
"""Add Pod Rm command to parent parser."""
parser = parent.add_parser('rm', help='Delete pod and container(s)')
parser.add_flag('--all', '-a', help='Remove all pods.')
parser.a... | the_stack_v2_python_sparse | pypodman/pypodman/lib/actions/pod/remove_parser.py | 4383/python-podman | train | 0 |
8b5de17457890678b2bf473802ae0182a5d7a447 | [
"self.graph = graph\nself.distances = graph.distance\nself.links = graph.links\nself.weighted_edge_list = graph.weighted_edge_list\nself.G = graph.G\nself.sort = sorted(self.weighted_edge_list, key=lambda x: x[2])\nself.ordered_distance = [i[2] for i in self.sort]\nself.ordered_links = [i[0:2] for i in self.sort]\n... | <|body_start_0|>
self.graph = graph
self.distances = graph.distance
self.links = graph.links
self.weighted_edge_list = graph.weighted_edge_list
self.G = graph.G
self.sort = sorted(self.weighted_edge_list, key=lambda x: x[2])
self.ordered_distance = [i[2] for i in ... | Kruskal and prims algorithm. | MST | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MST:
"""Kruskal and prims algorithm."""
def __init__(self, graph):
"""Take Graph object from read.py."""
<|body_0|>
def kruskal(self):
"""Find minimum spanning tree using kruskals algorithm."""
<|body_1|>
def prims(self, start_node, matrix=None):
... | stack_v2_sparse_classes_36k_train_032201 | 2,939 | no_license | [
{
"docstring": "Take Graph object from read.py.",
"name": "__init__",
"signature": "def __init__(self, graph)"
},
{
"docstring": "Find minimum spanning tree using kruskals algorithm.",
"name": "kruskal",
"signature": "def kruskal(self)"
},
{
"docstring": "Prims algorithm.",
"... | 3 | stack_v2_sparse_classes_30k_train_018730 | Implement the Python class `MST` described below.
Class description:
Kruskal and prims algorithm.
Method signatures and docstrings:
- def __init__(self, graph): Take Graph object from read.py.
- def kruskal(self): Find minimum spanning tree using kruskals algorithm.
- def prims(self, start_node, matrix=None): Prims a... | Implement the Python class `MST` described below.
Class description:
Kruskal and prims algorithm.
Method signatures and docstrings:
- def __init__(self, graph): Take Graph object from read.py.
- def kruskal(self): Find minimum spanning tree using kruskals algorithm.
- def prims(self, start_node, matrix=None): Prims a... | 1ab79611816cabe8d658d8893e06cab62b2b6af6 | <|skeleton|>
class MST:
"""Kruskal and prims algorithm."""
def __init__(self, graph):
"""Take Graph object from read.py."""
<|body_0|>
def kruskal(self):
"""Find minimum spanning tree using kruskals algorithm."""
<|body_1|>
def prims(self, start_node, matrix=None):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MST:
"""Kruskal and prims algorithm."""
def __init__(self, graph):
"""Take Graph object from read.py."""
self.graph = graph
self.distances = graph.distance
self.links = graph.links
self.weighted_edge_list = graph.weighted_edge_list
self.G = graph.G
... | the_stack_v2_python_sparse | GraphTheory/mst.py | Pullabhatla/M2R | train | 0 |
cbccd7f63b292b12037f6fa05b62befee0b6a20a | [
"self.tik_instance = tik.Tik(tik.Dprofile())\nself.aicore_num = cce.cce_conf.get_soc_spec(cce.cce_conf.CORE_NUM)\nself.shape = list(shape)\nself.dtype = dtype\nself.kernel_name = kernel_name\nblock_byte_size = 32\ndtype_byte_size = cce.cce_intrin.get_bit_len(dtype) // 8\nself.data_each_block = block_byte_size // dt... | <|body_start_0|>
self.tik_instance = tik.Tik(tik.Dprofile())
self.aicore_num = cce.cce_conf.get_soc_spec(cce.cce_conf.CORE_NUM)
self.shape = list(shape)
self.dtype = dtype
self.kernel_name = kernel_name
block_byte_size = 32
dtype_byte_size = cce.cce_intrin.get_bit... | Function: move the data from gm to gm via ub | MoveFromGm2Gm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MoveFromGm2Gm:
"""Function: move the data from gm to gm via ub"""
def __init__(self, shape, dtype, kernel_name):
"""init the parameters Parameters ---------- shape: tuple or list the shape of input tensor dtype: string the dtype of input tensor kernel_name: str kernel name, default v... | stack_v2_sparse_classes_36k_train_032202 | 39,050 | no_license | [
{
"docstring": "init the parameters Parameters ---------- shape: tuple or list the shape of input tensor dtype: string the dtype of input tensor kernel_name: str kernel name, default value is \"reverse_ext2\" Returns ------- None",
"name": "__init__",
"signature": "def __init__(self, shape, dtype, kerne... | 5 | null | Implement the Python class `MoveFromGm2Gm` described below.
Class description:
Function: move the data from gm to gm via ub
Method signatures and docstrings:
- def __init__(self, shape, dtype, kernel_name): init the parameters Parameters ---------- shape: tuple or list the shape of input tensor dtype: string the dtyp... | Implement the Python class `MoveFromGm2Gm` described below.
Class description:
Function: move the data from gm to gm via ub
Method signatures and docstrings:
- def __init__(self, shape, dtype, kernel_name): init the parameters Parameters ---------- shape: tuple or list the shape of input tensor dtype: string the dtyp... | 148511a31bfd195df889291946c43bb585acb546 | <|skeleton|>
class MoveFromGm2Gm:
"""Function: move the data from gm to gm via ub"""
def __init__(self, shape, dtype, kernel_name):
"""init the parameters Parameters ---------- shape: tuple or list the shape of input tensor dtype: string the dtype of input tensor kernel_name: str kernel name, default v... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MoveFromGm2Gm:
"""Function: move the data from gm to gm via ub"""
def __init__(self, shape, dtype, kernel_name):
"""init the parameters Parameters ---------- shape: tuple or list the shape of input tensor dtype: string the dtype of input tensor kernel_name: str kernel name, default value is "reve... | the_stack_v2_python_sparse | convertor/huawei/impl/reverse_v2_d.py | jizhuoran/caffe-huawei-atlas-convertor | train | 4 |
4cee7a401b7bf864752d86b0923e2a281bd8afbd | [
"assert 1 <= height <= len(lowercase) and 1 <= width <= len(lowercase)\nself.game = game\nself.width = width\nself.height = height\nself.left = width * height\nself.cells = [[Cell(self, x, y) for x in range(width)] for y in range(height)]",
"for mine_cell in sample(range(self.width * self.height), num_mines):\n ... | <|body_start_0|>
assert 1 <= height <= len(lowercase) and 1 <= width <= len(lowercase)
self.game = game
self.width = width
self.height = height
self.left = width * height
self.cells = [[Cell(self, x, y) for x in range(width)] for y in range(height)]
<|end_body_0|>
<|body... | The board. | Board | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Board:
"""The board."""
def __init__(self, game, width, height):
"""Create the board. Set game, width, height, # cells left, and create the raw grid."""
<|body_0|>
def place_mines(self, num_mines):
"""PLace mines and update neighbors' mine counts."""
<|bo... | stack_v2_sparse_classes_36k_train_032203 | 5,366 | no_license | [
{
"docstring": "Create the board. Set game, width, height, # cells left, and create the raw grid.",
"name": "__init__",
"signature": "def __init__(self, game, width, height)"
},
{
"docstring": "PLace mines and update neighbors' mine counts.",
"name": "place_mines",
"signature": "def plac... | 3 | stack_v2_sparse_classes_30k_train_018699 | Implement the Python class `Board` described below.
Class description:
The board.
Method signatures and docstrings:
- def __init__(self, game, width, height): Create the board. Set game, width, height, # cells left, and create the raw grid.
- def place_mines(self, num_mines): PLace mines and update neighbors' mine co... | Implement the Python class `Board` described below.
Class description:
The board.
Method signatures and docstrings:
- def __init__(self, game, width, height): Create the board. Set game, width, height, # cells left, and create the raw grid.
- def place_mines(self, num_mines): PLace mines and update neighbors' mine co... | 2244d63607be13c70c531a6e3064f85074111ca7 | <|skeleton|>
class Board:
"""The board."""
def __init__(self, game, width, height):
"""Create the board. Set game, width, height, # cells left, and create the raw grid."""
<|body_0|>
def place_mines(self, num_mines):
"""PLace mines and update neighbors' mine counts."""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Board:
"""The board."""
def __init__(self, game, width, height):
"""Create the board. Set game, width, height, # cells left, and create the raw grid."""
assert 1 <= height <= len(lowercase) and 1 <= width <= len(lowercase)
self.game = game
self.width = width
self.h... | the_stack_v2_python_sparse | HARD/minesweeper/minesweeper.py | jenihuang/hb_challenges | train | 2 |
5230ea5721ded9d90a7921349520d52b6e95a571 | [
"super().__init__('uvm_reg_indirect_ftdr_seq')\nself.m_addr_reg = addr_reg\nself.m_data_reg = data_reg\nself.m_idx = idx",
"arr: List[UVMRegItem] = []\nif not sv.cast(arr, self.rw_info.clone(), UVMRegItem):\n uvm_fatal('CAST_FAIL', 'Expected UVMRegItem, got ' + str(self.rw_info))\nrw = arr[0]\nrw.element = sel... | <|body_start_0|>
super().__init__('uvm_reg_indirect_ftdr_seq')
self.m_addr_reg = addr_reg
self.m_data_reg = data_reg
self.m_idx = idx
<|end_body_0|>
<|body_start_1|>
arr: List[UVMRegItem] = []
if not sv.cast(arr, self.rw_info.clone(), UVMRegItem):
uvm_fatal('... | uvm_reg_indirect_ftdr_seq | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class uvm_reg_indirect_ftdr_seq:
def __init__(self, addr_reg, idx, data_reg):
"""Constructor Args: addr_reg: idx: data_reg:"""
<|body_0|>
async def body(self):
"""Body of indirect sequence"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().__init__('... | stack_v2_sparse_classes_36k_train_032204 | 14,815 | permissive | [
{
"docstring": "Constructor Args: addr_reg: idx: data_reg:",
"name": "__init__",
"signature": "def __init__(self, addr_reg, idx, data_reg)"
},
{
"docstring": "Body of indirect sequence",
"name": "body",
"signature": "async def body(self)"
}
] | 2 | null | Implement the Python class `uvm_reg_indirect_ftdr_seq` described below.
Class description:
Implement the uvm_reg_indirect_ftdr_seq class.
Method signatures and docstrings:
- def __init__(self, addr_reg, idx, data_reg): Constructor Args: addr_reg: idx: data_reg:
- async def body(self): Body of indirect sequence | Implement the Python class `uvm_reg_indirect_ftdr_seq` described below.
Class description:
Implement the uvm_reg_indirect_ftdr_seq class.
Method signatures and docstrings:
- def __init__(self, addr_reg, idx, data_reg): Constructor Args: addr_reg: idx: data_reg:
- async def body(self): Body of indirect sequence
<|ske... | fc5f955701b2b56c1fddac195c70cb3ebb9139fe | <|skeleton|>
class uvm_reg_indirect_ftdr_seq:
def __init__(self, addr_reg, idx, data_reg):
"""Constructor Args: addr_reg: idx: data_reg:"""
<|body_0|>
async def body(self):
"""Body of indirect sequence"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class uvm_reg_indirect_ftdr_seq:
def __init__(self, addr_reg, idx, data_reg):
"""Constructor Args: addr_reg: idx: data_reg:"""
super().__init__('uvm_reg_indirect_ftdr_seq')
self.m_addr_reg = addr_reg
self.m_data_reg = data_reg
self.m_idx = idx
async def body(self):
... | the_stack_v2_python_sparse | src/uvm/reg/uvm_reg_indirect.py | tpoikela/uvm-python | train | 199 | |
ab39d5f448d055fd7c52eef846b06edf56b9945c | [
"security_parameter = 10\none_way_perm = blum_blum_shub.blum_blum_shub(security_parameter)\nhardcorePred = blum_blum_shub.parity",
"security_parameter = 10\none_way_perm = blum_blum_shub.blum_blum_shub(security_parameter)\nhardcorePred = blum_blum_shub.parity\nprint('Bit commitment')\nscheme = BBSBitCommitmentSch... | <|body_start_0|>
security_parameter = 10
one_way_perm = blum_blum_shub.blum_blum_shub(security_parameter)
hardcorePred = blum_blum_shub.parity
<|end_body_0|>
<|body_start_1|>
security_parameter = 10
one_way_perm = blum_blum_shub.blum_blum_shub(security_parameter)
hardcor... | " Basic tests for Commitment schemes. | TestCommitment | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCommitment:
"""" Basic tests for Commitment schemes."""
def test_pred_construction(self):
"""Test predicate construction works."""
<|body_0|>
def test_bit_commitment(self):
"""Test that bit commitment works."""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_36k_train_032205 | 908 | permissive | [
{
"docstring": "Test predicate construction works.",
"name": "test_pred_construction",
"signature": "def test_pred_construction(self)"
},
{
"docstring": "Test that bit commitment works.",
"name": "test_bit_commitment",
"signature": "def test_bit_commitment(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016753 | Implement the Python class `TestCommitment` described below.
Class description:
" Basic tests for Commitment schemes.
Method signatures and docstrings:
- def test_pred_construction(self): Test predicate construction works.
- def test_bit_commitment(self): Test that bit commitment works. | Implement the Python class `TestCommitment` described below.
Class description:
" Basic tests for Commitment schemes.
Method signatures and docstrings:
- def test_pred_construction(self): Test predicate construction works.
- def test_bit_commitment(self): Test that bit commitment works.
<|skeleton|>
class TestCommit... | f8e45d56c3934a1cf24220b58e073434379e3d78 | <|skeleton|>
class TestCommitment:
"""" Basic tests for Commitment schemes."""
def test_pred_construction(self):
"""Test predicate construction works."""
<|body_0|>
def test_bit_commitment(self):
"""Test that bit commitment works."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestCommitment:
"""" Basic tests for Commitment schemes."""
def test_pred_construction(self):
"""Test predicate construction works."""
security_parameter = 10
one_way_perm = blum_blum_shub.blum_blum_shub(security_parameter)
hardcorePred = blum_blum_shub.parity
def tes... | the_stack_v2_python_sparse | misc/test_commitment.py | computablelabs/starks | train | 9 |
09fe5ee15fa30a41280845e67458dec0e82c22e5 | [
"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!')",
"conte... | <|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... | Missing associated documentation comment in .proto file. | AzureSecretServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AzureSecretServiceServicer:
"""Missing associated documentation comment in .proto file."""
def getAzureSecret(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def createAzureSecret(self, request, context):
"""Miss... | stack_v2_sparse_classes_36k_train_032206 | 8,199 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "getAzureSecret",
"signature": "def getAzureSecret(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "createAzureSecret",
"signature": "def crea... | 4 | stack_v2_sparse_classes_30k_train_018142 | Implement the Python class `AzureSecretServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def getAzureSecret(self, request, context): Missing associated documentation comment in .proto file.
- def createAzureSecret(self, re... | Implement the Python class `AzureSecretServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def getAzureSecret(self, request, context): Missing associated documentation comment in .proto file.
- def createAzureSecret(self, re... | c69e14b409add099d151434b9add711e41f41b20 | <|skeleton|>
class AzureSecretServiceServicer:
"""Missing associated documentation comment in .proto file."""
def getAzureSecret(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def createAzureSecret(self, request, context):
"""Miss... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AzureSecretServiceServicer:
"""Missing associated documentation comment in .proto file."""
def getAzureSecret(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not imp... | the_stack_v2_python_sparse | python-sdk/src/airavata_mft_sdk/azure/AzureSecretService_pb2_grpc.py | apache/airavata-mft | train | 23 |
2eedf896d0eb158497b94f4a9d4ee140ff71bae3 | [
"wx.ImageList.__init__(self, width, height)\nself._width = width\nself._height = height\nself._cache = {}\nreturn",
"index = self._cache.get(filename)\nif index is None:\n if isinstance(filename, ImageResource):\n image = filename.create_image(size=(self._width, self._height))\n elif isinstance(filen... | <|body_start_0|>
wx.ImageList.__init__(self, width, height)
self._width = width
self._height = height
self._cache = {}
return
<|end_body_0|>
<|body_start_1|>
index = self._cache.get(filename)
if index is None:
if isinstance(filename, ImageResource):
... | A cached image list. | ImageList | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageList:
"""A cached image list."""
def __init__(self, width, height):
"""Creates a new cached image list."""
<|body_0|>
def GetIndex(self, filename):
"""Returns the index of the specified image. The image will be loaded and added to the image list if it is not... | stack_v2_sparse_classes_36k_train_032207 | 3,573 | permissive | [
{
"docstring": "Creates a new cached image list.",
"name": "__init__",
"signature": "def __init__(self, width, height)"
},
{
"docstring": "Returns the index of the specified image. The image will be loaded and added to the image list if it is not already there.",
"name": "GetIndex",
"sig... | 3 | null | Implement the Python class `ImageList` described below.
Class description:
A cached image list.
Method signatures and docstrings:
- def __init__(self, width, height): Creates a new cached image list.
- def GetIndex(self, filename): Returns the index of the specified image. The image will be loaded and added to the im... | Implement the Python class `ImageList` described below.
Class description:
A cached image list.
Method signatures and docstrings:
- def __init__(self, width, height): Creates a new cached image list.
- def GetIndex(self, filename): Returns the index of the specified image. The image will be loaded and added to the im... | 5466f5858dbd2f1f082fa0d7417b57c8fb068fad | <|skeleton|>
class ImageList:
"""A cached image list."""
def __init__(self, width, height):
"""Creates a new cached image list."""
<|body_0|>
def GetIndex(self, filename):
"""Returns the index of the specified image. The image will be loaded and added to the image list if it is not... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageList:
"""A cached image list."""
def __init__(self, width, height):
"""Creates a new cached image list."""
wx.ImageList.__init__(self, width, height)
self._width = width
self._height = height
self._cache = {}
return
def GetIndex(self, filename):
... | the_stack_v2_python_sparse | maps/build/TraitsGUI/enthought/pyface/image_list.py | m-elhussieny/code | train | 0 |
03afe29e16b9302b0d6cc6f65ff195993467f874 | [
"n = len(nums)\ndp = [1] * n\nfor i in range(n):\n for j in range(i):\n if nums[i] > nums[j]:\n dp[i] = max(dp[i], dp[j] + 1)\n if dp[i] == 3:\n return True\nreturn False",
"smallest = second_smallest = float('inf')\nfor num in nums:\n if num < smallest:\n ... | <|body_start_0|>
n = len(nums)
dp = [1] * n
for i in range(n):
for j in range(i):
if nums[i] > nums[j]:
dp[i] = max(dp[i], dp[j] + 1)
if dp[i] == 3:
return True
return False
<|end_body_0|>
<|body... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n = len(nums)
dp = [1] ... | stack_v2_sparse_classes_36k_train_032208 | 873 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "increasingTriplet",
"signature": "def increasingTriplet(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "increasingTriplet",
"signature": "def increasingTriplet(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009042 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool
- def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool
- def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool
<|skeleton|>
class Solution:
d... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool"""
n = len(nums)
dp = [1] * n
for i in range(n):
for j in range(i):
if nums[i] > nums[j]:
dp[i] = max(dp[i], dp[j] + 1)
if dp[i... | the_stack_v2_python_sparse | 0334_Increasing_Triplet_Subsequence.py | bingli8802/leetcode | train | 0 | |
24a030728c3ac49922c49487ca7d086ce0a3c421 | [
"if len(nums) > 1:\n mid = len(nums) // 2\n left = nums[:mid]\n right = nums[mid:]\n self.sortColors(left)\n self.sortColors(right)\n i, j, k = (0, 0, 0)\n while i < len(left) and j < len(right):\n if left[i] < right[j]:\n nums[k] = left[i]\n i += 1\n else:\n... | <|body_start_0|>
if len(nums) > 1:
mid = len(nums) // 2
left = nums[:mid]
right = nums[mid:]
self.sortColors(left)
self.sortColors(right)
i, j, k = (0, 0, 0)
while i < len(left) and j < len(right):
if left[i] < r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sortColors(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead. Merge sort: O(nLogn), O(n)"""
<|body_0|>
def sort_colors_optimised(self, nums: List[int]) -> None:
"""Counting sort approach: O(n+k), O(k)"""
<|b... | stack_v2_sparse_classes_36k_train_032209 | 2,274 | no_license | [
{
"docstring": "Do not return anything, modify nums in-place instead. Merge sort: O(nLogn), O(n)",
"name": "sortColors",
"signature": "def sortColors(self, nums: List[int]) -> None"
},
{
"docstring": "Counting sort approach: O(n+k), O(k)",
"name": "sort_colors_optimised",
"signature": "d... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortColors(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. Merge sort: O(nLogn), O(n)
- def sort_colors_optimised(self, nums: List[int])... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortColors(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. Merge sort: O(nLogn), O(n)
- def sort_colors_optimised(self, nums: List[int])... | fbaae4bdbb2017ee43b0d1a3f23137a75f7ea2c1 | <|skeleton|>
class Solution:
def sortColors(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead. Merge sort: O(nLogn), O(n)"""
<|body_0|>
def sort_colors_optimised(self, nums: List[int]) -> None:
"""Counting sort approach: O(n+k), O(k)"""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def sortColors(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead. Merge sort: O(nLogn), O(n)"""
if len(nums) > 1:
mid = len(nums) // 2
left = nums[:mid]
right = nums[mid:]
self.sortColors(left)
... | the_stack_v2_python_sparse | sort_colors_merge_sort.py | Milan-Chicago/ds-guide | train | 0 | |
eee1594ddc69c04569015c0b58b1f8749e36bea6 | [
"self.name = name\nself.dispatch_map = dispatch_map\nsuper().__init__(*args, **kwargs)",
"body = message.body\ndata = Objectify(body.get('data', {}))\nevent = body.get('event_name', '')\nmessage_id = body.get('id', '')\ndata.sqs_message_id = message_id\ndispatch = Objectify(self.dispatch_map.get(event, {}))\nif n... | <|body_start_0|>
self.name = name
self.dispatch_map = dispatch_map
super().__init__(*args, **kwargs)
<|end_body_0|>
<|body_start_1|>
body = message.body
data = Objectify(body.get('data', {}))
event = body.get('event_name', '')
message_id = body.get('id', '')
... | Ms.laure queue worker. | Worker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Worker:
"""Ms.laure queue worker."""
def __init__(self, *args, name: str, dispatch_map: dict, **kwargs):
"""Added new parameter to the worker init class."""
<|body_0|>
def process_message(self, message: SQSMessage) -> bool:
"""Process a message retrieved from the... | stack_v2_sparse_classes_36k_train_032210 | 4,814 | no_license | [
{
"docstring": "Added new parameter to the worker init class.",
"name": "__init__",
"signature": "def __init__(self, *args, name: str, dispatch_map: dict, **kwargs)"
},
{
"docstring": "Process a message retrieved from the input_queue. :param message: A message from the queue :returns: Status fro... | 2 | stack_v2_sparse_classes_30k_val_000911 | Implement the Python class `Worker` described below.
Class description:
Ms.laure queue worker.
Method signatures and docstrings:
- def __init__(self, *args, name: str, dispatch_map: dict, **kwargs): Added new parameter to the worker init class.
- def process_message(self, message: SQSMessage) -> bool: Process a messa... | Implement the Python class `Worker` described below.
Class description:
Ms.laure queue worker.
Method signatures and docstrings:
- def __init__(self, *args, name: str, dispatch_map: dict, **kwargs): Added new parameter to the worker init class.
- def process_message(self, message: SQSMessage) -> bool: Process a messa... | 689d2b6a20c8e4348a040471673fc266eb7d0142 | <|skeleton|>
class Worker:
"""Ms.laure queue worker."""
def __init__(self, *args, name: str, dispatch_map: dict, **kwargs):
"""Added new parameter to the worker init class."""
<|body_0|>
def process_message(self, message: SQSMessage) -> bool:
"""Process a message retrieved from the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Worker:
"""Ms.laure queue worker."""
def __init__(self, *args, name: str, dispatch_map: dict, **kwargs):
"""Added new parameter to the worker init class."""
self.name = name
self.dispatch_map = dispatch_map
super().__init__(*args, **kwargs)
def process_message(self, m... | the_stack_v2_python_sparse | src/briefy/reflex/queue/worker.py | BriefyHQ/briefy.reflex | train | 0 |
6a91d8ba859f0144ea3d4939fc310432085c368c | [
"count = collections.Counter()\nres = 0\nfor row in grid:\n for x, x_value in enumerate(row):\n if x_value == 1:\n for y, y_value in enumerate(row[x + 1:]):\n if y_value == 1:\n res += count[x, y]\n count[x, y] += 1\nreturn res",
"if not gr... | <|body_start_0|>
count = collections.Counter()
res = 0
for row in grid:
for x, x_value in enumerate(row):
if x_value == 1:
for y, y_value in enumerate(row[x + 1:]):
if y_value == 1:
res += count[x... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countCornerRectangles_CountConers(self, grid):
""":type grid: List[List[int]] :rtype: int"""
<|body_0|>
def countCornerRectangles_BruteForce_TLE(self, grid):
""":type grid: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_36k_train_032211 | 2,598 | no_license | [
{
"docstring": ":type grid: List[List[int]] :rtype: int",
"name": "countCornerRectangles_CountConers",
"signature": "def countCornerRectangles_CountConers(self, grid)"
},
{
"docstring": ":type grid: List[List[int]] :rtype: int",
"name": "countCornerRectangles_BruteForce_TLE",
"signature"... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countCornerRectangles_CountConers(self, grid): :type grid: List[List[int]] :rtype: int
- def countCornerRectangles_BruteForce_TLE(self, grid): :type grid: List[List[int]] :rt... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countCornerRectangles_CountConers(self, grid): :type grid: List[List[int]] :rtype: int
- def countCornerRectangles_BruteForce_TLE(self, grid): :type grid: List[List[int]] :rt... | 1a3c1f4d6e9d3444039f087763b93241f4ba7892 | <|skeleton|>
class Solution:
def countCornerRectangles_CountConers(self, grid):
""":type grid: List[List[int]] :rtype: int"""
<|body_0|>
def countCornerRectangles_BruteForce_TLE(self, grid):
""":type grid: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def countCornerRectangles_CountConers(self, grid):
""":type grid: List[List[int]] :rtype: int"""
count = collections.Counter()
res = 0
for row in grid:
for x, x_value in enumerate(row):
if x_value == 1:
for y, y_value in... | the_stack_v2_python_sparse | Algorithm/750_Number_Of_Corner_Rectangle.py | Gi1ia/TechNoteBook | train | 7 | |
a3fc638441de3b46fec90921e3fd6224260e64c5 | [
"self.dic = {}\nself.count = {}\nself.reverse = defaultdict(lambda: OrderedDict())\nself.cap = capacity",
"if self.dic.get(key) is not None:\n prevCount = self.count[key]\n newCount = prevCount + 1\n self.count[key] = newCount\n del self.reverse[prevCount][key]\n if len(self.reverse[prevCount]) == ... | <|body_start_0|>
self.dic = {}
self.count = {}
self.reverse = defaultdict(lambda: OrderedDict())
self.cap = capacity
<|end_body_0|>
<|body_start_1|>
if self.dic.get(key) is not None:
prevCount = self.count[key]
newCount = prevCount + 1
self.co... | LFUCache | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def set(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k_train_032212 | 4,146 | permissive | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: void",
"name": "se... | 3 | null | Implement the Python class `LFUCache` described below.
Class description:
Implement the LFUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def set(self, key, value): :type key: int :type value: int :rtype: void | Implement the Python class `LFUCache` described below.
Class description:
Implement the LFUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def set(self, key, value): :type key: int :type value: int :rtype: void
<|sk... | ffe317f9a984319fbb3c1811e2a438306fc4eee9 | <|skeleton|>
class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def set(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.dic = {}
self.count = {}
self.reverse = defaultdict(lambda: OrderedDict())
self.cap = capacity
def get(self, key):
""":type key: int :rtype: int"""
if self.dic.get(key) is not No... | the_stack_v2_python_sparse | LeetCode/03_Hard/lc_460.py | zubie7a/Algorithms | train | 10 | |
6991f56dd3447ec6a6d384647d3d7b1c7592fa03 | [
"if target == 0 and path not in result:\n result.append(path)\n return\nif target < 0 or index >= len(candidates):\n return\nfor idx in range(index, len(candidates)):\n if idx > index + 1 and candidates[idx] == candidates[idx - 1]:\n continue\n self.back_track(candidates, idx + 1, target - can... | <|body_start_0|>
if target == 0 and path not in result:
result.append(path)
return
if target < 0 or index >= len(candidates):
return
for idx in range(index, len(candidates)):
if idx > index + 1 and candidates[idx] == candidates[idx - 1]:
... | Array | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Array:
def back_track(self, candidates: List[int], index: int, target: int, path: List[int], result: List[List[int]]):
"""Back tracking function :param candidates: :param index: :param target: :param path: :param result: :return:"""
<|body_0|>
def combination_sum(self, candi... | stack_v2_sparse_classes_36k_train_032213 | 1,394 | no_license | [
{
"docstring": "Back tracking function :param candidates: :param index: :param target: :param path: :param result: :return:",
"name": "back_track",
"signature": "def back_track(self, candidates: List[int], index: int, target: int, path: List[int], result: List[List[int]])"
},
{
"docstring": "App... | 2 | null | Implement the Python class `Array` described below.
Class description:
Implement the Array class.
Method signatures and docstrings:
- def back_track(self, candidates: List[int], index: int, target: int, path: List[int], result: List[List[int]]): Back tracking function :param candidates: :param index: :param target: :... | Implement the Python class `Array` described below.
Class description:
Implement the Array class.
Method signatures and docstrings:
- def back_track(self, candidates: List[int], index: int, target: int, path: List[int], result: List[List[int]]): Back tracking function :param candidates: :param index: :param target: :... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Array:
def back_track(self, candidates: List[int], index: int, target: int, path: List[int], result: List[List[int]]):
"""Back tracking function :param candidates: :param index: :param target: :param path: :param result: :return:"""
<|body_0|>
def combination_sum(self, candi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Array:
def back_track(self, candidates: List[int], index: int, target: int, path: List[int], result: List[List[int]]):
"""Back tracking function :param candidates: :param index: :param target: :param path: :param result: :return:"""
if target == 0 and path not in result:
result.app... | the_stack_v2_python_sparse | revisited_2021/math_and_string/back_tracking/combination_sum_ii.py | Shiv2157k/leet_code | train | 1 | |
338f5a5c2fa153fb0f4ad251a5cb18aa0e79beba | [
"self.queue = {}\nif iterable is not None:\n for data, priority in iterable:\n self.insert(data, priority)",
"if priority in self.queue:\n self.queue[priority].insert(0, data)\nelse:\n self.queue[priority] = [data]",
"for priority in sorted(self.queue):\n if len(self.queue[priority]) > 0:\n ... | <|body_start_0|>
self.queue = {}
if iterable is not None:
for data, priority in iterable:
self.insert(data, priority)
<|end_body_0|>
<|body_start_1|>
if priority in self.queue:
self.queue[priority].insert(0, data)
else:
self.queue[prio... | Create Priority queue. | PriorityQueue | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PriorityQueue:
"""Create Priority queue."""
def __init__(self, iterable=None):
"""Initialize the Priority queue."""
<|body_0|>
def insert(self, data, priority=0):
"""Insert values into the priority queue."""
<|body_1|>
def pop(self):
"""Pop t... | stack_v2_sparse_classes_36k_train_032214 | 1,074 | permissive | [
{
"docstring": "Initialize the Priority queue.",
"name": "__init__",
"signature": "def __init__(self, iterable=None)"
},
{
"docstring": "Insert values into the priority queue.",
"name": "insert",
"signature": "def insert(self, data, priority=0)"
},
{
"docstring": "Pop the top ite... | 4 | stack_v2_sparse_classes_30k_train_000711 | Implement the Python class `PriorityQueue` described below.
Class description:
Create Priority queue.
Method signatures and docstrings:
- def __init__(self, iterable=None): Initialize the Priority queue.
- def insert(self, data, priority=0): Insert values into the priority queue.
- def pop(self): Pop the top item off... | Implement the Python class `PriorityQueue` described below.
Class description:
Create Priority queue.
Method signatures and docstrings:
- def __init__(self, iterable=None): Initialize the Priority queue.
- def insert(self, data, priority=0): Insert values into the priority queue.
- def pop(self): Pop the top item off... | b9b07656a2ca6fa8cda7d44be9112bb7c2782fb0 | <|skeleton|>
class PriorityQueue:
"""Create Priority queue."""
def __init__(self, iterable=None):
"""Initialize the Priority queue."""
<|body_0|>
def insert(self, data, priority=0):
"""Insert values into the priority queue."""
<|body_1|>
def pop(self):
"""Pop t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PriorityQueue:
"""Create Priority queue."""
def __init__(self, iterable=None):
"""Initialize the Priority queue."""
self.queue = {}
if iterable is not None:
for data, priority in iterable:
self.insert(data, priority)
def insert(self, data, priority... | the_stack_v2_python_sparse | src/priority_queue.py | Casey0Kane/data-structures | train | 1 |
113ef7c4a65b4863a4008206c59d9f687b864121 | [
"base_url = request.build_absolute_uri()\nseq_centers = '{0}10/sequencing_centers/'.format(base_url)\nseq_types = '{0}10/sequence_types/'.format(base_url)\nurls = {'Top 10 Sequencing Centers': seq_centers, 'Top 10 Sequence Types': seq_types}\nreturn Response(urls)",
"total = pk\nsql = 'SELECT sequencing_center, c... | <|body_start_0|>
base_url = request.build_absolute_uri()
seq_centers = '{0}10/sequencing_centers/'.format(base_url)
seq_types = '{0}10/sequence_types/'.format(base_url)
urls = {'Top 10 Sequencing Centers': seq_centers, 'Top 10 Sequence Types': seq_types}
return Response(urls)
<|e... | View top X sequencing centers and sequence types. To see more (or less) than 10 change the number between top/XXX/sequencing_center/. For example to see top 20 sequence types use top/20/sequence_types/ | TopViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TopViewSet:
"""View top X sequencing centers and sequence types. To see more (or less) than 10 change the number between top/XXX/sequencing_center/. For example to see top 20 sequence types use top/20/sequence_types/"""
def list(self, request):
"""Stored metadata information for a gi... | stack_v2_sparse_classes_36k_train_032215 | 2,398 | no_license | [
{
"docstring": "Stored metadata information for a given sample.",
"name": "list",
"signature": "def list(self, request)"
},
{
"docstring": "Stored metadata information for a given sample.",
"name": "sequencing_centers",
"signature": "def sequencing_centers(self, request, pk=10)"
},
{... | 3 | null | Implement the Python class `TopViewSet` described below.
Class description:
View top X sequencing centers and sequence types. To see more (or less) than 10 change the number between top/XXX/sequencing_center/. For example to see top 20 sequence types use top/20/sequence_types/
Method signatures and docstrings:
- def ... | Implement the Python class `TopViewSet` described below.
Class description:
View top X sequencing centers and sequence types. To see more (or less) than 10 change the number between top/XXX/sequencing_center/. For example to see top 20 sequence types use top/20/sequence_types/
Method signatures and docstrings:
- def ... | 2c35ee47e131a74642e60fae6f1cc23561d8b1a6 | <|skeleton|>
class TopViewSet:
"""View top X sequencing centers and sequence types. To see more (or less) than 10 change the number between top/XXX/sequencing_center/. For example to see top 20 sequence types use top/20/sequence_types/"""
def list(self, request):
"""Stored metadata information for a gi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TopViewSet:
"""View top X sequencing centers and sequence types. To see more (or less) than 10 change the number between top/XXX/sequencing_center/. For example to see top 20 sequence types use top/20/sequence_types/"""
def list(self, request):
"""Stored metadata information for a given sample.""... | the_stack_v2_python_sparse | api/viewsets/top.py | staphopia/staphopia-web | train | 5 |
d797ff1daba5b5ece7911e74d2dbf6824bfd7303 | [
"def recur(i, j):\n if i >= j:\n return True\n p = i\n while postorder[p] < postorder[j]:\n p += 1\n m = p\n while postorder[p] > postorder[j]:\n p += 1\n return p == j and recur(i, m - 1) and recur(m, j - 1)\nreturn recur(0, len(postorder) - 1)",
"stack, root = ([], float('... | <|body_start_0|>
def recur(i, j):
if i >= j:
return True
p = i
while postorder[p] < postorder[j]:
p += 1
m = p
while postorder[p] > postorder[j]:
p += 1
return p == j and recur(i, m - 1) and r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def verifyPostorder_1(self, postorder: [int]) -> bool:
"""递归分治 时间复杂度 O(N^2): 每次调用 recur(i,j) 减去一个根节点,因此递归占用 O(N) ; 最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N) 。 空间复杂度 O(N) : 最差情况下(即当树退化为链表),递归深度将达到 N 。 :param postorder: :return:"""
<|body_0|>
def verifyPostorder_2(self, ... | stack_v2_sparse_classes_36k_train_032216 | 2,159 | no_license | [
{
"docstring": "递归分治 时间复杂度 O(N^2): 每次调用 recur(i,j) 减去一个根节点,因此递归占用 O(N) ; 最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N) 。 空间复杂度 O(N) : 最差情况下(即当树退化为链表),递归深度将达到 N 。 :param postorder: :return:",
"name": "verifyPostorder_1",
"signature": "def verifyPostorder_1(self, postorder: [int]) -> bool"
},
{
"docstring... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def verifyPostorder_1(self, postorder: [int]) -> bool: 递归分治 时间复杂度 O(N^2): 每次调用 recur(i,j) 减去一个根节点,因此递归占用 O(N) ; 最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N) 。 空间复杂度 O(N) : 最差情况下(即当树退化为链... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def verifyPostorder_1(self, postorder: [int]) -> bool: 递归分治 时间复杂度 O(N^2): 每次调用 recur(i,j) 减去一个根节点,因此递归占用 O(N) ; 最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N) 。 空间复杂度 O(N) : 最差情况下(即当树退化为链... | 62419b49000e79962bcdc99cd98afd2fb82ea345 | <|skeleton|>
class Solution:
def verifyPostorder_1(self, postorder: [int]) -> bool:
"""递归分治 时间复杂度 O(N^2): 每次调用 recur(i,j) 减去一个根节点,因此递归占用 O(N) ; 最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N) 。 空间复杂度 O(N) : 最差情况下(即当树退化为链表),递归深度将达到 N 。 :param postorder: :return:"""
<|body_0|>
def verifyPostorder_2(self, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def verifyPostorder_1(self, postorder: [int]) -> bool:
"""递归分治 时间复杂度 O(N^2): 每次调用 recur(i,j) 减去一个根节点,因此递归占用 O(N) ; 最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N) 。 空间复杂度 O(N) : 最差情况下(即当树退化为链表),递归深度将达到 N 。 :param postorder: :return:"""
def recur(i, j):
if i >= j:
re... | the_stack_v2_python_sparse | 剑指 Offer(第 2 版)/verifyPostorder.py | MaoningGuan/LeetCode | train | 3 | |
f92a88048a86e2361562e7306f88b32e983ab158 | [
"if nums == []:\n return False\ntemp_count_0 = nums[-1]\ntemp_count_1 = min(nums)\nfor i in nums[:-1][::-1]:\n if i < temp_count_0:\n temp_count_1 = max(temp_count_1, i)\n if i > temp_count_0:\n temp_count_0 = i\n if i < temp_count_1:\n return True\nreturn False",
"import sys\nif ... | <|body_start_0|>
if nums == []:
return False
temp_count_0 = nums[-1]
temp_count_1 = min(nums)
for i in nums[:-1][::-1]:
if i < temp_count_0:
temp_count_1 = max(temp_count_1, i)
if i > temp_count_0:
temp_count_0 = i
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool 42ms"""
<|body_0|>
def increasingTriplet_1(self, nums):
""":type nums: List[int] :rtype: bool 35ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if nums == []:
... | stack_v2_sparse_classes_36k_train_032217 | 1,462 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool 42ms",
"name": "increasingTriplet",
"signature": "def increasingTriplet(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool 35ms",
"name": "increasingTriplet_1",
"signature": "def increasingTriplet_1(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007039 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool 42ms
- def increasingTriplet_1(self, nums): :type nums: List[int] :rtype: bool 35ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool 42ms
- def increasingTriplet_1(self, nums): :type nums: List[int] :rtype: bool 35ms
<|skeleton|>
class Solu... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool 42ms"""
<|body_0|>
def increasingTriplet_1(self, nums):
""":type nums: List[int] :rtype: bool 35ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool 42ms"""
if nums == []:
return False
temp_count_0 = nums[-1]
temp_count_1 = min(nums)
for i in nums[:-1][::-1]:
if i < temp_count_0:
temp_count_1 = ... | the_stack_v2_python_sparse | IncreasingTripletSubsequence_MID_334.py | 953250587/leetcode-python | train | 2 | |
ed16878258e796c9a04a67c1cde331177824e0e8 | [
"self.sender = Sender\nself.receiver = Receiver\nself.name = 'Referential Game'\nsuper().__init__([Sender, Receiver], **kwargs)",
"images = inputs\ntarget_indices = np.random.randint(self.D + 1, size=self.batch_size)\ntarget_images = np.zeros((Agent.batch_size, 2048))\nfor i, ti in enumerate(target_indices):\n ... | <|body_start_0|>
self.sender = Sender
self.receiver = Receiver
self.name = 'Referential Game'
super().__init__([Sender, Receiver], **kwargs)
<|end_body_0|>
<|body_start_1|>
images = inputs
target_indices = np.random.randint(self.D + 1, size=self.batch_size)
targe... | Class to play referential game, where a sender sees a target image and must send a message to a receiver, who must the pick the target image from a set of candidate images. Attributes: Sender [Agent] Receiver [Agent] Vocabulary Size [Int] Distractor Set Size [Int] | ReferentialGame | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReferentialGame:
"""Class to play referential game, where a sender sees a target image and must send a message to a receiver, who must the pick the target image from a set of candidate images. Attributes: Sender [Agent] Receiver [Agent] Vocabulary Size [Int] Distractor Set Size [Int]"""
def ... | stack_v2_sparse_classes_36k_train_032218 | 1,705 | no_license | [
{
"docstring": ":param K [Int]: Vocabulary Size :param D [Int]: Distractor Set Size :param use_images[Bool]: Whether to use images or one hot encoding (for debugging)",
"name": "__init__",
"signature": "def __init__(self, Sender, Receiver, **kwargs)"
},
{
"docstring": "Play a single instance of ... | 2 | stack_v2_sparse_classes_30k_train_007270 | Implement the Python class `ReferentialGame` described below.
Class description:
Class to play referential game, where a sender sees a target image and must send a message to a receiver, who must the pick the target image from a set of candidate images. Attributes: Sender [Agent] Receiver [Agent] Vocabulary Size [Int]... | Implement the Python class `ReferentialGame` described below.
Class description:
Class to play referential game, where a sender sees a target image and must send a message to a receiver, who must the pick the target image from a set of candidate images. Attributes: Sender [Agent] Receiver [Agent] Vocabulary Size [Int]... | af8c2d0f5525871d0820c5c83a49587e24663ba7 | <|skeleton|>
class ReferentialGame:
"""Class to play referential game, where a sender sees a target image and must send a message to a receiver, who must the pick the target image from a set of candidate images. Attributes: Sender [Agent] Receiver [Agent] Vocabulary Size [Int] Distractor Set Size [Int]"""
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReferentialGame:
"""Class to play referential game, where a sender sees a target image and must send a message to a receiver, who must the pick the target image from a set of candidate images. Attributes: Sender [Agent] Receiver [Agent] Vocabulary Size [Int] Distractor Set Size [Int]"""
def __init__(self... | the_stack_v2_python_sparse | Tasks/referential_game.py | StephAO/EmergentMAML | train | 0 |
a37e44c6984640b7d099f41866bd8e20acd0c18b | [
"dt = _get_client(self)\nfor record in self:\n if not record.dingtalk_id:\n pass\n department = dt.get_department_detail(record.dingtalk_id)\n _logger.info(department)\n record.dingtalk_order = department['order']\n record.dingtalk_dept_hiding = department['deptHiding']\n record.dingtalk_au... | <|body_start_0|>
dt = _get_client(self)
for record in self:
if not record.dingtalk_id:
pass
department = dt.get_department_detail(record.dingtalk_id)
_logger.info(department)
record.dingtalk_order = department['order']
record.di... | DingTalkDepartment | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DingTalkDepartment:
def dingtalk_get_department_detail(self):
"""获取部门详情"""
<|body_0|>
def dingtalk_update_department(self):
"""创建或者更新部门"""
<|body_1|>
def dingtalk_get_dept_user_list(self):
"""获取部门成员详情, GET"""
<|body_2|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_032219 | 4,197 | no_license | [
{
"docstring": "获取部门详情",
"name": "dingtalk_get_department_detail",
"signature": "def dingtalk_get_department_detail(self)"
},
{
"docstring": "创建或者更新部门",
"name": "dingtalk_update_department",
"signature": "def dingtalk_update_department(self)"
},
{
"docstring": "获取部门成员详情, GET",
... | 3 | stack_v2_sparse_classes_30k_train_009841 | Implement the Python class `DingTalkDepartment` described below.
Class description:
Implement the DingTalkDepartment class.
Method signatures and docstrings:
- def dingtalk_get_department_detail(self): 获取部门详情
- def dingtalk_update_department(self): 创建或者更新部门
- def dingtalk_get_dept_user_list(self): 获取部门成员详情, GET | Implement the Python class `DingTalkDepartment` described below.
Class description:
Implement the DingTalkDepartment class.
Method signatures and docstrings:
- def dingtalk_get_department_detail(self): 获取部门详情
- def dingtalk_update_department(self): 创建或者更新部门
- def dingtalk_get_dept_user_list(self): 获取部门成员详情, GET
<|sk... | d1ff9e06fb37f8f4181714dd1aa5ffb6e97f5c79 | <|skeleton|>
class DingTalkDepartment:
def dingtalk_get_department_detail(self):
"""获取部门详情"""
<|body_0|>
def dingtalk_update_department(self):
"""创建或者更新部门"""
<|body_1|>
def dingtalk_get_dept_user_list(self):
"""获取部门成员详情, GET"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DingTalkDepartment:
def dingtalk_get_department_detail(self):
"""获取部门详情"""
dt = _get_client(self)
for record in self:
if not record.dingtalk_id:
pass
department = dt.get_department_detail(record.dingtalk_id)
_logger.info(department)
... | the_stack_v2_python_sparse | wework/models/dingtalk.py | wuhuizhong/odoo-app | train | 0 | |
0d39983a848ca2efe037c94f13df7e4b91b6410e | [
"for i in range(len(numbers)):\n for j in range(i + 1, len(numbers)):\n if numbers[i] + numbers[j] == target:\n return [i + 1, j + 1]",
"visited = {}\nfor index, number in enumerate(numbers):\n if target - number in visited:\n return [visited[target - number], index + 1]\n else:\... | <|body_start_0|>
for i in range(len(numbers)):
for j in range(i + 1, len(numbers)):
if numbers[i] + numbers[j] == target:
return [i + 1, j + 1]
<|end_body_0|>
<|body_start_1|>
visited = {}
for index, number in enumerate(numbers):
if ta... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum1(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum2(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
def twoSum3(self... | stack_v2_sparse_classes_36k_train_032220 | 1,307 | no_license | [
{
"docstring": ":type numbers: List[int] :type target: int :rtype: List[int]",
"name": "twoSum1",
"signature": "def twoSum1(self, numbers, target)"
},
{
"docstring": ":type numbers: List[int] :type target: int :rtype: List[int]",
"name": "twoSum2",
"signature": "def twoSum2(self, numbers... | 3 | stack_v2_sparse_classes_30k_train_000215 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum1(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int]
- def twoSum2(self, numbers, target): :type numbers: List[int] :type target: int ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum1(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int]
- def twoSum2(self, numbers, target): :type numbers: List[int] :type target: int ... | 8dfbb10a87d8a3fdde466ab16fff8b67503e41f4 | <|skeleton|>
class Solution:
def twoSum1(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum2(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
def twoSum3(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum1(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
for i in range(len(numbers)):
for j in range(i + 1, len(numbers)):
if numbers[i] + numbers[j] == target:
return [i + 1, j + 1]
d... | the_stack_v2_python_sparse | easy/0167.two-sum-ii-input-array-is-sorted.py | codershenghai/PyLeetcode | train | 0 | |
7c5fba4d5f408837e92b0dd3e2814470dbc632fa | [
"self._order = dataset.property.order\nself._model = model\nself._comm = comm.mpi_comm\nself._properties = []\nself._coefficients = []\nself._units = []\nself._inputs = []\nself._labels = []\nself._predictions = []\nself._init_labels(dataset)",
"with chainer.using_config('train', False), chainer.using_config('ena... | <|body_start_0|>
self._order = dataset.property.order
self._model = model
self._comm = comm.mpi_comm
self._properties = []
self._coefficients = []
self._units = []
self._inputs = []
self._labels = []
self._predictions = []
self._init_labels... | Trainer extension to output predictions/labels scatter plots. | ScatterPlot | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScatterPlot:
"""Trainer extension to output predictions/labels scatter plots."""
def __init__(self, dataset, model, comm):
"""Args: dataset (HDNNPDataset): Test dataset to plot a scatter plot. It has to have both input dataset and label dataset. model (HighDimensionalNNP): HDNNP mode... | stack_v2_sparse_classes_36k_train_032221 | 4,279 | permissive | [
{
"docstring": "Args: dataset (HDNNPDataset): Test dataset to plot a scatter plot. It has to have both input dataset and label dataset. model (HighDimensionalNNP): HDNNP model to evaluate. comm (~chainermn.CommunicatorBase): ChainerMN communicator instance.",
"name": "__init__",
"signature": "def __init... | 4 | stack_v2_sparse_classes_30k_train_009890 | Implement the Python class `ScatterPlot` described below.
Class description:
Trainer extension to output predictions/labels scatter plots.
Method signatures and docstrings:
- def __init__(self, dataset, model, comm): Args: dataset (HDNNPDataset): Test dataset to plot a scatter plot. It has to have both input dataset ... | Implement the Python class `ScatterPlot` described below.
Class description:
Trainer extension to output predictions/labels scatter plots.
Method signatures and docstrings:
- def __init__(self, dataset, model, comm): Args: dataset (HDNNPDataset): Test dataset to plot a scatter plot. It has to have both input dataset ... | 394544bf8e89534fa535ebfbc7fc8ecab870f17e | <|skeleton|>
class ScatterPlot:
"""Trainer extension to output predictions/labels scatter plots."""
def __init__(self, dataset, model, comm):
"""Args: dataset (HDNNPDataset): Test dataset to plot a scatter plot. It has to have both input dataset and label dataset. model (HighDimensionalNNP): HDNNP mode... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ScatterPlot:
"""Trainer extension to output predictions/labels scatter plots."""
def __init__(self, dataset, model, comm):
"""Args: dataset (HDNNPDataset): Test dataset to plot a scatter plot. It has to have both input dataset and label dataset. model (HighDimensionalNNP): HDNNP model to evaluate... | the_stack_v2_python_sparse | hdnnpy/training/extensions.py | eminamitani/hdnnpy-update | train | 1 |
a01b187426a4943e961f3ee5147b9f65bdcd16a2 | [
"true_candidate_embeddings = tf.expand_dims(true_candidate_embeddings, axis=1)\npositive_scores = tf.reduce_sum(query_embeddings * true_candidate_embeddings, axis=2, keepdims=True)\npositive_scores = tf.reduce_max(positive_scores, axis=1)\ntop_k_predictions, _ = self._candidates(query_embeddings, k=self._k)\ny_true... | <|body_start_0|>
true_candidate_embeddings = tf.expand_dims(true_candidate_embeddings, axis=1)
positive_scores = tf.reduce_sum(query_embeddings * true_candidate_embeddings, axis=2, keepdims=True)
positive_scores = tf.reduce_max(positive_scores, axis=1)
top_k_predictions, _ = self._candid... | Computes metrics for multi user representations across top K candidates. We reuse the functionality from base class, while only modifying the update_state function to support multiple representations. See base class for details. | MultiQueryFactorizedTopK | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiQueryFactorizedTopK:
"""Computes metrics for multi user representations across top K candidates. We reuse the functionality from base class, while only modifying the update_state function to support multiple representations. See base class for details."""
def update_state(self, query_em... | stack_v2_sparse_classes_36k_train_032222 | 10,488 | permissive | [
{
"docstring": "Updates the state of the FactorizedTopK Metric. See the base class method `update_state` for details. This method extends the functionality to multiple user representation case, i.e. when query_embeddings is of shape [B, H, D]. Args: query_embeddings: The query embeddings used to retrieve candid... | 2 | null | Implement the Python class `MultiQueryFactorizedTopK` described below.
Class description:
Computes metrics for multi user representations across top K candidates. We reuse the functionality from base class, while only modifying the update_state function to support multiple representations. See base class for details.
... | Implement the Python class `MultiQueryFactorizedTopK` described below.
Class description:
Computes metrics for multi user representations across top K candidates. We reuse the functionality from base class, while only modifying the update_state function to support multiple representations. See base class for details.
... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class MultiQueryFactorizedTopK:
"""Computes metrics for multi user representations across top K candidates. We reuse the functionality from base class, while only modifying the update_state function to support multiple representations. See base class for details."""
def update_state(self, query_em... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiQueryFactorizedTopK:
"""Computes metrics for multi user representations across top K candidates. We reuse the functionality from base class, while only modifying the update_state function to support multiple representations. See base class for details."""
def update_state(self, query_embeddings, tru... | the_stack_v2_python_sparse | multiple_user_representations/models/task.py | Jimmy-INL/google-research | train | 1 |
4fb097419740566f4a32e5f3a1d862b02058fde9 | [
"self.INCREMENTAL_GROUP = 'incremental_tables'\nself.TRUNCATE_GROUP = 'truncate_tables'\nself.INCREMENTAL_COLUMN_TYPES = ['timestamp', 'date', 'datetime']",
"tables_data = {}\nlogger = injector.get('logger')\nfor table in tables_information['tables']:\n logger.debug('Generating configuration for table {table}'... | <|body_start_0|>
self.INCREMENTAL_GROUP = 'incremental_tables'
self.TRUNCATE_GROUP = 'truncate_tables'
self.INCREMENTAL_COLUMN_TYPES = ['timestamp', 'date', 'datetime']
<|end_body_0|>
<|body_start_1|>
tables_data = {}
logger = injector.get('logger')
for table in tables_i... | Generate the tables configuration | TablesConfiguration | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TablesConfiguration:
"""Generate the tables configuration"""
def __init__(self):
"""Initialize the class"""
<|body_0|>
def generate_configuration(self, tables_information, injector):
"""Generate the basic configuration given all the tables information :param tabl... | stack_v2_sparse_classes_36k_train_032223 | 1,621 | permissive | [
{
"docstring": "Initialize the class",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Generate the basic configuration given all the tables information :param tables_information: dict :param injector: Injector :return: dict",
"name": "generate_configuration",
"s... | 2 | stack_v2_sparse_classes_30k_train_004426 | Implement the Python class `TablesConfiguration` described below.
Class description:
Generate the tables configuration
Method signatures and docstrings:
- def __init__(self): Initialize the class
- def generate_configuration(self, tables_information, injector): Generate the basic configuration given all the tables in... | Implement the Python class `TablesConfiguration` described below.
Class description:
Generate the tables configuration
Method signatures and docstrings:
- def __init__(self): Initialize the class
- def generate_configuration(self, tables_information, injector): Generate the basic configuration given all the tables in... | d0e52277daff523eda63f5d3137b5a990413923d | <|skeleton|>
class TablesConfiguration:
"""Generate the tables configuration"""
def __init__(self):
"""Initialize the class"""
<|body_0|>
def generate_configuration(self, tables_information, injector):
"""Generate the basic configuration given all the tables information :param tabl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TablesConfiguration:
"""Generate the tables configuration"""
def __init__(self):
"""Initialize the class"""
self.INCREMENTAL_GROUP = 'incremental_tables'
self.TRUNCATE_GROUP = 'truncate_tables'
self.INCREMENTAL_COLUMN_TYPES = ['timestamp', 'date', 'datetime']
def gene... | the_stack_v2_python_sparse | src/slippinj/cli/scripts/tables_configuration/tables_configuration.py | cupid4/slippin-jimmy | train | 0 |
e4ff882ac432ed2ee43f9e7487b700100fccbea4 | [
"super(MorphGeodesicActiveContour, self).__init__(paramlist)\nif not paramlist:\n self.params['algorithm'] = 'MorphGeodesicActiveContour'\n self.params['alpha1'] = 1\n self.params['alpha2'] = 1\n self.params['beta1'] = 0.2\n self.params['beta2'] = 0.3\n self.params['beta2'] = 1\n self.params['m... | <|body_start_0|>
super(MorphGeodesicActiveContour, self).__init__(paramlist)
if not paramlist:
self.params['algorithm'] = 'MorphGeodesicActiveContour'
self.params['alpha1'] = 1
self.params['alpha2'] = 1
self.params['beta1'] = 0.2
self.params['b... | Peform Morphological Geodesic Active Contour segmentation algorithm. Uses an image from inverse_gaussian_gradient in order to segment object with visible, but noisy/broken borders. inverse_gaussian_gradient computes the magnitude of the gradients in an image. Returns a preprocessed image suitable for above function. Re... | MorphGeodesicActiveContour | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MorphGeodesicActiveContour:
"""Peform Morphological Geodesic Active Contour segmentation algorithm. Uses an image from inverse_gaussian_gradient in order to segment object with visible, but noisy/broken borders. inverse_gaussian_gradient computes the magnitude of the gradients in an image. Return... | stack_v2_sparse_classes_36k_train_032224 | 29,598 | permissive | [
{
"docstring": "Get parameters from parameter list that are used in segmentation algorithm. Assign default values to these parameters.",
"name": "__init__",
"signature": "def __init__(self, paramlist=None)"
},
{
"docstring": "Evaluate segmentation algorithm on training image. Keyword arguments: ... | 2 | stack_v2_sparse_classes_30k_train_016961 | Implement the Python class `MorphGeodesicActiveContour` described below.
Class description:
Peform Morphological Geodesic Active Contour segmentation algorithm. Uses an image from inverse_gaussian_gradient in order to segment object with visible, but noisy/broken borders. inverse_gaussian_gradient computes the magnitu... | Implement the Python class `MorphGeodesicActiveContour` described below.
Class description:
Peform Morphological Geodesic Active Contour segmentation algorithm. Uses an image from inverse_gaussian_gradient in order to segment object with visible, but noisy/broken borders. inverse_gaussian_gradient computes the magnitu... | 9246b8b20510d4c89357a6764ed96b919eb92d5a | <|skeleton|>
class MorphGeodesicActiveContour:
"""Peform Morphological Geodesic Active Contour segmentation algorithm. Uses an image from inverse_gaussian_gradient in order to segment object with visible, but noisy/broken borders. inverse_gaussian_gradient computes the magnitude of the gradients in an image. Return... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MorphGeodesicActiveContour:
"""Peform Morphological Geodesic Active Contour segmentation algorithm. Uses an image from inverse_gaussian_gradient in order to segment object with visible, but noisy/broken borders. inverse_gaussian_gradient computes the magnitude of the gradients in an image. Returns a preproces... | the_stack_v2_python_sparse | see/Segmentors.py | Deepak768/see-segment | train | 0 |
ecfbb7619ad69652fba8c29608cadcb7db8389c8 | [
"super().__init__()\nself.resize_input = resize_input\nself.normalize_input = normalize_input\ninception = fid_inception_v3()\nself.features = nn.Sequential(inception.Conv2d_1a_3x3, inception.Conv2d_2a_3x3, inception.Conv2d_2b_3x3, nn.MaxPool2d(kernel_size=3, stride=2), inception.Conv2d_3b_1x1, inception.Conv2d_4a_... | <|body_start_0|>
super().__init__()
self.resize_input = resize_input
self.normalize_input = normalize_input
inception = fid_inception_v3()
self.features = nn.Sequential(inception.Conv2d_1a_3x3, inception.Conv2d_2a_3x3, inception.Conv2d_2b_3x3, nn.MaxPool2d(kernel_size=3, stride=2... | Pretrained InceptionV3 network returning feature maps | FIDInceptionV3 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FIDInceptionV3:
"""Pretrained InceptionV3 network returning feature maps"""
def __init__(self, resize_input=True, normalize_input=True, requires_grad=False):
"""Build pretrained InceptionV3 Parameters ---------- resize_input : bool If true, bilinearly resizes input to width and heigh... | stack_v2_sparse_classes_36k_train_032225 | 10,118 | permissive | [
{
"docstring": "Build pretrained InceptionV3 Parameters ---------- resize_input : bool If true, bilinearly resizes input to width and height 299 before feeding input to model. As the network without fully connected layers is fully convolutional, it should be able to handle inputs of arbitrary size, so resizing ... | 2 | stack_v2_sparse_classes_30k_train_000534 | Implement the Python class `FIDInceptionV3` described below.
Class description:
Pretrained InceptionV3 network returning feature maps
Method signatures and docstrings:
- def __init__(self, resize_input=True, normalize_input=True, requires_grad=False): Build pretrained InceptionV3 Parameters ---------- resize_input : ... | Implement the Python class `FIDInceptionV3` described below.
Class description:
Pretrained InceptionV3 network returning feature maps
Method signatures and docstrings:
- def __init__(self, resize_input=True, normalize_input=True, requires_grad=False): Build pretrained InceptionV3 Parameters ---------- resize_input : ... | f19abcbedd844a700b2e2596dd817ea80cbb6287 | <|skeleton|>
class FIDInceptionV3:
"""Pretrained InceptionV3 network returning feature maps"""
def __init__(self, resize_input=True, normalize_input=True, requires_grad=False):
"""Build pretrained InceptionV3 Parameters ---------- resize_input : bool If true, bilinearly resizes input to width and heigh... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FIDInceptionV3:
"""Pretrained InceptionV3 network returning feature maps"""
def __init__(self, resize_input=True, normalize_input=True, requires_grad=False):
"""Build pretrained InceptionV3 Parameters ---------- resize_input : bool If true, bilinearly resizes input to width and height 299 before ... | the_stack_v2_python_sparse | horch/legacy/gan/inception.py | sbl1996/pytorch-hrvvi-ext | train | 18 |
09819c575296574bf10ed2136dbc6862aa5f99c6 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SynchronizationJobRestartCriteria()",
"from .synchronization_job_restart_scope import SynchronizationJobRestartScope\nfrom .synchronization_job_restart_scope import SynchronizationJobRestartScope\nfields: Dict[str, Callable[[Any], None... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return SynchronizationJobRestartCriteria()
<|end_body_0|>
<|body_start_1|>
from .synchronization_job_restart_scope import SynchronizationJobRestartScope
from .synchronization_job_restart_scope ... | SynchronizationJobRestartCriteria | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SynchronizationJobRestartCriteria:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discrimin... | stack_v2_sparse_classes_36k_train_032226 | 3,964 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: SynchronizationJobRestartCriteria",
"name": "create_from_discriminator_value",
"signature": "def create_from... | 3 | stack_v2_sparse_classes_30k_train_019521 | Implement the Python class `SynchronizationJobRestartCriteria` described below.
Class description:
Implement the SynchronizationJobRestartCriteria class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria: Creates a new in... | Implement the Python class `SynchronizationJobRestartCriteria` described below.
Class description:
Implement the SynchronizationJobRestartCriteria class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria: Creates a new in... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class SynchronizationJobRestartCriteria:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discrimin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SynchronizationJobRestartCriteria:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and... | the_stack_v2_python_sparse | msgraph/generated/models/synchronization_job_restart_criteria.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
b72cbb9741dbec450a5dc05f625bfb90f12eb18a | [
"try:\n payload = {'loginName': 'zhangyang1', 'loginPwd': 'zj03030418'}\n logger_message.loginfo(u'%s\\t入参%s\\t' % (send_time, payload))\n login_etbc = requests.post('http://etbc-qa.eslink.net.cn/user/login', data=payload)\n self.assertEqual(200, login_etbc.status_code, msg='失败原因:200 != %s' % login_etbc... | <|body_start_0|>
try:
payload = {'loginName': 'zhangyang1', 'loginPwd': 'zj03030418'}
logger_message.loginfo(u'%s\t入参%s\t' % (send_time, payload))
login_etbc = requests.post('http://etbc-qa.eslink.net.cn/user/login', data=payload)
self.assertEqual(200, login_etbc.... | Test_push_wechat_template | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_push_wechat_template:
def Loging_etbc(self):
"""发送请求登陆etbc"""
<|body_0|>
def test_Push_wechat_template(self):
"""微信模版推送"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
payload = {'loginName': 'zhangyang1', 'loginPwd': 'zj030304... | stack_v2_sparse_classes_36k_train_032227 | 2,353 | permissive | [
{
"docstring": "发送请求登陆etbc",
"name": "Loging_etbc",
"signature": "def Loging_etbc(self)"
},
{
"docstring": "微信模版推送",
"name": "test_Push_wechat_template",
"signature": "def test_Push_wechat_template(self)"
}
] | 2 | null | Implement the Python class `Test_push_wechat_template` described below.
Class description:
Implement the Test_push_wechat_template class.
Method signatures and docstrings:
- def Loging_etbc(self): 发送请求登陆etbc
- def test_Push_wechat_template(self): 微信模版推送 | Implement the Python class `Test_push_wechat_template` described below.
Class description:
Implement the Test_push_wechat_template class.
Method signatures and docstrings:
- def Loging_etbc(self): 发送请求登陆etbc
- def test_Push_wechat_template(self): 微信模版推送
<|skeleton|>
class Test_push_wechat_template:
def Loging_e... | 472f3f6d9bd407f1c4ed30a5557ec141e2434188 | <|skeleton|>
class Test_push_wechat_template:
def Loging_etbc(self):
"""发送请求登陆etbc"""
<|body_0|>
def test_Push_wechat_template(self):
"""微信模版推送"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_push_wechat_template:
def Loging_etbc(self):
"""发送请求登陆etbc"""
try:
payload = {'loginName': 'zhangyang1', 'loginPwd': 'zj03030418'}
logger_message.loginfo(u'%s\t入参%s\t' % (send_time, payload))
login_etbc = requests.post('http://etbc-qa.eslink.net.cn/user... | the_stack_v2_python_sparse | case/Test_Environment/Push/Test_push_wechat_template.py | Four-sun/Requests_Load | train | 0 | |
44880e86f63bca9d7d94116138c1067d7211b933 | [
"for line in self.move_line_ids:\n if line.lot_id:\n line.lot_id.qty_location = self.location_dest_id\n if self.location_dest_id:\n line.lot_id.qty_on_table = True\n else:\n line.lot_id.qty_on_table = False",
"res = super(FlspStockPickingFilterSn, self).button_validat... | <|body_start_0|>
for line in self.move_line_ids:
if line.lot_id:
line.lot_id.qty_location = self.location_dest_id
if self.location_dest_id:
line.lot_id.qty_on_table = True
else:
line.lot_id.qty_on_table = False
<... | class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga | FlspStockPickingFilterSn | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FlspStockPickingFilterSn:
"""class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga"""
def change_product_qty_in_lot_table(self):
"""Purpose: To wri... | stack_v2_sparse_classes_36k_train_032228 | 9,403 | no_license | [
{
"docstring": "Purpose: To write the stock.production.lot location and qty on table",
"name": "change_product_qty_in_lot_table",
"signature": "def change_product_qty_in_lot_table(self)"
},
{
"docstring": "Purpose: To call method to change the stock.production table Note: Used method because its... | 2 | null | Implement the Python class `FlspStockPickingFilterSn` described below.
Class description:
class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga
Method signatures and docstrings:
- d... | Implement the Python class `FlspStockPickingFilterSn` described below.
Class description:
class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga
Method signatures and docstrings:
- d... | 4a82cd5cfd1898c6da860cb68dff3a14e037bbad | <|skeleton|>
class FlspStockPickingFilterSn:
"""class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga"""
def change_product_qty_in_lot_table(self):
"""Purpose: To wri... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FlspStockPickingFilterSn:
"""class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga"""
def change_product_qty_in_lot_table(self):
"""Purpose: To write the stock.... | the_stack_v2_python_sparse | flsp_mrp_filter_sn/models/flsp_mrp_inherit.py | odoo-smg/firstlight | train | 3 |
9649de1fa39eeba6ff22ee66fe7f8285b650c110 | [
"self._K_P = K_P\nself._K_D = K_D\nself._K_I = K_I\nself.error = 0.0\nself.error_integral = 0.0\nself.error_derivative = 0.0",
"previous_error = self.error\nself.error = target_speed - current_speed\nself.error_integral = np.clip(self.error_integral + self.error, -40.0, 40.0)\nself.error_derivative = self.error -... | <|body_start_0|>
self._K_P = K_P
self._K_D = K_D
self._K_I = K_I
self.error = 0.0
self.error_integral = 0.0
self.error_derivative = 0.0
<|end_body_0|>
<|body_start_1|>
previous_error = self.error
self.error = target_speed - current_speed
self.erro... | PIDLongitudinalController implements longitudinal control using a PID. | PIDLongitudinalController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PIDLongitudinalController:
"""PIDLongitudinalController implements longitudinal control using a PID."""
def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0):
""":param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differential term :param K_I:... | stack_v2_sparse_classes_36k_train_032229 | 6,324 | permissive | [
{
"docstring": ":param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differential term :param K_I: Integral term",
"name": "__init__",
"signature": "def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0)"
},
{
"docstring": "Estimate the throttle of the vehi... | 2 | stack_v2_sparse_classes_30k_train_001135 | Implement the Python class `PIDLongitudinalController` described below.
Class description:
PIDLongitudinalController implements longitudinal control using a PID.
Method signatures and docstrings:
- def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0): :param vehicle: actor to apply to local planner logic onto :param K_P: Pr... | Implement the Python class `PIDLongitudinalController` described below.
Class description:
PIDLongitudinalController implements longitudinal control using a PID.
Method signatures and docstrings:
- def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0): :param vehicle: actor to apply to local planner logic onto :param K_P: Pr... | e9063d97ff5a724f76adbb1b852dc71da1dcfeec | <|skeleton|>
class PIDLongitudinalController:
"""PIDLongitudinalController implements longitudinal control using a PID."""
def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0):
""":param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differential term :param K_I:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PIDLongitudinalController:
"""PIDLongitudinalController implements longitudinal control using a PID."""
def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0):
""":param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differential term :param K_I: Integral ter... | the_stack_v2_python_sparse | carla_ad_agent/src/carla_ad_agent/vehicle_pid_controller.py | carla-simulator/ros-bridge | train | 448 |
31c7d54cb2ebf974366c31050cedde8cf2113d27 | [
"super(Elish, self).__init__()\nself.hard = hard\nif hard is not False:\n self.a = torch.tensor(0.0)\n self.b = torch.tensor(1.0)",
"if self.hard is False:\n return (input >= 0).float() * swish_function(input, False, False, None, None) + (input < 0).float() * (torch.exp(input) - 1) * torch.sigmoid(input)... | <|body_start_0|>
super(Elish, self).__init__()
self.hard = hard
if hard is not False:
self.a = torch.tensor(0.0)
self.b = torch.tensor(1.0)
<|end_body_0|>
<|body_start_1|>
if self.hard is False:
return (input >= 0).float() * swish_function(input, Fals... | Elish | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Elish:
def __init__(self, hard=False):
"""Init method."""
<|body_0|>
def forward(self, input):
"""Forward pass of the function."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(Elish, self).__init__()
self.hard = hard
if hard is... | stack_v2_sparse_classes_36k_train_032230 | 32,265 | no_license | [
{
"docstring": "Init method.",
"name": "__init__",
"signature": "def __init__(self, hard=False)"
},
{
"docstring": "Forward pass of the function.",
"name": "forward",
"signature": "def forward(self, input)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000905 | Implement the Python class `Elish` described below.
Class description:
Implement the Elish class.
Method signatures and docstrings:
- def __init__(self, hard=False): Init method.
- def forward(self, input): Forward pass of the function. | Implement the Python class `Elish` described below.
Class description:
Implement the Elish class.
Method signatures and docstrings:
- def __init__(self, hard=False): Init method.
- def forward(self, input): Forward pass of the function.
<|skeleton|>
class Elish:
def __init__(self, hard=False):
"""Init m... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class Elish:
def __init__(self, hard=False):
"""Init method."""
<|body_0|>
def forward(self, input):
"""Forward pass of the function."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Elish:
def __init__(self, hard=False):
"""Init method."""
super(Elish, self).__init__()
self.hard = hard
if hard is not False:
self.a = torch.tensor(0.0)
self.b = torch.tensor(1.0)
def forward(self, input):
"""Forward pass of the function.""... | the_stack_v2_python_sparse | generated/test_digantamisra98_Echo.py | jansel/pytorch-jit-paritybench | train | 35 | |
b87f95828974a114651d6da3830cd65aca75cf03 | [
"if len(prom_strings) < 1:\n self.logger.error('Please pass in a prom_string or a list of them to write to {}'.format(prom_file_path))\n return None\nresult_prom_string = prom_strings[0] if len(prom_strings) == 1 else '\\n'.join(prom_strings)\nif is_async:\n return self.write_prom_file_async_helper(prom_fi... | <|body_start_0|>
if len(prom_strings) < 1:
self.logger.error('Please pass in a prom_string or a list of them to write to {}'.format(prom_file_path))
return None
result_prom_string = prom_strings[0] if len(prom_strings) == 1 else '\n'.join(prom_strings)
if is_async:
... | The PromFileWriter class writes metric results to prom files. There is a synchronous option and an Asynchronous option (async option is used by the Scheduler since we can ensure that each metric is unique and will write to its own prom file) :param logger: logger for forensics | PromFileWriter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PromFileWriter:
"""The PromFileWriter class writes metric results to prom files. There is a synchronous option and an Asynchronous option (async option is used by the Scheduler since we can ensure that each metric is unique and will write to its own prom file) :param logger: logger for forensics"... | stack_v2_sparse_classes_36k_train_032231 | 5,963 | no_license | [
{
"docstring": "Write to the specified prom file in sync or async mode :param prom_file_path: the path to the prom file that we want to write to :param prom_strings: the string in prom format that we want to write. Most likely created using PromStrBuilder :param is_async: Default False. set to True if you want ... | 3 | stack_v2_sparse_classes_30k_train_000006 | Implement the Python class `PromFileWriter` described below.
Class description:
The PromFileWriter class writes metric results to prom files. There is a synchronous option and an Asynchronous option (async option is used by the Scheduler since we can ensure that each metric is unique and will write to its own prom fil... | Implement the Python class `PromFileWriter` described below.
Class description:
The PromFileWriter class writes metric results to prom files. There is a synchronous option and an Asynchronous option (async option is used by the Scheduler since we can ensure that each metric is unique and will write to its own prom fil... | e66651af2c4e106d8c05999ac1137a4b9a58f29f | <|skeleton|>
class PromFileWriter:
"""The PromFileWriter class writes metric results to prom files. There is a synchronous option and an Asynchronous option (async option is used by the Scheduler since we can ensure that each metric is unique and will write to its own prom file) :param logger: logger for forensics"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PromFileWriter:
"""The PromFileWriter class writes metric results to prom files. There is a synchronous option and an Asynchronous option (async option is used by the Scheduler since we can ensure that each metric is unique and will write to its own prom file) :param logger: logger for forensics"""
def w... | the_stack_v2_python_sparse | iris/utils/prom_helpers.py | dzhang30/Iris | train | 0 |
17180925069fc4ed68eb2ef0415c0286b12ce395 | [
"self.sensor_data = BME680Handler.SensorData()\nself._sensor = sensor\nself._gas_sensor_running = False\nself._hum_baseline = hum_baseline\nself._hum_weighting = hum_weighting\nself._gas_baseline = None\nif gas_measurement:\n threading.Thread(target=self._run_gas_sensor, kwargs={'burn_in_time': burn_in_time}, na... | <|body_start_0|>
self.sensor_data = BME680Handler.SensorData()
self._sensor = sensor
self._gas_sensor_running = False
self._hum_baseline = hum_baseline
self._hum_weighting = hum_weighting
self._gas_baseline = None
if gas_measurement:
threading.Thread(t... | BME680 sensor working in i2C bus. | BME680Handler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BME680Handler:
"""BME680 sensor working in i2C bus."""
def __init__(self, sensor, gas_measurement=False, burn_in_time=300, hum_baseline=40, hum_weighting=25):
"""Initialize the sensor handler."""
<|body_0|>
def _run_gas_sensor(self, burn_in_time):
"""Calibrate th... | stack_v2_sparse_classes_36k_train_032232 | 13,136 | permissive | [
{
"docstring": "Initialize the sensor handler.",
"name": "__init__",
"signature": "def __init__(self, sensor, gas_measurement=False, burn_in_time=300, hum_baseline=40, hum_weighting=25)"
},
{
"docstring": "Calibrate the Air Quality Gas Baseline.",
"name": "_run_gas_sensor",
"signature": ... | 4 | stack_v2_sparse_classes_30k_train_013011 | Implement the Python class `BME680Handler` described below.
Class description:
BME680 sensor working in i2C bus.
Method signatures and docstrings:
- def __init__(self, sensor, gas_measurement=False, burn_in_time=300, hum_baseline=40, hum_weighting=25): Initialize the sensor handler.
- def _run_gas_sensor(self, burn_i... | Implement the Python class `BME680Handler` described below.
Class description:
BME680 sensor working in i2C bus.
Method signatures and docstrings:
- def __init__(self, sensor, gas_measurement=False, burn_in_time=300, hum_baseline=40, hum_weighting=25): Initialize the sensor handler.
- def _run_gas_sensor(self, burn_i... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class BME680Handler:
"""BME680 sensor working in i2C bus."""
def __init__(self, sensor, gas_measurement=False, burn_in_time=300, hum_baseline=40, hum_weighting=25):
"""Initialize the sensor handler."""
<|body_0|>
def _run_gas_sensor(self, burn_in_time):
"""Calibrate th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BME680Handler:
"""BME680 sensor working in i2C bus."""
def __init__(self, sensor, gas_measurement=False, burn_in_time=300, hum_baseline=40, hum_weighting=25):
"""Initialize the sensor handler."""
self.sensor_data = BME680Handler.SensorData()
self._sensor = sensor
self._gas... | the_stack_v2_python_sparse | homeassistant/components/bme680/sensor.py | BenWoodford/home-assistant | train | 11 |
0bdf3d7eea0c43a39508a459cde812069258b8cc | [
"dp = [False for _ in range(len(s))]\nfor i in range(len(s)):\n for item in wordDict:\n if i - len(item) + 1 >= 0 and s[i - len(item) + 1:i + 1] == item and (i - len(item) < 0 or dp[i - len(item)] == True):\n dp[i] = True\nreturn dp[-1]",
"if not self.wordBreak_one(s, wordDict):\n return [... | <|body_start_0|>
dp = [False for _ in range(len(s))]
for i in range(len(s)):
for item in wordDict:
if i - len(item) + 1 >= 0 and s[i - len(item) + 1:i + 1] == item and (i - len(item) < 0 or dp[i - len(item)] == True):
dp[i] = True
return dp[-1]
<|e... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def wordBreak_one(self, s, wordDict):
""":type s: str :type wordDict: List[str] :rtype: bool"""
<|body_0|>
def wordBreak(self, s, wordDict):
""":type s: str :type wordDict: List[str] :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_032233 | 1,870 | no_license | [
{
"docstring": ":type s: str :type wordDict: List[str] :rtype: bool",
"name": "wordBreak_one",
"signature": "def wordBreak_one(self, s, wordDict)"
},
{
"docstring": ":type s: str :type wordDict: List[str] :rtype: List[str]",
"name": "wordBreak",
"signature": "def wordBreak(self, s, wordD... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wordBreak_one(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool
- def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wordBreak_one(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool
- def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: List[... | ede2a2e19f27ef4adf6e57d6692216b8990cf62b | <|skeleton|>
class Solution:
def wordBreak_one(self, s, wordDict):
""":type s: str :type wordDict: List[str] :rtype: bool"""
<|body_0|>
def wordBreak(self, s, wordDict):
""":type s: str :type wordDict: List[str] :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def wordBreak_one(self, s, wordDict):
""":type s: str :type wordDict: List[str] :rtype: bool"""
dp = [False for _ in range(len(s))]
for i in range(len(s)):
for item in wordDict:
if i - len(item) + 1 >= 0 and s[i - len(item) + 1:i + 1] == item and (... | the_stack_v2_python_sparse | word_break_II.py | ShunKaiZhang/LeetCode | train | 0 | |
1cfb673064b0386dacd7d0505302c29999d727d7 | [
"try:\n strike = self.strike\nexcept:\n pass\npaths = self.underlying.get_instrument_values(fixed_seed=fixed_seed)\ntime_grid = self.underlying.time_grid\ntry:\n time_index_start = int(np.where(time_grid == self.pricing_date)[0])\n time_index_end = int(np.where(time_grid == self.maturity)[0])\nexcept:\n... | <|body_start_0|>
try:
strike = self.strike
except:
pass
paths = self.underlying.get_instrument_values(fixed_seed=fixed_seed)
time_grid = self.underlying.time_grid
try:
time_index_start = int(np.where(time_grid == self.pricing_date)[0])
... | 단일 요인 몬테카를로 시뮬레이션을 사용한 임의의 페이오프에 대한 아메리칸 옵션 가치 평가 클래스 Method ======= generate_payoff : 주어진 경로와 페이오프 함수를 이용하여 페이오프 계산 present_value : 롱스태프-슈바르츠 방식에 따른 현재 가치 반환 | valuation_mcs_american | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class valuation_mcs_american:
"""단일 요인 몬테카를로 시뮬레이션을 사용한 임의의 페이오프에 대한 아메리칸 옵션 가치 평가 클래스 Method ======= generate_payoff : 주어진 경로와 페이오프 함수를 이용하여 페이오프 계산 present_value : 롱스태프-슈바르츠 방식에 따른 현재 가치 반환"""
def generate_payoff(self, fixed_seed=False):
"""인수 ==== fixed_seed : 가치 계산용 시드 값을 중복 사용"""
... | stack_v2_sparse_classes_36k_train_032234 | 3,211 | no_license | [
{
"docstring": "인수 ==== fixed_seed : 가치 계산용 시드 값을 중복 사용",
"name": "generate_payoff",
"signature": "def generate_payoff(self, fixed_seed=False)"
},
{
"docstring": "인수 ==== accuracy : int 반환되는 결과의 자리수 fixed_seed : Boolean 가치 계산용 시드 값을 중복 사용 bf : int 회귀분석에 사용할 기저 함수의 숫자 full : Boolean 현재 가치의 1차원 배열... | 2 | stack_v2_sparse_classes_30k_train_014663 | Implement the Python class `valuation_mcs_american` described below.
Class description:
단일 요인 몬테카를로 시뮬레이션을 사용한 임의의 페이오프에 대한 아메리칸 옵션 가치 평가 클래스 Method ======= generate_payoff : 주어진 경로와 페이오프 함수를 이용하여 페이오프 계산 present_value : 롱스태프-슈바르츠 방식에 따른 현재 가치 반환
Method signatures and docstrings:
- def generate_payoff(self, fixed_see... | Implement the Python class `valuation_mcs_american` described below.
Class description:
단일 요인 몬테카를로 시뮬레이션을 사용한 임의의 페이오프에 대한 아메리칸 옵션 가치 평가 클래스 Method ======= generate_payoff : 주어진 경로와 페이오프 함수를 이용하여 페이오프 계산 present_value : 롱스태프-슈바르츠 방식에 따른 현재 가치 반환
Method signatures and docstrings:
- def generate_payoff(self, fixed_see... | 4b16e55af5450337306adc25cab8b00320e87555 | <|skeleton|>
class valuation_mcs_american:
"""단일 요인 몬테카를로 시뮬레이션을 사용한 임의의 페이오프에 대한 아메리칸 옵션 가치 평가 클래스 Method ======= generate_payoff : 주어진 경로와 페이오프 함수를 이용하여 페이오프 계산 present_value : 롱스태프-슈바르츠 방식에 따른 현재 가치 반환"""
def generate_payoff(self, fixed_seed=False):
"""인수 ==== fixed_seed : 가치 계산용 시드 값을 중복 사용"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class valuation_mcs_american:
"""단일 요인 몬테카를로 시뮬레이션을 사용한 임의의 페이오프에 대한 아메리칸 옵션 가치 평가 클래스 Method ======= generate_payoff : 주어진 경로와 페이오프 함수를 이용하여 페이오프 계산 present_value : 롱스태프-슈바르츠 방식에 따른 현재 가치 반환"""
def generate_payoff(self, fixed_seed=False):
"""인수 ==== fixed_seed : 가치 계산용 시드 값을 중복 사용"""
try:
... | the_stack_v2_python_sparse | Chap17/valuation_mcs_american.py | JuHwiJae/python_for_Finance | train | 0 |
34e554a8e8b9d86d2702d338855b2259080495a4 | [
"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... | CurrenciesServiceServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CurrenciesServiceServicer:
def Health(self, request, context):
"""Health is empty method for checking service started"""
<|body_0|>
def Get(self, request, context):
"""Get returns list of currencies with current exchange rates and pledge coefficients"""
<|bod... | stack_v2_sparse_classes_36k_train_032235 | 2,252 | no_license | [
{
"docstring": "Health is empty method for checking service started",
"name": "Health",
"signature": "def Health(self, request, context)"
},
{
"docstring": "Get returns list of currencies with current exchange rates and pledge coefficients",
"name": "Get",
"signature": "def Get(self, req... | 2 | stack_v2_sparse_classes_30k_train_014824 | Implement the Python class `CurrenciesServiceServicer` described below.
Class description:
Implement the CurrenciesServiceServicer class.
Method signatures and docstrings:
- def Health(self, request, context): Health is empty method for checking service started
- def Get(self, request, context): Get returns list of c... | Implement the Python class `CurrenciesServiceServicer` described below.
Class description:
Implement the CurrenciesServiceServicer class.
Method signatures and docstrings:
- def Health(self, request, context): Health is empty method for checking service started
- def Get(self, request, context): Get returns list of c... | abd38ab4bf4d6387325afd09375c6f9ce1fa1ad5 | <|skeleton|>
class CurrenciesServiceServicer:
def Health(self, request, context):
"""Health is empty method for checking service started"""
<|body_0|>
def Get(self, request, context):
"""Get returns list of currencies with current exchange rates and pledge coefficients"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CurrenciesServiceServicer:
def Health(self, request, context):
"""Health is empty method for checking service started"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ... | the_stack_v2_python_sparse | exchanger/rpc/currencies_pb2_grpc.py | healfy/exchanger | train | 0 | |
37100d096351317caa4b124bc6afe3458e91bd2f | [
"super().__init__(index_name, sketch_id, timeline_id=timeline_id)\nself.misp_url = kwargs.get('misp_url')\nself.misp_api_key = kwargs.get('misp_api_key')\nself.total_event_counter = 0\nself.request_set = set()\nself.result_dict = dict()",
"misp_url = current_app.config.get('MISP_URL')\nmisp_api_key = current_app.... | <|body_start_0|>
super().__init__(index_name, sketch_id, timeline_id=timeline_id)
self.misp_url = kwargs.get('misp_url')
self.misp_api_key = kwargs.get('misp_api_key')
self.total_event_counter = 0
self.request_set = set()
self.result_dict = dict()
<|end_body_0|>
<|body_s... | Analyzer for MISP. | MispAnalyzer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MispAnalyzer:
"""Analyzer for MISP."""
def __init__(self, index_name, sketch_id, timeline_id=None, **kwargs):
"""Initialize the Analyzer. Args: index_name: OpenSearch index name sketch_id: The ID of the sketch. timeline_id: The ID of the timeline."""
<|body_0|>
def get_k... | stack_v2_sparse_classes_36k_train_032236 | 5,877 | permissive | [
{
"docstring": "Initialize the Analyzer. Args: index_name: OpenSearch index name sketch_id: The ID of the sketch. timeline_id: The ID of the timeline.",
"name": "__init__",
"signature": "def __init__(self, index_name, sketch_id, timeline_id=None, **kwargs)"
},
{
"docstring": "Get kwargs for the ... | 6 | null | Implement the Python class `MispAnalyzer` described below.
Class description:
Analyzer for MISP.
Method signatures and docstrings:
- def __init__(self, index_name, sketch_id, timeline_id=None, **kwargs): Initialize the Analyzer. Args: index_name: OpenSearch index name sketch_id: The ID of the sketch. timeline_id: The... | Implement the Python class `MispAnalyzer` described below.
Class description:
Analyzer for MISP.
Method signatures and docstrings:
- def __init__(self, index_name, sketch_id, timeline_id=None, **kwargs): Initialize the Analyzer. Args: index_name: OpenSearch index name sketch_id: The ID of the sketch. timeline_id: The... | 24f471b58ca4a87cb053961b5f05c07a544ca7b8 | <|skeleton|>
class MispAnalyzer:
"""Analyzer for MISP."""
def __init__(self, index_name, sketch_id, timeline_id=None, **kwargs):
"""Initialize the Analyzer. Args: index_name: OpenSearch index name sketch_id: The ID of the sketch. timeline_id: The ID of the timeline."""
<|body_0|>
def get_k... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MispAnalyzer:
"""Analyzer for MISP."""
def __init__(self, index_name, sketch_id, timeline_id=None, **kwargs):
"""Initialize the Analyzer. Args: index_name: OpenSearch index name sketch_id: The ID of the sketch. timeline_id: The ID of the timeline."""
super().__init__(index_name, sketch_id... | the_stack_v2_python_sparse | timesketch/lib/analyzers/contrib/misp_analyzer.py | google/timesketch | train | 2,263 |
1bf31946657b271b7a836bb0e7a1312e0febc74b | [
"n = len(s)\nif n == 0:\n return '^$'\nres = '^'\nfor i in range(n):\n res += '#' + s[i]\nres += '#$'\nreturn res",
"T = self.preProcess(s)\nn = len(T)\np = [0] * n\nC, R = (0, 0)\nfor i in range(1, n - 1):\n i_mirror = 2 * C - i\n if R > i:\n p[i] = min(R - i, p[i_mirror])\n while T[i + 1 +... | <|body_start_0|>
n = len(s)
if n == 0:
return '^$'
res = '^'
for i in range(n):
res += '#' + s[i]
res += '#$'
return res
<|end_body_0|>
<|body_start_1|>
T = self.preProcess(s)
n = len(T)
p = [0] * n
C, R = (0, 0)
... | Solution3 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution3:
def preProcess(self, s):
"""Transform S into T. For example, S = "abba", T = "^#a#b#b#a#$". ^ and $ signs are sentinels appended to each end to avoid bounds checking"""
<|body_0|>
def longestPalindrome(self, s):
""":type s: str :rtype: str"""
<|bod... | stack_v2_sparse_classes_36k_train_032237 | 2,734 | no_license | [
{
"docstring": "Transform S into T. For example, S = \"abba\", T = \"^#a#b#b#a#$\". ^ and $ signs are sentinels appended to each end to avoid bounds checking",
"name": "preProcess",
"signature": "def preProcess(self, s)"
},
{
"docstring": ":type s: str :rtype: str",
"name": "longestPalindrom... | 2 | stack_v2_sparse_classes_30k_train_011796 | Implement the Python class `Solution3` described below.
Class description:
Implement the Solution3 class.
Method signatures and docstrings:
- def preProcess(self, s): Transform S into T. For example, S = "abba", T = "^#a#b#b#a#$". ^ and $ signs are sentinels appended to each end to avoid bounds checking
- def longest... | Implement the Python class `Solution3` described below.
Class description:
Implement the Solution3 class.
Method signatures and docstrings:
- def preProcess(self, s): Transform S into T. For example, S = "abba", T = "^#a#b#b#a#$". ^ and $ signs are sentinels appended to each end to avoid bounds checking
- def longest... | 08e791733824ddf82ba07d1666b1e5e07fb8189d | <|skeleton|>
class Solution3:
def preProcess(self, s):
"""Transform S into T. For example, S = "abba", T = "^#a#b#b#a#$". ^ and $ signs are sentinels appended to each end to avoid bounds checking"""
<|body_0|>
def longestPalindrome(self, s):
""":type s: str :rtype: str"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution3:
def preProcess(self, s):
"""Transform S into T. For example, S = "abba", T = "^#a#b#b#a#$". ^ and $ signs are sentinels appended to each end to avoid bounds checking"""
n = len(s)
if n == 0:
return '^$'
res = '^'
for i in range(n):
res... | the_stack_v2_python_sparse | longest_palindromic_substring.py | mihaanali/coding_practice | train | 0 | |
af05e9075da4a9e3f814b237abd52e188265a6d2 | [
"if any((cost.state != 'draft' for cost in self)):\n raise UserError(_('Only draft landed costs can be validated'))\nif any((not cost.valuation_adjustment_lines for cost in self)):\n raise UserError(_('No Cost lines. You should maybe recompute the landed costs.'))\nif not self._check_sum():\n raise UserErr... | <|body_start_0|>
if any((cost.state != 'draft' for cost in self)):
raise UserError(_('Only draft landed costs can be validated'))
if any((not cost.valuation_adjustment_lines for cost in self)):
raise UserError(_('No Cost lines. You should maybe recompute the landed costs.'))
... | stockLandedCost | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class stockLandedCost:
def stock_responible_validate(self):
""":return:"""
<|body_0|>
def button_validate(self):
""":return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if any((cost.state != 'draft' for cost in self)):
raise UserError(_('O... | stack_v2_sparse_classes_36k_train_032238 | 42,016 | no_license | [
{
"docstring": ":return:",
"name": "stock_responible_validate",
"signature": "def stock_responible_validate(self)"
},
{
"docstring": ":return:",
"name": "button_validate",
"signature": "def button_validate(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008325 | Implement the Python class `stockLandedCost` described below.
Class description:
Implement the stockLandedCost class.
Method signatures and docstrings:
- def stock_responible_validate(self): :return:
- def button_validate(self): :return: | Implement the Python class `stockLandedCost` described below.
Class description:
Implement the stockLandedCost class.
Method signatures and docstrings:
- def stock_responible_validate(self): :return:
- def button_validate(self): :return:
<|skeleton|>
class stockLandedCost:
def stock_responible_validate(self):
... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class stockLandedCost:
def stock_responible_validate(self):
""":return:"""
<|body_0|>
def button_validate(self):
""":return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class stockLandedCost:
def stock_responible_validate(self):
""":return:"""
if any((cost.state != 'draft' for cost in self)):
raise UserError(_('Only draft landed costs can be validated'))
if any((not cost.valuation_adjustment_lines for cost in self)):
raise UserError(... | the_stack_v2_python_sparse | v_11/EBS-SVN/branches/ebs/stock_custom/models/models.py | musabahmed/baba | train | 0 | |
d21699729ad27950e8402c471366dc6483d7c8b3 | [
"n = len(seats)\nstart, res = (0, 0)\nfor i in range(n):\n if not seats[i]:\n continue\n if start == 0:\n res = max(res, i - start)\n else:\n res = max(res, (i - start + 1) // 2)\n start = i + 1\nres = max(res, n - start)\nreturn res",
"n = len(seats)\ndist1 = [n + 1] * (n + 1)\nd... | <|body_start_0|>
n = len(seats)
start, res = (0, 0)
for i in range(n):
if not seats[i]:
continue
if start == 0:
res = max(res, i - start)
else:
res = max(res, (i - start + 1) // 2)
start = i + 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxDistToClosest1Pass(self, seats):
""":type seats: List[int] :rtype: int"""
<|body_0|>
def maxDistToClosest(self, seats):
""":type seats: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n = len(seats)
sta... | stack_v2_sparse_classes_36k_train_032239 | 2,624 | no_license | [
{
"docstring": ":type seats: List[int] :rtype: int",
"name": "maxDistToClosest1Pass",
"signature": "def maxDistToClosest1Pass(self, seats)"
},
{
"docstring": ":type seats: List[int] :rtype: int",
"name": "maxDistToClosest",
"signature": "def maxDistToClosest(self, seats)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDistToClosest1Pass(self, seats): :type seats: List[int] :rtype: int
- def maxDistToClosest(self, seats): :type seats: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDistToClosest1Pass(self, seats): :type seats: List[int] :rtype: int
- def maxDistToClosest(self, seats): :type seats: List[int] :rtype: int
<|skeleton|>
class Solution:
... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def maxDistToClosest1Pass(self, seats):
""":type seats: List[int] :rtype: int"""
<|body_0|>
def maxDistToClosest(self, seats):
""":type seats: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxDistToClosest1Pass(self, seats):
""":type seats: List[int] :rtype: int"""
n = len(seats)
start, res = (0, 0)
for i in range(n):
if not seats[i]:
continue
if start == 0:
res = max(res, i - start)
... | the_stack_v2_python_sparse | M/MaximizeDistanceToClosestPerson.py | bssrdf/pyleet | train | 2 | |
36411adfecc59a959c1b034ba26157f728bf06a8 | [
"self.fileHandle = fileHandle\nself.dagPath = dagPath\nself.light = OpenMaya.MFnSpotLight(dagPath)",
"color = self.light.color()\nintensity = self.light.intensity()\ncolorR = self.rgcAndClamp(color.r * intensity)\ncolorG = self.rgcAndClamp(color.g * intensity)\ncolorB = self.rgcAndClamp(color.b * intensity)\nself... | <|body_start_0|>
self.fileHandle = fileHandle
self.dagPath = dagPath
self.light = OpenMaya.MFnSpotLight(dagPath)
<|end_body_0|>
<|body_start_1|>
color = self.light.color()
intensity = self.light.intensity()
colorR = self.rgcAndClamp(color.r * intensity)
colorG = ... | Spot light type. | SpotLight | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpotLight:
"""Spot light type."""
def __init__(self, fileHandle, dagPath):
"""Constructor. Sets up this object's data."""
<|body_0|>
def getOutput(self):
"""Return lux LightSource "spot" from the given spotlight node."""
<|body_1|>
<|end_skeleton|>
<|bo... | stack_v2_sparse_classes_36k_train_032240 | 4,533 | no_license | [
{
"docstring": "Constructor. Sets up this object's data.",
"name": "__init__",
"signature": "def __init__(self, fileHandle, dagPath)"
},
{
"docstring": "Return lux LightSource \"spot\" from the given spotlight node.",
"name": "getOutput",
"signature": "def getOutput(self)"
}
] | 2 | null | Implement the Python class `SpotLight` described below.
Class description:
Spot light type.
Method signatures and docstrings:
- def __init__(self, fileHandle, dagPath): Constructor. Sets up this object's data.
- def getOutput(self): Return lux LightSource "spot" from the given spotlight node. | Implement the Python class `SpotLight` described below.
Class description:
Spot light type.
Method signatures and docstrings:
- def __init__(self, fileHandle, dagPath): Constructor. Sets up this object's data.
- def getOutput(self): Return lux LightSource "spot" from the given spotlight node.
<|skeleton|>
class Spot... | 3891e40c3c4c3a054e5ff1ff16d051d4e690cc4a | <|skeleton|>
class SpotLight:
"""Spot light type."""
def __init__(self, fileHandle, dagPath):
"""Constructor. Sets up this object's data."""
<|body_0|>
def getOutput(self):
"""Return lux LightSource "spot" from the given spotlight node."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpotLight:
"""Spot light type."""
def __init__(self, fileHandle, dagPath):
"""Constructor. Sets up this object's data."""
self.fileHandle = fileHandle
self.dagPath = dagPath
self.light = OpenMaya.MFnSpotLight(dagPath)
def getOutput(self):
"""Return lux LightSo... | the_stack_v2_python_sparse | luxPlugin/Lux/LuxExportModules/Light.py | LuxRender/LuxMaya | train | 0 |
cce97d4ba52d5c0b91a3b2e4339b803afa81b171 | [
"self.cluster_id = cluster_id\nself.cluster_incarnation_id = cluster_incarnation_id\nself.current_operation = current_operation\nself.message = message\nself.name = name\nself.node_statuses = node_statuses\nself.removal_state = removal_state\nself.services_synced = services_synced\nself.software_version = software_... | <|body_start_0|>
self.cluster_id = cluster_id
self.cluster_incarnation_id = cluster_incarnation_id
self.current_operation = current_operation
self.message = message
self.name = name
self.node_statuses = node_statuses
self.removal_state = removal_state
self... | Implementation of the 'ClusterStatusResult' model. Specifies the result of getting the status of a Cluster. Attributes: cluster_id (long|int): Specifies the ID of the Cluster. cluster_incarnation_id (long|int): Specifies the incarnation ID of the Cluster. current_operation (CurrentOperationClusterStatusResultEnum): Spe... | ClusterStatusResult | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClusterStatusResult:
"""Implementation of the 'ClusterStatusResult' model. Specifies the result of getting the status of a Cluster. Attributes: cluster_id (long|int): Specifies the ID of the Cluster. cluster_incarnation_id (long|int): Specifies the incarnation ID of the Cluster. current_operation... | stack_v2_sparse_classes_36k_train_032241 | 8,388 | permissive | [
{
"docstring": "Constructor for the ClusterStatusResult class",
"name": "__init__",
"signature": "def __init__(self, cluster_id=None, cluster_incarnation_id=None, current_operation=None, message=None, name=None, node_statuses=None, removal_state=None, services_synced=None, software_version=None, stopped... | 2 | stack_v2_sparse_classes_30k_train_018030 | Implement the Python class `ClusterStatusResult` described below.
Class description:
Implementation of the 'ClusterStatusResult' model. Specifies the result of getting the status of a Cluster. Attributes: cluster_id (long|int): Specifies the ID of the Cluster. cluster_incarnation_id (long|int): Specifies the incarnati... | Implement the Python class `ClusterStatusResult` described below.
Class description:
Implementation of the 'ClusterStatusResult' model. Specifies the result of getting the status of a Cluster. Attributes: cluster_id (long|int): Specifies the ID of the Cluster. cluster_incarnation_id (long|int): Specifies the incarnati... | 0093194d125fc6746f55b8499da1270c64f473fc | <|skeleton|>
class ClusterStatusResult:
"""Implementation of the 'ClusterStatusResult' model. Specifies the result of getting the status of a Cluster. Attributes: cluster_id (long|int): Specifies the ID of the Cluster. cluster_incarnation_id (long|int): Specifies the incarnation ID of the Cluster. current_operation... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClusterStatusResult:
"""Implementation of the 'ClusterStatusResult' model. Specifies the result of getting the status of a Cluster. Attributes: cluster_id (long|int): Specifies the ID of the Cluster. cluster_incarnation_id (long|int): Specifies the incarnation ID of the Cluster. current_operation (CurrentOper... | the_stack_v2_python_sparse | cohesity_management_sdk/models/cluster_status_result.py | hsantoyo2/management-sdk-python | train | 0 |
98b5b5a9d7c346cdfb6518d0830ea3814fd70f7a | [
"test_task = {'run_time': None, 'last_update': None}\nstats = TurbiniaStats()\nstats.add_task(test_task)\nself.assertIn(test_task, stats.tasks)\nself.assertEqual(stats.count, 1)",
"last_update = datetime.now()\ntest_task1 = {'run_time': timedelta(minutes=3), 'last_update': last_update}\ntest_task2 = {'run_time': ... | <|body_start_0|>
test_task = {'run_time': None, 'last_update': None}
stats = TurbiniaStats()
stats.add_task(test_task)
self.assertIn(test_task, stats.tasks)
self.assertEqual(stats.count, 1)
<|end_body_0|>
<|body_start_1|>
last_update = datetime.now()
test_task1 =... | Test TurbiniaStats class. | TestTurbiniaStats | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestTurbiniaStats:
"""Test TurbiniaStats class."""
def testTurbiniaStatsAddTask(self):
"""Tests TurbiniaStats.add_task() method."""
<|body_0|>
def testTurbiniaStatsCalculateStats(self):
"""Tests TurbiniaStats.calculateStats() method."""
<|body_1|>
de... | stack_v2_sparse_classes_36k_train_032242 | 31,299 | permissive | [
{
"docstring": "Tests TurbiniaStats.add_task() method.",
"name": "testTurbiniaStatsAddTask",
"signature": "def testTurbiniaStatsAddTask(self)"
},
{
"docstring": "Tests TurbiniaStats.calculateStats() method.",
"name": "testTurbiniaStatsCalculateStats",
"signature": "def testTurbiniaStatsC... | 5 | null | Implement the Python class `TestTurbiniaStats` described below.
Class description:
Test TurbiniaStats class.
Method signatures and docstrings:
- def testTurbiniaStatsAddTask(self): Tests TurbiniaStats.add_task() method.
- def testTurbiniaStatsCalculateStats(self): Tests TurbiniaStats.calculateStats() method.
- def te... | Implement the Python class `TestTurbiniaStats` described below.
Class description:
Test TurbiniaStats class.
Method signatures and docstrings:
- def testTurbiniaStatsAddTask(self): Tests TurbiniaStats.add_task() method.
- def testTurbiniaStatsCalculateStats(self): Tests TurbiniaStats.calculateStats() method.
- def te... | e73717549c6919e869ce4963449c36f227e3ccd6 | <|skeleton|>
class TestTurbiniaStats:
"""Test TurbiniaStats class."""
def testTurbiniaStatsAddTask(self):
"""Tests TurbiniaStats.add_task() method."""
<|body_0|>
def testTurbiniaStatsCalculateStats(self):
"""Tests TurbiniaStats.calculateStats() method."""
<|body_1|>
de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestTurbiniaStats:
"""Test TurbiniaStats class."""
def testTurbiniaStatsAddTask(self):
"""Tests TurbiniaStats.add_task() method."""
test_task = {'run_time': None, 'last_update': None}
stats = TurbiniaStats()
stats.add_task(test_task)
self.assertIn(test_task, stats.... | the_stack_v2_python_sparse | turbinia/client_test.py | Ash515/turbinia | train | 6 |
4b2bd27c7b3baa3961bc8a09eaff6405b9546db8 | [
"self.to = to\nself.support_phone = support_phone\nself.subject = subject\nself.first_name = first_name\nself.institution_name = institution_name\nself.institution_address = institution_address\nself.signature = signature\nself.additional_properties = additional_properties",
"if dictionary is None:\n return No... | <|body_start_0|>
self.to = to
self.support_phone = support_phone
self.subject = subject
self.first_name = first_name
self.institution_name = institution_name
self.institution_address = institution_address
self.signature = signature
self.additional_properti... | Implementation of the 'Connect V2 Email Options' model. The parameter definitions used to configure the Connect email's sent to customers. Attributes: to (string): The email address for the customer receiving the Connect email. support_phone (string): (Optional) The support phone number listed in the email. subject (st... | ConnectV2EmailOptions | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConnectV2EmailOptions:
"""Implementation of the 'Connect V2 Email Options' model. The parameter definitions used to configure the Connect email's sent to customers. Attributes: to (string): The email address for the customer receiving the Connect email. support_phone (string): (Optional) The supp... | stack_v2_sparse_classes_36k_train_032243 | 3,677 | permissive | [
{
"docstring": "Constructor for the ConnectV2EmailOptions class",
"name": "__init__",
"signature": "def __init__(self, to=None, support_phone=None, subject=None, first_name=None, institution_name=None, institution_address=None, signature=None, additional_properties={})"
},
{
"docstring": "Create... | 2 | null | Implement the Python class `ConnectV2EmailOptions` described below.
Class description:
Implementation of the 'Connect V2 Email Options' model. The parameter definitions used to configure the Connect email's sent to customers. Attributes: to (string): The email address for the customer receiving the Connect email. supp... | Implement the Python class `ConnectV2EmailOptions` described below.
Class description:
Implementation of the 'Connect V2 Email Options' model. The parameter definitions used to configure the Connect email's sent to customers. Attributes: to (string): The email address for the customer receiving the Connect email. supp... | b2ab1ded435db75c78d42261f5e4acd2a3061487 | <|skeleton|>
class ConnectV2EmailOptions:
"""Implementation of the 'Connect V2 Email Options' model. The parameter definitions used to configure the Connect email's sent to customers. Attributes: to (string): The email address for the customer receiving the Connect email. support_phone (string): (Optional) The supp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConnectV2EmailOptions:
"""Implementation of the 'Connect V2 Email Options' model. The parameter definitions used to configure the Connect email's sent to customers. Attributes: to (string): The email address for the customer receiving the Connect email. support_phone (string): (Optional) The support phone num... | the_stack_v2_python_sparse | finicityapi/models/connect_v_2_email_options.py | monarchmoney/finicity-python | train | 0 |
22e3916e150a9d46ab71c346c824bd3d63c807ef | [
"self.found = found\nself.displaying = displaying\nself.more_available = more_available\nself.created_date = created_date\nself.institutions = institutions\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\nfound = dictionary.get('found')\ndisplaying = dictionary.get('... | <|body_start_0|>
self.found = found
self.displaying = displaying
self.more_available = more_available
self.created_date = created_date
self.institutions = institutions
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionar... | Implementation of the 'Get Certified Institutions Response' model. TODO: type model description here. Attributes: found (int): Total number of results found displaying (int): Displaying count more_available (bool): Indicates if there are more institutions to display that match the parameters created_date (int): Date th... | GetCertifiedInstitutionsResponse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetCertifiedInstitutionsResponse:
"""Implementation of the 'Get Certified Institutions Response' model. TODO: type model description here. Attributes: found (int): Total number of results found displaying (int): Displaying count more_available (bool): Indicates if there are more institutions to d... | stack_v2_sparse_classes_36k_train_032244 | 3,106 | permissive | [
{
"docstring": "Constructor for the GetCertifiedInstitutionsResponse class",
"name": "__init__",
"signature": "def __init__(self, found=None, displaying=None, more_available=None, created_date=None, institutions=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this mode... | 2 | null | Implement the Python class `GetCertifiedInstitutionsResponse` described below.
Class description:
Implementation of the 'Get Certified Institutions Response' model. TODO: type model description here. Attributes: found (int): Total number of results found displaying (int): Displaying count more_available (bool): Indica... | Implement the Python class `GetCertifiedInstitutionsResponse` described below.
Class description:
Implementation of the 'Get Certified Institutions Response' model. TODO: type model description here. Attributes: found (int): Total number of results found displaying (int): Displaying count more_available (bool): Indica... | b2ab1ded435db75c78d42261f5e4acd2a3061487 | <|skeleton|>
class GetCertifiedInstitutionsResponse:
"""Implementation of the 'Get Certified Institutions Response' model. TODO: type model description here. Attributes: found (int): Total number of results found displaying (int): Displaying count more_available (bool): Indicates if there are more institutions to d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetCertifiedInstitutionsResponse:
"""Implementation of the 'Get Certified Institutions Response' model. TODO: type model description here. Attributes: found (int): Total number of results found displaying (int): Displaying count more_available (bool): Indicates if there are more institutions to display that m... | the_stack_v2_python_sparse | finicityapi/models/get_certified_institutions_response.py | monarchmoney/finicity-python | train | 0 |
904435b8f270fdb7b191e6039da47ce9da99be0f | [
"self.features_parser = self.get_feature_parser(features_to_sample, allowed_feature_types=lambda fty: fty.is_image())\nself.mask_of_samples = mask_of_samples\nif mask_of_samples is not None:\n self.mask_of_samples = self.parse_feature(mask_of_samples, allowed_feature_types={FeatureType.MASK_TIMELESS})",
"image... | <|body_start_0|>
self.features_parser = self.get_feature_parser(features_to_sample, allowed_feature_types=lambda fty: fty.is_image())
self.mask_of_samples = mask_of_samples
if mask_of_samples is not None:
self.mask_of_samples = self.parse_feature(mask_of_samples, allowed_feature_type... | A base class for sampling tasks | BaseSamplingTask | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseSamplingTask:
"""A base class for sampling tasks"""
def __init__(self, features_to_sample: FeaturesSpecification, *, mask_of_samples: tuple[FeatureType, str] | None=None):
""":param features_to_sample: Features that will be spatially sampled according to given sampling parameters... | stack_v2_sparse_classes_36k_train_032245 | 17,895 | permissive | [
{
"docstring": ":param features_to_sample: Features that will be spatially sampled according to given sampling parameters. :param mask_of_samples: An output mask timeless feature of counts how many times each pixel has been sampled.",
"name": "__init__",
"signature": "def __init__(self, features_to_samp... | 2 | stack_v2_sparse_classes_30k_train_017879 | Implement the Python class `BaseSamplingTask` described below.
Class description:
A base class for sampling tasks
Method signatures and docstrings:
- def __init__(self, features_to_sample: FeaturesSpecification, *, mask_of_samples: tuple[FeatureType, str] | None=None): :param features_to_sample: Features that will be... | Implement the Python class `BaseSamplingTask` described below.
Class description:
A base class for sampling tasks
Method signatures and docstrings:
- def __init__(self, features_to_sample: FeaturesSpecification, *, mask_of_samples: tuple[FeatureType, str] | None=None): :param features_to_sample: Features that will be... | a65899e4632b50c9c41a67e1f7698c09b929d840 | <|skeleton|>
class BaseSamplingTask:
"""A base class for sampling tasks"""
def __init__(self, features_to_sample: FeaturesSpecification, *, mask_of_samples: tuple[FeatureType, str] | None=None):
""":param features_to_sample: Features that will be spatially sampled according to given sampling parameters... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseSamplingTask:
"""A base class for sampling tasks"""
def __init__(self, features_to_sample: FeaturesSpecification, *, mask_of_samples: tuple[FeatureType, str] | None=None):
""":param features_to_sample: Features that will be spatially sampled according to given sampling parameters. :param mask... | the_stack_v2_python_sparse | ml_tools/eolearn/ml_tools/sampling.py | sentinel-hub/eo-learn | train | 1,072 |
d005558ccb96764cc0a13447a44630ba80046cd9 | [
"super().__init__(unique_id, model)\nself.pos = np.array(pos)\nself.speed = speed\nself.velocity = velocity\nself.vision = vision\nself.separation = separation\nself.cohere_factor = cohere\nself.separate_factor = separate\nself.match_factor = match",
"cohere = np.zeros(2)\nif neighbors:\n for neighbor in neigh... | <|body_start_0|>
super().__init__(unique_id, model)
self.pos = np.array(pos)
self.speed = speed
self.velocity = velocity
self.vision = vision
self.separation = separation
self.cohere_factor = cohere
self.separate_factor = separate
self.match_factor... | A Boid-style flocker agent. The agent follows three behaviors to flock: - Cohesion: steering towards neighboring agents. - Separation: avoiding getting too close to any other agent. - Alignment: try to fly in the same direction as the neighbors. Boids have a vision that defines the radius in which they look for their n... | Boid | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Boid:
"""A Boid-style flocker agent. The agent follows three behaviors to flock: - Cohesion: steering towards neighboring agents. - Separation: avoiding getting too close to any other agent. - Alignment: try to fly in the same direction as the neighbors. Boids have a vision that defines the radiu... | stack_v2_sparse_classes_36k_train_032246 | 7,183 | no_license | [
{
"docstring": "Create a new Boid flocker agent. Args: unique_id: Unique agent identifyer. pos: Starting position speed: Distance to move per step. vision: Radius to look around for nearby Boids. separation: Minimum distance to maintain from other Boids. cohere: the relative importance of matching neighbors' po... | 5 | stack_v2_sparse_classes_30k_train_018453 | Implement the Python class `Boid` described below.
Class description:
A Boid-style flocker agent. The agent follows three behaviors to flock: - Cohesion: steering towards neighboring agents. - Separation: avoiding getting too close to any other agent. - Alignment: try to fly in the same direction as the neighbors. Boi... | Implement the Python class `Boid` described below.
Class description:
A Boid-style flocker agent. The agent follows three behaviors to flock: - Cohesion: steering towards neighboring agents. - Separation: avoiding getting too close to any other agent. - Alignment: try to fly in the same direction as the neighbors. Boi... | 18166af285d2a40f903bc178f5c37b7d758fb0bd | <|skeleton|>
class Boid:
"""A Boid-style flocker agent. The agent follows three behaviors to flock: - Cohesion: steering towards neighboring agents. - Separation: avoiding getting too close to any other agent. - Alignment: try to fly in the same direction as the neighbors. Boids have a vision that defines the radiu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Boid:
"""A Boid-style flocker agent. The agent follows three behaviors to flock: - Cohesion: steering towards neighboring agents. - Separation: avoiding getting too close to any other agent. - Alignment: try to fly in the same direction as the neighbors. Boids have a vision that defines the radius in which th... | the_stack_v2_python_sparse | alternative_models/boids.py | sowasser/fish-shoaling-model | train | 1 |
49459c083d2ae2d3ffac6fce816a886077d9b446 | [
"from collections import Counter\nres = 0\nd = dict(Counter(chars))\nfor word in words:\n cnt = dict(Counter(word))\n if all((d.get(k) is not None and d.get(k) >= cnt.get(k) for k in cnt.keys())):\n res += len(word)\nreturn res",
"from collections import Counter\nres = 0\nd = Counter(chars)\nfor word... | <|body_start_0|>
from collections import Counter
res = 0
d = dict(Counter(chars))
for word in words:
cnt = dict(Counter(word))
if all((d.get(k) is not None and d.get(k) >= cnt.get(k) for k in cnt.keys())):
res += len(word)
return res
<|end_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countCharacters(self, words, chars):
""":type words: List[str] :type chars: str :rtype: int"""
<|body_0|>
def countCharacters(self, words, chars):
""":type words: List[str] :type chars: str :rtype: int"""
<|body_1|>
def countCharacters(self... | stack_v2_sparse_classes_36k_train_032247 | 1,416 | no_license | [
{
"docstring": ":type words: List[str] :type chars: str :rtype: int",
"name": "countCharacters",
"signature": "def countCharacters(self, words, chars)"
},
{
"docstring": ":type words: List[str] :type chars: str :rtype: int",
"name": "countCharacters",
"signature": "def countCharacters(se... | 3 | stack_v2_sparse_classes_30k_train_007887 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countCharacters(self, words, chars): :type words: List[str] :type chars: str :rtype: int
- def countCharacters(self, words, chars): :type words: List[str] :type chars: str :r... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countCharacters(self, words, chars): :type words: List[str] :type chars: str :rtype: int
- def countCharacters(self, words, chars): :type words: List[str] :type chars: str :r... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def countCharacters(self, words, chars):
""":type words: List[str] :type chars: str :rtype: int"""
<|body_0|>
def countCharacters(self, words, chars):
""":type words: List[str] :type chars: str :rtype: int"""
<|body_1|>
def countCharacters(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def countCharacters(self, words, chars):
""":type words: List[str] :type chars: str :rtype: int"""
from collections import Counter
res = 0
d = dict(Counter(chars))
for word in words:
cnt = dict(Counter(word))
if all((d.get(k) is not Non... | the_stack_v2_python_sparse | 1160_Find_Words_That_Can Be_Formed_by_Characters.py | bingli8802/leetcode | train | 0 | |
ddc98dee16a5a934bcda0d41212816c994b1874b | [
"super().__init__(first_name, last_name)\n'Initialize the son class attributes'\nself.privileges = ['add post', 'delete post']",
"print('This user has permission which allows him to:')\nfor privilege in self.privileges:\n print(' - ' + privilege)"
] | <|body_start_0|>
super().__init__(first_name, last_name)
'Initialize the son class attributes'
self.privileges = ['add post', 'delete post']
<|end_body_0|>
<|body_start_1|>
print('This user has permission which allows him to:')
for privilege in self.privileges:
print... | Simple attempt to build a son class of 'USER' | Admin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Admin:
"""Simple attempt to build a son class of 'USER'"""
def __init__(self, first_name, last_name):
"""Initialize the parent class attributes"""
<|body_0|>
def show_privileges(self):
"""Print privileges value"""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_36k_train_032248 | 1,295 | no_license | [
{
"docstring": "Initialize the parent class attributes",
"name": "__init__",
"signature": "def __init__(self, first_name, last_name)"
},
{
"docstring": "Print privileges value",
"name": "show_privileges",
"signature": "def show_privileges(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019936 | Implement the Python class `Admin` described below.
Class description:
Simple attempt to build a son class of 'USER'
Method signatures and docstrings:
- def __init__(self, first_name, last_name): Initialize the parent class attributes
- def show_privileges(self): Print privileges value | Implement the Python class `Admin` described below.
Class description:
Simple attempt to build a son class of 'USER'
Method signatures and docstrings:
- def __init__(self, first_name, last_name): Initialize the parent class attributes
- def show_privileges(self): Print privileges value
<|skeleton|>
class Admin:
... | b0ac2e1aa2728de709912335075b46ea931d091c | <|skeleton|>
class Admin:
"""Simple attempt to build a son class of 'USER'"""
def __init__(self, first_name, last_name):
"""Initialize the parent class attributes"""
<|body_0|>
def show_privileges(self):
"""Print privileges value"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Admin:
"""Simple attempt to build a son class of 'USER'"""
def __init__(self, first_name, last_name):
"""Initialize the parent class attributes"""
super().__init__(first_name, last_name)
'Initialize the son class attributes'
self.privileges = ['add post', 'delete post']
... | the_stack_v2_python_sparse | Chapter 9/9-7.py | MoModar/PythonCrashCourse | train | 4 |
38b4c40c7a9c2945123acc777d0d777af151df7a | [
"if not head:\n return None\nif head.next is None:\n return head\nlist_len = 0\npointer = head\nwhile pointer is not None:\n pointer = pointer.next\n list_len += 1\nk = k % list_len\nfor i in range(k):\n head = self._rotateRightStep(head)\nreturn head",
"pre = head\npointer = head\nwhile pointer.ne... | <|body_start_0|>
if not head:
return None
if head.next is None:
return head
list_len = 0
pointer = head
while pointer is not None:
pointer = pointer.next
list_len += 1
k = k % list_len
for i in range(k):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rotateRight(self, head: ListNode, k: int) -> ListNode:
"""思路: 1、移动K次 => 写出移动1次的方法 => 循环k次 2、优化:k次过大时,优化 k % n, 循环n次 :param head: :param k: :return:"""
<|body_0|>
def _rotateRightStep(self, head: ListNode) -> ListNode:
"""将链表向右移动一位,返回head :param head: :r... | stack_v2_sparse_classes_36k_train_032249 | 1,379 | no_license | [
{
"docstring": "思路: 1、移动K次 => 写出移动1次的方法 => 循环k次 2、优化:k次过大时,优化 k % n, 循环n次 :param head: :param k: :return:",
"name": "rotateRight",
"signature": "def rotateRight(self, head: ListNode, k: int) -> ListNode"
},
{
"docstring": "将链表向右移动一位,返回head :param head: :return:",
"name": "_rotateRightStep",
... | 2 | stack_v2_sparse_classes_30k_train_010598 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotateRight(self, head: ListNode, k: int) -> ListNode: 思路: 1、移动K次 => 写出移动1次的方法 => 循环k次 2、优化:k次过大时,优化 k % n, 循环n次 :param head: :param k: :return:
- def _rotateRightStep(self, ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotateRight(self, head: ListNode, k: int) -> ListNode: 思路: 1、移动K次 => 写出移动1次的方法 => 循环k次 2、优化:k次过大时,优化 k % n, 循环n次 :param head: :param k: :return:
- def _rotateRightStep(self, ... | 6708479302cca3ea3d930e6e80264f213ea29c5f | <|skeleton|>
class Solution:
def rotateRight(self, head: ListNode, k: int) -> ListNode:
"""思路: 1、移动K次 => 写出移动1次的方法 => 循环k次 2、优化:k次过大时,优化 k % n, 循环n次 :param head: :param k: :return:"""
<|body_0|>
def _rotateRightStep(self, head: ListNode) -> ListNode:
"""将链表向右移动一位,返回head :param head: :r... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def rotateRight(self, head: ListNode, k: int) -> ListNode:
"""思路: 1、移动K次 => 写出移动1次的方法 => 循环k次 2、优化:k次过大时,优化 k % n, 循环n次 :param head: :param k: :return:"""
if not head:
return None
if head.next is None:
return head
list_len = 0
pointer =... | the_stack_v2_python_sparse | Python/链表/Medium/leetcode_61_链表每个结点向左向右移动k.py | Gyczero/Leetcode_practice | train | 0 | |
effb00a0161be4d56d0591e9d61923133a70cce9 | [
"self.node = node\nself.connection_manager = manager\npb.PBClientFactory.__init__(self)",
"with self.connection_manager._lock:\n node = self.node\n node.ref = None\n for i in range(node.cores):\n w_key = '%s:%s:%i' % (node.host, node.port, i)\n del self.connection_manager.workers[w_key]\n ... | <|body_start_0|>
self.node = node
self.connection_manager = manager
pb.PBClientFactory.__init__(self)
<|end_body_0|>
<|body_start_1|>
with self.connection_manager._lock:
node = self.node
node.ref = None
for i in range(node.cores):
w_ke... | Subclassing of PBClientFactory to add auto-reconnect via Master's reconnection code. This factory is specific to the master acting as a client of a Node. | NodeClientFactory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NodeClientFactory:
"""Subclassing of PBClientFactory to add auto-reconnect via Master's reconnection code. This factory is specific to the master acting as a client of a Node."""
def __init__(self, node, manager):
"""@param node - node this factory is watching @param manager - manage... | stack_v2_sparse_classes_36k_train_032250 | 12,623 | no_license | [
{
"docstring": "@param node - node this factory is watching @param manager - manager that is tracking this node",
"name": "__init__",
"signature": "def __init__(self, node, manager)"
},
{
"docstring": "Called when self.node disconnects",
"name": "clientConnectionLost",
"signature": "def ... | 2 | stack_v2_sparse_classes_30k_test_000891 | Implement the Python class `NodeClientFactory` described below.
Class description:
Subclassing of PBClientFactory to add auto-reconnect via Master's reconnection code. This factory is specific to the master acting as a client of a Node.
Method signatures and docstrings:
- def __init__(self, node, manager): @param nod... | Implement the Python class `NodeClientFactory` described below.
Class description:
Subclassing of PBClientFactory to add auto-reconnect via Master's reconnection code. This factory is specific to the master acting as a client of a Node.
Method signatures and docstrings:
- def __init__(self, node, manager): @param nod... | 9696819fcebfc175969d680bbf58a70d615c4f07 | <|skeleton|>
class NodeClientFactory:
"""Subclassing of PBClientFactory to add auto-reconnect via Master's reconnection code. This factory is specific to the master acting as a client of a Node."""
def __init__(self, node, manager):
"""@param node - node this factory is watching @param manager - manage... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NodeClientFactory:
"""Subclassing of PBClientFactory to add auto-reconnect via Master's reconnection code. This factory is specific to the master acting as a client of a Node."""
def __init__(self, node, manager):
"""@param node - node this factory is watching @param manager - manager that is tra... | the_stack_v2_python_sparse | pydra/cluster/master/node_connection_manager.py | kreneskyp/Pydra | train | 2 |
ff26659bc45ae5a6a1012e42232fa265a3fc27f5 | [
"self.capacity = capacity\nself.length = 0\nself.dict = collections.OrderedDict()",
"try:\n value = self.dict[key]\n del self.dict[key]\n self.dict[key] = value\n return value\nexcept:\n return -1",
"try:\n del self.dict[key]\n self.dict[key] = value\nexcept:\n if self.length == self.cap... | <|body_start_0|>
self.capacity = capacity
self.length = 0
self.dict = collections.OrderedDict()
<|end_body_0|>
<|body_start_1|>
try:
value = self.dict[key]
del self.dict[key]
self.dict[key] = value
return value
except:
... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k_train_032251 | 1,363 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: void",
"name": "pu... | 3 | null | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void
<|sk... | 0584b86642dff667f5bf6b7acfbbce86a41a55b6 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.length = 0
self.dict = collections.OrderedDict()
def get(self, key):
""":type key: int :rtype: int"""
try:
value = self.dict[key]
del sel... | the_stack_v2_python_sparse | python_solution/141_150/LRUCache.py | CescWang1991/LeetCode-Python | train | 1 | |
a7d1e3122a45101d245ddd44a5cf1293eac47863 | [
"self.name = name\nself.connNotify = connNotify\nif websocketState.wsConnectionLists.get(name) is None:\n websocketState.wsConnectionLists[name] = []\nif callback is not None:\n websocketState.wsCallbacks[name] = callback\nif websocketState.wsCallbacks.get(name) is None:\n websocketState.wsCallbacks[name] ... | <|body_start_0|>
self.name = name
self.connNotify = connNotify
if websocketState.wsConnectionLists.get(name) is None:
websocketState.wsConnectionLists[name] = []
if callback is not None:
websocketState.wsCallbacks[name] = callback
if websocketState.wsCallb... | Generic web socket handler. Estabilishes and maintains a ws connection. Intitialized with a callback function that gets called when messages are received on this socket instance. | BaseWebSocketHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseWebSocketHandler:
"""Generic web socket handler. Estabilishes and maintains a ws connection. Intitialized with a callback function that gets called when messages are received on this socket instance."""
def initialize(self, name, callback=None, connNotify=None):
"""initialize met... | stack_v2_sparse_classes_36k_train_032252 | 16,816 | permissive | [
{
"docstring": "initialize method is called by Tornado with args provided to the addHandler call Args: name: the websocket endpoint name, such as wsData callback: the handler function to call whenever a client message is received over the connection. connNotify: the function to call when a connection is opened ... | 4 | stack_v2_sparse_classes_30k_train_014109 | Implement the Python class `BaseWebSocketHandler` described below.
Class description:
Generic web socket handler. Estabilishes and maintains a ws connection. Intitialized with a callback function that gets called when messages are received on this socket instance.
Method signatures and docstrings:
- def initialize(se... | Implement the Python class `BaseWebSocketHandler` described below.
Class description:
Generic web socket handler. Estabilishes and maintains a ws connection. Intitialized with a callback function that gets called when messages are received on this socket instance.
Method signatures and docstrings:
- def initialize(se... | 3eb181152e173d5e8e5e46c2d2faeab25f11f564 | <|skeleton|>
class BaseWebSocketHandler:
"""Generic web socket handler. Estabilishes and maintains a ws connection. Intitialized with a callback function that gets called when messages are received on this socket instance."""
def initialize(self, name, callback=None, connNotify=None):
"""initialize met... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseWebSocketHandler:
"""Generic web socket handler. Estabilishes and maintains a ws connection. Intitialized with a callback function that gets called when messages are received on this socket instance."""
def initialize(self, name, callback=None, connNotify=None):
"""initialize method is called... | the_stack_v2_python_sparse | rtCommon/webSocketHandlers.py | brainiak/rt-cloud | train | 13 |
6ea8db3c1eb7a1dc3adb3ad68ea8f5e0d032479e | [
"import bisect\nres = 0\nnums_prod = []\ntmp = 1\nfor n in nums:\n tmp *= n\n nums_prod.append(tmp)\nfor i, n in enumerate(nums):\n if bisect.bisect(nums_prod[i] / n):\n res += 1\nreturn res",
"if k < 1:\n return 0\nres = 0\nwindow_prod = 1\nleft = 0\nright = 0\nwhile right < len(nums):\n c ... | <|body_start_0|>
import bisect
res = 0
nums_prod = []
tmp = 1
for n in nums:
tmp *= n
nums_prod.append(tmp)
for i, n in enumerate(nums):
if bisect.bisect(nums_prod[i] / n):
res += 1
return res
<|end_body_0|>
<|b... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSubarrayProductLessThanK_bisect(self, nums, k: int) -> int:
"""思路同和大约等于target的最短子数组 1. 滑动窗口遍历所有子数组组合,O(n)--要求小于,不好求 2. 前缀乘积+二分查找除数O(nlog(n))"""
<|body_0|>
def numSubarrayProductLessThanK(self, nums, k: int) -> int:
"""思路同和大约等于target的最短子数组 1. 滑动窗口遍历所有... | stack_v2_sparse_classes_36k_train_032253 | 2,206 | no_license | [
{
"docstring": "思路同和大约等于target的最短子数组 1. 滑动窗口遍历所有子数组组合,O(n)--要求小于,不好求 2. 前缀乘积+二分查找除数O(nlog(n))",
"name": "numSubarrayProductLessThanK_bisect",
"signature": "def numSubarrayProductLessThanK_bisect(self, nums, k: int) -> int"
},
{
"docstring": "思路同和大约等于target的最短子数组 1. 滑动窗口遍历所有子数组组合,O(n)--要求小于,窗口的子数... | 2 | stack_v2_sparse_classes_30k_train_020750 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSubarrayProductLessThanK_bisect(self, nums, k: int) -> int: 思路同和大约等于target的最短子数组 1. 滑动窗口遍历所有子数组组合,O(n)--要求小于,不好求 2. 前缀乘积+二分查找除数O(nlog(n))
- def numSubarrayProductLessThanK... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSubarrayProductLessThanK_bisect(self, nums, k: int) -> int: 思路同和大约等于target的最短子数组 1. 滑动窗口遍历所有子数组组合,O(n)--要求小于,不好求 2. 前缀乘积+二分查找除数O(nlog(n))
- def numSubarrayProductLessThanK... | c9eed637887753eb28d78cf252ea3763231e23a2 | <|skeleton|>
class Solution:
def numSubarrayProductLessThanK_bisect(self, nums, k: int) -> int:
"""思路同和大约等于target的最短子数组 1. 滑动窗口遍历所有子数组组合,O(n)--要求小于,不好求 2. 前缀乘积+二分查找除数O(nlog(n))"""
<|body_0|>
def numSubarrayProductLessThanK(self, nums, k: int) -> int:
"""思路同和大约等于target的最短子数组 1. 滑动窗口遍历所有... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numSubarrayProductLessThanK_bisect(self, nums, k: int) -> int:
"""思路同和大约等于target的最短子数组 1. 滑动窗口遍历所有子数组组合,O(n)--要求小于,不好求 2. 前缀乘积+二分查找除数O(nlog(n))"""
import bisect
res = 0
nums_prod = []
tmp = 1
for n in nums:
tmp *= n
nums_pro... | the_stack_v2_python_sparse | CODE/剑指 Offer II 009. 乘积小于 K 的子数组.py | moshlwx/leetcode | train | 5 | |
46474149d71f81d4a62389852ac87a43ffefb761 | [
"super().__init__()\nself.layers = torch.nn.ModuleList()\nassert len(kernel_sizes) == 2\nassert kernel_sizes[0] % 2 == 1\nassert kernel_sizes[1] % 2 == 1\nself.layers += [torch.nn.Sequential(getattr(torch.nn, pad)((np.prod(kernel_sizes) - 1) // 2, **pad_params), torch.nn.Conv1d(in_channels, channels, np.prod(kernel... | <|body_start_0|>
super().__init__()
self.layers = torch.nn.ModuleList()
assert len(kernel_sizes) == 2
assert kernel_sizes[0] % 2 == 1
assert kernel_sizes[1] % 2 == 1
self.layers += [torch.nn.Sequential(getattr(torch.nn, pad)((np.prod(kernel_sizes) - 1) // 2, **pad_params)... | MelGAN discriminator module. | MelGANDiscriminator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MelGANDiscriminator:
"""MelGAN discriminator module."""
def __init__(self, in_channels: int=1, out_channels: int=1, kernel_sizes: List[int]=[5, 3], channels: int=16, max_downsample_channels: int=1024, bias: bool=True, downsample_scales: List[int]=[4, 4, 4, 4], nonlinear_activation: str='Leak... | stack_v2_sparse_classes_36k_train_032254 | 16,694 | permissive | [
{
"docstring": "Initilize MelGANDiscriminator module. Args: in_channels (int): Number of input channels. out_channels (int): Number of output channels. kernel_sizes (List[int]): List of two kernel sizes. The prod will be used for the first conv layer, and the first and the second kernel sizes will be used for t... | 2 | null | Implement the Python class `MelGANDiscriminator` described below.
Class description:
MelGAN discriminator module.
Method signatures and docstrings:
- def __init__(self, in_channels: int=1, out_channels: int=1, kernel_sizes: List[int]=[5, 3], channels: int=16, max_downsample_channels: int=1024, bias: bool=True, downsa... | Implement the Python class `MelGANDiscriminator` described below.
Class description:
MelGAN discriminator module.
Method signatures and docstrings:
- def __init__(self, in_channels: int=1, out_channels: int=1, kernel_sizes: List[int]=[5, 3], channels: int=16, max_downsample_channels: int=1024, bias: bool=True, downsa... | bcd20948db7846ee523443ef9fd78c7a1248c95e | <|skeleton|>
class MelGANDiscriminator:
"""MelGAN discriminator module."""
def __init__(self, in_channels: int=1, out_channels: int=1, kernel_sizes: List[int]=[5, 3], channels: int=16, max_downsample_channels: int=1024, bias: bool=True, downsample_scales: List[int]=[4, 4, 4, 4], nonlinear_activation: str='Leak... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MelGANDiscriminator:
"""MelGAN discriminator module."""
def __init__(self, in_channels: int=1, out_channels: int=1, kernel_sizes: List[int]=[5, 3], channels: int=16, max_downsample_channels: int=1024, bias: bool=True, downsample_scales: List[int]=[4, 4, 4, 4], nonlinear_activation: str='LeakyReLU', nonli... | the_stack_v2_python_sparse | espnet2/gan_tts/melgan/melgan.py | espnet/espnet | train | 7,242 |
606d8e82bb60d92136cc352b14378f20a830c894 | [
"if LooseVersion(self.version) < LooseVersion('4.3'):\n self.cfg.update('configopts', '--enable-shared')\n if self.toolchain.options['pic']:\n self.cfg.update('configopts', '--with-pic')\n tup = (os.getenv('FFLAGS'), os.getenv('MPICC'), os.getenv('F90'))\n self.cfg.update('configopts', 'FCFLAGS=\... | <|body_start_0|>
if LooseVersion(self.version) < LooseVersion('4.3'):
self.cfg.update('configopts', '--enable-shared')
if self.toolchain.options['pic']:
self.cfg.update('configopts', '--with-pic')
tup = (os.getenv('FFLAGS'), os.getenv('MPICC'), os.getenv('F90'... | Support for building/installing netCDF | EB_netCDF | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EB_netCDF:
"""Support for building/installing netCDF"""
def configure_step(self):
"""Configure build: set config options and configure"""
<|body_0|>
def sanity_check_step(self):
"""Custom sanity check for netCDF"""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_36k_train_032255 | 4,968 | no_license | [
{
"docstring": "Configure build: set config options and configure",
"name": "configure_step",
"signature": "def configure_step(self)"
},
{
"docstring": "Custom sanity check for netCDF",
"name": "sanity_check_step",
"signature": "def sanity_check_step(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013511 | Implement the Python class `EB_netCDF` described below.
Class description:
Support for building/installing netCDF
Method signatures and docstrings:
- def configure_step(self): Configure build: set config options and configure
- def sanity_check_step(self): Custom sanity check for netCDF | Implement the Python class `EB_netCDF` described below.
Class description:
Support for building/installing netCDF
Method signatures and docstrings:
- def configure_step(self): Configure build: set config options and configure
- def sanity_check_step(self): Custom sanity check for netCDF
<|skeleton|>
class EB_netCDF:... | 3c5434f9a4193fbe4cf8107327faadda83d798ae | <|skeleton|>
class EB_netCDF:
"""Support for building/installing netCDF"""
def configure_step(self):
"""Configure build: set config options and configure"""
<|body_0|>
def sanity_check_step(self):
"""Custom sanity check for netCDF"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EB_netCDF:
"""Support for building/installing netCDF"""
def configure_step(self):
"""Configure build: set config options and configure"""
if LooseVersion(self.version) < LooseVersion('4.3'):
self.cfg.update('configopts', '--enable-shared')
if self.toolchain.options... | the_stack_v2_python_sparse | 1.11.1/easyblock/easyblocks/n/netcdf.py | lsuhpchelp/easybuild_smic | train | 0 |
7af9fee9518075024f48098091d40b0fecf9bf70 | [
"org_tag = Tags.query.filter_by(organisations=organisation_tag).one_or_none()\nif org_tag is not None:\n return org_tag.organisations\ntag = Tags()\ntag.organisations = organisation_tag\ndb.session.add(tag)\nreturn organisation_tag",
"camp_tag = Tags.query.filter_by(campaigns=campaign_tag).one_or_none()\nif ca... | <|body_start_0|>
org_tag = Tags.query.filter_by(organisations=organisation_tag).one_or_none()
if org_tag is not None:
return org_tag.organisations
tag = Tags()
tag.organisations = organisation_tag
db.session.add(tag)
return organisation_tag
<|end_body_0|>
<|b... | Describes an individual mapping Task | Tags | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Tags:
"""Describes an individual mapping Task"""
def upsert_organisation_tag(organisation_tag: str) -> str:
"""Insert organisation tag if it doesn't exists otherwise return matching tag"""
<|body_0|>
def upsert_campaign_tag(campaign_tag: str) -> str:
"""Insert ca... | stack_v2_sparse_classes_36k_train_032256 | 1,927 | permissive | [
{
"docstring": "Insert organisation tag if it doesn't exists otherwise return matching tag",
"name": "upsert_organisation_tag",
"signature": "def upsert_organisation_tag(organisation_tag: str) -> str"
},
{
"docstring": "Insert campaign tag if doesn't exist otherwise return matching tag",
"na... | 4 | stack_v2_sparse_classes_30k_train_012180 | Implement the Python class `Tags` described below.
Class description:
Describes an individual mapping Task
Method signatures and docstrings:
- def upsert_organisation_tag(organisation_tag: str) -> str: Insert organisation tag if it doesn't exists otherwise return matching tag
- def upsert_campaign_tag(campaign_tag: s... | Implement the Python class `Tags` described below.
Class description:
Describes an individual mapping Task
Method signatures and docstrings:
- def upsert_organisation_tag(organisation_tag: str) -> str: Insert organisation tag if it doesn't exists otherwise return matching tag
- def upsert_campaign_tag(campaign_tag: s... | 45bf3937c74902226096aee5b49e7abea62df524 | <|skeleton|>
class Tags:
"""Describes an individual mapping Task"""
def upsert_organisation_tag(organisation_tag: str) -> str:
"""Insert organisation tag if it doesn't exists otherwise return matching tag"""
<|body_0|>
def upsert_campaign_tag(campaign_tag: str) -> str:
"""Insert ca... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Tags:
"""Describes an individual mapping Task"""
def upsert_organisation_tag(organisation_tag: str) -> str:
"""Insert organisation tag if it doesn't exists otherwise return matching tag"""
org_tag = Tags.query.filter_by(organisations=organisation_tag).one_or_none()
if org_tag is n... | the_stack_v2_python_sparse | backend/models/postgis/tags.py | hotosm/tasking-manager | train | 526 |
73ae62b04ff853b54b2ba2c5663497fad2947d77 | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('alanbur_aquan_erj826_jcaluag', 'alanbur_aquan_erj826_jcaluag')\ncollection = repo.alanbur_aquan_erj826_jcaluag.NYaccidents\nrepo.dropCollection('alanbur_aquan_erj826_jcaluag.parseNYaccidents')\nrepo.crea... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('alanbur_aquan_erj826_jcaluag', 'alanbur_aquan_erj826_jcaluag')
collection = repo.alanbur_aquan_erj826_jcaluag.NYaccidents
repo.dropCollection('ala... | parseNYAccidents | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class parseNYAccidents:
def execute(trial=False):
"""Retrieve crime incident report information from Boston."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happening in this... | stack_v2_sparse_classes_36k_train_032257 | 4,293 | no_license | [
{
"docstring": "Retrieve crime incident report information from Boston.",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new document describing th... | 2 | null | Implement the Python class `parseNYAccidents` described below.
Class description:
Implement the parseNYAccidents class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve crime incident report information from Boston.
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): C... | Implement the Python class `parseNYAccidents` described below.
Class description:
Implement the parseNYAccidents class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve crime incident report information from Boston.
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): C... | 97e72731ffadbeae57d7a332decd58706e7c08de | <|skeleton|>
class parseNYAccidents:
def execute(trial=False):
"""Retrieve crime incident report information from Boston."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happening in this... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class parseNYAccidents:
def execute(trial=False):
"""Retrieve crime incident report information from Boston."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('alanbur_aquan_erj826_jcaluag', 'alanbur_aquan_erj826_jc... | the_stack_v2_python_sparse | alanbur_aquan_erj826_jcaluag/parseNYAccidents.py | ROODAY/course-2017-fal-proj | train | 3 | |
d6e87e3492b54bc69fb90139bcd9415c3e2a094c | [
"ring = self.coordinate_ring()\nargs = ring.arguments()\nrepr_x = self.change_ring(SR)._repr_()\nif len(args) == 1:\n return '%s |--> %s' % (args[0], repr_x)\nelse:\n args = ', '.join(map(str, args))\n return '(%s) |--> %s' % (args, repr_x)",
"from sage.misc.latex import latex\nring = self.coordinate_rin... | <|body_start_0|>
ring = self.coordinate_ring()
args = ring.arguments()
repr_x = self.change_ring(SR)._repr_()
if len(args) == 1:
return '%s |--> %s' % (args[0], repr_x)
else:
args = ', '.join(map(str, args))
return '(%s) |--> %s' % (args, repr_... | Vector_callable_symbolic_dense | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vector_callable_symbolic_dense:
def _repr_(self):
"""Returns the string representation of the vector EXAMPLES:: sage: f(u,v,w) = (2*u+v,u-w,w^2+u) sage: f (u, v, w) |--> (2*u + v, u - w, w^2 + u) sage: r(t) = (cos(t), sin(t)) sage: r t |--> (cos(t), sin(t))"""
<|body_0|>
def... | stack_v2_sparse_classes_36k_train_032258 | 3,334 | no_license | [
{
"docstring": "Returns the string representation of the vector EXAMPLES:: sage: f(u,v,w) = (2*u+v,u-w,w^2+u) sage: f (u, v, w) |--> (2*u + v, u - w, w^2 + u) sage: r(t) = (cos(t), sin(t)) sage: r t |--> (cos(t), sin(t))",
"name": "_repr_",
"signature": "def _repr_(self)"
},
{
"docstring": "Retu... | 2 | stack_v2_sparse_classes_30k_train_010638 | Implement the Python class `Vector_callable_symbolic_dense` described below.
Class description:
Implement the Vector_callable_symbolic_dense class.
Method signatures and docstrings:
- def _repr_(self): Returns the string representation of the vector EXAMPLES:: sage: f(u,v,w) = (2*u+v,u-w,w^2+u) sage: f (u, v, w) |-->... | Implement the Python class `Vector_callable_symbolic_dense` described below.
Class description:
Implement the Vector_callable_symbolic_dense class.
Method signatures and docstrings:
- def _repr_(self): Returns the string representation of the vector EXAMPLES:: sage: f(u,v,w) = (2*u+v,u-w,w^2+u) sage: f (u, v, w) |-->... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class Vector_callable_symbolic_dense:
def _repr_(self):
"""Returns the string representation of the vector EXAMPLES:: sage: f(u,v,w) = (2*u+v,u-w,w^2+u) sage: f (u, v, w) |--> (2*u + v, u - w, w^2 + u) sage: r(t) = (cos(t), sin(t)) sage: r t |--> (cos(t), sin(t))"""
<|body_0|>
def... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Vector_callable_symbolic_dense:
def _repr_(self):
"""Returns the string representation of the vector EXAMPLES:: sage: f(u,v,w) = (2*u+v,u-w,w^2+u) sage: f (u, v, w) |--> (2*u + v, u - w, w^2 + u) sage: r(t) = (cos(t), sin(t)) sage: r t |--> (cos(t), sin(t))"""
ring = self.coordinate_ring()
... | the_stack_v2_python_sparse | sage/src/sage/modules/vector_callable_symbolic_dense.py | bopopescu/geosci | train | 0 | |
8136a2f9a9f1918c102aebeb74c9a52c3b804e99 | [
"self.label = label.upper()\nself.datee = upcomming(datee)\nself.dist = cal_dist(self.datee)\nself.dist_months = cal_months(self.dist.days)\nself.date_formated = d_format(self.datee)\nself.day_of_week = day_of_week(self.datee)",
"print(f'{self.label:} {self.date_formated} {self.day_of_week}')\nprint(f'- {self.dis... | <|body_start_0|>
self.label = label.upper()
self.datee = upcomming(datee)
self.dist = cal_dist(self.datee)
self.dist_months = cal_months(self.dist.days)
self.date_formated = d_format(self.datee)
self.day_of_week = day_of_week(self.datee)
<|end_body_0|>
<|body_start_1|>
... | Event | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Event:
def __init__(self, label, datee):
"""Individual Event information"""
<|body_0|>
def display(self):
"""Displays the distance between Event date and current date"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.label = label.upper()
... | stack_v2_sparse_classes_36k_train_032259 | 3,191 | no_license | [
{
"docstring": "Individual Event information",
"name": "__init__",
"signature": "def __init__(self, label, datee)"
},
{
"docstring": "Displays the distance between Event date and current date",
"name": "display",
"signature": "def display(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018025 | Implement the Python class `Event` described below.
Class description:
Implement the Event class.
Method signatures and docstrings:
- def __init__(self, label, datee): Individual Event information
- def display(self): Displays the distance between Event date and current date | Implement the Python class `Event` described below.
Class description:
Implement the Event class.
Method signatures and docstrings:
- def __init__(self, label, datee): Individual Event information
- def display(self): Displays the distance between Event date and current date
<|skeleton|>
class Event:
def __init... | ea13e7f8151d0a10cbf5386baf21e2188bc454f9 | <|skeleton|>
class Event:
def __init__(self, label, datee):
"""Individual Event information"""
<|body_0|>
def display(self):
"""Displays the distance between Event date and current date"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Event:
def __init__(self, label, datee):
"""Individual Event information"""
self.label = label.upper()
self.datee = upcomming(datee)
self.dist = cal_dist(self.datee)
self.dist_months = cal_months(self.dist.days)
self.date_formated = d_format(self.datee)
... | the_stack_v2_python_sparse | calendar_class.py | shadowthebat/Calendar_countdown | 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_36k_train_032260 | 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_010326 | 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_36k | data/stack_v2_sparse_classes_30k | 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 |
66617fa2583b9f290ef6cc0b8dfbc3de79e900a8 | [
"print('setUp')\nself.item_code = 654\nself.description = 'table'\nself.market_price = 800\nself.rental_price = 25\nself.test_inv = inventory_class.Inventory(self.item_code, self.description, self.market_price, self.rental_price)\nself.test_inv_dict = self.test_inv.return_as_dictionary()",
"print('test_inv_creati... | <|body_start_0|>
print('setUp')
self.item_code = 654
self.description = 'table'
self.market_price = 800
self.rental_price = 25
self.test_inv = inventory_class.Inventory(self.item_code, self.description, self.market_price, self.rental_price)
self.test_inv_dict = se... | Perform tests on inventory_class module. | InventoryTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InventoryTests:
"""Perform tests on inventory_class module."""
def setUp(self):
"""Define set up characteristics of inventory tests."""
<|body_0|>
def test_inv_creation(self):
"""Compare setup dict to intended dict created."""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_36k_train_032261 | 10,660 | no_license | [
{
"docstring": "Define set up characteristics of inventory tests.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Compare setup dict to intended dict created.",
"name": "test_inv_creation",
"signature": "def test_inv_creation(self)"
}
] | 2 | null | Implement the Python class `InventoryTests` described below.
Class description:
Perform tests on inventory_class module.
Method signatures and docstrings:
- def setUp(self): Define set up characteristics of inventory tests.
- def test_inv_creation(self): Compare setup dict to intended dict created. | Implement the Python class `InventoryTests` described below.
Class description:
Perform tests on inventory_class module.
Method signatures and docstrings:
- def setUp(self): Define set up characteristics of inventory tests.
- def test_inv_creation(self): Compare setup dict to intended dict created.
<|skeleton|>
clas... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class InventoryTests:
"""Perform tests on inventory_class module."""
def setUp(self):
"""Define set up characteristics of inventory tests."""
<|body_0|>
def test_inv_creation(self):
"""Compare setup dict to intended dict created."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InventoryTests:
"""Perform tests on inventory_class module."""
def setUp(self):
"""Define set up characteristics of inventory tests."""
print('setUp')
self.item_code = 654
self.description = 'table'
self.market_price = 800
self.rental_price = 25
sel... | the_stack_v2_python_sparse | students/Reem_Alqaysi/Lesson_01/test_unit.py | JavaRod/SP_Python220B_2019 | train | 1 |
8a6f0d52d714f803465af4612c27800394cb413d | [
"super(BasicConv2d, self).__init__()\nself.conv = nn.Conv2d(in_channels, out_channels, bias=False, **kwargs)\nself.bn = nn.BatchNorm2d(out_channels, eps=0.001)",
"x = self.conv(x)\nx = self.bn(x)\nreturn F.relu(x, inplace=True)"
] | <|body_start_0|>
super(BasicConv2d, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, bias=False, **kwargs)
self.bn = nn.BatchNorm2d(out_channels, eps=0.001)
<|end_body_0|>
<|body_start_1|>
x = self.conv(x)
x = self.bn(x)
return F.relu(x, inplace=True)
<|... | Build 2D convolutionnal layer with batch normalization and relu activation function. The generated output of this neural network is a 2D tensor. Neural network structure : (basic_conv2d): (0): Conv2d(1, out_channels) (2): BatchNorm2d(out_channels, eps=1e-03) (1): ReLU(inplace=True) | BasicConv2d | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicConv2d:
"""Build 2D convolutionnal layer with batch normalization and relu activation function. The generated output of this neural network is a 2D tensor. Neural network structure : (basic_conv2d): (0): Conv2d(1, out_channels) (2): BatchNorm2d(out_channels, eps=1e-03) (1): ReLU(inplace=True... | stack_v2_sparse_classes_36k_train_032262 | 13,487 | no_license | [
{
"docstring": ":param in_channels : int, number of input channels :param out_channels : int, number of output channels",
"name": "__init__",
"signature": "def __init__(self, in_channels: int, out_channels: int, **kwargs) -> None"
},
{
"docstring": ":param x : tensor, 2D tensor",
"name": "fo... | 2 | stack_v2_sparse_classes_30k_train_011544 | Implement the Python class `BasicConv2d` described below.
Class description:
Build 2D convolutionnal layer with batch normalization and relu activation function. The generated output of this neural network is a 2D tensor. Neural network structure : (basic_conv2d): (0): Conv2d(1, out_channels) (2): BatchNorm2d(out_chan... | Implement the Python class `BasicConv2d` described below.
Class description:
Build 2D convolutionnal layer with batch normalization and relu activation function. The generated output of this neural network is a 2D tensor. Neural network structure : (basic_conv2d): (0): Conv2d(1, out_channels) (2): BatchNorm2d(out_chan... | 9189d2eeb748b1e539a1062a09a06b38a09780de | <|skeleton|>
class BasicConv2d:
"""Build 2D convolutionnal layer with batch normalization and relu activation function. The generated output of this neural network is a 2D tensor. Neural network structure : (basic_conv2d): (0): Conv2d(1, out_channels) (2): BatchNorm2d(out_channels, eps=1e-03) (1): ReLU(inplace=True... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasicConv2d:
"""Build 2D convolutionnal layer with batch normalization and relu activation function. The generated output of this neural network is a 2D tensor. Neural network structure : (basic_conv2d): (0): Conv2d(1, out_channels) (2): BatchNorm2d(out_channels, eps=1e-03) (1): ReLU(inplace=True)"""
def... | the_stack_v2_python_sparse | Simulations/helpers/model/googLeNet.py | emmahoggett/Error_class_lenstronomy | train | 1 |
a68b9565a97edec62497eafc94f3d89a1e5616cc | [
"Part = self.old_state.apps.get_model('part', 'part')\nCompany = self.old_state.apps.get_model('company', 'company')\nSupplierPart = self.old_state.apps.get_model('company', 'supplierpart')\npart = Part.objects.create(name='CAP CER 0.1UF 10V X5R 0402', description='CAP CER 0.1UF 10V X5R 0402', purchaseable=True, le... | <|body_start_0|>
Part = self.old_state.apps.get_model('part', 'part')
Company = self.old_state.apps.get_model('company', 'company')
SupplierPart = self.old_state.apps.get_model('company', 'supplierpart')
part = Part.objects.create(name='CAP CER 0.1UF 10V X5R 0402', description='CAP CER 0... | Tests for migration 0034-0037 which added and transitioned to the ManufacturerPart model. | TestManufacturerPart | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestManufacturerPart:
"""Tests for migration 0034-0037 which added and transitioned to the ManufacturerPart model."""
def prepare(self):
"""Prepare the database by adding some test data 'before' the change: - Part object - Company object (supplier) - SupplierPart object"""
<|... | stack_v2_sparse_classes_36k_train_032263 | 12,626 | permissive | [
{
"docstring": "Prepare the database by adding some test data 'before' the change: - Part object - Company object (supplier) - SupplierPart object",
"name": "prepare",
"signature": "def prepare(self)"
},
{
"docstring": "Test that the new companies have been created successfully.",
"name": "t... | 2 | null | Implement the Python class `TestManufacturerPart` described below.
Class description:
Tests for migration 0034-0037 which added and transitioned to the ManufacturerPart model.
Method signatures and docstrings:
- def prepare(self): Prepare the database by adding some test data 'before' the change: - Part object - Comp... | Implement the Python class `TestManufacturerPart` described below.
Class description:
Tests for migration 0034-0037 which added and transitioned to the ManufacturerPart model.
Method signatures and docstrings:
- def prepare(self): Prepare the database by adding some test data 'before' the change: - Part object - Comp... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class TestManufacturerPart:
"""Tests for migration 0034-0037 which added and transitioned to the ManufacturerPart model."""
def prepare(self):
"""Prepare the database by adding some test data 'before' the change: - Part object - Company object (supplier) - SupplierPart object"""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestManufacturerPart:
"""Tests for migration 0034-0037 which added and transitioned to the ManufacturerPart model."""
def prepare(self):
"""Prepare the database by adding some test data 'before' the change: - Part object - Company object (supplier) - SupplierPart object"""
Part = self.old... | the_stack_v2_python_sparse | InvenTree/company/test_migrations.py | inventree/InvenTree | train | 3,077 |
53510848269c9f1f2d9c631f9de8e5cf99e962ac | [
"super(UploaderThread, self).__init__(parent, **kwargs)\nself._snapshot = snapshot\nself._output = {'urls': dict()}",
"self._log.write('<h1>Beginning Uploads...</h1>')\nprojectData = FlexProjectData(**self._snapshot)\nfor pid, active in self._snapshot['platforms'].iteritems():\n if not active or pid in self._s... | <|body_start_0|>
super(UploaderThread, self).__init__(parent, **kwargs)
self._snapshot = snapshot
self._output = {'urls': dict()}
<|end_body_0|>
<|body_start_1|>
self._log.write('<h1>Beginning Uploads...</h1>')
projectData = FlexProjectData(**self._snapshot)
for pid, act... | A class for... | UploaderThread | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UploaderThread:
"""A class for..."""
def __init__(self, parent, snapshot, **kwargs):
"""Creates a new instance of UploaderThread."""
<|body_0|>
def _runImpl(self):
"""Doc..."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(UploaderThread, s... | stack_v2_sparse_classes_36k_train_032264 | 2,791 | no_license | [
{
"docstring": "Creates a new instance of UploaderThread.",
"name": "__init__",
"signature": "def __init__(self, parent, snapshot, **kwargs)"
},
{
"docstring": "Doc...",
"name": "_runImpl",
"signature": "def _runImpl(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014516 | Implement the Python class `UploaderThread` described below.
Class description:
A class for...
Method signatures and docstrings:
- def __init__(self, parent, snapshot, **kwargs): Creates a new instance of UploaderThread.
- def _runImpl(self): Doc... | Implement the Python class `UploaderThread` described below.
Class description:
A class for...
Method signatures and docstrings:
- def __init__(self, parent, snapshot, **kwargs): Creates a new instance of UploaderThread.
- def _runImpl(self): Doc...
<|skeleton|>
class UploaderThread:
"""A class for..."""
de... | 36ffb0fd1ef2e86c1b67feb61fd744f508b13c74 | <|skeleton|>
class UploaderThread:
"""A class for..."""
def __init__(self, parent, snapshot, **kwargs):
"""Creates a new instance of UploaderThread."""
<|body_0|>
def _runImpl(self):
"""Doc..."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UploaderThread:
"""A class for..."""
def __init__(self, parent, snapshot, **kwargs):
"""Creates a new instance of UploaderThread."""
super(UploaderThread, self).__init__(parent, **kwargs)
self._snapshot = snapshot
self._output = {'urls': dict()}
def _runImpl(self):
... | the_stack_v2_python_sparse | src/CompilerDeck/deploy/UploaderThread.py | sernst/CompilerDeck | train | 0 |
343c759d70f1c9c727773ebb2c71416c03e7b198 | [
"p_col = field.get_col(self.lhs.alias)\nif value is None:\n lookup_type, value = ('isnull', True)\nelse:\n lookup_type, value = ('exact', value)\nlookup = field.get_lookup(lookup_type)(p_col, value)\nreturn lookup.as_sql(compiler, connection)",
"if self.rhs_is_direct_value():\n sql_list, params_list = ([... | <|body_start_0|>
p_col = field.get_col(self.lhs.alias)
if value is None:
lookup_type, value = ('isnull', True)
else:
lookup_type, value = ('exact', value)
lookup = field.get_lookup(lookup_type)(p_col, value)
return lookup.as_sql(compiler, connection)
<|end... | Exact match Lookup for VirtualCompField. Tries to break the provided lookup value into its constituent parts and create a multi-part, ANDed together WHERE statement for a nice efficient lookup. | CompositeExact | [
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompositeExact:
"""Exact match Lookup for VirtualCompField. Tries to break the provided lookup value into its constituent parts and create a multi-part, ANDed together WHERE statement for a nice efficient lookup."""
def _partfield_as_sql(self, field, value, compiler, connection):
"""... | stack_v2_sparse_classes_36k_train_032265 | 17,987 | permissive | [
{
"docstring": "Return exact-match lookup `as_sql` result for the given field and value. Lookup is converted to `isnull` if value is None.",
"name": "_partfield_as_sql",
"signature": "def _partfield_as_sql(self, field, value, compiler, connection)"
},
{
"docstring": "Return an SQL tuple: sql, pa... | 2 | stack_v2_sparse_classes_30k_train_019658 | Implement the Python class `CompositeExact` described below.
Class description:
Exact match Lookup for VirtualCompField. Tries to break the provided lookup value into its constituent parts and create a multi-part, ANDed together WHERE statement for a nice efficient lookup.
Method signatures and docstrings:
- def _par... | Implement the Python class `CompositeExact` described below.
Class description:
Exact match Lookup for VirtualCompField. Tries to break the provided lookup value into its constituent parts and create a multi-part, ANDed together WHERE statement for a nice efficient lookup.
Method signatures and docstrings:
- def _par... | 9189a6cc64305a6ead4b95ca0b56d7b7ae6c87d5 | <|skeleton|>
class CompositeExact:
"""Exact match Lookup for VirtualCompField. Tries to break the provided lookup value into its constituent parts and create a multi-part, ANDed together WHERE statement for a nice efficient lookup."""
def _partfield_as_sql(self, field, value, compiler, connection):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CompositeExact:
"""Exact match Lookup for VirtualCompField. Tries to break the provided lookup value into its constituent parts and create a multi-part, ANDed together WHERE statement for a nice efficient lookup."""
def _partfield_as_sql(self, field, value, compiler, connection):
"""Return exact-... | the_stack_v2_python_sparse | django/sierra/base/fields.py | unt-libraries/catalog-api | train | 20 |
313a57e9a21b2af422dc3ee4ce281ed2d2007267 | [
"if id is None:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects\nelse:\n self.id = id",
"if list_dictionaries is None or list_dictionaries == '':\n return '[]'\nelse:\n string_repr = json.dumps(list_dictionaries)\nreturn string_repr",
"if list_objs is None:\n jsonfile.write('[]')\nelse:... | <|body_start_0|>
if id is None:
Base.__nb_objects += 1
self.id = Base.__nb_objects
else:
self.id = id
<|end_body_0|>
<|body_start_1|>
if list_dictionaries is None or list_dictionaries == '':
return '[]'
else:
string_repr = json... | Definition of the function | Base | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Base:
"""Definition of the function"""
def __init__(self, id=None):
"""Definition of the function"""
<|body_0|>
def to_json_string(list_dictionaries):
"""Definition of the function"""
<|body_1|>
def save_to_file(cls, list_objs):
"""Definition... | stack_v2_sparse_classes_36k_train_032266 | 1,566 | no_license | [
{
"docstring": "Definition of the function",
"name": "__init__",
"signature": "def __init__(self, id=None)"
},
{
"docstring": "Definition of the function",
"name": "to_json_string",
"signature": "def to_json_string(list_dictionaries)"
},
{
"docstring": "Definition of the function... | 5 | stack_v2_sparse_classes_30k_train_017494 | Implement the Python class `Base` described below.
Class description:
Definition of the function
Method signatures and docstrings:
- def __init__(self, id=None): Definition of the function
- def to_json_string(list_dictionaries): Definition of the function
- def save_to_file(cls, list_objs): Definition of the functio... | Implement the Python class `Base` described below.
Class description:
Definition of the function
Method signatures and docstrings:
- def __init__(self, id=None): Definition of the function
- def to_json_string(list_dictionaries): Definition of the function
- def save_to_file(cls, list_objs): Definition of the functio... | 35743cff63f46aae41fbcb2dcd1ce3b6af4992b4 | <|skeleton|>
class Base:
"""Definition of the function"""
def __init__(self, id=None):
"""Definition of the function"""
<|body_0|>
def to_json_string(list_dictionaries):
"""Definition of the function"""
<|body_1|>
def save_to_file(cls, list_objs):
"""Definition... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Base:
"""Definition of the function"""
def __init__(self, id=None):
"""Definition of the function"""
if id is None:
Base.__nb_objects += 1
self.id = Base.__nb_objects
else:
self.id = id
def to_json_string(list_dictionaries):
"""Defi... | the_stack_v2_python_sparse | 0x0C-python-almost_a_circle/models/base.py | toyugo/holbertonschool-higher_level_programming | train | 0 |
cc926b9e095d55720a745906bdef862fefb7069f | [
"l1 = ListNode(1)\nl1.next = ListNode(2)\nl1.next.next = ListNode(4)\nl2 = ListNode(1)\nl2.next = ListNode(3)\nl2.next.next = ListNode(4)\nsol = Solution()\nl3 = sol.mergeTwoLists(l1, l2)\nexpected_list = [1, 1, 2, 3, 4, 4]\nresult_list = l3.dump()\nself.assertEqual(expected_list, result_list)",
"l1 = ListNode(1)... | <|body_start_0|>
l1 = ListNode(1)
l1.next = ListNode(2)
l1.next.next = ListNode(4)
l2 = ListNode(1)
l2.next = ListNode(3)
l2.next.next = ListNode(4)
sol = Solution()
l3 = sol.mergeTwoLists(l1, l2)
expected_list = [1, 1, 2, 3, 4, 4]
result_l... | TestMergeTwoSortedLists | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestMergeTwoSortedLists:
def test_case_1(self):
"""Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4"""
<|body_0|>
def test_case_2(self):
"""Input: 1, 3->4 Output: 1->3->4"""
<|body_1|>
def test_case_3(self):
"""Input: None, 3->4 Output: 3->4"""
... | stack_v2_sparse_classes_36k_train_032267 | 1,380 | no_license | [
{
"docstring": "Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4",
"name": "test_case_1",
"signature": "def test_case_1(self)"
},
{
"docstring": "Input: 1, 3->4 Output: 1->3->4",
"name": "test_case_2",
"signature": "def test_case_2(self)"
},
{
"docstring": "Input: None, 3->4 Outp... | 3 | stack_v2_sparse_classes_30k_train_005183 | Implement the Python class `TestMergeTwoSortedLists` described below.
Class description:
Implement the TestMergeTwoSortedLists class.
Method signatures and docstrings:
- def test_case_1(self): Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4
- def test_case_2(self): Input: 1, 3->4 Output: 1->3->4
- def test_case_3(se... | Implement the Python class `TestMergeTwoSortedLists` described below.
Class description:
Implement the TestMergeTwoSortedLists class.
Method signatures and docstrings:
- def test_case_1(self): Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4
- def test_case_2(self): Input: 1, 3->4 Output: 1->3->4
- def test_case_3(se... | 2748c874b29f712806a21bd4dbaef6cc25c71175 | <|skeleton|>
class TestMergeTwoSortedLists:
def test_case_1(self):
"""Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4"""
<|body_0|>
def test_case_2(self):
"""Input: 1, 3->4 Output: 1->3->4"""
<|body_1|>
def test_case_3(self):
"""Input: None, 3->4 Output: 3->4"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestMergeTwoSortedLists:
def test_case_1(self):
"""Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4"""
l1 = ListNode(1)
l1.next = ListNode(2)
l1.next.next = ListNode(4)
l2 = ListNode(1)
l2.next = ListNode(3)
l2.next.next = ListNode(4)
sol = Solut... | the_stack_v2_python_sparse | merge-two-sorted-lists/testMergeTwoSortedLists.py | shaohong/algo | train | 0 | |
2958cf5f388871323e7e7193985c67c505a6fddc | [
"actions = super().get_actions(request)\nif not request.user.is_superuser:\n if 'delete_selected' in actions:\n del actions['delete_selected']\nreturn actions",
"if not hasattr(obj, 'created_by'):\n obj.created_by = request.user\nobj.updated_by = request.user\nobj.save()"
] | <|body_start_0|>
actions = super().get_actions(request)
if not request.user.is_superuser:
if 'delete_selected' in actions:
del actions['delete_selected']
return actions
<|end_body_0|>
<|body_start_1|>
if not hasattr(obj, 'created_by'):
obj.created... | Use this class as the base class for other admin classes inheriting from :class:`django.contrib.admin.ModelAdmin` if so desired | BaseAdmin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseAdmin:
"""Use this class as the base class for other admin classes inheriting from :class:`django.contrib.admin.ModelAdmin` if so desired"""
def get_actions(self, request):
"""override :meth:`django.contrib.admin.ModelAdmin.get_actions` The purpose is to only allow superusers the... | stack_v2_sparse_classes_36k_train_032268 | 3,701 | no_license | [
{
"docstring": "override :meth:`django.contrib.admin.ModelAdmin.get_actions` The purpose is to only allow superusers the privilege of deleting objects from `Django Admin Summary pages`",
"name": "get_actions",
"signature": "def get_actions(self, request)"
},
{
"docstring": "override :meth:`djang... | 2 | stack_v2_sparse_classes_30k_train_021546 | Implement the Python class `BaseAdmin` described below.
Class description:
Use this class as the base class for other admin classes inheriting from :class:`django.contrib.admin.ModelAdmin` if so desired
Method signatures and docstrings:
- def get_actions(self, request): override :meth:`django.contrib.admin.ModelAdmin... | Implement the Python class `BaseAdmin` described below.
Class description:
Use this class as the base class for other admin classes inheriting from :class:`django.contrib.admin.ModelAdmin` if so desired
Method signatures and docstrings:
- def get_actions(self, request): override :meth:`django.contrib.admin.ModelAdmin... | d96200e06cd350bdacdd6bdc59b14a6901051a59 | <|skeleton|>
class BaseAdmin:
"""Use this class as the base class for other admin classes inheriting from :class:`django.contrib.admin.ModelAdmin` if so desired"""
def get_actions(self, request):
"""override :meth:`django.contrib.admin.ModelAdmin.get_actions` The purpose is to only allow superusers the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseAdmin:
"""Use this class as the base class for other admin classes inheriting from :class:`django.contrib.admin.ModelAdmin` if so desired"""
def get_actions(self, request):
"""override :meth:`django.contrib.admin.ModelAdmin.get_actions` The purpose is to only allow superusers the privilege of... | the_stack_v2_python_sparse | p_soc_auto_base/admin.py | serbant/PHSA-SOC | train | 0 |
144beb59f7984ebcbd9ea08914127cb5c50c957c | [
"utilities.assert_arg_type(parent, Gtk.Window, arg_pos=2)\nsuper(FileChooserDialog, self).__init__(title, parent, **kwargs)\nself.parent = self.get_parent_window()",
"if not isinstance(patterns, (list, tuple)):\n patterns = (patterns,)\nnew_filter = Gtk.FileFilter()\nnew_filter.set_name(name)\nfor pattern in p... | <|body_start_0|>
utilities.assert_arg_type(parent, Gtk.Window, arg_pos=2)
super(FileChooserDialog, self).__init__(title, parent, **kwargs)
self.parent = self.get_parent_window()
<|end_body_0|>
<|body_start_1|>
if not isinstance(patterns, (list, tuple)):
patterns = (patterns,... | Display a file chooser dialog with additional convenience methods. | FileChooserDialog | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileChooserDialog:
"""Display a file chooser dialog with additional convenience methods."""
def __init__(self, title, parent, **kwargs):
""":param str title: The title for the file chooser dialog. :param parent: The parent window for the dialog. :type parent: :py:class:`Gtk.Window`""... | stack_v2_sparse_classes_36k_train_032269 | 17,407 | permissive | [
{
"docstring": ":param str title: The title for the file chooser dialog. :param parent: The parent window for the dialog. :type parent: :py:class:`Gtk.Window`",
"name": "__init__",
"signature": "def __init__(self, title, parent, **kwargs)"
},
{
"docstring": "Add a filter for displaying files, th... | 5 | stack_v2_sparse_classes_30k_train_011059 | Implement the Python class `FileChooserDialog` described below.
Class description:
Display a file chooser dialog with additional convenience methods.
Method signatures and docstrings:
- def __init__(self, title, parent, **kwargs): :param str title: The title for the file chooser dialog. :param parent: The parent wind... | Implement the Python class `FileChooserDialog` described below.
Class description:
Display a file chooser dialog with additional convenience methods.
Method signatures and docstrings:
- def __init__(self, title, parent, **kwargs): :param str title: The title for the file chooser dialog. :param parent: The parent wind... | 1bbc1bf122a18085b1ea4af20c9af10cc4cf899e | <|skeleton|>
class FileChooserDialog:
"""Display a file chooser dialog with additional convenience methods."""
def __init__(self, title, parent, **kwargs):
""":param str title: The title for the file chooser dialog. :param parent: The parent window for the dialog. :type parent: :py:class:`Gtk.Window`""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileChooserDialog:
"""Display a file chooser dialog with additional convenience methods."""
def __init__(self, title, parent, **kwargs):
""":param str title: The title for the file chooser dialog. :param parent: The parent window for the dialog. :type parent: :py:class:`Gtk.Window`"""
uti... | the_stack_v2_python_sparse | king_phisher/client/widget/extras.py | rsmusllp/king-phisher | train | 1,018 |
7bceab939a8265584bd1adf10752916c79ae4d1d | [
"user = obj.user\nserializer = UserSerializer(data=user, many=False)\nreturn serializer.data",
"items = obj.order_set.all()\nserializer = OrderSerializer(data=items, many=True)\nreturn serializer.data",
"try:\n address = ShippingAddressSerializer(data=obj.shipping_address, many=False)\nexcept:\n address =... | <|body_start_0|>
user = obj.user
serializer = UserSerializer(data=user, many=False)
return serializer.data
<|end_body_0|>
<|body_start_1|>
items = obj.order_set.all()
serializer = OrderSerializer(data=items, many=True)
return serializer.data
<|end_body_1|>
<|body_start_... | CartSerializerTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CartSerializerTest:
def get_user(self, obj):
"""Returns the user data. Obj = user object?"""
<|body_0|>
def get_orders(self, obj):
"""Returns the customer's orders in their cart. Obj = orders object?"""
<|body_1|>
def get_shipping_address(self, obj):
... | stack_v2_sparse_classes_36k_train_032270 | 9,517 | no_license | [
{
"docstring": "Returns the user data. Obj = user object?",
"name": "get_user",
"signature": "def get_user(self, obj)"
},
{
"docstring": "Returns the customer's orders in their cart. Obj = orders object?",
"name": "get_orders",
"signature": "def get_orders(self, obj)"
},
{
"docst... | 3 | stack_v2_sparse_classes_30k_train_016537 | Implement the Python class `CartSerializerTest` described below.
Class description:
Implement the CartSerializerTest class.
Method signatures and docstrings:
- def get_user(self, obj): Returns the user data. Obj = user object?
- def get_orders(self, obj): Returns the customer's orders in their cart. Obj = orders obje... | Implement the Python class `CartSerializerTest` described below.
Class description:
Implement the CartSerializerTest class.
Method signatures and docstrings:
- def get_user(self, obj): Returns the user data. Obj = user object?
- def get_orders(self, obj): Returns the customer's orders in their cart. Obj = orders obje... | 317b6359a666e9b8ea2247ae5c63e5062e75aac4 | <|skeleton|>
class CartSerializerTest:
def get_user(self, obj):
"""Returns the user data. Obj = user object?"""
<|body_0|>
def get_orders(self, obj):
"""Returns the customer's orders in their cart. Obj = orders object?"""
<|body_1|>
def get_shipping_address(self, obj):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CartSerializerTest:
def get_user(self, obj):
"""Returns the user data. Obj = user object?"""
user = obj.user
serializer = UserSerializer(data=user, many=False)
return serializer.data
def get_orders(self, obj):
"""Returns the customer's orders in their cart. Obj = o... | the_stack_v2_python_sparse | api/serializers.py | Niyamas/wagtail_react_ecommerce_tutorial | train | 0 | |
9186dc6ed98133340bf9202c8c1797f1aa90a9f4 | [
"if diff == Difficulty.TRIVIAL:\n return InfiniteHealth()\nif diff == Difficulty.NORMAL:\n return Health(100, 0.1)\nif diff == Difficulty.HARD:\n return OneHealth()\nreturn None",
"super().__init__(containers=play_screen.get_containers('PLAYER', 'ENTITY'), image=self.sprite_image, start=start, health=sel... | <|body_start_0|>
if diff == Difficulty.TRIVIAL:
return InfiniteHealth()
if diff == Difficulty.NORMAL:
return Health(100, 0.1)
if diff == Difficulty.HARD:
return OneHealth()
return None
<|end_body_0|>
<|body_start_1|>
super().__init__(container... | The player entity for the game | Player | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Player:
"""The player entity for the game"""
def health_from_difficulty(diff):
"""Creates the player's health, given the difficulty"""
<|body_0|>
def __init__(self, play_screen, start, diff=Difficulty.NORMAL):
"""Creates the Player"""
<|body_1|>
def ... | stack_v2_sparse_classes_36k_train_032271 | 2,970 | no_license | [
{
"docstring": "Creates the player's health, given the difficulty",
"name": "health_from_difficulty",
"signature": "def health_from_difficulty(diff)"
},
{
"docstring": "Creates the Player",
"name": "__init__",
"signature": "def __init__(self, play_screen, start, diff=Difficulty.NORMAL)"
... | 3 | stack_v2_sparse_classes_30k_train_013158 | Implement the Python class `Player` described below.
Class description:
The player entity for the game
Method signatures and docstrings:
- def health_from_difficulty(diff): Creates the player's health, given the difficulty
- def __init__(self, play_screen, start, diff=Difficulty.NORMAL): Creates the Player
- def upda... | Implement the Python class `Player` described below.
Class description:
The player entity for the game
Method signatures and docstrings:
- def health_from_difficulty(diff): Creates the player's health, given the difficulty
- def __init__(self, play_screen, start, diff=Difficulty.NORMAL): Creates the Player
- def upda... | 8604a243baeecdd393a54c18bf2ff9e003b4b8a0 | <|skeleton|>
class Player:
"""The player entity for the game"""
def health_from_difficulty(diff):
"""Creates the player's health, given the difficulty"""
<|body_0|>
def __init__(self, play_screen, start, diff=Difficulty.NORMAL):
"""Creates the Player"""
<|body_1|>
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Player:
"""The player entity for the game"""
def health_from_difficulty(diff):
"""Creates the player's health, given the difficulty"""
if diff == Difficulty.TRIVIAL:
return InfiniteHealth()
if diff == Difficulty.NORMAL:
return Health(100, 0.1)
if di... | the_stack_v2_python_sparse | src/sprite/player.py | ZXQYC/random-shooter-game | train | 0 |
64906c9f91f86359cf91a96914a424bd13a0ce0d | [
"xl = len(matrix)\nif not xl:\n return\nyl = len(matrix[0])\nif not yl:\n return\nself.s = [[0] * yl for i in range(xl)]\nc = [0] * yl\nfor i in range(xl):\n for j in range(yl):\n c[j] += matrix[i][j]\n self.s[i][j] = (self.s[i][j - 1] if j else 0) + c[j]",
"ans = self.s[row2][col2]\nif row... | <|body_start_0|>
xl = len(matrix)
if not xl:
return
yl = len(matrix[0])
if not yl:
return
self.s = [[0] * yl for i in range(xl)]
c = [0] * yl
for i in range(xl):
for j in range(yl):
c[j] += matrix[i][j]
... | MaxQuadTree | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MaxQuadTree:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
"""sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :... | stack_v2_sparse_classes_36k_train_032272 | 1,020 | no_license | [
{
"docstring": "initialize your data structure here. :type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": "sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :type row2: int :type col2: int :rtyp... | 2 | null | Implement the Python class `MaxQuadTree` described below.
Class description:
Implement the MaxQuadTree class.
Method signatures and docstrings:
- def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,c... | Implement the Python class `MaxQuadTree` described below.
Class description:
Implement the MaxQuadTree class.
Method signatures and docstrings:
- def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,c... | e1a9ce5d9b8fe4bd11e50bd1d5ba1933de845db7 | <|skeleton|>
class MaxQuadTree:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
"""sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MaxQuadTree:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
xl = len(matrix)
if not xl:
return
yl = len(matrix[0])
if not yl:
return
self.s = [[0] * yl for i in range(xl)]
c = ... | the_stack_v2_python_sparse | python/304.py | scturtle/leetcode-sol | train | 1 | |
68b3b9bcee3eaf1fa2cb5464179da71fa131a197 | [
"self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]",
"while len(self.x_values) < self.num_points:\n x_direction = choice([1])\n x_distsnce = choice([0, 1, 2, 3, 4, 5, 6, 7, 8])\n x_step = x_direction * x_distsnce\n y_direction = choice([1, -1])\n y_distsnce = choice([0, 1, 2, 3... | <|body_start_0|>
self.num_points = num_points
self.x_values = [0]
self.y_values = [0]
<|end_body_0|>
<|body_start_1|>
while len(self.x_values) < self.num_points:
x_direction = choice([1])
x_distsnce = choice([0, 1, 2, 3, 4, 5, 6, 7, 8])
x_step = x_dir... | Класс для гененрации случайных блужданий | RandomWalk | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomWalk:
"""Класс для гененрации случайных блужданий"""
def __init__(self, num_points=5000):
"""Инициализирует атрибуты блуждания"""
<|body_0|>
def fill_walk(self):
"""Вычесляет все точки блуждания"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_032273 | 1,467 | no_license | [
{
"docstring": "Инициализирует атрибуты блуждания",
"name": "__init__",
"signature": "def __init__(self, num_points=5000)"
},
{
"docstring": "Вычесляет все точки блуждания",
"name": "fill_walk",
"signature": "def fill_walk(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005911 | Implement the Python class `RandomWalk` described below.
Class description:
Класс для гененрации случайных блужданий
Method signatures and docstrings:
- def __init__(self, num_points=5000): Инициализирует атрибуты блуждания
- def fill_walk(self): Вычесляет все точки блуждания | Implement the Python class `RandomWalk` described below.
Class description:
Класс для гененрации случайных блужданий
Method signatures and docstrings:
- def __init__(self, num_points=5000): Инициализирует атрибуты блуждания
- def fill_walk(self): Вычесляет все точки блуждания
<|skeleton|>
class RandomWalk:
"""Кл... | 80f302074e5fef48fb40e72f7d79ab4b8658b38a | <|skeleton|>
class RandomWalk:
"""Класс для гененрации случайных блужданий"""
def __init__(self, num_points=5000):
"""Инициализирует атрибуты блуждания"""
<|body_0|>
def fill_walk(self):
"""Вычесляет все точки блуждания"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomWalk:
"""Класс для гененрации случайных блужданий"""
def __init__(self, num_points=5000):
"""Инициализирует атрибуты блуждания"""
self.num_points = num_points
self.x_values = [0]
self.y_values = [0]
def fill_walk(self):
"""Вычесляет все точки блуждания""... | the_stack_v2_python_sparse | part_2/visualization/random/random_walk_1.py | anton1k/python_crash_course | train | 0 |
f502e1458a2372b927aaccd64e4a9575cd39ac14 | [
"try:\n value = self[key]\nexcept KeyError:\n if default is self.__marker:\n raise\n return default\nelse:\n del self[key]\n return value",
"try:\n key = next(iter(self))\nexcept StopIteration:\n raise KeyError\nvalue = self[key]\ndel self[key]\nreturn (key, value)",
"try:\n while... | <|body_start_0|>
try:
value = self[key]
except KeyError:
if default is self.__marker:
raise
return default
else:
del self[key]
return value
<|end_body_0|>
<|body_start_1|>
try:
key = next(iter(self))... | MutableMapping | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MutableMapping:
def pop(self, key, default=__marker):
"""D.pop(k[,d]) => v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised."""
<|body_0|>
def popitem(self):
"""D.popitem() => (k, v), ... | stack_v2_sparse_classes_36k_train_032274 | 4,598 | permissive | [
{
"docstring": "D.pop(k[,d]) => v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.",
"name": "pop",
"signature": "def pop(self, key, default=__marker)"
},
{
"docstring": "D.popitem() => (k, v), remove and return ... | 5 | null | Implement the Python class `MutableMapping` described below.
Class description:
Implement the MutableMapping class.
Method signatures and docstrings:
- def pop(self, key, default=__marker): D.pop(k[,d]) => v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwi... | Implement the Python class `MutableMapping` described below.
Class description:
Implement the MutableMapping class.
Method signatures and docstrings:
- def pop(self, key, default=__marker): D.pop(k[,d]) => v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwi... | 486e2e9332553240bcbd80e100d26bff58071709 | <|skeleton|>
class MutableMapping:
def pop(self, key, default=__marker):
"""D.pop(k[,d]) => v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised."""
<|body_0|>
def popitem(self):
"""D.popitem() => (k, v), ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MutableMapping:
def pop(self, key, default=__marker):
"""D.pop(k[,d]) => v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised."""
try:
value = self[key]
except KeyError:
if default ... | the_stack_v2_python_sparse | src/compas/datastructures/_mutablemapping.py | compas-dev/compas | train | 286 | |
8d13ac41a96cc93851d962ccfcedcc3f06e71bc6 | [
"control = GPIOControl(self.mudpi, config)\nif control:\n self.add_component(control)\nreturn True",
"if not isinstance(config, list):\n config = [config]\nfor conf in config:\n if conf.get('key') is None:\n raise ConfigError('Missing `key` in example control.')\n if conf.get('pin') is None:\n ... | <|body_start_0|>
control = GPIOControl(self.mudpi, config)
if control:
self.add_component(control)
return True
<|end_body_0|>
<|body_start_1|>
if not isinstance(config, list):
config = [config]
for conf in config:
if conf.get('key') is None:
... | Interface | [
"BSD-4-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Interface:
def load(self, config):
"""Load GPIO control component from configs"""
<|body_0|>
def validate(self, config):
"""Validate the control config"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
control = GPIOControl(self.mudpi, config)
... | stack_v2_sparse_classes_36k_train_032275 | 5,886 | permissive | [
{
"docstring": "Load GPIO control component from configs",
"name": "load",
"signature": "def load(self, config)"
},
{
"docstring": "Validate the control config",
"name": "validate",
"signature": "def validate(self, config)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005466 | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load GPIO control component from configs
- def validate(self, config): Validate the control config | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load GPIO control component from configs
- def validate(self, config): Validate the control config
<|skeleton|>
class Interface:
def load(self, co... | fb206b1136f529c7197f1e6b29629ed05630d377 | <|skeleton|>
class Interface:
def load(self, config):
"""Load GPIO control component from configs"""
<|body_0|>
def validate(self, config):
"""Validate the control config"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Interface:
def load(self, config):
"""Load GPIO control component from configs"""
control = GPIOControl(self.mudpi, config)
if control:
self.add_component(control)
return True
def validate(self, config):
"""Validate the control config"""
if not ... | the_stack_v2_python_sparse | mudpi/extensions/gpio/control.py | mistasp0ck/mudpi-core | train | 0 | |
053fc0a105d269fb6af68df8167b248347ece6e2 | [
"dev = self.selectedDevice(c)\ndiodeMonitorReturnString = (yield dev.query('TVAL? 0'))\ntemperatures = [float(x) * units.K for x in diodeMonitorReturnString.strip('\\x00').split(',')][:2]\nreturnValue(temperatures)",
"dev = self.selectedDevice(c)\ndev.write('*CLS')\ndiodeMonitorReturnString = (yield dev.query('VO... | <|body_start_0|>
dev = self.selectedDevice(c)
diodeMonitorReturnString = (yield dev.query('TVAL? 0'))
temperatures = [float(x) * units.K for x in diodeMonitorReturnString.strip('\x00').split(',')][:2]
returnValue(temperatures)
<|end_body_0|>
<|body_start_1|>
dev = self.selectedD... | Provides basic control for SRS SIM922 Diode Temperature Monitor Module | SIM922Server | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SIM922Server:
"""Provides basic control for SRS SIM922 Diode Temperature Monitor Module"""
def getDiodeTemperatures(self, c):
"""Get the temperatures of the Si Diode Thermometers connected to the first two slots of the SIM922."""
<|body_0|>
def getMagnetVoltage(self, c):... | stack_v2_sparse_classes_36k_train_032276 | 2,599 | no_license | [
{
"docstring": "Get the temperatures of the Si Diode Thermometers connected to the first two slots of the SIM922.",
"name": "getDiodeTemperatures",
"signature": "def getDiodeTemperatures(self, c)"
},
{
"docstring": "Get the voltage across the magnet. Two values are measured (third and fourth slo... | 2 | null | Implement the Python class `SIM922Server` described below.
Class description:
Provides basic control for SRS SIM922 Diode Temperature Monitor Module
Method signatures and docstrings:
- def getDiodeTemperatures(self, c): Get the temperatures of the Si Diode Thermometers connected to the first two slots of the SIM922.
... | Implement the Python class `SIM922Server` described below.
Class description:
Provides basic control for SRS SIM922 Diode Temperature Monitor Module
Method signatures and docstrings:
- def getDiodeTemperatures(self, c): Get the temperatures of the Si Diode Thermometers connected to the first two slots of the SIM922.
... | 6f041503ff9967e7ed52cfb619d9cc21d66b5ad6 | <|skeleton|>
class SIM922Server:
"""Provides basic control for SRS SIM922 Diode Temperature Monitor Module"""
def getDiodeTemperatures(self, c):
"""Get the temperatures of the Si Diode Thermometers connected to the first two slots of the SIM922."""
<|body_0|>
def getMagnetVoltage(self, c):... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SIM922Server:
"""Provides basic control for SRS SIM922 Diode Temperature Monitor Module"""
def getDiodeTemperatures(self, c):
"""Get the temperatures of the Si Diode Thermometers connected to the first two slots of the SIM922."""
dev = self.selectedDevice(c)
diodeMonitorReturnStri... | the_stack_v2_python_sparse | instruments/gpibdevices/sim/sim_922_diode_temp_monitor.py | McDermott-Group/servers | train | 0 |
f530e7b40769dacb5cf9565b85f536fe2337e97f | [
"left = self.help(nums, target, True)\nif left == len(nums) or nums[left] != target:\n return [-1, -1]\nreturn [left, self.help(nums, target, False) - 1]",
"l = 0\nr = len(nums)\nwhile l < r:\n mid = (l + r) // 2\n if nums[mid] > target or (vis and target == nums[mid]):\n r = mid\n else:\n ... | <|body_start_0|>
left = self.help(nums, target, True)
if left == len(nums) or nums[left] != target:
return [-1, -1]
return [left, self.help(nums, target, False) - 1]
<|end_body_0|>
<|body_start_1|>
l = 0
r = len(nums)
while l < r:
mid = (l + r) //... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def searchRange(self, nums, target):
"""排序数组查找某个元素始末位置"""
<|body_0|>
def help(self, nums, target, vis):
"""vis判断递归哪个区间"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
left = self.help(nums, target, True)
if left == len(nums) or num... | stack_v2_sparse_classes_36k_train_032277 | 1,242 | no_license | [
{
"docstring": "排序数组查找某个元素始末位置",
"name": "searchRange",
"signature": "def searchRange(self, nums, target)"
},
{
"docstring": "vis判断递归哪个区间",
"name": "help",
"signature": "def help(self, nums, target, vis)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchRange(self, nums, target): 排序数组查找某个元素始末位置
- def help(self, nums, target, vis): vis判断递归哪个区间 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchRange(self, nums, target): 排序数组查找某个元素始末位置
- def help(self, nums, target, vis): vis判断递归哪个区间
<|skeleton|>
class Solution:
def searchRange(self, nums, target):
... | a3872425745425f8ca960840120f06de4a8370bb | <|skeleton|>
class Solution:
def searchRange(self, nums, target):
"""排序数组查找某个元素始末位置"""
<|body_0|>
def help(self, nums, target, vis):
"""vis判断递归哪个区间"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def searchRange(self, nums, target):
"""排序数组查找某个元素始末位置"""
left = self.help(nums, target, True)
if left == len(nums) or nums[left] != target:
return [-1, -1]
return [left, self.help(nums, target, False) - 1]
def help(self, nums, target, vis):
"... | the_stack_v2_python_sparse | leetcode_排序数组查找某个元素始末位置.py | xiaozuo7/algorithm_python | train | 1 | |
dd5071dfaeef377a0a095b58e503bc7af420c903 | [
"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 AdGroupFeed service. Service to manage ad group feeds. | AdGroupFeedServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdGroupFeedServiceServicer:
"""Proto file describing the AdGroupFeed service. Service to manage ad group feeds."""
def GetAdGroupFeed(self, request, context):
"""Returns the requested ad group feed in full detail."""
<|body_0|>
def MutateAdGroupFeeds(self, request, conte... | stack_v2_sparse_classes_36k_train_032278 | 5,536 | permissive | [
{
"docstring": "Returns the requested ad group feed in full detail.",
"name": "GetAdGroupFeed",
"signature": "def GetAdGroupFeed(self, request, context)"
},
{
"docstring": "Creates, updates, or removes ad group feeds. Operation statuses are returned.",
"name": "MutateAdGroupFeeds",
"sign... | 2 | stack_v2_sparse_classes_30k_train_013994 | Implement the Python class `AdGroupFeedServiceServicer` described below.
Class description:
Proto file describing the AdGroupFeed service. Service to manage ad group feeds.
Method signatures and docstrings:
- def GetAdGroupFeed(self, request, context): Returns the requested ad group feed in full detail.
- def MutateA... | Implement the Python class `AdGroupFeedServiceServicer` described below.
Class description:
Proto file describing the AdGroupFeed service. Service to manage ad group feeds.
Method signatures and docstrings:
- def GetAdGroupFeed(self, request, context): Returns the requested ad group feed in full detail.
- def MutateA... | a5b6cede64f4d9912ae6ad26927a54e40448c9fe | <|skeleton|>
class AdGroupFeedServiceServicer:
"""Proto file describing the AdGroupFeed service. Service to manage ad group feeds."""
def GetAdGroupFeed(self, request, context):
"""Returns the requested ad group feed in full detail."""
<|body_0|>
def MutateAdGroupFeeds(self, request, conte... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdGroupFeedServiceServicer:
"""Proto file describing the AdGroupFeed service. Service to manage ad group feeds."""
def GetAdGroupFeed(self, request, context):
"""Returns the requested ad group feed in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_deta... | the_stack_v2_python_sparse | google/ads/google_ads/v5/proto/services/ad_group_feed_service_pb2_grpc.py | fiboknacky/google-ads-python | train | 0 |
881417ed40147b934579f46cd6fecf7404fb4fe9 | [
"for m in self:\n if hasattr(m, 'condition') and m is not self:\n cast(Callable, m.condition)(z)",
"for nm, m in self.named_children():\n try:\n if hasattr(m, 'condition') and z is not None:\n x = m(x, z)\n else:\n x = m(x)\n except Exception as e:\n rais... | <|body_start_0|>
for m in self:
if hasattr(m, 'condition') and m is not self:
cast(Callable, m.condition)(z)
<|end_body_0|>
<|body_start_1|>
for nm, m in self.named_children():
try:
if hasattr(m, 'condition') and z is not None:
... | An extension to torch's Sequential that allows conditioning either as a second forward argument or `condition()` | CondSeq | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CondSeq:
"""An extension to torch's Sequential that allows conditioning either as a second forward argument or `condition()`"""
def condition(self, z: Any) -> None:
"""Conditions all the layers on z Args: z: conditioning"""
<|body_0|>
def forward(self, x: Any, z: Optiona... | stack_v2_sparse_classes_36k_train_032279 | 1,123 | permissive | [
{
"docstring": "Conditions all the layers on z Args: z: conditioning",
"name": "condition",
"signature": "def condition(self, z: Any) -> None"
},
{
"docstring": "Forward pass Args: x: input z (optional): conditioning. condition() must be called first if left None",
"name": "forward",
"si... | 2 | stack_v2_sparse_classes_30k_val_000109 | Implement the Python class `CondSeq` described below.
Class description:
An extension to torch's Sequential that allows conditioning either as a second forward argument or `condition()`
Method signatures and docstrings:
- def condition(self, z: Any) -> None: Conditions all the layers on z Args: z: conditioning
- def ... | Implement the Python class `CondSeq` described below.
Class description:
An extension to torch's Sequential that allows conditioning either as a second forward argument or `condition()`
Method signatures and docstrings:
- def condition(self, z: Any) -> None: Conditions all the layers on z Args: z: conditioning
- def ... | 3b09ea9a4cfa195aa78dcac676aab1c43815bd53 | <|skeleton|>
class CondSeq:
"""An extension to torch's Sequential that allows conditioning either as a second forward argument or `condition()`"""
def condition(self, z: Any) -> None:
"""Conditions all the layers on z Args: z: conditioning"""
<|body_0|>
def forward(self, x: Any, z: Optiona... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CondSeq:
"""An extension to torch's Sequential that allows conditioning either as a second forward argument or `condition()`"""
def condition(self, z: Any) -> None:
"""Conditions all the layers on z Args: z: conditioning"""
for m in self:
if hasattr(m, 'condition') and m is no... | the_stack_v2_python_sparse | torchelie/nn/condseq.py | Vermeille/Torchelie | train | 124 |
dafeb5ffc6685f724a581d5e9d23054b7d161d71 | [
"pos_bboxes_list = [res.pos_bboxes for res in sampling_results]\nneg_bboxes_list = [res.neg_bboxes for res in sampling_results]\npos_gt_bboxes_list = [res.pos_gt_bboxes for res in sampling_results]\npos_gt_labels_list = [res.pos_gt_labels for res in sampling_results]\nlabels, label_weights, bbox_targets, bbox_weigh... | <|body_start_0|>
pos_bboxes_list = [res.pos_bboxes for res in sampling_results]
neg_bboxes_list = [res.neg_bboxes for res in sampling_results]
pos_gt_bboxes_list = [res.pos_gt_bboxes for res in sampling_results]
pos_gt_labels_list = [res.pos_gt_labels for res in sampling_results]
... | CustomConvFCBBoxHead class for OTX. | CustomConvFCBBoxHead | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomConvFCBBoxHead:
"""CustomConvFCBBoxHead class for OTX."""
def get_targets(self, sampling_results, gt_bboxes, gt_labels, img_metas, rcnn_train_cfg, concat=True):
"""Calculate the ground truth for all samples in a batch according to the sampling_results. Almost the same as the im... | stack_v2_sparse_classes_36k_train_032280 | 8,559 | permissive | [
{
"docstring": "Calculate the ground truth for all samples in a batch according to the sampling_results. Almost the same as the implementation in bbox_head, we passed additional parameters pos_inds_list and neg_inds_list to `_get_target_single` function. Args: sampling_results (List[obj:SamplingResults]): Assig... | 2 | stack_v2_sparse_classes_30k_test_000127 | Implement the Python class `CustomConvFCBBoxHead` described below.
Class description:
CustomConvFCBBoxHead class for OTX.
Method signatures and docstrings:
- def get_targets(self, sampling_results, gt_bboxes, gt_labels, img_metas, rcnn_train_cfg, concat=True): Calculate the ground truth for all samples in a batch acc... | Implement the Python class `CustomConvFCBBoxHead` described below.
Class description:
CustomConvFCBBoxHead class for OTX.
Method signatures and docstrings:
- def get_targets(self, sampling_results, gt_bboxes, gt_labels, img_metas, rcnn_train_cfg, concat=True): Calculate the ground truth for all samples in a batch acc... | 80454808b38727e358e8b880043eeac0f18152fb | <|skeleton|>
class CustomConvFCBBoxHead:
"""CustomConvFCBBoxHead class for OTX."""
def get_targets(self, sampling_results, gt_bboxes, gt_labels, img_metas, rcnn_train_cfg, concat=True):
"""Calculate the ground truth for all samples in a batch according to the sampling_results. Almost the same as the im... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CustomConvFCBBoxHead:
"""CustomConvFCBBoxHead class for OTX."""
def get_targets(self, sampling_results, gt_bboxes, gt_labels, img_metas, rcnn_train_cfg, concat=True):
"""Calculate the ground truth for all samples in a batch according to the sampling_results. Almost the same as the implementation ... | the_stack_v2_python_sparse | src/otx/algorithms/detection/adapters/mmdet/models/heads/custom_roi_head.py | openvinotoolkit/training_extensions | train | 397 |
ea3829b37dfa42eaae190f67f4ef45a05c5d5b02 | [
"len_nums = len(nums)\nans = [-1] * len_nums\nstack = []\nfor i, n in enumerate(nums + nums):\n while stack and nums[stack[-1]] < n:\n ans[stack.pop()] = n\n stack.append(i % len_nums)\nreturn ans",
"ans = [-1] * len(nums)\nstack = []\nfor i, n in enumerate(nums):\n while stack and nums[stack[-1]]... | <|body_start_0|>
len_nums = len(nums)
ans = [-1] * len_nums
stack = []
for i, n in enumerate(nums + nums):
while stack and nums[stack[-1]] < n:
ans[stack.pop()] = n
stack.append(i % len_nums)
return ans
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def nextGreaterElements(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def nextGreaterElementsWhyButFaster(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
len_n... | stack_v2_sparse_classes_36k_train_032281 | 1,061 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "nextGreaterElements",
"signature": "def nextGreaterElements(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "nextGreaterElementsWhyButFaster",
"signature": "def nextGreaterElementsWhyButF... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextGreaterElements(self, nums): :type nums: List[int] :rtype: List[int]
- def nextGreaterElementsWhyButFaster(self, nums): :type nums: List[int] :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextGreaterElements(self, nums): :type nums: List[int] :rtype: List[int]
- def nextGreaterElementsWhyButFaster(self, nums): :type nums: List[int] :rtype: List[int]
<|skeleto... | ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd | <|skeleton|>
class Solution:
def nextGreaterElements(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def nextGreaterElementsWhyButFaster(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def nextGreaterElements(self, nums):
""":type nums: List[int] :rtype: List[int]"""
len_nums = len(nums)
ans = [-1] * len_nums
stack = []
for i, n in enumerate(nums + nums):
while stack and nums[stack[-1]] < n:
ans[stack.pop()] = n
... | the_stack_v2_python_sparse | cs_notes/stack_n_queue/next_greater_element_ii.py | hwc1824/LeetCodeSolution | train | 0 | |
0ebbfdefe772bd1a23b3db776b623643f0203fd5 | [
"if not parsername:\n parsername = ADStxtToREFs\nTXTtoREFs.__init__(self, filename, buffer, parsername)",
"references = []\nfor raw_block_references in self.raw_references:\n bibcode = raw_block_references['bibcode']\n block_references = raw_block_references['block_references']\n item_nums = raw_block... | <|body_start_0|>
if not parsername:
parsername = ADStxtToREFs
TXTtoREFs.__init__(self, filename, buffer, parsername)
<|end_body_0|>
<|body_start_1|>
references = []
for raw_block_references in self.raw_references:
bibcode = raw_block_references['bibcode']
... | ADStxtToREFs | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ADStxtToREFs:
def __init__(self, filename, buffer, parsername=None):
""":param filename: :param buffer:"""
<|body_0|>
def process_and_dispatch(self):
"""this function does reference cleaning and then calls the parser :return:"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_032282 | 18,702 | permissive | [
{
"docstring": ":param filename: :param buffer:",
"name": "__init__",
"signature": "def __init__(self, filename, buffer, parsername=None)"
},
{
"docstring": "this function does reference cleaning and then calls the parser :return:",
"name": "process_and_dispatch",
"signature": "def proce... | 2 | stack_v2_sparse_classes_30k_val_000412 | Implement the Python class `ADStxtToREFs` described below.
Class description:
Implement the ADStxtToREFs class.
Method signatures and docstrings:
- def __init__(self, filename, buffer, parsername=None): :param filename: :param buffer:
- def process_and_dispatch(self): this function does reference cleaning and then ca... | Implement the Python class `ADStxtToREFs` described below.
Class description:
Implement the ADStxtToREFs class.
Method signatures and docstrings:
- def __init__(self, filename, buffer, parsername=None): :param filename: :param buffer:
- def process_and_dispatch(self): this function does reference cleaning and then ca... | d41ed17b3b2fd7f5ae2deb48243f530cf7f494ee | <|skeleton|>
class ADStxtToREFs:
def __init__(self, filename, buffer, parsername=None):
""":param filename: :param buffer:"""
<|body_0|>
def process_and_dispatch(self):
"""this function does reference cleaning and then calls the parser :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ADStxtToREFs:
def __init__(self, filename, buffer, parsername=None):
""":param filename: :param buffer:"""
if not parsername:
parsername = ADStxtToREFs
TXTtoREFs.__init__(self, filename, buffer, parsername)
def process_and_dispatch(self):
"""this function does ... | the_stack_v2_python_sparse | adsrefpipe/refparsers/ADStxt.py | golnazads/ADSReferencePipeline | train | 1 | |
43ccaf36ecb7dea27eee44547953a2f66a424aef | [
"self.name = name\nself.time_begin = time_begin\nself.time_end = time_end",
"if self.time_begin > self.time_end:\n begin_message = 'The begining time {} seconds is higher than'.format(self.time_begin)\n end_message = ' the ending time {} seconds.'.format(self.time_end)\nelse:\n begin_message = 'The video... | <|body_start_0|>
self.name = name
self.time_begin = time_begin
self.time_end = time_end
<|end_body_0|>
<|body_start_1|>
if self.time_begin > self.time_end:
begin_message = 'The begining time {} seconds is higher than'.format(self.time_begin)
end_message = ' the e... | The exception class error to tell that the time or the number of image is not possible | TimeError | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimeError:
"""The exception class error to tell that the time or the number of image is not possible"""
def __init__(self, name, time_begin, time_end):
"""Args: name (string): name of the video. time_begin (integer in second): the first image will be at the second 'time'. time_end (i... | stack_v2_sparse_classes_36k_train_032283 | 2,261 | no_license | [
{
"docstring": "Args: name (string): name of the video. time_begin (integer in second): the first image will be at the second 'time'. time_end (integer in second): the final time at which we can_stop to register the video.",
"name": "__init__",
"signature": "def __init__(self, name, time_begin, time_end... | 2 | stack_v2_sparse_classes_30k_train_011729 | Implement the Python class `TimeError` described below.
Class description:
The exception class error to tell that the time or the number of image is not possible
Method signatures and docstrings:
- def __init__(self, name, time_begin, time_end): Args: name (string): name of the video. time_begin (integer in second): ... | Implement the Python class `TimeError` described below.
Class description:
The exception class error to tell that the time or the number of image is not possible
Method signatures and docstrings:
- def __init__(self, name, time_begin, time_end): Args: name (string): name of the video. time_begin (integer in second): ... | 237ca81580db43525d8945017c0565b9722046ad | <|skeleton|>
class TimeError:
"""The exception class error to tell that the time or the number of image is not possible"""
def __init__(self, name, time_begin, time_end):
"""Args: name (string): name of the video. time_begin (integer in second): the first image will be at the second 'time'. time_end (i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TimeError:
"""The exception class error to tell that the time or the number of image is not possible"""
def __init__(self, name, time_begin, time_end):
"""Args: name (string): name of the video. time_begin (integer in second): the first image will be at the second 'time'. time_end (integer in sec... | the_stack_v2_python_sparse | src/d0_utils/extractions/exceptions/exception_classes.py | remingtonCarmi/TrackingSwimmingENPC | train | 0 |
dd131b4529eceb1fb14c02010b498f83e901062d | [
"self.g = g\nself.visited = [False] * self.g.get_size()\nself.vertex_group = [0] * self.g.get_size()",
"if self.visited[v]:\n return\nself.visited[v] = True\nself.vertex_group[v] = group\nfor vertex in self.g.adj(v):\n self.dfs(vertex, group)",
"group = 0\nfor i in range(len(self.visited)):\n if not se... | <|body_start_0|>
self.g = g
self.visited = [False] * self.g.get_size()
self.vertex_group = [0] * self.g.get_size()
<|end_body_0|>
<|body_start_1|>
if self.visited[v]:
return
self.visited[v] = True
self.vertex_group[v] = group
for vertex in self.g.adj(... | class to compute connected components of given graph | ConnectedComponents | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConnectedComponents:
"""class to compute connected components of given graph"""
def __init__(self, g: Graph):
"""init with a graph :param g: Graph"""
<|body_0|>
def dfs(self, v: int, group: int):
"""dfs to mark components from the same group Complexity O(E + V) :... | stack_v2_sparse_classes_36k_train_032284 | 1,418 | no_license | [
{
"docstring": "init with a graph :param g: Graph",
"name": "__init__",
"signature": "def __init__(self, g: Graph)"
},
{
"docstring": "dfs to mark components from the same group Complexity O(E + V) :param v: starting vertex :param group: current group number",
"name": "dfs",
"signature":... | 4 | stack_v2_sparse_classes_30k_train_018892 | Implement the Python class `ConnectedComponents` described below.
Class description:
class to compute connected components of given graph
Method signatures and docstrings:
- def __init__(self, g: Graph): init with a graph :param g: Graph
- def dfs(self, v: int, group: int): dfs to mark components from the same group ... | Implement the Python class `ConnectedComponents` described below.
Class description:
class to compute connected components of given graph
Method signatures and docstrings:
- def __init__(self, g: Graph): init with a graph :param g: Graph
- def dfs(self, v: int, group: int): dfs to mark components from the same group ... | e24f1a422a998672d1e78ba6bc23dfa5836e3a51 | <|skeleton|>
class ConnectedComponents:
"""class to compute connected components of given graph"""
def __init__(self, g: Graph):
"""init with a graph :param g: Graph"""
<|body_0|>
def dfs(self, v: int, group: int):
"""dfs to mark components from the same group Complexity O(E + V) :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConnectedComponents:
"""class to compute connected components of given graph"""
def __init__(self, g: Graph):
"""init with a graph :param g: Graph"""
self.g = g
self.visited = [False] * self.g.get_size()
self.vertex_group = [0] * self.g.get_size()
def dfs(self, v: int... | the_stack_v2_python_sparse | graphs/connected_components.py | mkozel92/algos_py | train | 1 |
a5a42b8dcf8571fac52efec2de04c7effb43d400 | [
"try:\n return CustomPlugin\nexcept NameError:\n return None",
"custom_plugin = cls.custom_plugin()\nif custom_plugin is not None:\n plugin_ = custom_plugin.get(operation, plugin)\n if plugin_ is not None:\n return plugin_\nif operation in Plugin._map:\n if plugin in Plugin._map[operation]:\... | <|body_start_0|>
try:
return CustomPlugin
except NameError:
return None
<|end_body_0|>
<|body_start_1|>
custom_plugin = cls.custom_plugin()
if custom_plugin is not None:
plugin_ = custom_plugin.get(operation, plugin)
if plugin_ is not None... | This class implements the Plugin class. | Plugin | [
"BSD-3-Clause-Clear"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Plugin:
"""This class implements the Plugin class."""
def custom_plugin(cls):
"""This method returns CustomPlugin if defined. :rtype: CustomPlugin"""
<|body_0|>
def get(cls, operation, plugin='default'):
"""This method returns a plugin for an operation and name. ... | stack_v2_sparse_classes_36k_train_032285 | 5,411 | permissive | [
{
"docstring": "This method returns CustomPlugin if defined. :rtype: CustomPlugin",
"name": "custom_plugin",
"signature": "def custom_plugin(cls)"
},
{
"docstring": "This method returns a plugin for an operation and name. :param str operation: The operation name. :param str plugin: The plugin na... | 2 | null | Implement the Python class `Plugin` described below.
Class description:
This class implements the Plugin class.
Method signatures and docstrings:
- def custom_plugin(cls): This method returns CustomPlugin if defined. :rtype: CustomPlugin
- def get(cls, operation, plugin='default'): This method returns a plugin for an... | Implement the Python class `Plugin` described below.
Class description:
This class implements the Plugin class.
Method signatures and docstrings:
- def custom_plugin(cls): This method returns CustomPlugin if defined. :rtype: CustomPlugin
- def get(cls, operation, plugin='default'): This method returns a plugin for an... | fe0fe12317975104fa6ff6c058d141f11e6e951d | <|skeleton|>
class Plugin:
"""This class implements the Plugin class."""
def custom_plugin(cls):
"""This method returns CustomPlugin if defined. :rtype: CustomPlugin"""
<|body_0|>
def get(cls, operation, plugin='default'):
"""This method returns a plugin for an operation and name. ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Plugin:
"""This class implements the Plugin class."""
def custom_plugin(cls):
"""This method returns CustomPlugin if defined. :rtype: CustomPlugin"""
try:
return CustomPlugin
except NameError:
return None
def get(cls, operation, plugin='default'):
... | the_stack_v2_python_sparse | deepstar/plugins/plugin.py | lcsouzamenezes/deepstar | train | 0 |
89e1dcaae000d2b8234ce4a318aa8615326e26aa | [
"x_shape = [300, 10]\ntargets = np.random.random_sample(x_shape).astype(np.float32)\nlogits = np.random.randn(*x_shape).astype(np.float32)\nweighted_loss = util.weighted_sigmoid_cross_entropy_with_logits(targets, logits)\nexpected_loss = tf.contrib.nn.deprecated_flipped_sigmoid_cross_entropy_with_logits(logits, tar... | <|body_start_0|>
x_shape = [300, 10]
targets = np.random.random_sample(x_shape).astype(np.float32)
logits = np.random.randn(*x_shape).astype(np.float32)
weighted_loss = util.weighted_sigmoid_cross_entropy_with_logits(targets, logits)
expected_loss = tf.contrib.nn.deprecated_flipp... | WeightedSigmoidCrossEntropyTest | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeightedSigmoidCrossEntropyTest:
def testTrivialCompatibilityWithSigmoidCrossEntropy(self):
"""Tests compatibility with unweighted function with weight 1.0."""
<|body_0|>
def testNonTrivialCompatibilityWithSigmoidCrossEntropy(self):
"""Tests use of an arbitrary weigh... | stack_v2_sparse_classes_36k_train_032286 | 13,413 | permissive | [
{
"docstring": "Tests compatibility with unweighted function with weight 1.0.",
"name": "testTrivialCompatibilityWithSigmoidCrossEntropy",
"signature": "def testTrivialCompatibilityWithSigmoidCrossEntropy(self)"
},
{
"docstring": "Tests use of an arbitrary weight (4.12).",
"name": "testNonTr... | 6 | null | Implement the Python class `WeightedSigmoidCrossEntropyTest` described below.
Class description:
Implement the WeightedSigmoidCrossEntropyTest class.
Method signatures and docstrings:
- def testTrivialCompatibilityWithSigmoidCrossEntropy(self): Tests compatibility with unweighted function with weight 1.0.
- def testN... | Implement the Python class `WeightedSigmoidCrossEntropyTest` described below.
Class description:
Implement the WeightedSigmoidCrossEntropyTest class.
Method signatures and docstrings:
- def testTrivialCompatibilityWithSigmoidCrossEntropy(self): Tests compatibility with unweighted function with weight 1.0.
- def testN... | a115d918f6894a69586174653172be0b5d1de952 | <|skeleton|>
class WeightedSigmoidCrossEntropyTest:
def testTrivialCompatibilityWithSigmoidCrossEntropy(self):
"""Tests compatibility with unweighted function with weight 1.0."""
<|body_0|>
def testNonTrivialCompatibilityWithSigmoidCrossEntropy(self):
"""Tests use of an arbitrary weigh... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WeightedSigmoidCrossEntropyTest:
def testTrivialCompatibilityWithSigmoidCrossEntropy(self):
"""Tests compatibility with unweighted function with weight 1.0."""
x_shape = [300, 10]
targets = np.random.random_sample(x_shape).astype(np.float32)
logits = np.random.randn(*x_shape).a... | the_stack_v2_python_sparse | models/research/global_objectives/util_test.py | finnickniu/tensorflow_object_detection_tflite | train | 60 | |
696750e4d5bfae81463edd0318b501a49948a0a2 | [
"if flt.shape != msk.shape:\n raise Exception('model and data must have same shape')\nmsk[:] = flt[:]\nmsk[:, :, 0] = 0.0",
"if flt.shape != msk.shape:\n raise Exception('model and data must have same shape')\nflt[:] = msk[:]\nflt[:, :, 0] = 0.0"
] | <|body_start_0|>
if flt.shape != msk.shape:
raise Exception('model and data must have same shape')
msk[:] = flt[:]
msk[:, :, 0] = 0.0
<|end_body_0|>
<|body_start_1|>
if flt.shape != msk.shape:
raise Exception('model and data must have same shape')
flt[:] ... | Mask operator for not updating the zero lag coefficient | peflv2dmask | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class peflv2dmask:
"""Mask operator for not updating the zero lag coefficient"""
def forward(self, add, flt, msk):
"""Applies the mask to the filter"""
<|body_0|>
def adjoint(self, add, flt, msk):
"""Applies adjoint mask"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_032287 | 9,076 | no_license | [
{
"docstring": "Applies the mask to the filter",
"name": "forward",
"signature": "def forward(self, add, flt, msk)"
},
{
"docstring": "Applies adjoint mask",
"name": "adjoint",
"signature": "def adjoint(self, add, flt, msk)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003457 | Implement the Python class `peflv2dmask` described below.
Class description:
Mask operator for not updating the zero lag coefficient
Method signatures and docstrings:
- def forward(self, add, flt, msk): Applies the mask to the filter
- def adjoint(self, add, flt, msk): Applies adjoint mask | Implement the Python class `peflv2dmask` described below.
Class description:
Mask operator for not updating the zero lag coefficient
Method signatures and docstrings:
- def forward(self, add, flt, msk): Applies the mask to the filter
- def adjoint(self, add, flt, msk): Applies adjoint mask
<|skeleton|>
class peflv2d... | db8c81f6a98cd665a493b54099eae1d28ee092e7 | <|skeleton|>
class peflv2dmask:
"""Mask operator for not updating the zero lag coefficient"""
def forward(self, add, flt, msk):
"""Applies the mask to the filter"""
<|body_0|>
def adjoint(self, add, flt, msk):
"""Applies adjoint mask"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class peflv2dmask:
"""Mask operator for not updating the zero lag coefficient"""
def forward(self, add, flt, msk):
"""Applies the mask to the filter"""
if flt.shape != msk.shape:
raise Exception('model and data must have same shape')
msk[:] = flt[:]
msk[:, :, 0] = 0.... | the_stack_v2_python_sparse | adf/adf/nstat/peflv2d.py | ke0m/process_f3_data | train | 1 |
9c8e734370a81fa28df6d3bb54ecb730a079a5c5 | [
"if not isinstance(items, list):\n items = [items]\nfor item in items:\n item.sync_ad_campaigns()\nreturn redirect('adcampaignview/list/')",
"if not isinstance(items, list):\n items = [items]\nitems[0].sync_all_ad_sets()\nreturn redirect('adsetview/list/')",
"if not isinstance(items, list):\n items ... | <|body_start_0|>
if not isinstance(items, list):
items = [items]
for item in items:
item.sync_ad_campaigns()
return redirect('adcampaignview/list/')
<|end_body_0|>
<|body_start_1|>
if not isinstance(items, list):
items = [items]
items[0].sync_... | View For Facebook AdAccount Model. | AdAccountView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdAccountView:
"""View For Facebook AdAccount Model."""
def sync_ad_campaigns(self, items):
"""Call sync_ad_accounts."""
<|body_0|>
def sync_all_ad_sets(self, items):
"""Call sync_all_ad_sets."""
<|body_1|>
def sync_all_ads(self, items):
"""C... | stack_v2_sparse_classes_36k_train_032288 | 5,227 | permissive | [
{
"docstring": "Call sync_ad_accounts.",
"name": "sync_ad_campaigns",
"signature": "def sync_ad_campaigns(self, items)"
},
{
"docstring": "Call sync_all_ad_sets.",
"name": "sync_all_ad_sets",
"signature": "def sync_all_ad_sets(self, items)"
},
{
"docstring": "Call sync_all_ad_set... | 4 | null | Implement the Python class `AdAccountView` described below.
Class description:
View For Facebook AdAccount Model.
Method signatures and docstrings:
- def sync_ad_campaigns(self, items): Call sync_ad_accounts.
- def sync_all_ad_sets(self, items): Call sync_all_ad_sets.
- def sync_all_ads(self, items): Call sync_all_ad... | Implement the Python class `AdAccountView` described below.
Class description:
View For Facebook AdAccount Model.
Method signatures and docstrings:
- def sync_ad_campaigns(self, items): Call sync_ad_accounts.
- def sync_all_ad_sets(self, items): Call sync_all_ad_sets.
- def sync_all_ads(self, items): Call sync_all_ad... | e268c22ffb479b9f2b65be0aa66b51e825eb78c5 | <|skeleton|>
class AdAccountView:
"""View For Facebook AdAccount Model."""
def sync_ad_campaigns(self, items):
"""Call sync_ad_accounts."""
<|body_0|>
def sync_all_ad_sets(self, items):
"""Call sync_all_ad_sets."""
<|body_1|>
def sync_all_ads(self, items):
"""C... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdAccountView:
"""View For Facebook AdAccount Model."""
def sync_ad_campaigns(self, items):
"""Call sync_ad_accounts."""
if not isinstance(items, list):
items = [items]
for item in items:
item.sync_ad_campaigns()
return redirect('adcampaignview/list... | the_stack_v2_python_sparse | connectors/fb_ads/views/fb.py | woakes070048/bit | train | 0 |
d166f0e62667805b2c28b3eabb466e23329e3dde | [
"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 Campaign Budget service. Service to manage campaign budgets. | CampaignBudgetServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CampaignBudgetServiceServicer:
"""Proto file describing the Campaign Budget service. Service to manage campaign budgets."""
def GetCampaignBudget(self, request, context):
"""Returns the requested Campaign Budget in full detail."""
<|body_0|>
def MutateCampaignBudgets(sel... | stack_v2_sparse_classes_36k_train_032289 | 5,659 | permissive | [
{
"docstring": "Returns the requested Campaign Budget in full detail.",
"name": "GetCampaignBudget",
"signature": "def GetCampaignBudget(self, request, context)"
},
{
"docstring": "Creates, updates, or removes campaign budgets. Operation statuses are returned.",
"name": "MutateCampaignBudget... | 2 | stack_v2_sparse_classes_30k_train_013604 | Implement the Python class `CampaignBudgetServiceServicer` described below.
Class description:
Proto file describing the Campaign Budget service. Service to manage campaign budgets.
Method signatures and docstrings:
- def GetCampaignBudget(self, request, context): Returns the requested Campaign Budget in full detail.... | Implement the Python class `CampaignBudgetServiceServicer` described below.
Class description:
Proto file describing the Campaign Budget service. Service to manage campaign budgets.
Method signatures and docstrings:
- def GetCampaignBudget(self, request, context): Returns the requested Campaign Budget in full detail.... | 969eff5b6c3cec59d21191fa178cffb6270074c3 | <|skeleton|>
class CampaignBudgetServiceServicer:
"""Proto file describing the Campaign Budget service. Service to manage campaign budgets."""
def GetCampaignBudget(self, request, context):
"""Returns the requested Campaign Budget in full detail."""
<|body_0|>
def MutateCampaignBudgets(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CampaignBudgetServiceServicer:
"""Proto file describing the Campaign Budget service. Service to manage campaign budgets."""
def GetCampaignBudget(self, request, context):
"""Returns the requested Campaign Budget in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
co... | the_stack_v2_python_sparse | google/ads/google_ads/v6/proto/services/campaign_budget_service_pb2_grpc.py | VincentFritzsche/google-ads-python | train | 0 |
e83474f30a5e4ded4c5f0ae91bc63f76cf65e815 | [
"cnt = 0\nl = set()\nfor i in range(len(nums) - 1):\n for n in range(i + 1, len(nums)):\n if abs(nums[i] - nums[n]) == k:\n if nums[i] not in l or nums[n] not in l:\n cnt += 1\n l.add(nums[i])\n l.add(nums[n])\nreturn cnt",
"nums.sort()\ncomp = {}\... | <|body_start_0|>
cnt = 0
l = set()
for i in range(len(nums) - 1):
for n in range(i + 1, len(nums)):
if abs(nums[i] - nums[n]) == k:
if nums[i] not in l or nums[n] not in l:
cnt += 1
l.add(nums[i])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findPairs(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def findPairs2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
def findPairs3(self, nums, k):
""":type nums: L... | stack_v2_sparse_classes_36k_train_032290 | 1,441 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "findPairs",
"signature": "def findPairs(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "findPairs2",
"signature": "def findPairs2(self, nums, k)"
},
{
"docstring... | 3 | stack_v2_sparse_classes_30k_train_018289 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findPairs(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def findPairs2(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def findPairs3(self... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findPairs(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def findPairs2(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def findPairs3(self... | b925bb22d1daa4a56c5a238a5758a926905559b4 | <|skeleton|>
class Solution:
def findPairs(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def findPairs2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
def findPairs3(self, nums, k):
""":type nums: L... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findPairs(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
cnt = 0
l = set()
for i in range(len(nums) - 1):
for n in range(i + 1, len(nums)):
if abs(nums[i] - nums[n]) == k:
if nums[i] not in l or... | the_stack_v2_python_sparse | 532. K-diff Pairs in an Array.py | beninghton/notGivenUpToG | train | 0 | |
d875cd8a89ee40608fe99b35121796a26f34229d | [
"self.database_copy_info_list = database_copy_info_list\nself.guid = guid\nself.name = name",
"if dictionary is None:\n return None\ndatabase_copy_info_list = None\nif dictionary.get('databaseCopyInfoList') != None:\n database_copy_info_list = list()\n for structure in dictionary.get('databaseCopyInfoLis... | <|body_start_0|>
self.database_copy_info_list = database_copy_info_list
self.guid = guid
self.name = name
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
database_copy_info_list = None
if dictionary.get('databaseCopyInfoList') != None:
... | Implementation of the 'ExchangeDAGDatabase' model. Specifies the information about all the copies of the database that is part of DAG. Attributes: database_copy_info_list (list of ExchangeDatabaseCopyInfo): Specifies about all the copies of this DAG database. This include active and passive copy of the database. guid (... | ExchangeDAGDatabase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExchangeDAGDatabase:
"""Implementation of the 'ExchangeDAGDatabase' model. Specifies the information about all the copies of the database that is part of DAG. Attributes: database_copy_info_list (list of ExchangeDatabaseCopyInfo): Specifies about all the copies of this DAG database. This include ... | stack_v2_sparse_classes_36k_train_032291 | 2,372 | permissive | [
{
"docstring": "Constructor for the ExchangeDAGDatabase class",
"name": "__init__",
"signature": "def __init__(self, database_copy_info_list=None, guid=None, name=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representat... | 2 | null | Implement the Python class `ExchangeDAGDatabase` described below.
Class description:
Implementation of the 'ExchangeDAGDatabase' model. Specifies the information about all the copies of the database that is part of DAG. Attributes: database_copy_info_list (list of ExchangeDatabaseCopyInfo): Specifies about all the cop... | Implement the Python class `ExchangeDAGDatabase` described below.
Class description:
Implementation of the 'ExchangeDAGDatabase' model. Specifies the information about all the copies of the database that is part of DAG. Attributes: database_copy_info_list (list of ExchangeDatabaseCopyInfo): Specifies about all the cop... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ExchangeDAGDatabase:
"""Implementation of the 'ExchangeDAGDatabase' model. Specifies the information about all the copies of the database that is part of DAG. Attributes: database_copy_info_list (list of ExchangeDatabaseCopyInfo): Specifies about all the copies of this DAG database. This include ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExchangeDAGDatabase:
"""Implementation of the 'ExchangeDAGDatabase' model. Specifies the information about all the copies of the database that is part of DAG. Attributes: database_copy_info_list (list of ExchangeDatabaseCopyInfo): Specifies about all the copies of this DAG database. This include active and pa... | the_stack_v2_python_sparse | cohesity_management_sdk/models/exchange_dag_database.py | cohesity/management-sdk-python | train | 24 |
48495827d4f139c6463ed0a004e9465dab3f2da0 | [
"schema = EmployeeSchema()\nemployee = Employee.get_by_id(employee_id)\nif not employee:\n return (dict(status='fail', message=f'Employee with id {employee_id} not found'), 404)\nemployee_data, errors = schema.dumps(employee)\nif errors:\n return (dict(status='fail', message=errors), 500)\nreturn (dict(status... | <|body_start_0|>
schema = EmployeeSchema()
employee = Employee.get_by_id(employee_id)
if not employee:
return (dict(status='fail', message=f'Employee with id {employee_id} not found'), 404)
employee_data, errors = schema.dumps(employee)
if errors:
return (... | EmployeeDetailView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmployeeDetailView:
def get(self, employee_id):
"""Getting individual employee"""
<|body_0|>
def patch(self, employee_id):
"""Update a single employee"""
<|body_1|>
def delete(self, employee_id):
"""Delete a single employee"""
<|body_2|>
... | stack_v2_sparse_classes_36k_train_032292 | 3,201 | no_license | [
{
"docstring": "Getting individual employee",
"name": "get",
"signature": "def get(self, employee_id)"
},
{
"docstring": "Update a single employee",
"name": "patch",
"signature": "def patch(self, employee_id)"
},
{
"docstring": "Delete a single employee",
"name": "delete",
... | 3 | stack_v2_sparse_classes_30k_train_018298 | Implement the Python class `EmployeeDetailView` described below.
Class description:
Implement the EmployeeDetailView class.
Method signatures and docstrings:
- def get(self, employee_id): Getting individual employee
- def patch(self, employee_id): Update a single employee
- def delete(self, employee_id): Delete a sin... | Implement the Python class `EmployeeDetailView` described below.
Class description:
Implement the EmployeeDetailView class.
Method signatures and docstrings:
- def get(self, employee_id): Getting individual employee
- def patch(self, employee_id): Update a single employee
- def delete(self, employee_id): Delete a sin... | 015d70b8f79df6c1a5629add35767cee52f424f5 | <|skeleton|>
class EmployeeDetailView:
def get(self, employee_id):
"""Getting individual employee"""
<|body_0|>
def patch(self, employee_id):
"""Update a single employee"""
<|body_1|>
def delete(self, employee_id):
"""Delete a single employee"""
<|body_2|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EmployeeDetailView:
def get(self, employee_id):
"""Getting individual employee"""
schema = EmployeeSchema()
employee = Employee.get_by_id(employee_id)
if not employee:
return (dict(status='fail', message=f'Employee with id {employee_id} not found'), 404)
emp... | the_stack_v2_python_sparse | app/controllers/employee.py | MutegekiHenry/project-cohort-backend | train | 0 | |
d4c0d4ff846a926227104b93cf336e4f7a8d740c | [
"with Database() as db:\n if id_city_type is None and is_active is None:\n data = db.query(Table).all()\n elif id_city_type is None:\n data = db.query(Table).filter(Table.is_active == is_active).all()\n else:\n data = db.query(Table).get(id_city_type)\nreturn {'data': data}",
"if sel... | <|body_start_0|>
with Database() as db:
if id_city_type is None and is_active is None:
data = db.query(Table).all()
elif id_city_type is None:
data = db.query(Table).filter(Table.is_active == is_active).all()
else:
data = db.que... | CityType | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CityType:
def get(self, id_city_type=None, is_active=None):
"""Return all information for city type :param id_city_type: UUID :param is_active: BOOLEAN"""
<|body_0|>
def create(self, body):
"""Create a new city type :param body: { name: JSON }"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_032293 | 2,313 | no_license | [
{
"docstring": "Return all information for city type :param id_city_type: UUID :param is_active: BOOLEAN",
"name": "get",
"signature": "def get(self, id_city_type=None, is_active=None)"
},
{
"docstring": "Create a new city type :param body: { name: JSON }",
"name": "create",
"signature":... | 4 | null | Implement the Python class `CityType` described below.
Class description:
Implement the CityType class.
Method signatures and docstrings:
- def get(self, id_city_type=None, is_active=None): Return all information for city type :param id_city_type: UUID :param is_active: BOOLEAN
- def create(self, body): Create a new ... | Implement the Python class `CityType` described below.
Class description:
Implement the CityType class.
Method signatures and docstrings:
- def get(self, id_city_type=None, is_active=None): Return all information for city type :param id_city_type: UUID :param is_active: BOOLEAN
- def create(self, body): Create a new ... | 43bd57c466a5cd3b133ddc437cb4a6b9f007d267 | <|skeleton|>
class CityType:
def get(self, id_city_type=None, is_active=None):
"""Return all information for city type :param id_city_type: UUID :param is_active: BOOLEAN"""
<|body_0|>
def create(self, body):
"""Create a new city type :param body: { name: JSON }"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CityType:
def get(self, id_city_type=None, is_active=None):
"""Return all information for city type :param id_city_type: UUID :param is_active: BOOLEAN"""
with Database() as db:
if id_city_type is None and is_active is None:
data = db.query(Table).all()
... | the_stack_v2_python_sparse | resturls/citytype.py | CAUCA-9-1-1/survip-api | train | 1 | |
0de9c6985ccb43cc8bc5776368c163243b92dcc1 | [
"pages = super().paginate_queryset(queryset, request, view=view)\nself.recordsExist = queryset.filter(exists=True).count()\nreturn pages",
"response = super().get_paginated_response(data)\nresponse.data['recordsExist'] = self.recordsExist if self.recordsExist else 0\nreturn response"
] | <|body_start_0|>
pages = super().paginate_queryset(queryset, request, view=view)
self.recordsExist = queryset.filter(exists=True).count()
return pages
<|end_body_0|>
<|body_start_1|>
response = super().get_paginated_response(data)
response.data['recordsExist'] = self.recordsExis... | Custom paginator which adds `recordsExist` to json context. | Paginator | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Paginator:
"""Custom paginator which adds `recordsExist` to json context."""
def paginate_queryset(self, queryset, request, view=None):
"""Paginates queryset and sets `recordsExist`."""
<|body_0|>
def get_paginated_response(self, data):
"""Renders respons and add... | stack_v2_sparse_classes_36k_train_032294 | 1,031 | permissive | [
{
"docstring": "Paginates queryset and sets `recordsExist`.",
"name": "paginate_queryset",
"signature": "def paginate_queryset(self, queryset, request, view=None)"
},
{
"docstring": "Renders respons and adds `recordsExist` to response data.",
"name": "get_paginated_response",
"signature"... | 2 | null | Implement the Python class `Paginator` described below.
Class description:
Custom paginator which adds `recordsExist` to json context.
Method signatures and docstrings:
- def paginate_queryset(self, queryset, request, view=None): Paginates queryset and sets `recordsExist`.
- def get_paginated_response(self, data): Re... | Implement the Python class `Paginator` described below.
Class description:
Custom paginator which adds `recordsExist` to json context.
Method signatures and docstrings:
- def paginate_queryset(self, queryset, request, view=None): Paginates queryset and sets `recordsExist`.
- def get_paginated_response(self, data): Re... | 75c06748f3d59332a84ec1b5794c215c5974a46f | <|skeleton|>
class Paginator:
"""Custom paginator which adds `recordsExist` to json context."""
def paginate_queryset(self, queryset, request, view=None):
"""Paginates queryset and sets `recordsExist`."""
<|body_0|>
def get_paginated_response(self, data):
"""Renders respons and add... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Paginator:
"""Custom paginator which adds `recordsExist` to json context."""
def paginate_queryset(self, queryset, request, view=None):
"""Paginates queryset and sets `recordsExist`."""
pages = super().paginate_queryset(queryset, request, view=view)
self.recordsExist = queryset.fi... | the_stack_v2_python_sparse | lattedb/project/formfac/rest/pagination.py | callat-qcd/lattedb | train | 1 |
f7afa6e58023edd9127289644c31de2a9538f499 | [
"super().__init__(config=config, timezone=timezone, logger=logger)\nif not api_url:\n self.api_url = 'https://api.uezo.net/mecab/parse'\n self.logger.warning('Do not use default API URL for the production environment. This is for trial use only. Install MeCab and use MeCabTagger instead.')\nelse:\n self.ap... | <|body_start_0|>
super().__init__(config=config, timezone=timezone, logger=logger)
if not api_url:
self.api_url = 'https://api.uezo.net/mecab/parse'
self.logger.warning('Do not use default API URL for the production environment. This is for trial use only. Install MeCab and use M... | Tagger using mecab-service Attributes ---------- config : minette.Config Configuration timezone : pytz.timezone Timezone logger : logging.Logger Logger api_url : str URL for MeCabService API | MeCabServiceTagger | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MeCabServiceTagger:
"""Tagger using mecab-service Attributes ---------- config : minette.Config Configuration timezone : pytz.timezone Timezone logger : logging.Logger Logger api_url : str URL for MeCabService API"""
def __init__(self, config=None, timezone=None, logger=None, *, api_url=None... | stack_v2_sparse_classes_36k_train_032295 | 3,495 | permissive | [
{
"docstring": "Parameters ---------- config : Config, default None Configuration timezone : timezone, default None Timezone logger : Logger, default None Logger api_url : str, default None URL for MeCabService API. If None trial URL is used.",
"name": "__init__",
"signature": "def __init__(self, config... | 2 | null | Implement the Python class `MeCabServiceTagger` described below.
Class description:
Tagger using mecab-service Attributes ---------- config : minette.Config Configuration timezone : pytz.timezone Timezone logger : logging.Logger Logger api_url : str URL for MeCabService API
Method signatures and docstrings:
- def __i... | Implement the Python class `MeCabServiceTagger` described below.
Class description:
Tagger using mecab-service Attributes ---------- config : minette.Config Configuration timezone : pytz.timezone Timezone logger : logging.Logger Logger api_url : str URL for MeCabService API
Method signatures and docstrings:
- def __i... | dd8cd7d244b6e6e4133c8e73d637ded8a8c6846f | <|skeleton|>
class MeCabServiceTagger:
"""Tagger using mecab-service Attributes ---------- config : minette.Config Configuration timezone : pytz.timezone Timezone logger : logging.Logger Logger api_url : str URL for MeCabService API"""
def __init__(self, config=None, timezone=None, logger=None, *, api_url=None... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MeCabServiceTagger:
"""Tagger using mecab-service Attributes ---------- config : minette.Config Configuration timezone : pytz.timezone Timezone logger : logging.Logger Logger api_url : str URL for MeCabService API"""
def __init__(self, config=None, timezone=None, logger=None, *, api_url=None, **kwargs):
... | the_stack_v2_python_sparse | minette/tagger/mecabservice.py | uezo/minette-python | train | 33 |
6de916fb17caf7136b22033461b2ececfa2bfcdf | [
"data = super()._from_dict_transform(data)\nif 'verified' in data:\n data['is_verified'] = data.pop('verified')\nif 'verification_code' in data:\n del data['verification_code']\nreturn data",
"if 'is_verified' in data:\n data['verified'] = data.pop('is_verified')\ndata = super()._to_dict_transform(data)\... | <|body_start_0|>
data = super()._from_dict_transform(data)
if 'verified' in data:
data['is_verified'] = data.pop('verified')
if 'verification_code' in data:
del data['verification_code']
return data
<|end_body_0|>
<|body_start_1|>
if 'is_verified' in data... | Elements that can be verified or not. | VerifiedElement | [
"BSD-2-Clause-Views"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VerifiedElement:
"""Elements that can be verified or not."""
def _from_dict_transform(cls: Type[TVerifiedElementSubclass], data: Dict[str, Any]) -> Dict[str, Any]:
"""Transform data received in eduid format into pythonic format."""
<|body_0|>
def _to_dict_transform(self,... | stack_v2_sparse_classes_36k_train_032296 | 18,109 | permissive | [
{
"docstring": "Transform data received in eduid format into pythonic format.",
"name": "_from_dict_transform",
"signature": "def _from_dict_transform(cls: Type[TVerifiedElementSubclass], data: Dict[str, Any]) -> Dict[str, Any]"
},
{
"docstring": "Transform data kept in pythonic format into edui... | 2 | stack_v2_sparse_classes_30k_train_018678 | Implement the Python class `VerifiedElement` described below.
Class description:
Elements that can be verified or not.
Method signatures and docstrings:
- def _from_dict_transform(cls: Type[TVerifiedElementSubclass], data: Dict[str, Any]) -> Dict[str, Any]: Transform data received in eduid format into pythonic format... | Implement the Python class `VerifiedElement` described below.
Class description:
Elements that can be verified or not.
Method signatures and docstrings:
- def _from_dict_transform(cls: Type[TVerifiedElementSubclass], data: Dict[str, Any]) -> Dict[str, Any]: Transform data received in eduid format into pythonic format... | 5970880caf0b0e2bdee6c23869ef287acc87af2a | <|skeleton|>
class VerifiedElement:
"""Elements that can be verified or not."""
def _from_dict_transform(cls: Type[TVerifiedElementSubclass], data: Dict[str, Any]) -> Dict[str, Any]:
"""Transform data received in eduid format into pythonic format."""
<|body_0|>
def _to_dict_transform(self,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VerifiedElement:
"""Elements that can be verified or not."""
def _from_dict_transform(cls: Type[TVerifiedElementSubclass], data: Dict[str, Any]) -> Dict[str, Any]:
"""Transform data received in eduid format into pythonic format."""
data = super()._from_dict_transform(data)
if 'ver... | the_stack_v2_python_sparse | src/eduid_userdb/element.py | SUNET/eduid-userdb | train | 0 |
e01d79ea55a7a7667092d85dc0dc249867207720 | [
"self.xint = xint\nself.yint = yint\nself.n = len(xint)\nw = np.ones(self.n)\nself.C = (np.max(xint) - np.min(xint)) / 4\nshuffle = np.random.permutation(self.n - 1)\nfor j in range(self.n):\n temp = (xint[j] - np.delete(xint, j)) / self.C\n temp = temp[shuffle]\n w[j] /= np.product(temp)\nself.weights = w... | <|body_start_0|>
self.xint = xint
self.yint = yint
self.n = len(xint)
w = np.ones(self.n)
self.C = (np.max(xint) - np.min(xint)) / 4
shuffle = np.random.permutation(self.n - 1)
for j in range(self.n):
temp = (xint[j] - np.delete(xint, j)) / self.C
... | Class for performing Barycentric Lagrange interpolation. Attributes: w ((n,) ndarray): Array of Barycentric weights. n (int): Number of interpolation points. x ((n,) ndarray): x values of interpolating points. y ((n,) ndarray): y values of interpolating points. | Barycentric | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Barycentric:
"""Class for performing Barycentric Lagrange interpolation. Attributes: w ((n,) ndarray): Array of Barycentric weights. n (int): Number of interpolation points. x ((n,) ndarray): x values of interpolating points. y ((n,) ndarray): y values of interpolating points."""
def __init_... | stack_v2_sparse_classes_36k_train_032297 | 6,344 | no_license | [
{
"docstring": "Calculate the Barycentric weights using initial interpolating points. Parameters: xint ((n,) ndarray): x values of interpolating points. yint ((n,) ndarray): y values of interpolating points.",
"name": "__init__",
"signature": "def __init__(self, xint, yint)"
},
{
"docstring": "U... | 3 | stack_v2_sparse_classes_30k_train_008151 | Implement the Python class `Barycentric` described below.
Class description:
Class for performing Barycentric Lagrange interpolation. Attributes: w ((n,) ndarray): Array of Barycentric weights. n (int): Number of interpolation points. x ((n,) ndarray): x values of interpolating points. y ((n,) ndarray): y values of in... | Implement the Python class `Barycentric` described below.
Class description:
Class for performing Barycentric Lagrange interpolation. Attributes: w ((n,) ndarray): Array of Barycentric weights. n (int): Number of interpolation points. x ((n,) ndarray): x values of interpolating points. y ((n,) ndarray): y values of in... | 6e969de3a8337b0bd9bb4ba7abac722ab5c065ab | <|skeleton|>
class Barycentric:
"""Class for performing Barycentric Lagrange interpolation. Attributes: w ((n,) ndarray): Array of Barycentric weights. n (int): Number of interpolation points. x ((n,) ndarray): x values of interpolating points. y ((n,) ndarray): y values of interpolating points."""
def __init_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Barycentric:
"""Class for performing Barycentric Lagrange interpolation. Attributes: w ((n,) ndarray): Array of Barycentric weights. n (int): Number of interpolation points. x ((n,) ndarray): x values of interpolating points. y ((n,) ndarray): y values of interpolating points."""
def __init__(self, xint,... | the_stack_v2_python_sparse | Class/ACME_Volume_2-Python/PolynomialInterpolation/polynomial_interpolation.py | scj1420/Class-Projects-Research | train | 0 |
2d75c2ea0fe56e1d5d34af2e465f157258b9179f | [
"Camera.__init__(self)\nself._installation = installation\nself._camera = camera\nself._auth = auth\nself._attr_unique_id = f'{installation.contract} {camera.id}'\nself._attr_name = camera.description\nself._attr_device_info = DeviceInfo(name=f'Contract {installation.contract}', manufacturer='Prosegur', model='smar... | <|body_start_0|>
Camera.__init__(self)
self._installation = installation
self._camera = camera
self._auth = auth
self._attr_unique_id = f'{installation.contract} {camera.id}'
self._attr_name = camera.description
self._attr_device_info = DeviceInfo(name=f'Contract ... | Representation of a Smart Prosegur Camera. | ProsegurCamera | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProsegurCamera:
"""Representation of a Smart Prosegur Camera."""
def __init__(self, installation: Installation, camera: InstallationCamera, auth: Auth) -> None:
"""Initialize Prosegur Camera component."""
<|body_0|>
async def async_camera_image(self, width: int | None=No... | stack_v2_sparse_classes_36k_train_032298 | 3,129 | permissive | [
{
"docstring": "Initialize Prosegur Camera component.",
"name": "__init__",
"signature": "def __init__(self, installation: Installation, camera: InstallationCamera, auth: Auth) -> None"
},
{
"docstring": "Return bytes of camera image.",
"name": "async_camera_image",
"signature": "async d... | 3 | stack_v2_sparse_classes_30k_train_021524 | Implement the Python class `ProsegurCamera` described below.
Class description:
Representation of a Smart Prosegur Camera.
Method signatures and docstrings:
- def __init__(self, installation: Installation, camera: InstallationCamera, auth: Auth) -> None: Initialize Prosegur Camera component.
- async def async_camera_... | Implement the Python class `ProsegurCamera` described below.
Class description:
Representation of a Smart Prosegur Camera.
Method signatures and docstrings:
- def __init__(self, installation: Installation, camera: InstallationCamera, auth: Auth) -> None: Initialize Prosegur Camera component.
- async def async_camera_... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class ProsegurCamera:
"""Representation of a Smart Prosegur Camera."""
def __init__(self, installation: Installation, camera: InstallationCamera, auth: Auth) -> None:
"""Initialize Prosegur Camera component."""
<|body_0|>
async def async_camera_image(self, width: int | None=No... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProsegurCamera:
"""Representation of a Smart Prosegur Camera."""
def __init__(self, installation: Installation, camera: InstallationCamera, auth: Auth) -> None:
"""Initialize Prosegur Camera component."""
Camera.__init__(self)
self._installation = installation
self._camera... | the_stack_v2_python_sparse | homeassistant/components/prosegur/camera.py | home-assistant/core | train | 35,501 |
4ac00ea3000fc1a5bce534ab608941f046340019 | [
"self.alternate_name = alternate_name\nself.lab_test_data = lab_test_data\nself.lab_test_id = lab_test_id\nself.lab_test_name = lab_test_name\nself.id = id\nself.search_score = search_score\nself.names = {'alternate_name': 'alternate_name', 'lab_test_data': 'lab_test_data', 'lab_test_id': 'lab_test_id', 'lab_test_n... | <|body_start_0|>
self.alternate_name = alternate_name
self.lab_test_data = lab_test_data
self.lab_test_id = lab_test_id
self.lab_test_name = lab_test_name
self.id = id
self.search_score = search_score
self.names = {'alternate_name': 'alternate_name', 'lab_test_dat... | Implementation of the 'Lab TestsResponse' model. TODO: type model description here. Attributes: alternate_name (string): TODO: type description here. lab_test_data (LabTestData): TODO: type description here. lab_test_id (string): TODO: type description here. lab_test_name (string): TODO: type description here. id (stri... | LabTestsResponse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LabTestsResponse:
"""Implementation of the 'Lab TestsResponse' model. TODO: type model description here. Attributes: alternate_name (string): TODO: type description here. lab_test_data (LabTestData): TODO: type description here. lab_test_id (string): TODO: type description here. lab_test_name (st... | stack_v2_sparse_classes_36k_train_032299 | 3,081 | permissive | [
{
"docstring": "Constructor for the LabTestsResponse class",
"name": "__init__",
"signature": "def __init__(self, alternate_name=None, lab_test_data=None, lab_test_id=None, lab_test_name=None, id=None, search_score=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Arg... | 2 | stack_v2_sparse_classes_30k_train_017242 | Implement the Python class `LabTestsResponse` described below.
Class description:
Implementation of the 'Lab TestsResponse' model. TODO: type model description here. Attributes: alternate_name (string): TODO: type description here. lab_test_data (LabTestData): TODO: type description here. lab_test_id (string): TODO: t... | Implement the Python class `LabTestsResponse` described below.
Class description:
Implementation of the 'Lab TestsResponse' model. TODO: type model description here. Attributes: alternate_name (string): TODO: type description here. lab_test_data (LabTestData): TODO: type description here. lab_test_id (string): TODO: t... | 641b165344063affd50de27b8931cd851fee0d6f | <|skeleton|>
class LabTestsResponse:
"""Implementation of the 'Lab TestsResponse' model. TODO: type model description here. Attributes: alternate_name (string): TODO: type description here. lab_test_data (LabTestData): TODO: type description here. lab_test_id (string): TODO: type description here. lab_test_name (st... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LabTestsResponse:
"""Implementation of the 'Lab TestsResponse' model. TODO: type model description here. Attributes: alternate_name (string): TODO: type description here. lab_test_data (LabTestData): TODO: type description here. lab_test_id (string): TODO: type description here. lab_test_name (string): TODO: ... | the_stack_v2_python_sparse | healthoslib/models/lab_tests_response.py | priyamsahoo/Day-Zero-Diagnostics | train | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.