blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
2b1c33cfeed07e9fa8e64f78478cb7958d05934b
[ "self.step = kwargs.get('step', None)\nself.enabled = kwargs.get('enabled', True)\nself.name = name\nself.start_time = None\nself._logger = logging.getLogger(__name__)", "if not self.enabled:\n return\nself.start_time = time.time()", "if not self.enabled:\n return\nrun_time = time.time() - self.start_time...
<|body_start_0|> self.step = kwargs.get('step', None) self.enabled = kwargs.get('enabled', True) self.name = name self.start_time = None self._logger = logging.getLogger(__name__) <|end_body_0|> <|body_start_1|> if not self.enabled: return self.start_...
This class should be used to time a code block. The time diff is computed from __enter__ to __exit__. Example ------- ```python with LogTimeBlock("my_perf_metric_name"): print("(((sleeping for 1 second)))") time.sleep(1) ```
LogTimeBlock
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogTimeBlock: """This class should be used to time a code block. The time diff is computed from __enter__ to __exit__. Example ------- ```python with LogTimeBlock("my_perf_metric_name"): print("(((sleeping for 1 second)))") time.sleep(1) ```""" def __init__(self, name, **kwargs): """...
stack_v2_sparse_classes_75kplus_train_071400
6,355
permissive
[ { "docstring": "Constructs the LogTimeBlock. Args: name (str): key for the time difference (for storing as metric) kwargs (dict): any keyword will be added as properties to metrics for logging (work in progress)", "name": "__init__", "signature": "def __init__(self, name, **kwargs)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_017329
Implement the Python class `LogTimeBlock` described below. Class description: This class should be used to time a code block. The time diff is computed from __enter__ to __exit__. Example ------- ```python with LogTimeBlock("my_perf_metric_name"): print("(((sleeping for 1 second)))") time.sleep(1) ``` Method signatur...
Implement the Python class `LogTimeBlock` described below. Class description: This class should be used to time a code block. The time diff is computed from __enter__ to __exit__. Example ------- ```python with LogTimeBlock("my_perf_metric_name"): print("(((sleeping for 1 second)))") time.sleep(1) ``` Method signatur...
e5f7b247d4753f115a8f7da30cbe25294f71f9d7
<|skeleton|> class LogTimeBlock: """This class should be used to time a code block. The time diff is computed from __enter__ to __exit__. Example ------- ```python with LogTimeBlock("my_perf_metric_name"): print("(((sleeping for 1 second)))") time.sleep(1) ```""" def __init__(self, name, **kwargs): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LogTimeBlock: """This class should be used to time a code block. The time diff is computed from __enter__ to __exit__. Example ------- ```python with LogTimeBlock("my_perf_metric_name"): print("(((sleeping for 1 second)))") time.sleep(1) ```""" def __init__(self, name, **kwargs): """Constructs th...
the_stack_v2_python_sparse
cli/jobs/pipelines/tensorflow-image-segmentation/src/common/profiling.py
Azure/azureml-examples
train
1,219
4a0521e733d7580ef3eba6519f3e26a369b68637
[ "super().__init__(pooling_class, N, depth, laplacian_type, kernel_size, ratio)\nself.sequence_length = sequence_length\nself.encoder = EncoderTemporalConv(self.pooling_class.pooling, self.laps, self.sequence_length, self.kernel_size)\nself.decoder = Decoder(self.pooling_class.unpooling, self.laps, self.kernel_size)...
<|body_start_0|> super().__init__(pooling_class, N, depth, laplacian_type, kernel_size, ratio) self.sequence_length = sequence_length self.encoder = EncoderTemporalConv(self.pooling_class.pooling, self.laps, self.sequence_length, self.kernel_size) self.decoder = Decoder(self.pooling_clas...
Spherical GCNN Autoencoder with temporality by means of convolution over time.
SphericalUNetTemporalConv
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SphericalUNetTemporalConv: """Spherical GCNN Autoencoder with temporality by means of convolution over time.""" def __init__(self, pooling_class, N, depth, laplacian_type, sequence_length, kernel_size, ratio=1): """Initialization. Args: pooling_class (obj): One of three classes of po...
stack_v2_sparse_classes_75kplus_train_071401
41,403
no_license
[ { "docstring": "Initialization. Args: pooling_class (obj): One of three classes of pooling methods N (int): Number of pixels in the input image depth (int): The depth of the UNet, which is bounded by the N and the type of pooling sequence_length (int): The number of images used per sample kernel_size (int): che...
2
stack_v2_sparse_classes_30k_train_050523
Implement the Python class `SphericalUNetTemporalConv` described below. Class description: Spherical GCNN Autoencoder with temporality by means of convolution over time. Method signatures and docstrings: - def __init__(self, pooling_class, N, depth, laplacian_type, sequence_length, kernel_size, ratio=1): Initializati...
Implement the Python class `SphericalUNetTemporalConv` described below. Class description: Spherical GCNN Autoencoder with temporality by means of convolution over time. Method signatures and docstrings: - def __init__(self, pooling_class, N, depth, laplacian_type, sequence_length, kernel_size, ratio=1): Initializati...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class SphericalUNetTemporalConv: """Spherical GCNN Autoencoder with temporality by means of convolution over time.""" def __init__(self, pooling_class, N, depth, laplacian_type, sequence_length, kernel_size, ratio=1): """Initialization. Args: pooling_class (obj): One of three classes of po...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SphericalUNetTemporalConv: """Spherical GCNN Autoencoder with temporality by means of convolution over time.""" def __init__(self, pooling_class, N, depth, laplacian_type, sequence_length, kernel_size, ratio=1): """Initialization. Args: pooling_class (obj): One of three classes of pooling methods...
the_stack_v2_python_sparse
generated/test_deepsphere_deepsphere_pytorch.py
jansel/pytorch-jit-paritybench
train
35
3342f222fda78504b78785b21f32d93d3a638e25
[ "super(GuidedBackprop, self).__init__(graph, session, y, x)\ntensorflow = _import_tf()\ntf = tensorflow.compat.v1\nself.x = x\nif not GuidedBackprop.guided_relu_registered:\n\n @tf.RegisterGradient('GuidedRelu')\n def _GuidedReluGrad(op, grad):\n gate_g = tf.cast(grad > 0, 'float32')\n gate_y = ...
<|body_start_0|> super(GuidedBackprop, self).__init__(graph, session, y, x) tensorflow = _import_tf() tf = tensorflow.compat.v1 self.x = x if not GuidedBackprop.guided_relu_registered: @tf.RegisterGradient('GuidedRelu') def _GuidedReluGrad(op, grad): ...
A TF1Saliency class that computes saliency masks with GuidedBackProp. This implementation copies the TensorFlow graph to a new graph with the ReLU gradient overwritten as in the paper: https://arxiv.org/abs/1412.6806 Thanks to Chris Olah for generously sharing his implementation of the ReLU backprop.
GuidedBackprop
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GuidedBackprop: """A TF1Saliency class that computes saliency masks with GuidedBackProp. This implementation copies the TensorFlow graph to a new graph with the ReLU gradient overwritten as in the paper: https://arxiv.org/abs/1412.6806 Thanks to Chris Olah for generously sharing his implementatio...
stack_v2_sparse_classes_75kplus_train_071402
3,213
permissive
[ { "docstring": "Constructs a GuidedBackprop method using TF1 Saliency.", "name": "__init__", "signature": "def __init__(self, graph, session, y, x, tmp_ckpt_path='/tmp/guided_backprop_ckpt')" }, { "docstring": "Returns a GuidedBackprop mask. Args: x_value: Input value, not batched. feed_dict: (O...
2
stack_v2_sparse_classes_30k_train_049572
Implement the Python class `GuidedBackprop` described below. Class description: A TF1Saliency class that computes saliency masks with GuidedBackProp. This implementation copies the TensorFlow graph to a new graph with the ReLU gradient overwritten as in the paper: https://arxiv.org/abs/1412.6806 Thanks to Chris Olah f...
Implement the Python class `GuidedBackprop` described below. Class description: A TF1Saliency class that computes saliency masks with GuidedBackProp. This implementation copies the TensorFlow graph to a new graph with the ReLU gradient overwritten as in the paper: https://arxiv.org/abs/1412.6806 Thanks to Chris Olah f...
fc90418fadff32285620331e8c385cef852793a5
<|skeleton|> class GuidedBackprop: """A TF1Saliency class that computes saliency masks with GuidedBackProp. This implementation copies the TensorFlow graph to a new graph with the ReLU gradient overwritten as in the paper: https://arxiv.org/abs/1412.6806 Thanks to Chris Olah for generously sharing his implementatio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GuidedBackprop: """A TF1Saliency class that computes saliency masks with GuidedBackProp. This implementation copies the TensorFlow graph to a new graph with the ReLU gradient overwritten as in the paper: https://arxiv.org/abs/1412.6806 Thanks to Chris Olah for generously sharing his implementation of the ReLU...
the_stack_v2_python_sparse
saliency/tf1/guided_backprop.py
Pandinosaurus/saliency
train
1
43d411150bed2483837da27b03ac03cd9aaa8c8e
[ "if isinstance(dshape, list):\n self.ss = []\n for dsz in dshape:\n self.ss.append(np.zeros(dsz))\nelse:\n self.ss = np.zeros(dshape)\nif isinstance(mshape, list):\n self.s = []\n for msz in mshape:\n self.s.append(np.zeros(msz))\nelse:\n self.s = np.zeros(mshape)\nself.small = 1e-20...
<|body_start_0|> if isinstance(dshape, list): self.ss = [] for dsz in dshape: self.ss.append(np.zeros(dsz)) else: self.ss = np.zeros(dshape) if isinstance(mshape, list): self.s = [] for msz in mshape: sel...
Performs one step of conjugate directions
cdstep
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class cdstep: """Performs one step of conjugate directions""" def __init__(self, mshape, dshape): """Constructor for cdstep Parameters: mshape - list of shapes of model vectors dshape - list of shapes of data vectors""" <|body_0|> def step(self, m, g, rr, gg) -> None: ...
stack_v2_sparse_classes_75kplus_train_071403
13,170
no_license
[ { "docstring": "Constructor for cdstep Parameters: mshape - list of shapes of model vectors dshape - list of shapes of data vectors", "name": "__init__", "signature": "def __init__(self, mshape, dshape)" }, { "docstring": "Performs one step of conjugate directions Parameters: m - model for the c...
2
stack_v2_sparse_classes_30k_train_030122
Implement the Python class `cdstep` described below. Class description: Performs one step of conjugate directions Method signatures and docstrings: - def __init__(self, mshape, dshape): Constructor for cdstep Parameters: mshape - list of shapes of model vectors dshape - list of shapes of data vectors - def step(self,...
Implement the Python class `cdstep` described below. Class description: Performs one step of conjugate directions Method signatures and docstrings: - def __init__(self, mshape, dshape): Constructor for cdstep Parameters: mshape - list of shapes of model vectors dshape - list of shapes of data vectors - def step(self,...
32a303eddd13385d8778b8bb3b4fbbfbe78bea51
<|skeleton|> class cdstep: """Performs one step of conjugate directions""" def __init__(self, mshape, dshape): """Constructor for cdstep Parameters: mshape - list of shapes of model vectors dshape - list of shapes of data vectors""" <|body_0|> def step(self, m, g, rr, gg) -> None: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class cdstep: """Performs one step of conjugate directions""" def __init__(self, mshape, dshape): """Constructor for cdstep Parameters: mshape - list of shapes of model vectors dshape - list of shapes of data vectors""" if isinstance(dshape, list): self.ss = [] for dsz i...
the_stack_v2_python_sparse
opt/linopt/cd.py
ke0m/scaas
train
2
aeb94b31f5ffedf8021b5fb3812bc52f3830df4c
[ "self.__customer_path = customer_path\nself.__stores_path = stores_path\nself.__configurations = IMC()", "customer_images_paths = RU.get_images_names_in_folder(self.__customer_path)\nstore_paths = RU.reading_all_folders_paths_in_given_path(self.__stores_path)\nfor store_path in store_paths:\n self.run_matching...
<|body_start_0|> self.__customer_path = customer_path self.__stores_path = stores_path self.__configurations = IMC() <|end_body_0|> <|body_start_1|> customer_images_paths = RU.get_images_names_in_folder(self.__customer_path) store_paths = RU.reading_all_folders_paths_in_given_pa...
This class represents the image matching module, part of the MIPAS system. Attributes ---------- customer_path : str a string that contains the path for the folder containing all the customer images. stores_path : str a string that contains the path for the folder containing all folders for all the stores to compare wi...
ImageMatching
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageMatching: """This class represents the image matching module, part of the MIPAS system. Attributes ---------- customer_path : str a string that contains the path for the folder containing all the customer images. stores_path : str a string that contains the path for the folder containing all...
stack_v2_sparse_classes_75kplus_train_071404
9,453
no_license
[ { "docstring": ":param customer_path: a string that contains the path for the folder containing all the customer images. :param stores_path: a string that contains the path for the folder containing all folders for all the stores to compare with.", "name": "__init__", "signature": "def __init__(self, cu...
5
stack_v2_sparse_classes_30k_train_009023
Implement the Python class `ImageMatching` described below. Class description: This class represents the image matching module, part of the MIPAS system. Attributes ---------- customer_path : str a string that contains the path for the folder containing all the customer images. stores_path : str a string that contains...
Implement the Python class `ImageMatching` described below. Class description: This class represents the image matching module, part of the MIPAS system. Attributes ---------- customer_path : str a string that contains the path for the folder containing all the customer images. stores_path : str a string that contains...
232b7f0c9776be9f1825152e78fe0e9ecbaf2337
<|skeleton|> class ImageMatching: """This class represents the image matching module, part of the MIPAS system. Attributes ---------- customer_path : str a string that contains the path for the folder containing all the customer images. stores_path : str a string that contains the path for the folder containing all...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageMatching: """This class represents the image matching module, part of the MIPAS system. Attributes ---------- customer_path : str a string that contains the path for the folder containing all the customer images. stores_path : str a string that contains the path for the folder containing all folders for ...
the_stack_v2_python_sparse
image_matching_module/image_matching.py
ilanpogr/MIPAS
train
1
f7340ad1cfab4fe16bfdd7872ea2ca84ff8f6cd7
[ "@functools.wraps(decorated)\ndef wrapper(*args, **kwargs):\n \"\"\" wrapper for decorated function. args and kwargs are standard\n function parameters.\n \"\"\"\n func_args = inspect.getcallargs(decorated, *args, **kwargs)\n key = 'dir_path'\n if key not in func_args:\n rai...
<|body_start_0|> @functools.wraps(decorated) def wrapper(*args, **kwargs): """ wrapper for decorated function. args and kwargs are standard function parameters. """ func_args = inspect.getcallargs(decorated, *args, **kwargs) key...
File validation decorator :raises FileNotFoundError: File or path is incorrect
FileDecorators
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileDecorators: """File validation decorator :raises FileNotFoundError: File or path is incorrect""" def validate_dir_path(cls, decorated): """Validate if the input path is a valid dir or location :param decorated: decorated function :type decorated: function, required :return: funct...
stack_v2_sparse_classes_75kplus_train_071405
5,633
permissive
[ { "docstring": "Validate if the input path is a valid dir or location :param decorated: decorated function :type decorated: function, required :return: function if the path is valid :rtype: function object", "name": "validate_dir_path", "signature": "def validate_dir_path(cls, decorated)" }, { "...
2
stack_v2_sparse_classes_30k_test_001631
Implement the Python class `FileDecorators` described below. Class description: File validation decorator :raises FileNotFoundError: File or path is incorrect Method signatures and docstrings: - def validate_dir_path(cls, decorated): Validate if the input path is a valid dir or location :param decorated: decorated fu...
Implement the Python class `FileDecorators` described below. Class description: File validation decorator :raises FileNotFoundError: File or path is incorrect Method signatures and docstrings: - def validate_dir_path(cls, decorated): Validate if the input path is a valid dir or location :param decorated: decorated fu...
8d046967116f7f859e828fb310b0f31b48817876
<|skeleton|> class FileDecorators: """File validation decorator :raises FileNotFoundError: File or path is incorrect""" def validate_dir_path(cls, decorated): """Validate if the input path is a valid dir or location :param decorated: decorated function :type decorated: function, required :return: funct...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileDecorators: """File validation decorator :raises FileNotFoundError: File or path is incorrect""" def validate_dir_path(cls, decorated): """Validate if the input path is a valid dir or location :param decorated: decorated function :type decorated: function, required :return: function if the pa...
the_stack_v2_python_sparse
Katna/decorators.py
mmmwhy/katna-zhihu
train
0
5e71fd1cd8a1f05611f660922829359a577b5974
[ "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...
A service that application uses to manipulate triggers and functions.
CloudFunctionsServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloudFunctionsServiceServicer: """A service that application uses to manipulate triggers and functions.""" def ListFunctions(self, request, context): """Returns a list of functions that belong to the requested project.""" <|body_0|> def GetFunction(self, request, context...
stack_v2_sparse_classes_75kplus_train_071406
7,183
no_license
[ { "docstring": "Returns a list of functions that belong to the requested project.", "name": "ListFunctions", "signature": "def ListFunctions(self, request, context)" }, { "docstring": "Returns a function with the given name from the requested project.", "name": "GetFunction", "signature"...
6
null
Implement the Python class `CloudFunctionsServiceServicer` described below. Class description: A service that application uses to manipulate triggers and functions. Method signatures and docstrings: - def ListFunctions(self, request, context): Returns a list of functions that belong to the requested project. - def Ge...
Implement the Python class `CloudFunctionsServiceServicer` described below. Class description: A service that application uses to manipulate triggers and functions. Method signatures and docstrings: - def ListFunctions(self, request, context): Returns a list of functions that belong to the requested project. - def Ge...
d7424d21aa0dc121acc4d64b427ba365a3581a20
<|skeleton|> class CloudFunctionsServiceServicer: """A service that application uses to manipulate triggers and functions.""" def ListFunctions(self, request, context): """Returns a list of functions that belong to the requested project.""" <|body_0|> def GetFunction(self, request, context...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CloudFunctionsServiceServicer: """A service that application uses to manipulate triggers and functions.""" def ListFunctions(self, request, context): """Returns a list of functions that belong to the requested project.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set...
the_stack_v2_python_sparse
google/cloud/functions/v1beta2/functions_pb2_grpc.py
msachtler/bazel-event-protocol-parser
train
1
bfc0dcb519744aeb476b1ddcbe22a553eb746aa7
[ "self.conf = gkeep_conf\nself.keep = gkeepapi.Keep()\nself.keep.resume(gkeep_conf['api_username'], keyring.get_password('gkeep-key', gkeep_conf['api_username']))\nself.keep.sync()", "for course, course_params in courses.items():\n if len((course_note_list := list(self.keep.find(course_params['nickname'])))) ==...
<|body_start_0|> self.conf = gkeep_conf self.keep = gkeepapi.Keep() self.keep.resume(gkeep_conf['api_username'], keyring.get_password('gkeep-key', gkeep_conf['api_username'])) self.keep.sync() <|end_body_0|> <|body_start_1|> for course, course_params in courses.items(): ...
Google Keep class, used to interface with Google Keep
GKeep
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GKeep: """Google Keep class, used to interface with Google Keep""" def __init__(self, gkeep_conf: Dict): """Initialize google keep object Parameters ---------- gkeep_conf : Dict google keep configuration""" <|body_0|> def post_todo_state(self, update_dict: Dict[int, Dict...
stack_v2_sparse_classes_75kplus_train_071407
4,309
permissive
[ { "docstring": "Initialize google keep object Parameters ---------- gkeep_conf : Dict google keep configuration", "name": "__init__", "signature": "def __init__(self, gkeep_conf: Dict)" }, { "docstring": "Posts state to API to match with new changes Parameters ---------- update_dict : Dict[int, ...
4
stack_v2_sparse_classes_30k_train_021983
Implement the Python class `GKeep` described below. Class description: Google Keep class, used to interface with Google Keep Method signatures and docstrings: - def __init__(self, gkeep_conf: Dict): Initialize google keep object Parameters ---------- gkeep_conf : Dict google keep configuration - def post_todo_state(s...
Implement the Python class `GKeep` described below. Class description: Google Keep class, used to interface with Google Keep Method signatures and docstrings: - def __init__(self, gkeep_conf: Dict): Initialize google keep object Parameters ---------- gkeep_conf : Dict google keep configuration - def post_todo_state(s...
ec37cb06c03fe942a8c57b98bc7b9f0086c6e661
<|skeleton|> class GKeep: """Google Keep class, used to interface with Google Keep""" def __init__(self, gkeep_conf: Dict): """Initialize google keep object Parameters ---------- gkeep_conf : Dict google keep configuration""" <|body_0|> def post_todo_state(self, update_dict: Dict[int, Dict...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GKeep: """Google Keep class, used to interface with Google Keep""" def __init__(self, gkeep_conf: Dict): """Initialize google keep object Parameters ---------- gkeep_conf : Dict google keep configuration""" self.conf = gkeep_conf self.keep = gkeepapi.Keep() self.keep.resum...
the_stack_v2_python_sparse
canvas_todo/todo/gkeep.py
ryansingman/canvas-todo
train
0
83a6a0a14edafe4a8b05b3e8c43310593865625f
[ "for key in dictionary:\n try:\n dictionary[key] = int(dictionary[key])\n except:\n try:\n dictionary[key] = float(dictionary[key])\n except:\n pass\nreturn dictionary", "config = ConfigParser.ConfigParser()\nconfig.read(config_path)\nsection_list = config.items(co...
<|body_start_0|> for key in dictionary: try: dictionary[key] = int(dictionary[key]) except: try: dictionary[key] = float(dictionary[key]) except: pass return dictionary <|end_body_0|> <|body_...
ConfigUtils
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigUtils: def cast_dict(self, dictionary): """Tries to convert the values in a dict to int, then float""" <|body_0|> def config_to_dict(self, config_path, config_section='default'): """Grabs section from config file and converts it to a dict""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_071408
5,740
permissive
[ { "docstring": "Tries to convert the values in a dict to int, then float", "name": "cast_dict", "signature": "def cast_dict(self, dictionary)" }, { "docstring": "Grabs section from config file and converts it to a dict", "name": "config_to_dict", "signature": "def config_to_dict(self, co...
2
null
Implement the Python class `ConfigUtils` described below. Class description: Implement the ConfigUtils class. Method signatures and docstrings: - def cast_dict(self, dictionary): Tries to convert the values in a dict to int, then float - def config_to_dict(self, config_path, config_section='default'): Grabs section f...
Implement the Python class `ConfigUtils` described below. Class description: Implement the ConfigUtils class. Method signatures and docstrings: - def cast_dict(self, dictionary): Tries to convert the values in a dict to int, then float - def config_to_dict(self, config_path, config_section='default'): Grabs section f...
eb1730d90e438327edaa53375765a9690b968d2b
<|skeleton|> class ConfigUtils: def cast_dict(self, dictionary): """Tries to convert the values in a dict to int, then float""" <|body_0|> def config_to_dict(self, config_path, config_section='default'): """Grabs section from config file and converts it to a dict""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConfigUtils: def cast_dict(self, dictionary): """Tries to convert the values in a dict to int, then float""" for key in dictionary: try: dictionary[key] = int(dictionary[key]) except: try: dictionary[key] = float(dicti...
the_stack_v2_python_sparse
ppy_terminal/imports/utilities.py
jimmyauyeung/generative_art
train
0
676a0a53ffa75a783417e24f4a5c660f1b59ecee
[ "urllib.request.urlopen(self.url + 'public/ipsum.html')\ntime.sleep(0.1)\nwith open('log.txt') as fin:\n lines = fin.readlines()\n last_line = lines[-1]\n self.assertIn('GET /public/ipsum.html - 200 Ok', last_line)", "urllib.request.urlopen(self.url)\ntime.sleep(0.1)\nwith open('log.txt') as fin:\n li...
<|body_start_0|> urllib.request.urlopen(self.url + 'public/ipsum.html') time.sleep(0.1) with open('log.txt') as fin: lines = fin.readlines() last_line = lines[-1] self.assertIn('GET /public/ipsum.html - 200 Ok', last_line) <|end_body_0|> <|body_start_1|> ...
Tests server logs.
TestLogs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestLogs: """Tests server logs.""" def test_logs_ok(self): """Request method, URI and response status must be in the log file.""" <|body_0|> def test_logs_ok_fields(self): """Log file must contain <date> <time> <method> <uri> - <status>""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_071409
17,868
no_license
[ { "docstring": "Request method, URI and response status must be in the log file.", "name": "test_logs_ok", "signature": "def test_logs_ok(self)" }, { "docstring": "Log file must contain <date> <time> <method> <uri> - <status>", "name": "test_logs_ok_fields", "signature": "def test_logs_o...
4
null
Implement the Python class `TestLogs` described below. Class description: Tests server logs. Method signatures and docstrings: - def test_logs_ok(self): Request method, URI and response status must be in the log file. - def test_logs_ok_fields(self): Log file must contain <date> <time> <method> <uri> - <status> - def...
Implement the Python class `TestLogs` described below. Class description: Tests server logs. Method signatures and docstrings: - def test_logs_ok(self): Request method, URI and response status must be in the log file. - def test_logs_ok_fields(self): Log file must contain <date> <time> <method> <uri> - <status> - def...
d27b122c87131789178f77e6f693b718dd57c594
<|skeleton|> class TestLogs: """Tests server logs.""" def test_logs_ok(self): """Request method, URI and response status must be in the log file.""" <|body_0|> def test_logs_ok_fields(self): """Log file must contain <date> <time> <method> <uri> - <status>""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestLogs: """Tests server logs.""" def test_logs_ok(self): """Request method, URI and response status must be in the log file.""" urllib.request.urlopen(self.url + 'public/ipsum.html') time.sleep(0.1) with open('log.txt') as fin: lines = fin.readlines() ...
the_stack_v2_python_sparse
2º Ano/2º Semestre/Computação Distribuida/Projectos/tp3-team-alexandrecoelho-sergioverissimo-t3/tests.py
alexmpc98/Engenharia-Informatica-IPS
train
4
86f36cced25211060eb700f305cef822ffd18378
[ "now = now or OSAUtil.get_now()\nbasetime = DateTimeUtil.toLoginTime(now)\nreturn basetime <= self.ltime", "if self.isToday(now=now):\n return self.point\nelse:\n return 0", "if self.isToday(now=now):\n return self.win\nelse:\n return 0", "if self.isToday(now=now):\n return self.winmax\nelse:\n...
<|body_start_0|> now = now or OSAUtil.get_now() basetime = DateTimeUtil.toLoginTime(now) return basetime <= self.ltime <|end_body_0|> <|body_start_1|> if self.isToday(now=now): return self.point else: return 0 <|end_body_1|> <|body_start_2|> if s...
プレイヤーのスコア情報.
BattleEventScore
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BattleEventScore: """プレイヤーのスコア情報.""" def isToday(self, now=None): """今日のスコアなのか判定.""" <|body_0|> def getPointToday(self, now=None): """本日獲得ポイントの取得.""" <|body_1|> def getWinToday(self, now=None): """本日現在連勝数の取得.""" <|body_2|> def ge...
stack_v2_sparse_classes_75kplus_train_071410
37,034
no_license
[ { "docstring": "今日のスコアなのか判定.", "name": "isToday", "signature": "def isToday(self, now=None)" }, { "docstring": "本日獲得ポイントの取得.", "name": "getPointToday", "signature": "def getPointToday(self, now=None)" }, { "docstring": "本日現在連勝数の取得.", "name": "getWinToday", "signature": "d...
6
stack_v2_sparse_classes_30k_train_023839
Implement the Python class `BattleEventScore` described below. Class description: プレイヤーのスコア情報. Method signatures and docstrings: - def isToday(self, now=None): 今日のスコアなのか判定. - def getPointToday(self, now=None): 本日獲得ポイントの取得. - def getWinToday(self, now=None): 本日現在連勝数の取得. - def getWinMaxToday(self, now=None): 本日最大連勝数の取得...
Implement the Python class `BattleEventScore` described below. Class description: プレイヤーのスコア情報. Method signatures and docstrings: - def isToday(self, now=None): 今日のスコアなのか判定. - def getPointToday(self, now=None): 本日獲得ポイントの取得. - def getWinToday(self, now=None): 本日現在連勝数の取得. - def getWinMaxToday(self, now=None): 本日最大連勝数の取得...
492bf477ac00c380f2b2758c86b46aa7e58bbad9
<|skeleton|> class BattleEventScore: """プレイヤーのスコア情報.""" def isToday(self, now=None): """今日のスコアなのか判定.""" <|body_0|> def getPointToday(self, now=None): """本日獲得ポイントの取得.""" <|body_1|> def getWinToday(self, now=None): """本日現在連勝数の取得.""" <|body_2|> def ge...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BattleEventScore: """プレイヤーのスコア情報.""" def isToday(self, now=None): """今日のスコアなのか判定.""" now = now or OSAUtil.get_now() basetime = DateTimeUtil.toLoginTime(now) return basetime <= self.ltime def getPointToday(self, now=None): """本日獲得ポイントの取得.""" if self.isT...
the_stack_v2_python_sparse
src/dprj/platinumegg/app/cabaret/models/battleevent/BattleEvent.py
hitandaway100/caba
train
0
3c36c8665b45a1664df341a7bfc8109cd0f3c636
[ "self.counts = {}\nself.max_time = {}\nself.min_time = {}\nself.total_time = {}", "if name in self.counts:\n self.counts[name] += 1\n self.max_time[name] = max(self.max_time[name], duration)\n self.min_time[name] = min(self.min_time[name], duration)\n self.total_time[name] += duration\nelse:\n self...
<|body_start_0|> self.counts = {} self.max_time = {} self.min_time = {} self.total_time = {} <|end_body_0|> <|body_start_1|> if name in self.counts: self.counts[name] += 1 self.max_time[name] = max(self.max_time[name], duration) self.min_time[...
A collection of statistics.
Stats
[ "LicenseRef-scancode-dco-1.1", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stats: """A collection of statistics.""" def __init__(self): """Initialize the Stats instance.""" <|body_0|> def log(self, name: str, duration: float): """Log an entry in the stats.""" <|body_1|> def extract(self, names: Sequence[str]=None) -> dict: ...
stack_v2_sparse_classes_75kplus_train_071411
6,778
permissive
[ { "docstring": "Initialize the Stats instance.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Log an entry in the stats.", "name": "log", "signature": "def log(self, name: str, duration: float)" }, { "docstring": "Summarize the stats in a dictionary.",...
3
stack_v2_sparse_classes_30k_train_018705
Implement the Python class `Stats` described below. Class description: A collection of statistics. Method signatures and docstrings: - def __init__(self): Initialize the Stats instance. - def log(self, name: str, duration: float): Log an entry in the stats. - def extract(self, names: Sequence[str]=None) -> dict: Summ...
Implement the Python class `Stats` described below. Class description: A collection of statistics. Method signatures and docstrings: - def __init__(self): Initialize the Stats instance. - def log(self, name: str, duration: float): Log an entry in the stats. - def extract(self, names: Sequence[str]=None) -> dict: Summ...
39cac36d8937ce84a9307ce100aaefb8bc05ec04
<|skeleton|> class Stats: """A collection of statistics.""" def __init__(self): """Initialize the Stats instance.""" <|body_0|> def log(self, name: str, duration: float): """Log an entry in the stats.""" <|body_1|> def extract(self, names: Sequence[str]=None) -> dict: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Stats: """A collection of statistics.""" def __init__(self): """Initialize the Stats instance.""" self.counts = {} self.max_time = {} self.min_time = {} self.total_time = {} def log(self, name: str, duration: float): """Log an entry in the stats.""" ...
the_stack_v2_python_sparse
aries_cloudagent/utils/stats.py
hyperledger/aries-cloudagent-python
train
370
2bc57e50c57176f7c889c8715c9768cc0e0a0d45
[ "SpWCS.__init__(self, filename, info, helcorr, spwcstab, xtractab)\nself.extension = ('events', 1)\nself.keywords = ['ctype1', 'ctype2', 'crpix1', 'crpix2', 'crval1', 'crval2', 'pc1_1', 'pc1_2', 'pc2_1', 'pc2_2', 'cdelt1', 'cdelt2', 'cunit1', 'cunit2', 'pv1_0', 'pv1_1', 'pv1_2', 'pv1_6']\nprimary_keywords = ['tctyp...
<|body_start_0|> SpWCS.__init__(self, filename, info, helcorr, spwcstab, xtractab) self.extension = ('events', 1) self.keywords = ['ctype1', 'ctype2', 'crpix1', 'crpix2', 'crval1', 'crval2', 'pc1_1', 'pc1_2', 'pc2_1', 'pc2_2', 'cdelt1', 'cdelt2', 'cunit1', 'cunit2', 'pv1_0', 'pv1_1', 'pv1_2', 'p...
Spectroscopic WCS for pixel list (corrtag) data. Parameters ---------- filename: str Name of corrtag file. info: dictionary Header keywords and values. helcorr: str PERFORM or COMPLETE if heliocentric correction should be applied to the wavelengths (CRVAL1). spwcstab: str Name of reference table containing spectroscopi...
SpWcsCorrtag
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpWcsCorrtag: """Spectroscopic WCS for pixel list (corrtag) data. Parameters ---------- filename: str Name of corrtag file. info: dictionary Header keywords and values. helcorr: str PERFORM or COMPLETE if heliocentric correction should be applied to the wavelengths (CRVAL1). spwcstab: str Name of...
stack_v2_sparse_classes_75kplus_train_071412
21,291
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, filename, info, helcorr, spwcstab, xtractab)" }, { "docstring": "Determine the values of the WCS keywords. wcs_info: pyfits record object One row from the spwcstab alt: str Alternate WCS letter, or \"\" for the p...
3
stack_v2_sparse_classes_30k_train_053840
Implement the Python class `SpWcsCorrtag` described below. Class description: Spectroscopic WCS for pixel list (corrtag) data. Parameters ---------- filename: str Name of corrtag file. info: dictionary Header keywords and values. helcorr: str PERFORM or COMPLETE if heliocentric correction should be applied to the wave...
Implement the Python class `SpWcsCorrtag` described below. Class description: Spectroscopic WCS for pixel list (corrtag) data. Parameters ---------- filename: str Name of corrtag file. info: dictionary Header keywords and values. helcorr: str PERFORM or COMPLETE if heliocentric correction should be applied to the wave...
4401823e46d28eb8dfa7f4e7d83e4ea728ddd3e5
<|skeleton|> class SpWcsCorrtag: """Spectroscopic WCS for pixel list (corrtag) data. Parameters ---------- filename: str Name of corrtag file. info: dictionary Header keywords and values. helcorr: str PERFORM or COMPLETE if heliocentric correction should be applied to the wavelengths (CRVAL1). spwcstab: str Name of...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpWcsCorrtag: """Spectroscopic WCS for pixel list (corrtag) data. Parameters ---------- filename: str Name of corrtag file. info: dictionary Header keywords and values. helcorr: str PERFORM or COMPLETE if heliocentric correction should be applied to the wavelengths (CRVAL1). spwcstab: str Name of reference ta...
the_stack_v2_python_sparse
calcos/spwcs.py
spacetelescope/calcos
train
5
0582fe1d0c3100afd8d4baa29f0fbca1dbf47097
[ "super(SimpleModel, self).__init__()\nself.blocks = [layers.Flatten(name='flatten')]\nself.blocks.append(build_linear_layers(hidden_dim, 1, name='fc0', **kwargs))\nfor i in range(num_residual_linear_blocks):\n self.blocks.append(ResLinearBlock(hidden_dim, num_layers_per_block, name='res_fcs' + str(i + 1), **kwar...
<|body_start_0|> super(SimpleModel, self).__init__() self.blocks = [layers.Flatten(name='flatten')] self.blocks.append(build_linear_layers(hidden_dim, 1, name='fc0', **kwargs)) for i in range(num_residual_linear_blocks): self.blocks.append(ResLinearBlock(hidden_dim, num_layer...
Simple model architecture with a point or Gaussian embedder.
SimpleModel
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleModel: """Simple model architecture with a point or Gaussian embedder.""" def __init__(self, output_shape, embedder=TYPE_EMBEDDER_POINT, hidden_dim=1024, num_residual_linear_blocks=2, num_layers_per_block=2, **kwargs): """Initializer. Args: output_shape: A tuple for the shape o...
stack_v2_sparse_classes_75kplus_train_071413
30,548
permissive
[ { "docstring": "Initializer. Args: output_shape: A tuple for the shape of the output. embedder: A string for the type of the embedder. hidden_dim: An integer for the dimension of linear layers. num_residual_linear_blocks: An integer for the number of residual linear blocks. num_layers_per_block: An integer for ...
2
stack_v2_sparse_classes_30k_train_028752
Implement the Python class `SimpleModel` described below. Class description: Simple model architecture with a point or Gaussian embedder. Method signatures and docstrings: - def __init__(self, output_shape, embedder=TYPE_EMBEDDER_POINT, hidden_dim=1024, num_residual_linear_blocks=2, num_layers_per_block=2, **kwargs):...
Implement the Python class `SimpleModel` described below. Class description: Simple model architecture with a point or Gaussian embedder. Method signatures and docstrings: - def __init__(self, output_shape, embedder=TYPE_EMBEDDER_POINT, hidden_dim=1024, num_residual_linear_blocks=2, num_layers_per_block=2, **kwargs):...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class SimpleModel: """Simple model architecture with a point or Gaussian embedder.""" def __init__(self, output_shape, embedder=TYPE_EMBEDDER_POINT, hidden_dim=1024, num_residual_linear_blocks=2, num_layers_per_block=2, **kwargs): """Initializer. Args: output_shape: A tuple for the shape o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleModel: """Simple model architecture with a point or Gaussian embedder.""" def __init__(self, output_shape, embedder=TYPE_EMBEDDER_POINT, hidden_dim=1024, num_residual_linear_blocks=2, num_layers_per_block=2, **kwargs): """Initializer. Args: output_shape: A tuple for the shape of the output....
the_stack_v2_python_sparse
poem/cv_mim/models.py
Jimmy-INL/google-research
train
1
7cebaa98aa274383b70615d2869af2d0889a37c6
[ "super(AfterSaleServiceConditionImpliedWarranties, self).__init__(*args, **kwargs)\nself.endpoint = '/after-sales-service-conditions/implied-warranties'\nself.seller_id = None\nself._headers = {'Accept': 'application/vnd.allegro.public.v1+json', 'Content-type': 'application/vnd.allegro.public.v1+json'}", "self.se...
<|body_start_0|> super(AfterSaleServiceConditionImpliedWarranties, self).__init__(*args, **kwargs) self.endpoint = '/after-sales-service-conditions/implied-warranties' self.seller_id = None self._headers = {'Accept': 'application/vnd.allegro.public.v1+json', 'Content-type': 'application/...
Manage category tree
AfterSaleServiceConditionImpliedWarranties
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AfterSaleServiceConditionImpliedWarranties: """Manage category tree""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" <|body_0|> def all(self, seller_id=None): """Get a list of categories :param seller_id: The seller's unique id. :type seller_...
stack_v2_sparse_classes_75kplus_train_071414
1,357
permissive
[ { "docstring": "Initialize the endpoint", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Get a list of categories :param seller_id: The seller's unique id. :type seller_id: :py:class:`str` :return: The JSON response from API or error or None (if 204) :r...
2
stack_v2_sparse_classes_30k_train_022356
Implement the Python class `AfterSaleServiceConditionImpliedWarranties` described below. Class description: Manage category tree Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize the endpoint - def all(self, seller_id=None): Get a list of categories :param seller_id: The seller's uni...
Implement the Python class `AfterSaleServiceConditionImpliedWarranties` described below. Class description: Manage category tree Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize the endpoint - def all(self, seller_id=None): Get a list of categories :param seller_id: The seller's uni...
112b0f2570fcf3840645dd62f6f7150956e56f9c
<|skeleton|> class AfterSaleServiceConditionImpliedWarranties: """Manage category tree""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" <|body_0|> def all(self, seller_id=None): """Get a list of categories :param seller_id: The seller's unique id. :type seller_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AfterSaleServiceConditionImpliedWarranties: """Manage category tree""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" super(AfterSaleServiceConditionImpliedWarranties, self).__init__(*args, **kwargs) self.endpoint = '/after-sales-service-conditions/implied-warr...
the_stack_v2_python_sparse
allegroapi/entities/aftersalesserviceconditionsimpliedwarranties.py
krystianmagdziarz/python-allegro
train
0
2aaa9198de413b075286979ad7b095a06abfec13
[ "df = pd.DataFrame(self.dict())\nlambdas = pd.json_normalize(df.pop('ham_props'))\nresources = pd.json_normalize(df.pop('resources'))\ndf = df.join(pd.DataFrame(lambdas))\ndf = df.join(pd.DataFrame(resources))\nreturn df", "self.ham_props.append(ham_properties)\nself.resources.append(resource_estimates)\nself.cut...
<|body_start_0|> df = pd.DataFrame(self.dict()) lambdas = pd.json_normalize(df.pop('ham_props')) resources = pd.json_normalize(df.pop('resources')) df = df.join(pd.DataFrame(lambdas)) df = df.join(pd.DataFrame(resources)) return df <|end_body_0|> <|body_start_1|> ...
Helper class to hold resource estimates given a range of cutoffs. Attributes: system_name: Descriptive name for calculation. num_spin_orbitals: Number of spin orbitals. num_kpts: Number of k-points. dE: Epsilon for phase estimation. chi: A number of bits controlling the precision of the factorization. What this means i...
PBCResources
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PBCResources: """Helper class to hold resource estimates given a range of cutoffs. Attributes: system_name: Descriptive name for calculation. num_spin_orbitals: Number of spin orbitals. num_kpts: Number of k-points. dE: Epsilon for phase estimation. chi: A number of bits controlling the precision...
stack_v2_sparse_classes_75kplus_train_071415
3,401
permissive
[ { "docstring": "Convert PBCResources instance to pandas DataFrame.", "name": "to_dataframe", "signature": "def to_dataframe(self) -> pd.DataFrame" }, { "docstring": "Add resource estimates to container for given cutoff value. Args: ham_properties: lambda values resource_estimates: resource estim...
2
null
Implement the Python class `PBCResources` described below. Class description: Helper class to hold resource estimates given a range of cutoffs. Attributes: system_name: Descriptive name for calculation. num_spin_orbitals: Number of spin orbitals. num_kpts: Number of k-points. dE: Epsilon for phase estimation. chi: A n...
Implement the Python class `PBCResources` described below. Class description: Helper class to hold resource estimates given a range of cutoffs. Attributes: system_name: Descriptive name for calculation. num_spin_orbitals: Number of spin orbitals. num_kpts: Number of k-points. dE: Epsilon for phase estimation. chi: A n...
788481753c798a72c5cb3aa9f2aa9da3ce3190b0
<|skeleton|> class PBCResources: """Helper class to hold resource estimates given a range of cutoffs. Attributes: system_name: Descriptive name for calculation. num_spin_orbitals: Number of spin orbitals. num_kpts: Number of k-points. dE: Epsilon for phase estimation. chi: A number of bits controlling the precision...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PBCResources: """Helper class to hold resource estimates given a range of cutoffs. Attributes: system_name: Descriptive name for calculation. num_spin_orbitals: Number of spin orbitals. num_kpts: Number of k-points. dE: Epsilon for phase estimation. chi: A number of bits controlling the precision of the facto...
the_stack_v2_python_sparse
src/openfermion/resource_estimates/pbc/resources/data_types.py
quantumlib/OpenFermion
train
1,481
d5a456e1140f46d8e71eb584b2403b9cd4da83bb
[ "low, high = (0, x)\nwhile low <= high:\n mid = (low + high) // 2\n if mid * mid == x:\n return mid\n elif mid * mid > x:\n high = mid - 1\n else:\n low = mid + 1\nreturn low - 1", "if x == 1:\n return 1\nlow = 0\nhigh = x\nwhile low < high - 1:\n mid = low + (high - low) //...
<|body_start_0|> low, high = (0, x) while low <= high: mid = (low + high) // 2 if mid * mid == x: return mid elif mid * mid > x: high = mid - 1 else: low = mid + 1 return low - 1 <|end_body_0|> <|bod...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mySqrt2(self, x: int) -> int: """Updated at 2021/12/02 1017 / 1017 test cases passed. Status: Accepted Runtime: 32 ms Memory Usage: 14.3 MB 0 <= x <= 2^31 - 1 :param x: :return:""" <|body_0|> def mySqrt(self, x): """:type x: int :rtype: int""" <...
stack_v2_sparse_classes_75kplus_train_071416
1,497
permissive
[ { "docstring": "Updated at 2021/12/02 1017 / 1017 test cases passed. Status: Accepted Runtime: 32 ms Memory Usage: 14.3 MB 0 <= x <= 2^31 - 1 :param x: :return:", "name": "mySqrt2", "signature": "def mySqrt2(self, x: int) -> int" }, { "docstring": ":type x: int :rtype: int", "name": "mySqrt"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mySqrt2(self, x: int) -> int: Updated at 2021/12/02 1017 / 1017 test cases passed. Status: Accepted Runtime: 32 ms Memory Usage: 14.3 MB 0 <= x <= 2^31 - 1 :param x: :return:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mySqrt2(self, x: int) -> int: Updated at 2021/12/02 1017 / 1017 test cases passed. Status: Accepted Runtime: 32 ms Memory Usage: 14.3 MB 0 <= x <= 2^31 - 1 :param x: :return:...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def mySqrt2(self, x: int) -> int: """Updated at 2021/12/02 1017 / 1017 test cases passed. Status: Accepted Runtime: 32 ms Memory Usage: 14.3 MB 0 <= x <= 2^31 - 1 :param x: :return:""" <|body_0|> def mySqrt(self, x): """:type x: int :rtype: int""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def mySqrt2(self, x: int) -> int: """Updated at 2021/12/02 1017 / 1017 test cases passed. Status: Accepted Runtime: 32 ms Memory Usage: 14.3 MB 0 <= x <= 2^31 - 1 :param x: :return:""" low, high = (0, x) while low <= high: mid = (low + high) // 2 if mi...
the_stack_v2_python_sparse
src/69-SqrtX.py
Jiezhi/myleetcode
train
1
1801e9b481b0fdb242bcdb293ba5b77aeca77ba6
[ "cls.validate(tuple((node_key.value for node_key, _ in node.value)))\nfor node_key, node_value in node.value:\n if node_key.value == 'name':\n node_value.value = slugify(node_value.value).replace('-', '_')\n break\nreturn loader.construct_yaml_object(node, cls)", "cls.validate(mapping)\nfor key i...
<|body_start_0|> cls.validate(tuple((node_key.value for node_key, _ in node.value))) for node_key, node_value in node.value: if node_key.value == 'name': node_value.value = slugify(node_value.value).replace('-', '_') break return loader.construct_yaml_...
Representation of eodag configuration. :param name: The name of the provider :type name: str :param priority: (optional) The priority of the provider while searching a product. Lower value means lower priority. (Default: 0) :type priority: int :param api: (optional) The configuration of a plugin of type Api :type api: ...
ProviderConfig
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "Python-2.0", "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProviderConfig: """Representation of eodag configuration. :param name: The name of the provider :type name: str :param priority: (optional) The priority of the provider while searching a product. Lower value means lower priority. (Default: 0) :type priority: int :param api: (optional) The configu...
stack_v2_sparse_classes_75kplus_train_071417
17,556
permissive
[ { "docstring": "Build a :class:`~eodag.config.ProviderConfig` from Yaml", "name": "from_yaml", "signature": "def from_yaml(cls, loader, node)" }, { "docstring": "Build a :class:`~eodag.config.ProviderConfig` from a mapping", "name": "from_mapping", "signature": "def from_mapping(cls, map...
4
stack_v2_sparse_classes_30k_test_001071
Implement the Python class `ProviderConfig` described below. Class description: Representation of eodag configuration. :param name: The name of the provider :type name: str :param priority: (optional) The priority of the provider while searching a product. Lower value means lower priority. (Default: 0) :type priority:...
Implement the Python class `ProviderConfig` described below. Class description: Representation of eodag configuration. :param name: The name of the provider :type name: str :param priority: (optional) The priority of the provider while searching a product. Lower value means lower priority. (Default: 0) :type priority:...
f2ac36ba14d3b9b6a09daf0b0b7323dca59766ac
<|skeleton|> class ProviderConfig: """Representation of eodag configuration. :param name: The name of the provider :type name: str :param priority: (optional) The priority of the provider while searching a product. Lower value means lower priority. (Default: 0) :type priority: int :param api: (optional) The configu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProviderConfig: """Representation of eodag configuration. :param name: The name of the provider :type name: str :param priority: (optional) The priority of the provider while searching a product. Lower value means lower priority. (Default: 0) :type priority: int :param api: (optional) The configuration of a p...
the_stack_v2_python_sparse
eodag/config.py
CS-SI/eodag
train
257
4f7fe68f14e96a64b9d56840cdba54d5c9b01f2c
[ "if len(A) > len(B):\n lst1 = B\n lst2 = A\nelse:\n lst1 = A\n lst2 = B\nm = len(lst1)\nn = len(lst2)\nreturn self.find_median2(lst1, lst2, m, n)", "if m == 0:\n return median(lst2)\nelif m <= 3:\n next_lst1 = lst1\n if n <= m + 3:\n next_lst2 = lst2\n else:\n next_lst2 = lst...
<|body_start_0|> if len(A) > len(B): lst1 = B lst2 = A else: lst1 = A lst2 = B m = len(lst1) n = len(lst2) return self.find_median2(lst1, lst2, m, n) <|end_body_0|> <|body_start_1|> if m == 0: return median(lst2...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, A, B): """Given two sorted list A and B return the median of combined list (A+B), as a float""" <|body_0|> def find_median2(self, lst1, lst2, m, n): """Given two sorted list lst1 and lst2 return the median of combined list (...
stack_v2_sparse_classes_75kplus_train_071418
3,629
no_license
[ { "docstring": "Given two sorted list A and B return the median of combined list (A+B), as a float", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, A, B)" }, { "docstring": "Given two sorted list lst1 and lst2 return the median of combined list (lst1+lst2), as a...
2
stack_v2_sparse_classes_30k_train_028389
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, A, B): Given two sorted list A and B return the median of combined list (A+B), as a float - def find_median2(self, lst1, lst2, m, n): Given two s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, A, B): Given two sorted list A and B return the median of combined list (A+B), as a float - def find_median2(self, lst1, lst2, m, n): Given two s...
46182640d38e6250e02da46cf69bd849954a79e6
<|skeleton|> class Solution: def findMedianSortedArrays(self, A, B): """Given two sorted list A and B return the median of combined list (A+B), as a float""" <|body_0|> def find_median2(self, lst1, lst2, m, n): """Given two sorted list lst1 and lst2 return the median of combined list (...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findMedianSortedArrays(self, A, B): """Given two sorted list A and B return the median of combined list (A+B), as a float""" if len(A) > len(B): lst1 = B lst2 = A else: lst1 = A lst2 = B m = len(lst1) n = len...
the_stack_v2_python_sparse
src/Median of Two Sorted Arrays.py
wangzhixuan/LeetCodeSolution
train
0
e57994feb3b88908e68d7f0b6bc9dce8c9040cad
[ "\"\"\"\n self.ele = {}\n self.length = 0\n \"\"\"\nself.dic = {}\nself.ele = []\nself.length = 0", "\"\"\"\n if val in self.ele:\n return False\n self.ele[val] = 1\n self.length += 1\n return True\n \"\"\"\nif val in self.dic:\n return False\n...
<|body_start_0|> """ self.ele = {} self.length = 0 """ self.dic = {} self.ele = [] self.length = 0 <|end_body_0|> <|body_start_1|> """ if val in self.ele: return False self.ele[va...
RandomizedSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not already contain the specified element.""" <|body_1|> def remove(se...
stack_v2_sparse_classes_75kplus_train_071419
2,005
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inserts a value to the set. Returns true if the set did not already contain the specified element.", "name": "insert", "signature": "def insert(self, val: int) ...
4
stack_v2_sparse_classes_30k_train_011239
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta...
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta...
90fd00246707b23d60a5d13b5a89d5b5f64ad008
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not already contain the specified element.""" <|body_1|> def remove(se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomizedSet: def __init__(self): """Initialize your data structure here.""" """ self.ele = {} self.length = 0 """ self.dic = {} self.ele = [] self.length = 0 def insert(self, val: int) -> bool: """Inserts a ...
the_stack_v2_python_sparse
python_solution/0380.py
Dongzi-dq394/leetcode
train
0
4308db5d1331f7c667cfebb0ca2e08118d8105df
[ "if not l1:\n return l2\nif not l2:\n return l1\nnew_listnode = ListNode(0)\nnode = new_listnode\nwhile True:\n if l1.val < l2.val:\n node.val = l1.val\n l1 = l1.next\n else:\n node.val = l2.val\n l2 = l2.next\n if not l1:\n node.next = l2\n return new_listno...
<|body_start_0|> if not l1: return l2 if not l2: return l1 new_listnode = ListNode(0) node = new_listnode while True: if l1.val < l2.val: node.val = l1.val l1 = l1.next else: node.val ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not l...
stack_v2_sparse_classes_75kplus_train_071420
2,390
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" }, { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" } ]
2
stack_v2_sparse_classes_30k_train_037152
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode <|skeleton|>...
621c579c76e9f6b926354a9c25c0b0ed66890800
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" if not l1: return l2 if not l2: return l1 new_listnode = ListNode(0) node = new_listnode while True: if l1.val < l2.val: ...
the_stack_v2_python_sparse
leetcode_23.py
JayWu7/Code
train
3
f8556c1b1f6d886ffd056f590c435f766a011e77
[ "self.config = config\nself.figsize = figsize\nself.yheight = yheight\nself.padding = padding\nfor features, kwargs in self.config:\n if 'ybase' in kwargs:\n raise ValueError('Please do not specify \"ybase\"; this is handled automatically by the %s class' % self.__class__.__name__)\n if 'yheight' in kw...
<|body_start_0|> self.config = config self.figsize = figsize self.yheight = yheight self.padding = padding for features, kwargs in self.config: if 'ybase' in kwargs: raise ValueError('Please do not specify "ybase"; this is handled automatically by the ...
TrackCollection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrackCollection: def __init__(self, config, yheight=1, figsize=None, padding=0.1): """Handles multiple tracks on the same figure. :param config: A list of tuples that configures tracks. Each tuple contains a filename, BedTool object, or other iterable of pybedtools.Interval objects and a...
stack_v2_sparse_classes_75kplus_train_071421
19,828
permissive
[ { "docstring": "Handles multiple tracks on the same figure. :param config: A list of tuples that configures tracks. Each tuple contains a filename, BedTool object, or other iterable of pybedtools.Interval objects and a dictionary of keyword args that will be used to create a corresponding Track object, e.g.:: [...
2
stack_v2_sparse_classes_30k_train_002440
Implement the Python class `TrackCollection` described below. Class description: Implement the TrackCollection class. Method signatures and docstrings: - def __init__(self, config, yheight=1, figsize=None, padding=0.1): Handles multiple tracks on the same figure. :param config: A list of tuples that configures tracks...
Implement the Python class `TrackCollection` described below. Class description: Implement the TrackCollection class. Method signatures and docstrings: - def __init__(self, config, yheight=1, figsize=None, padding=0.1): Handles multiple tracks on the same figure. :param config: A list of tuples that configures tracks...
9876fa25e80c7547101e662ebe1c6388579405d5
<|skeleton|> class TrackCollection: def __init__(self, config, yheight=1, figsize=None, padding=0.1): """Handles multiple tracks on the same figure. :param config: A list of tuples that configures tracks. Each tuple contains a filename, BedTool object, or other iterable of pybedtools.Interval objects and a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TrackCollection: def __init__(self, config, yheight=1, figsize=None, padding=0.1): """Handles multiple tracks on the same figure. :param config: A list of tuples that configures tracks. Each tuple contains a filename, BedTool object, or other iterable of pybedtools.Interval objects and a dictionary of...
the_stack_v2_python_sparse
pybedtools/contrib/plotting.py
daler/pybedtools
train
248
90b4d1e25c03d46b677ff831bd79e6b859d1fb2a
[ "intervals = []\ninsertInt = interval('(1,3)')\nself.assertEqual(insert(intervals, insertInt), [insertInt])", "intervals = [interval('(0,3)'), interval('(6,10)')]\ninsertInt = interval('(4,5]')\nself.assertEqual(insert(intervals, insertInt), [interval('(0,3)'), interval('(4,5]'), interval('(6,10)')])", "interva...
<|body_start_0|> intervals = [] insertInt = interval('(1,3)') self.assertEqual(insert(intervals, insertInt), [insertInt]) <|end_body_0|> <|body_start_1|> intervals = [interval('(0,3)'), interval('(6,10)')] insertInt = interval('(4,5]') self.assertEqual(insert(intervals, ...
Tests for insert method method from interval class, grouped for clarity
InsertTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InsertTests: """Tests for insert method method from interval class, grouped for clarity""" def testEmptyList(self): """Test that insert works on empty list""" <|body_0|> def testInsertWithoutMerge(self): """Test that insert adds interval to list when none can be ...
stack_v2_sparse_classes_75kplus_train_071422
8,576
no_license
[ { "docstring": "Test that insert works on empty list", "name": "testEmptyList", "signature": "def testEmptyList(self)" }, { "docstring": "Test that insert adds interval to list when none can be merged", "name": "testInsertWithoutMerge", "signature": "def testInsertWithoutMerge(self)" }...
4
stack_v2_sparse_classes_30k_train_053143
Implement the Python class `InsertTests` described below. Class description: Tests for insert method method from interval class, grouped for clarity Method signatures and docstrings: - def testEmptyList(self): Test that insert works on empty list - def testInsertWithoutMerge(self): Test that insert adds interval to l...
Implement the Python class `InsertTests` described below. Class description: Tests for insert method method from interval class, grouped for clarity Method signatures and docstrings: - def testEmptyList(self): Test that insert works on empty list - def testInsertWithoutMerge(self): Test that insert adds interval to l...
33c7a3e579c37ce3096099a350a7c8135b302ea4
<|skeleton|> class InsertTests: """Tests for insert method method from interval class, grouped for clarity""" def testEmptyList(self): """Test that insert works on empty list""" <|body_0|> def testInsertWithoutMerge(self): """Test that insert adds interval to list when none can be ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InsertTests: """Tests for insert method method from interval class, grouped for clarity""" def testEmptyList(self): """Test that insert works on empty list""" intervals = [] insertInt = interval('(1,3)') self.assertEqual(insert(intervals, insertInt), [insertInt]) def ...
the_stack_v2_python_sparse
lh1036/interval/test_interval.py
ds-ga-1007/assignment7
train
0
e1c5fa5870fbec729160f7e9759451c2be81ac93
[ "if isinstance(key, int):\n return Authentication(key)\nif key not in Authentication._member_map_:\n extend_enum(Authentication, key, default)\nreturn Authentication[key]", "if not (isinstance(value, int) and 0 <= value <= 65535):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 4 <...
<|body_start_0|> if isinstance(key, int): return Authentication(key) if key not in Authentication._member_map_: extend_enum(Authentication, key, default) return Authentication[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 6...
[Authentication] Authentication Types
Authentication
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Authentication: """[Authentication] Authentication Types""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_75kplus_train_071423
1,587
permissive
[ { "docstring": "Backport support for original codes.", "name": "get", "signature": "def get(key, default=-1)" }, { "docstring": "Lookup function used when value is not found.", "name": "_missing_", "signature": "def _missing_(cls, value)" } ]
2
null
Implement the Python class `Authentication` described below. Class description: [Authentication] Authentication Types Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found.
Implement the Python class `Authentication` described below. Class description: [Authentication] Authentication Types Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found. <|skeleton|> class Authen...
90cd07d67df28d5c5ab0585bc60f467a78d9db33
<|skeleton|> class Authentication: """[Authentication] Authentication Types""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Authentication: """[Authentication] Authentication Types""" def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Authentication(key) if key not in Authentication._member_map_: extend_enum(Authentication, key, ...
the_stack_v2_python_sparse
pcapkit/const/ospf/authentication.py
stjordanis/PyPCAPKit
train
0
836833f3db3cb802f2a09501c2c9d93687b8efb2
[ "assert n_blocks >= 0\nsuper(ResnetGenerator, self).__init__()\nself.ngf = ngf\nself.device = device\nself.epsilon = epsilon\nself.norm = norm\nself.fc_z = nn.Linear(ngf, 32 * 32)\nuse_bias = norm_layer == nn.InstanceNorm2d\npre_model = [nn.ReflectionPad2d(3), nn.Conv2d(input_nc, ngf - 1, kernel_size=7, padding=0, ...
<|body_start_0|> assert n_blocks >= 0 super(ResnetGenerator, self).__init__() self.ngf = ngf self.device = device self.epsilon = epsilon self.norm = norm self.fc_z = nn.Linear(ngf, 32 * 32) use_bias = norm_layer == nn.InstanceNorm2d pre_model = [nn...
Resnet-based generator that consists of Resnet blocks between a few downsampling/upsampling operations. We adapt Torch code and idea from Justin Johnson's neural style transfer project(https://github.com/jcjohnson/fast-neural-style)
ResnetGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResnetGenerator: """Resnet-based generator that consists of Resnet blocks between a few downsampling/upsampling operations. We adapt Torch code and idea from Justin Johnson's neural style transfer project(https://github.com/jcjohnson/fast-neural-style)""" def __init__(self, device, input_nc,...
stack_v2_sparse_classes_75kplus_train_071424
6,267
permissive
[ { "docstring": "Construct a Resnet-based generator Parameters: input_nc (int) -- the number of channels in input images output_nc (int) -- the number of channels in output images ngf (int) -- the number of filters in the last conv layer norm_layer -- normalization layer use_dropout (bool) -- if use dropout laye...
2
stack_v2_sparse_classes_30k_train_023597
Implement the Python class `ResnetGenerator` described below. Class description: Resnet-based generator that consists of Resnet blocks between a few downsampling/upsampling operations. We adapt Torch code and idea from Justin Johnson's neural style transfer project(https://github.com/jcjohnson/fast-neural-style) Meth...
Implement the Python class `ResnetGenerator` described below. Class description: Resnet-based generator that consists of Resnet blocks between a few downsampling/upsampling operations. We adapt Torch code and idea from Justin Johnson's neural style transfer project(https://github.com/jcjohnson/fast-neural-style) Meth...
4219137e5263cd7de86687ed74cc1cef7497bb78
<|skeleton|> class ResnetGenerator: """Resnet-based generator that consists of Resnet blocks between a few downsampling/upsampling operations. We adapt Torch code and idea from Justin Johnson's neural style transfer project(https://github.com/jcjohnson/fast-neural-style)""" def __init__(self, device, input_nc,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResnetGenerator: """Resnet-based generator that consists of Resnet blocks between a few downsampling/upsampling operations. We adapt Torch code and idea from Justin Johnson's neural style transfer project(https://github.com/jcjohnson/fast-neural-style)""" def __init__(self, device, input_nc, output_nc, e...
the_stack_v2_python_sparse
models/resnet.py
joeybose/Adversarial-Example-Games
train
24
b1393f51b2a1d4ac04f47d516bc774a4187db7e8
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn TargetedManagedAppConfiguration()", "from .managed_app_configuration import ManagedAppConfiguration\nfrom .managed_app_policy_deployment_summary import ManagedAppPolicyDeploymentSummary\nfrom .managed_mobile_app import ManagedMobileApp...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return TargetedManagedAppConfiguration() <|end_body_0|> <|body_start_1|> from .managed_app_configuration import ManagedAppConfiguration from .managed_app_policy_deployment_summary import Manage...
Configuration used to deliver a set of custom settings as-is to all users in the targeted security group
TargetedManagedAppConfiguration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TargetedManagedAppConfiguration: """Configuration used to deliver a set of custom settings as-is to all users in the targeted security group""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TargetedManagedAppConfiguration: """Creates a new instance of t...
stack_v2_sparse_classes_75kplus_train_071425
4,444
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: TargetedManagedAppConfiguration", "name": "create_from_discriminator_value", "signature": "def create_from_d...
3
stack_v2_sparse_classes_30k_train_033850
Implement the Python class `TargetedManagedAppConfiguration` described below. Class description: Configuration used to deliver a set of custom settings as-is to all users in the targeted security group Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Tar...
Implement the Python class `TargetedManagedAppConfiguration` described below. Class description: Configuration used to deliver a set of custom settings as-is to all users in the targeted security group Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Tar...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class TargetedManagedAppConfiguration: """Configuration used to deliver a set of custom settings as-is to all users in the targeted security group""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TargetedManagedAppConfiguration: """Creates a new instance of t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TargetedManagedAppConfiguration: """Configuration used to deliver a set of custom settings as-is to all users in the targeted security group""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TargetedManagedAppConfiguration: """Creates a new instance of the appropriat...
the_stack_v2_python_sparse
msgraph/generated/models/targeted_managed_app_configuration.py
microsoftgraph/msgraph-sdk-python
train
135
a0dfb5a67fa80589aa1f3d741b5232a13827a4ee
[ "phone = request.COOKIES.get('ph')\nuser_info = check_user_auth_level(user_phone=phone)\nif user_info[0] == '0':\n sql = 'select hosName, hosId, agentName, agentId from hos_name '\nelse:\n sql = \"select hosName, hosId, agentName, agentId from hos_name where agentId = '%s'\" % user_info[1]\ncon_mysql_connect ...
<|body_start_0|> phone = request.COOKIES.get('ph') user_info = check_user_auth_level(user_phone=phone) if user_info[0] == '0': sql = 'select hosName, hosId, agentName, agentId from hos_name ' else: sql = "select hosName, hosId, agentName, agentId from hos_name whe...
新增科室
AddDepartmentData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddDepartmentData: """新增科室""" def get(self, request): """新增 代理商下拉列表 :param request: :return:""" <|body_0|> def post(self, request): """新增科室数据 :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> phone = request.COOKIES.get('p...
stack_v2_sparse_classes_75kplus_train_071426
18,260
no_license
[ { "docstring": "新增 代理商下拉列表 :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "新增科室数据 :param request: :return:", "name": "post", "signature": "def post(self, request)" } ]
2
null
Implement the Python class `AddDepartmentData` described below. Class description: 新增科室 Method signatures and docstrings: - def get(self, request): 新增 代理商下拉列表 :param request: :return: - def post(self, request): 新增科室数据 :param request: :return:
Implement the Python class `AddDepartmentData` described below. Class description: 新增科室 Method signatures and docstrings: - def get(self, request): 新增 代理商下拉列表 :param request: :return: - def post(self, request): 新增科室数据 :param request: :return: <|skeleton|> class AddDepartmentData: """新增科室""" def get(self, re...
37b0bbff8818e73fd4897871956cfef446589e2f
<|skeleton|> class AddDepartmentData: """新增科室""" def get(self, request): """新增 代理商下拉列表 :param request: :return:""" <|body_0|> def post(self, request): """新增科室数据 :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AddDepartmentData: """新增科室""" def get(self, request): """新增 代理商下拉列表 :param request: :return:""" phone = request.COOKIES.get('ph') user_info = check_user_auth_level(user_phone=phone) if user_info[0] == '0': sql = 'select hosName, hosId, agentName, agentId from h...
the_stack_v2_python_sparse
applet_background/participate_hospital_management/hospital_join_views.py
xieboxiebo/escortbed
train
0
fb24be696c09ecebdd46836481167454da43d69f
[ "tab = []\nfor x in range(nelx):\n for y in range(nely):\n if abs(((x - (nelx - 1) / 2.0) ** 2 + (y - (nely - 1) / 2.0) ** 2) ** 0.5 - (nelx - 1) / 20.0) < 0.5:\n tab.append((x, y, 0))\n tab.append((x, y, 1))\nreturn tab", "peripheral_elements = onCircle_elements(nelx, nely)\namp =...
<|body_start_0|> tab = [] for x in range(nelx): for y in range(nely): if abs(((x - (nelx - 1) / 2.0) ** 2 + (y - (nely - 1) / 2.0) ** 2) ** 0.5 - (nelx - 1) / 20.0) < 0.5: tab.append((x, y, 0)) tab.append((x, y, 1)) return tab <...
BoundaryConditions
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoundaryConditions: def get_fixed_nodes(nelx, nely, params): """Small circle in the center only""" <|body_0|> def set_forces(nelx, nely, f, params): """Force on all the peripheral elements""" <|body_1|> def set_passive_elements(nelx, nely, lb, ub, params...
stack_v2_sparse_classes_75kplus_train_071427
3,704
permissive
[ { "docstring": "Small circle in the center only", "name": "get_fixed_nodes", "signature": "def get_fixed_nodes(nelx, nely, params)" }, { "docstring": "Force on all the peripheral elements", "name": "set_forces", "signature": "def set_forces(nelx, nely, f, params)" }, { "docstring...
3
null
Implement the Python class `BoundaryConditions` described below. Class description: Implement the BoundaryConditions class. Method signatures and docstrings: - def get_fixed_nodes(nelx, nely, params): Small circle in the center only - def set_forces(nelx, nely, f, params): Force on all the peripheral elements - def s...
Implement the Python class `BoundaryConditions` described below. Class description: Implement the BoundaryConditions class. Method signatures and docstrings: - def get_fixed_nodes(nelx, nely, params): Small circle in the center only - def set_forces(nelx, nely, f, params): Force on all the peripheral elements - def s...
120209e695f4f25ecdc6797f683e2b23894689f4
<|skeleton|> class BoundaryConditions: def get_fixed_nodes(nelx, nely, params): """Small circle in the center only""" <|body_0|> def set_forces(nelx, nely, f, params): """Force on all the peripheral elements""" <|body_1|> def set_passive_elements(nelx, nely, lb, ub, params...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BoundaryConditions: def get_fixed_nodes(nelx, nely, params): """Small circle in the center only""" tab = [] for x in range(nelx): for y in range(nely): if abs(((x - (nelx - 1) / 2.0) ** 2 + (y - (nely - 1) / 2.0) ** 2) ** 0.5 - (nelx - 1) / 20.0) < 0.5: ...
the_stack_v2_python_sparse
src/problems/wheel.py
Antoinehoff/Project_II
train
0
c753697354826e8b9e43c4002a7a239160d4cdd3
[ "self.ap = AxesSetupPanel(self.MovieFrames)\nself.dp = DisplayPanel()\nself.cp = ControlPanel()\nctrl_box = gtk.VBox()\nctrl_box.set_border_width(3)\nctrl_box.pack_start(self.dp, False, False, 5)\nctrl_box.pack_start(self.ap, False, False, 5)\nctrl_box.pack_end(self.cp, False, False, 5)\nreturn ctrl_box", "self.M...
<|body_start_0|> self.ap = AxesSetupPanel(self.MovieFrames) self.dp = DisplayPanel() self.cp = ControlPanel() ctrl_box = gtk.VBox() ctrl_box.set_border_width(3) ctrl_box.pack_start(self.dp, False, False, 5) ctrl_box.pack_start(self.ap, False, False, 5) ctr...
GTK Window with movie frame and control elements Members: canvas -- MPL canvas ap -- Axis panel dp -- Display panel cp -- Control panel toolbar -- Toolbar
MovieGUI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovieGUI: """GTK Window with movie frame and control elements Members: canvas -- MPL canvas ap -- Axis panel dp -- Display panel cp -- Control panel toolbar -- Toolbar""" def make_control_box(self): """make VBox with various control panels""" <|body_0|> def __init__(self...
stack_v2_sparse_classes_75kplus_train_071428
2,542
no_license
[ { "docstring": "make VBox with various control panels", "name": "make_control_box", "signature": "def make_control_box(self)" }, { "docstring": "canvas should set size request before", "name": "__init__", "signature": "def __init__(self, movie_frames, movie_file_maker, *args, **kwargs)" ...
2
stack_v2_sparse_classes_30k_train_019249
Implement the Python class `MovieGUI` described below. Class description: GTK Window with movie frame and control elements Members: canvas -- MPL canvas ap -- Axis panel dp -- Display panel cp -- Control panel toolbar -- Toolbar Method signatures and docstrings: - def make_control_box(self): make VBox with various co...
Implement the Python class `MovieGUI` described below. Class description: GTK Window with movie frame and control elements Members: canvas -- MPL canvas ap -- Axis panel dp -- Display panel cp -- Control panel toolbar -- Toolbar Method signatures and docstrings: - def make_control_box(self): make VBox with various co...
775dc841b1d8538584c8c68a5f75ae997191e685
<|skeleton|> class MovieGUI: """GTK Window with movie frame and control elements Members: canvas -- MPL canvas ap -- Axis panel dp -- Display panel cp -- Control panel toolbar -- Toolbar""" def make_control_box(self): """make VBox with various control panels""" <|body_0|> def __init__(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MovieGUI: """GTK Window with movie frame and control elements Members: canvas -- MPL canvas ap -- Axis panel dp -- Display panel cp -- Control panel toolbar -- Toolbar""" def make_control_box(self): """make VBox with various control panels""" self.ap = AxesSetupPanel(self.MovieFrames) ...
the_stack_v2_python_sparse
Movie/Movie_GUI/GUI/movie_gui.py
atimokhin/tdc_vis
train
0
9c0c3b64e469c154e4385b71e27e8bd3a22eebf6
[ "query = {'uuid': metadata_id}\nprojection = {'_id': False}\nlogging.debug(f'MONGO-START: db.Metadata.find_one(filter={query}, projection={projection})')\nret = await self.db.Metadata.find_one(filter=query, projection=projection)\nlogging.debug('MONGO-END: db.Metadata.find_one(filter, projection)')\nif not ret:\n...
<|body_start_0|> query = {'uuid': metadata_id} projection = {'_id': False} logging.debug(f'MONGO-START: db.Metadata.find_one(filter={query}, projection={projection})') ret = await self.db.Metadata.find_one(filter=query, projection=projection) logging.debug('MONGO-END: db.Metada...
MetadataSingleHandler handles object level routes for Metadata.
MetadataSingleHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetadataSingleHandler: """MetadataSingleHandler handles object level routes for Metadata.""" async def get(self, metadata_id: str) -> None: """Handle GET /Metadata/{uuid}.""" <|body_0|> async def delete(self, metadata_id: str) -> None: """Handle DELETE /Metadata/...
stack_v2_sparse_classes_75kplus_train_071429
42,572
permissive
[ { "docstring": "Handle GET /Metadata/{uuid}.", "name": "get", "signature": "async def get(self, metadata_id: str) -> None" }, { "docstring": "Handle DELETE /Metadata/{uuid}.", "name": "delete", "signature": "async def delete(self, metadata_id: str) -> None" } ]
2
stack_v2_sparse_classes_30k_train_005136
Implement the Python class `MetadataSingleHandler` described below. Class description: MetadataSingleHandler handles object level routes for Metadata. Method signatures and docstrings: - async def get(self, metadata_id: str) -> None: Handle GET /Metadata/{uuid}. - async def delete(self, metadata_id: str) -> None: Han...
Implement the Python class `MetadataSingleHandler` described below. Class description: MetadataSingleHandler handles object level routes for Metadata. Method signatures and docstrings: - async def get(self, metadata_id: str) -> None: Handle GET /Metadata/{uuid}. - async def delete(self, metadata_id: str) -> None: Han...
12719efa84be2281debe98a18c69bbe7a6d0f399
<|skeleton|> class MetadataSingleHandler: """MetadataSingleHandler handles object level routes for Metadata.""" async def get(self, metadata_id: str) -> None: """Handle GET /Metadata/{uuid}.""" <|body_0|> async def delete(self, metadata_id: str) -> None: """Handle DELETE /Metadata/...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MetadataSingleHandler: """MetadataSingleHandler handles object level routes for Metadata.""" async def get(self, metadata_id: str) -> None: """Handle GET /Metadata/{uuid}.""" query = {'uuid': metadata_id} projection = {'_id': False} logging.debug(f'MONGO-START: db.Metadata...
the_stack_v2_python_sparse
lta/rest_server.py
blinkdog/lta
train
0
16eae5547a771ceaceca9825e977c9b61e8115f1
[ "super(Pyramid, self).__init__(nodes_to_cell, coord_nodes_to_cell, geometry_type)\nself.permeability = permeability\nself.prop_id = prop_id", "self.nodes_to_faces[0] = [self.nodes_to_cell[0], self.nodes_to_cell[1], self.nodes_to_cell[2], self.nodes_to_cell[3]]\nself.nodes_to_faces[1] = [self.nodes_to_cell[0], sel...
<|body_start_0|> super(Pyramid, self).__init__(nodes_to_cell, coord_nodes_to_cell, geometry_type) self.permeability = permeability self.prop_id = prop_id <|end_body_0|> <|body_start_1|> self.nodes_to_faces[0] = [self.nodes_to_cell[0], self.nodes_to_cell[1], self.nodes_to_cell[2], self.n...
Pyramid
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pyramid: def __init__(self, nodes_to_cell, coord_nodes_to_cell, geometry_type, permeability, prop_id=-1): """Class constructor for the child class Pyramid :param nodes_to_cell: array with all the nodes belonging the the control volume (CV) :param coord_nodes_to_cell: array with the (x,y,...
stack_v2_sparse_classes_75kplus_train_071430
31,478
permissive
[ { "docstring": "Class constructor for the child class Pyramid :param nodes_to_cell: array with all the nodes belonging the the control volume (CV) :param coord_nodes_to_cell: array with the (x,y,z) coordinates of the nodes belonging to this control volume :param geometry_type: geometry of the control volume (e....
4
null
Implement the Python class `Pyramid` described below. Class description: Implement the Pyramid class. Method signatures and docstrings: - def __init__(self, nodes_to_cell, coord_nodes_to_cell, geometry_type, permeability, prop_id=-1): Class constructor for the child class Pyramid :param nodes_to_cell: array with all ...
Implement the Python class `Pyramid` described below. Class description: Implement the Pyramid class. Method signatures and docstrings: - def __init__(self, nodes_to_cell, coord_nodes_to_cell, geometry_type, permeability, prop_id=-1): Class constructor for the child class Pyramid :param nodes_to_cell: array with all ...
a81d21c38c0e7f66b2a07af016cd34bf0fcb6aa5
<|skeleton|> class Pyramid: def __init__(self, nodes_to_cell, coord_nodes_to_cell, geometry_type, permeability, prop_id=-1): """Class constructor for the child class Pyramid :param nodes_to_cell: array with all the nodes belonging the the control volume (CV) :param coord_nodes_to_cell: array with the (x,y,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Pyramid: def __init__(self, nodes_to_cell, coord_nodes_to_cell, geometry_type, permeability, prop_id=-1): """Class constructor for the child class Pyramid :param nodes_to_cell: array with all the nodes belonging the the control volume (CV) :param coord_nodes_to_cell: array with the (x,y,z) coordinates...
the_stack_v2_python_sparse
darts/mesh/geometrymodule.py
dvoskov/hackathon-darts
train
0
caf5ea35f2109f7f61bcc5b4961def81f1152511
[ "n = len(prices)\nif n < 2:\n return 0\nif k >= n / 2:\n return sum((i - j for i, j in zip(prices[1:], prices[:-1]) if i - j > 0))\nglobal_max = [[0] * n for _ in xrange(k + 1)]\nfor i in xrange(1, k + 1):\n local_max = [0] * n\n for j in xrange(1, n):\n profit = prices[j] - prices[j - 1]\n ...
<|body_start_0|> n = len(prices) if n < 2: return 0 if k >= n / 2: return sum((i - j for i, j in zip(prices[1:], prices[:-1]) if i - j > 0)) global_max = [[0] * n for _ in xrange(k + 1)] for i in xrange(1, k + 1): local_max = [0] * n ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int beats 35.60%""" <|body_0|> def maxProfit1(self, k, prices): """:type k: int :type prices: List[int] :rtype: int beats 50.00%""" <|body_1|> def maxProfit2(self, ...
stack_v2_sparse_classes_75kplus_train_071431
3,377
no_license
[ { "docstring": ":type k: int :type prices: List[int] :rtype: int beats 35.60%", "name": "maxProfit", "signature": "def maxProfit(self, k, prices)" }, { "docstring": ":type k: int :type prices: List[int] :rtype: int beats 50.00%", "name": "maxProfit1", "signature": "def maxProfit1(self, k...
3
stack_v2_sparse_classes_30k_train_017658
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int beats 35.60% - def maxProfit1(self, k, prices): :type k: int :type prices: List[int] :rtype: int ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int beats 35.60% - def maxProfit1(self, k, prices): :type k: int :type prices: List[int] :rtype: int ...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int beats 35.60%""" <|body_0|> def maxProfit1(self, k, prices): """:type k: int :type prices: List[int] :rtype: int beats 50.00%""" <|body_1|> def maxProfit2(self, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int beats 35.60%""" n = len(prices) if n < 2: return 0 if k >= n / 2: return sum((i - j for i, j in zip(prices[1:], prices[:-1]) if i - j > 0)) global_max =...
the_stack_v2_python_sparse
LeetCode/188_best_time_to_buy_and_sell_stock_IV.py
yao23/Machine_Learning_Playground
train
12
22b2b45144d5e1b5cc0a3dbb1d55016e3ff51688
[ "self.applications = applications\nself.entity_permission_info = entity_permission_info\nself.logical_size_bytes = logical_size_bytes\nself.registration_info = registration_info\nself.root_node = root_node\nself.stats = stats\nself.stats_by_env = stats_by_env\nself.total_downtiered_size_in_bytes = total_downtiered_...
<|body_start_0|> self.applications = applications self.entity_permission_info = entity_permission_info self.logical_size_bytes = logical_size_bytes self.registration_info = registration_info self.root_node = root_node self.stats = stats self.stats_by_env = stats_b...
Implementation of the 'ProtectionSourceTreeInfo' model. Specifies the registration and protection information of a registered Protection Source Tree on the Cohesity Cluster. Many different Protection Source trees are supported such as 'kVMware', 'kAcropolis', 'kPhysical' etc., Attributes: applications (list of Applicat...
ProtectionSourceTreeInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectionSourceTreeInfo: """Implementation of the 'ProtectionSourceTreeInfo' model. Specifies the registration and protection information of a registered Protection Source Tree on the Cohesity Cluster. Many different Protection Source trees are supported such as 'kVMware', 'kAcropolis', 'kPhysic...
stack_v2_sparse_classes_75kplus_train_071432
6,386
permissive
[ { "docstring": "Constructor for the ProtectionSourceTreeInfo class", "name": "__init__", "signature": "def __init__(self, applications=None, entity_permission_info=None, logical_size_bytes=None, registration_info=None, root_node=None, stats=None, stats_by_env=None, total_downtiered_size_in_bytes=None, t...
2
stack_v2_sparse_classes_30k_train_021119
Implement the Python class `ProtectionSourceTreeInfo` described below. Class description: Implementation of the 'ProtectionSourceTreeInfo' model. Specifies the registration and protection information of a registered Protection Source Tree on the Cohesity Cluster. Many different Protection Source trees are supported su...
Implement the Python class `ProtectionSourceTreeInfo` described below. Class description: Implementation of the 'ProtectionSourceTreeInfo' model. Specifies the registration and protection information of a registered Protection Source Tree on the Cohesity Cluster. Many different Protection Source trees are supported su...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ProtectionSourceTreeInfo: """Implementation of the 'ProtectionSourceTreeInfo' model. Specifies the registration and protection information of a registered Protection Source Tree on the Cohesity Cluster. Many different Protection Source trees are supported such as 'kVMware', 'kAcropolis', 'kPhysic...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProtectionSourceTreeInfo: """Implementation of the 'ProtectionSourceTreeInfo' model. Specifies the registration and protection information of a registered Protection Source Tree on the Cohesity Cluster. Many different Protection Source trees are supported such as 'kVMware', 'kAcropolis', 'kPhysical' etc., Att...
the_stack_v2_python_sparse
cohesity_management_sdk/models/protection_source_tree_info.py
cohesity/management-sdk-python
train
24
88e202dbfd2f9b539e964b809033f7df1335347f
[ "cluster = self.get_object_or_404(Cluster, cluster_id)\nif not cluster.attributes:\n raise web.internalerror('No attributes found!')\nreturn {'editable': cluster.attributes.editable}", "cluster = self.get_object_or_404(Cluster, cluster_id)\nif not cluster.attributes:\n raise web.internalerror('No attributes...
<|body_start_0|> cluster = self.get_object_or_404(Cluster, cluster_id) if not cluster.attributes: raise web.internalerror('No attributes found!') return {'editable': cluster.attributes.editable} <|end_body_0|> <|body_start_1|> cluster = self.get_object_or_404(Cluster, cluste...
Cluster attributes handler
ClusterAttributesHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterAttributesHandler: """Cluster attributes handler""" def GET(self, cluster_id): """:returns: JSONized Cluster attributes. :http: * 200 (OK) * 404 (cluster not found in db) * 500 (cluster has no attributes)""" <|body_0|> def PUT(self, cluster_id): """:return...
stack_v2_sparse_classes_75kplus_train_071433
13,435
no_license
[ { "docstring": ":returns: JSONized Cluster attributes. :http: * 200 (OK) * 404 (cluster not found in db) * 500 (cluster has no attributes)", "name": "GET", "signature": "def GET(self, cluster_id)" }, { "docstring": ":returns: JSONized Cluster attributes. :http: * 200 (OK) * 400 (wrong attributes...
2
stack_v2_sparse_classes_30k_train_016762
Implement the Python class `ClusterAttributesHandler` described below. Class description: Cluster attributes handler Method signatures and docstrings: - def GET(self, cluster_id): :returns: JSONized Cluster attributes. :http: * 200 (OK) * 404 (cluster not found in db) * 500 (cluster has no attributes) - def PUT(self,...
Implement the Python class `ClusterAttributesHandler` described below. Class description: Cluster attributes handler Method signatures and docstrings: - def GET(self, cluster_id): :returns: JSONized Cluster attributes. :http: * 200 (OK) * 404 (cluster not found in db) * 500 (cluster has no attributes) - def PUT(self,...
64d5e511c5ceb0e2d18107012d73042ad1daa345
<|skeleton|> class ClusterAttributesHandler: """Cluster attributes handler""" def GET(self, cluster_id): """:returns: JSONized Cluster attributes. :http: * 200 (OK) * 404 (cluster not found in db) * 500 (cluster has no attributes)""" <|body_0|> def PUT(self, cluster_id): """:return...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClusterAttributesHandler: """Cluster attributes handler""" def GET(self, cluster_id): """:returns: JSONized Cluster attributes. :http: * 200 (OK) * 404 (cluster not found in db) * 500 (cluster has no attributes)""" cluster = self.get_object_or_404(Cluster, cluster_id) if not clust...
the_stack_v2_python_sparse
nailgun/nailgun/api/handlers/cluster.py
loles/fuel-web
train
1
eb215723810d93eac6750dfaf490b56a84796295
[ "byA_PatternStep.__init__(self, **kwargs)\ntableVal = self._parent._dicoMesures['Hauteurdubassin' + self._stature]\np1 = self._parent._dicoConstruction['HipLine_middleBackPoint']\np2 = self._parent._dicoConstruction['HipLine_middleFrontPoint']\nself._middleBackPoint = byA_Point(x=p1._x, y=p1._y - tableVal)\nself._m...
<|body_start_0|> byA_PatternStep.__init__(self, **kwargs) tableVal = self._parent._dicoMesures['Hauteurdubassin' + self._stature] p1 = self._parent._dicoConstruction['HipLine_middleBackPoint'] p2 = self._parent._dicoConstruction['HipLine_middleFrontPoint'] self._middleBackPoint =...
byA_WaistLine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class byA_WaistLine: def __init__(self, **kwargs): """Constructor""" <|body_0|> def addToGroup(self, drawing, svggroup, **extra): """add a line to a SVG group""" <|body_1|> <|end_skeleton|> <|body_start_0|> byA_PatternStep.__init__(self, **kwargs) ...
stack_v2_sparse_classes_75kplus_train_071434
1,902
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "add a line to a SVG group", "name": "addToGroup", "signature": "def addToGroup(self, drawing, svggroup, **extra)" } ]
2
stack_v2_sparse_classes_30k_train_005655
Implement the Python class `byA_WaistLine` described below. Class description: Implement the byA_WaistLine class. Method signatures and docstrings: - def __init__(self, **kwargs): Constructor - def addToGroup(self, drawing, svggroup, **extra): add a line to a SVG group
Implement the Python class `byA_WaistLine` described below. Class description: Implement the byA_WaistLine class. Method signatures and docstrings: - def __init__(self, **kwargs): Constructor - def addToGroup(self, drawing, svggroup, **extra): add a line to a SVG group <|skeleton|> class byA_WaistLine: def __in...
f4fb3fca0af1f18f375104d093cd6921bfce7b32
<|skeleton|> class byA_WaistLine: def __init__(self, **kwargs): """Constructor""" <|body_0|> def addToGroup(self, drawing, svggroup, **extra): """add a line to a SVG group""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class byA_WaistLine: def __init__(self, **kwargs): """Constructor""" byA_PatternStep.__init__(self, **kwargs) tableVal = self._parent._dicoMesures['Hauteurdubassin' + self._stature] p1 = self._parent._dicoConstruction['HipLine_middleBackPoint'] p2 = self._parent._dicoConstruc...
the_stack_v2_python_sparse
LineJaquePattern/byA_WaistLine.py
byAnhor/PatternGenerator1
train
0
b558a76131e8bcbc35b033bb3809cea087f2641b
[ "if model._meta.app_label == 'orion_flash':\n return 'orion_aux_db'\nreturn None", "if model._meta.app_label == 'orion_flash':\n return 'orion_aux_db'\nreturn None", "if obj1._state.db == 'orion_aux_db' and obj2._state.db == 'orion_aux_db':\n return True\nreturn None", "if app_label == 'orion_flash':...
<|body_start_0|> if model._meta.app_label == 'orion_flash': return 'orion_aux_db' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label == 'orion_flash': return 'orion_aux_db' return None <|end_body_1|> <|body_start_2|> if obj1._state.db =...
database router class for the orion auxiliary database
OrionAuxRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrionAuxRouter: """database router class for the orion auxiliary database""" def db_for_read(self, model, **hints): """all models in orion_flash will read from the orion auxiliary database""" <|body_0|> def db_for_write(self, model, **hints): """all models in ori...
stack_v2_sparse_classes_75kplus_train_071435
1,525
no_license
[ { "docstring": "all models in orion_flash will read from the orion auxiliary database", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "all models in orion_flash will write to the orion auxiliary database", "name": "db_for_write", "signature...
4
stack_v2_sparse_classes_30k_train_031938
Implement the Python class `OrionAuxRouter` described below. Class description: database router class for the orion auxiliary database Method signatures and docstrings: - def db_for_read(self, model, **hints): all models in orion_flash will read from the orion auxiliary database - def db_for_write(self, model, **hint...
Implement the Python class `OrionAuxRouter` described below. Class description: database router class for the orion auxiliary database Method signatures and docstrings: - def db_for_read(self, model, **hints): all models in orion_flash will read from the orion auxiliary database - def db_for_write(self, model, **hint...
08bf0cc90e4d63a84fcd4e35bf5d196430c43319
<|skeleton|> class OrionAuxRouter: """database router class for the orion auxiliary database""" def db_for_read(self, model, **hints): """all models in orion_flash will read from the orion auxiliary database""" <|body_0|> def db_for_write(self, model, **hints): """all models in ori...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OrionAuxRouter: """database router class for the orion auxiliary database""" def db_for_read(self, model, **hints): """all models in orion_flash will read from the orion auxiliary database""" if model._meta.app_label == 'orion_flash': return 'orion_aux_db' return None ...
the_stack_v2_python_sparse
orion_flash/router.py
PHSAServiceOperationsCenter/PHSA-SOC
train
0
f0399a9228a9fab83e677c580eae18ebf964a3cd
[ "self.n, self.k = (n, k)\nif n < 1 or k < 1:\n raise OutOfRangeException", "self.var = [elem * 0 for elem in range(self.k)]\nself.var[self.k - 1] = -1\nself.i = self.k - 1\nreturn self", "if self.var[self.i] != self.n - 1:\n self.var[self.i] += 1\n return self.var\nelse:\n while self.var[self.i] == ...
<|body_start_0|> self.n, self.k = (n, k) if n < 1 or k < 1: raise OutOfRangeException <|end_body_0|> <|body_start_1|> self.var = [elem * 0 for elem in range(self.k)] self.var[self.k - 1] = -1 self.i = self.k - 1 return self <|end_body_1|> <|body_start_2|> ...
Klasa implementująca wariacje. Zadaniem tej klasy jest dostarczenie iterowalnego interfejsu do wykonywania wariacji. Elementy stanowiące wariacje są liczbami.
Variation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Variation: """Klasa implementująca wariacje. Zadaniem tej klasy jest dostarczenie iterowalnego interfejsu do wykonywania wariacji. Elementy stanowiące wariacje są liczbami.""" def __init__(self, n, k): """Konstruktor. Argumenty: n -- liczba elementów zbioru k -- liczba wyrazów wariac...
stack_v2_sparse_classes_75kplus_train_071436
4,474
no_license
[ { "docstring": "Konstruktor. Argumenty: n -- liczba elementów zbioru k -- liczba wyrazów wariacji", "name": "__init__", "signature": "def __init__(self, n, k)" }, { "docstring": "Inicjalizacja generatora.", "name": "__iter__", "signature": "def __iter__(self)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_002942
Implement the Python class `Variation` described below. Class description: Klasa implementująca wariacje. Zadaniem tej klasy jest dostarczenie iterowalnego interfejsu do wykonywania wariacji. Elementy stanowiące wariacje są liczbami. Method signatures and docstrings: - def __init__(self, n, k): Konstruktor. Argumenty...
Implement the Python class `Variation` described below. Class description: Klasa implementująca wariacje. Zadaniem tej klasy jest dostarczenie iterowalnego interfejsu do wykonywania wariacji. Elementy stanowiące wariacje są liczbami. Method signatures and docstrings: - def __init__(self, n, k): Konstruktor. Argumenty...
1afb26ec87f0412a0bd9b2abc0d602c4279c6324
<|skeleton|> class Variation: """Klasa implementująca wariacje. Zadaniem tej klasy jest dostarczenie iterowalnego interfejsu do wykonywania wariacji. Elementy stanowiące wariacje są liczbami.""" def __init__(self, n, k): """Konstruktor. Argumenty: n -- liczba elementów zbioru k -- liczba wyrazów wariac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Variation: """Klasa implementująca wariacje. Zadaniem tej klasy jest dostarczenie iterowalnego interfejsu do wykonywania wariacji. Elementy stanowiące wariacje są liczbami.""" def __init__(self, n, k): """Konstruktor. Argumenty: n -- liczba elementów zbioru k -- liczba wyrazów wariacji""" ...
the_stack_v2_python_sparse
src/combinatorics/variation.py
wengyingjian/rjohn
train
0
610a5c3471eaac24cc4dc102d099c366b7af718b
[ "if index is None:\n index_ = np.arange(self.n_views_)\nelse:\n index_ = np.copy(index)\n index_ = np.atleast_1d(index_)\nassert len(index_) == len(Xs)\ncheck_is_fitted(self)\nXs = check_Xs(Xs)\nXs_transformed = []\nfor estimator, X in zip([self.estimators_[i] for i in index_], Xs):\n Xs_transformed.app...
<|body_start_0|> if index is None: index_ = np.arange(self.n_views_) else: index_ = np.copy(index) index_ = np.atleast_1d(index_) assert len(index_) == len(Xs) check_is_fitted(self) Xs = check_Xs(Xs) Xs_transformed = [] for esti...
Apply a sklearn transformer to each view of a dataset Build a transformer from multiview dataset to multiview dataset by using one or more individual scikit-learn transformers on each view. Parameters ---------- base_estimator : a sklearn transformer instance, or a list Either a single sklearn transformer that will be ...
ViewTransformer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViewTransformer: """Apply a sklearn transformer to each view of a dataset Build a transformer from multiview dataset to multiview dataset by using one or more individual scikit-learn transformers on each view. Parameters ---------- base_estimator : a sklearn transformer instance, or a list Either...
stack_v2_sparse_classes_75kplus_train_071437
10,189
permissive
[ { "docstring": "Transform each dataset Applies the transform of each transformer on the individual views. Parameters ---------- Xs : list of array-likes or numpy.ndarray - Xs length: n_views - Xs[i] shape: (n_samples, n_features_i) The input data. index: int or array-like, default=None The index or list of indi...
3
stack_v2_sparse_classes_30k_train_053857
Implement the Python class `ViewTransformer` described below. Class description: Apply a sklearn transformer to each view of a dataset Build a transformer from multiview dataset to multiview dataset by using one or more individual scikit-learn transformers on each view. Parameters ---------- base_estimator : a sklearn...
Implement the Python class `ViewTransformer` described below. Class description: Apply a sklearn transformer to each view of a dataset Build a transformer from multiview dataset to multiview dataset by using one or more individual scikit-learn transformers on each view. Parameters ---------- base_estimator : a sklearn...
003dccea563926fca5d957f5bbf39c1494acfe94
<|skeleton|> class ViewTransformer: """Apply a sklearn transformer to each view of a dataset Build a transformer from multiview dataset to multiview dataset by using one or more individual scikit-learn transformers on each view. Parameters ---------- base_estimator : a sklearn transformer instance, or a list Either...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ViewTransformer: """Apply a sklearn transformer to each view of a dataset Build a transformer from multiview dataset to multiview dataset by using one or more individual scikit-learn transformers on each view. Parameters ---------- base_estimator : a sklearn transformer instance, or a list Either a single skl...
the_stack_v2_python_sparse
mvlearn/compose/wrap.py
mvlearn/mvlearn
train
136
0ea535e4e9f7a1e90d07a5d9b553051827490b41
[ "self.data = [0]\nfor w_ in w:\n self.data.append(self.data[-1] + w_)\nself.data = self.data[1:]", "rand = random.randint(1, self.data[-1])\nidx = bisect.bisect_left(self.data, rand)\nreturn idx" ]
<|body_start_0|> self.data = [0] for w_ in w: self.data.append(self.data[-1] + w_) self.data = self.data[1:] <|end_body_0|> <|body_start_1|> rand = random.randint(1, self.data[-1]) idx = bisect.bisect_left(self.data, rand) return idx <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.data = [0] for w_ in w: self.data.append(self.data[-1] + w_) se...
stack_v2_sparse_classes_75kplus_train_071438
1,440
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
stack_v2_sparse_classes_30k_train_021134
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
a5cb862f0c5a3cfd21468141800568c2dedded0a
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def __init__(self, w): """:type w: List[int]""" self.data = [0] for w_ in w: self.data.append(self.data[-1] + w_) self.data = self.data[1:] def pickIndex(self): """:rtype: int""" rand = random.randint(1, self.data[-1]) idx = bi...
the_stack_v2_python_sparse
python/leetcode/sampling/528_random_pick_weight.py
Levintsky/topcoder
train
0
0e07df5de969277dc69536d0fe57a72958bcfed2
[ "if not email:\n raise ValueError('User must have an email address')\nprint('-----------------Antes de guardar usuarios')\nemail = self.normalize_email(email)\nuser = self.model(email=email)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(email, password)\nuser.i...
<|body_start_0|> if not email: raise ValueError('User must have an email address') print('-----------------Antes de guardar usuarios') email = self.normalize_email(email) user = self.model(email=email) user.set_password(password) user.save(using=self._db) ...
Administrador para perfiles de Usuario
UserProfileManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProfileManager: """Administrador para perfiles de Usuario""" def create_user(self, email: str, password: str) -> User: """Crea un nuevo usuario""" <|body_0|> def create_superuser(self, email: str, password: str) -> User: """Crea un nuevo superusuario""" ...
stack_v2_sparse_classes_75kplus_train_071439
2,388
no_license
[ { "docstring": "Crea un nuevo usuario", "name": "create_user", "signature": "def create_user(self, email: str, password: str) -> User" }, { "docstring": "Crea un nuevo superusuario", "name": "create_superuser", "signature": "def create_superuser(self, email: str, password: str) -> User" ...
2
stack_v2_sparse_classes_30k_train_027617
Implement the Python class `UserProfileManager` described below. Class description: Administrador para perfiles de Usuario Method signatures and docstrings: - def create_user(self, email: str, password: str) -> User: Crea un nuevo usuario - def create_superuser(self, email: str, password: str) -> User: Crea un nuevo ...
Implement the Python class `UserProfileManager` described below. Class description: Administrador para perfiles de Usuario Method signatures and docstrings: - def create_user(self, email: str, password: str) -> User: Crea un nuevo usuario - def create_superuser(self, email: str, password: str) -> User: Crea un nuevo ...
6f7ee866d21cd87de1b03a57adc3276204031a9e
<|skeleton|> class UserProfileManager: """Administrador para perfiles de Usuario""" def create_user(self, email: str, password: str) -> User: """Crea un nuevo usuario""" <|body_0|> def create_superuser(self, email: str, password: str) -> User: """Crea un nuevo superusuario""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserProfileManager: """Administrador para perfiles de Usuario""" def create_user(self, email: str, password: str) -> User: """Crea un nuevo usuario""" if not email: raise ValueError('User must have an email address') print('-----------------Antes de guardar usuarios') ...
the_stack_v2_python_sparse
profiles/models.py
JCamilo5/backProyecto1
train
0
d28b0ab278e2fbf63f8aa4dc805636fe630e8036
[ "self.parent = parent\nself.line = line\nself.file = file\nself.comment = comment\nself.init()", "ext = os.path.splitext(self.file)[-1].lower()\nif ext == '.tex':\n self.obj = LatexFile(self.file, self.parent.root, line=self.line)\nelif ext in ['.py', '.cpp', '.h', '.hpp', '.c', '.hhp', '.vba', '.sql', '.r', '...
<|body_start_0|> self.parent = parent self.line = line self.file = file self.comment = comment self.init() <|end_body_0|> <|body_start_1|> ext = os.path.splitext(self.file)[-1].lower() if ext == '.tex': self.obj = LatexFile(self.file, self.parent.root...
Describes a file included a latex file. @var parent (LatexFile) @var line (int) line number @var file (str) file name @var comment (str) comment @var obj (LatexFile|LatexCode) object
LatexIncludedFile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LatexIncludedFile: """Describes a file included a latex file. @var parent (LatexFile) @var line (int) line number @var file (str) file name @var comment (str) comment @var obj (LatexFile|LatexCode) object""" def __init__(self, parent, line, file, comment): """@param parent (LatexFile...
stack_v2_sparse_classes_75kplus_train_071440
14,403
permissive
[ { "docstring": "@param parent (LatexFile) which contains this file @param line line number where it was found in the late file it belongs to @param file file name @param comment comment", "name": "__init__", "signature": "def __init__(self, parent, line, file, comment)" }, { "docstring": "Comple...
3
null
Implement the Python class `LatexIncludedFile` described below. Class description: Describes a file included a latex file. @var parent (LatexFile) @var line (int) line number @var file (str) file name @var comment (str) comment @var obj (LatexFile|LatexCode) object Method signatures and docstrings: - def __init__(sel...
Implement the Python class `LatexIncludedFile` described below. Class description: Describes a file included a latex file. @var parent (LatexFile) @var line (int) line number @var file (str) file name @var comment (str) comment @var obj (LatexFile|LatexCode) object Method signatures and docstrings: - def __init__(sel...
2abbc7a20c7437f9ab91d1ec83a6aecdefceb028
<|skeleton|> class LatexIncludedFile: """Describes a file included a latex file. @var parent (LatexFile) @var line (int) line number @var file (str) file name @var comment (str) comment @var obj (LatexFile|LatexCode) object""" def __init__(self, parent, line, file, comment): """@param parent (LatexFile...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LatexIncludedFile: """Describes a file included a latex file. @var parent (LatexFile) @var line (int) line number @var file (str) file name @var comment (str) comment @var obj (LatexFile|LatexCode) object""" def __init__(self, parent, line, file, comment): """@param parent (LatexFile) which conta...
the_stack_v2_python_sparse
src/ensae_teaching_cs/homeblog/latex_file.py
Pandinosaurus/ensae_teaching_cs
train
1
5e4a9106eeb32f7bf8936828eae3531aa70011bd
[ "for con in self.contents:\n if con is not obj and (con.has_account or (hasattr(con, 'is_character') and con.is_character)):\n return False\nreturn True", "if obj.has_account or (hasattr(obj, 'is_character') and obj.is_character):\n if self.is_empty_except(obj):\n self.softdelete()" ]
<|body_start_0|> for con in self.contents: if con is not obj and (con.has_account or (hasattr(con, 'is_character') and con.is_character)): return False return True <|end_body_0|> <|body_start_1|> if obj.has_account or (hasattr(obj, 'is_character') and obj.is_characte...
A temporary room, which will reap itself when everyone has left.
TempRoom
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TempRoom: """A temporary room, which will reap itself when everyone has left.""" def is_empty_except(self, obj): """Returns whether or not this room is currently empty of characters save the given object. :return: True if the room has no characters or NPCs in it, False if someone is ...
stack_v2_sparse_classes_75kplus_train_071441
32,896
permissive
[ { "docstring": "Returns whether or not this room is currently empty of characters save the given object. :return: True if the room has no characters or NPCs in it, False if someone is present.", "name": "is_empty_except", "signature": "def is_empty_except(self, obj)" }, { "docstring": "Override ...
2
null
Implement the Python class `TempRoom` described below. Class description: A temporary room, which will reap itself when everyone has left. Method signatures and docstrings: - def is_empty_except(self, obj): Returns whether or not this room is currently empty of characters save the given object. :return: True if the r...
Implement the Python class `TempRoom` described below. Class description: A temporary room, which will reap itself when everyone has left. Method signatures and docstrings: - def is_empty_except(self, obj): Returns whether or not this room is currently empty of characters save the given object. :return: True if the r...
363a1f14fd1a640580a4bf4486a1afe776757557
<|skeleton|> class TempRoom: """A temporary room, which will reap itself when everyone has left.""" def is_empty_except(self, obj): """Returns whether or not this room is currently empty of characters save the given object. :return: True if the room has no characters or NPCs in it, False if someone is ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TempRoom: """A temporary room, which will reap itself when everyone has left.""" def is_empty_except(self, obj): """Returns whether or not this room is currently empty of characters save the given object. :return: True if the room has no characters or NPCs in it, False if someone is present.""" ...
the_stack_v2_python_sparse
typeclasses/rooms.py
Arx-Game/arxcode
train
52
f2ff0560bc3dce89e8dd607c7d3a891754151282
[ "self.N = 8\nself.cache = []\nself.stack = []", "if not self.cache:\n if len(self.stack) == self.N:\n self.cache.append([x])\n else:\n self.stack.append(x)\nelif len(self.cache[-1]) == self.N:\n self.cache.append([x])\nelse:\n self.cache[-1].append(x)", "if not self.stack:\n tmp = [...
<|body_start_0|> self.N = 8 self.cache = [] self.stack = [] <|end_body_0|> <|body_start_1|> if not self.cache: if len(self.stack) == self.N: self.cache.append([x]) else: self.stack.append(x) elif len(self.cache[-1]) == self...
MyQueue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyQueue: def __init__(self): """Initialize your data structure here.""" <|body_0|> def push(self, x: int) -> None: """Push element x to the back of queue.""" <|body_1|> def pop(self) -> int: """Removes the element from in front of queue and retur...
stack_v2_sparse_classes_75kplus_train_071442
2,125
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Push element x to the back of queue.", "name": "push", "signature": "def push(self, x: int) -> None" }, { "docstring": "Removes the element from in fron...
5
null
Implement the Python class `MyQueue` described below. Class description: Implement the MyQueue class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def push(self, x: int) -> None: Push element x to the back of queue. - def pop(self) -> int: Removes the element from in ...
Implement the Python class `MyQueue` described below. Class description: Implement the MyQueue class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def push(self, x: int) -> None: Push element x to the back of queue. - def pop(self) -> int: Removes the element from in ...
b7d9238d692b1b2f5ab8f73a76d02228a71a4d15
<|skeleton|> class MyQueue: def __init__(self): """Initialize your data structure here.""" <|body_0|> def push(self, x: int) -> None: """Push element x to the back of queue.""" <|body_1|> def pop(self) -> int: """Removes the element from in front of queue and retur...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyQueue: def __init__(self): """Initialize your data structure here.""" self.N = 8 self.cache = [] self.stack = [] def push(self, x: int) -> None: """Push element x to the back of queue.""" if not self.cache: if len(self.stack) == self.N: ...
the_stack_v2_python_sparse
232-Implement-Queue-Using-Stacks.py
liuspencersjtu/MyLeetCode
train
0
bf549facf7d72fff791d7df48bd009eef44a1cac
[ "self._debug = debug\nself._ip_addr = ip_addr\nself._address_dict = {}\nself._resource_dict = {}\nself._listen_thread = None\nself._listen_port = listen_port\nself._sending_thr_timeout = sending_thr_timeout\nself._resource_tree = aiocoap.resource.Site()\nself._logger = logging.getLogger(self.__class__.__name__)\nse...
<|body_start_0|> self._debug = debug self._ip_addr = ip_addr self._address_dict = {} self._resource_dict = {} self._listen_thread = None self._listen_port = listen_port self._sending_thr_timeout = sending_thr_timeout self._resource_tree = aiocoap.resource....
A CoAP Server that receives CoAP Messages for re-distribution
CoapServer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoapServer: """A CoAP Server that receives CoAP Messages for re-distribution""" def __init__(self, ip_addr, listen_port=5683, sending_thr_timeout=5, debug=False): """Initialize the CoAP USP Binding for a USP Endpoint - 5683 is the default CoAP port, but 5684 is the default CoAPS port...
stack_v2_sparse_classes_75kplus_train_071443
11,505
permissive
[ { "docstring": "Initialize the CoAP USP Binding for a USP Endpoint - 5683 is the default CoAP port, but 5684 is the default CoAPS port", "name": "__init__", "signature": "def __init__(self, ip_addr, listen_port=5683, sending_thr_timeout=5, debug=False)" }, { "docstring": "Listen for incoming CoA...
5
stack_v2_sparse_classes_30k_train_014855
Implement the Python class `CoapServer` described below. Class description: A CoAP Server that receives CoAP Messages for re-distribution Method signatures and docstrings: - def __init__(self, ip_addr, listen_port=5683, sending_thr_timeout=5, debug=False): Initialize the CoAP USP Binding for a USP Endpoint - 5683 is ...
Implement the Python class `CoapServer` described below. Class description: A CoAP Server that receives CoAP Messages for re-distribution Method signatures and docstrings: - def __init__(self, ip_addr, listen_port=5683, sending_thr_timeout=5, debug=False): Initialize the CoAP USP Binding for a USP Endpoint - 5683 is ...
54fee603dc3b48e5d142bf72616e4707823f2c58
<|skeleton|> class CoapServer: """A CoAP Server that receives CoAP Messages for re-distribution""" def __init__(self, ip_addr, listen_port=5683, sending_thr_timeout=5, debug=False): """Initialize the CoAP USP Binding for a USP Endpoint - 5683 is the default CoAP port, but 5684 is the default CoAPS port...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CoapServer: """A CoAP Server that receives CoAP Messages for re-distribution""" def __init__(self, ip_addr, listen_port=5683, sending_thr_timeout=5, debug=False): """Initialize the CoAP USP Binding for a USP Endpoint - 5683 is the default CoAP port, but 5684 is the default CoAPS port""" s...
the_stack_v2_python_sparse
mtp-proxy/mtp_proxy/coap_server.py
BroadbandForum/usp
train
29
77e3d562df9d9fcbfa5e8058db904decf2df2dba
[ "for i in self._inOrderGen(self.root):\n if re.match(str(string), str(i[0])):\n yield i[0]", "def generate(root):\n if root:\n yield list(generate(root.left))\n val = root.val[:5]\n val.append(root.val[5].treestr())\n val.append(root.val[6].treestr())\n yield (root....
<|body_start_0|> for i in self._inOrderGen(self.root): if re.match(str(string), str(i[0])): yield i[0] <|end_body_0|> <|body_start_1|> def generate(root): if root: yield list(generate(root.left)) val = root.val[:5] ...
User_BST
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User_BST: def simsearch(self, string): """Simple similarity search for user tree Time complexity: O(n)""" <|body_0|> def treestr(self): """Returns string of nested lists that can be used to build the tree (using the Date treestr)""" <|body_1|> def treebu...
stack_v2_sparse_classes_75kplus_train_071444
9,078
no_license
[ { "docstring": "Simple similarity search for user tree Time complexity: O(n)", "name": "simsearch", "signature": "def simsearch(self, string)" }, { "docstring": "Returns string of nested lists that can be used to build the tree (using the Date treestr)", "name": "treestr", "signature": "...
3
stack_v2_sparse_classes_30k_train_043283
Implement the Python class `User_BST` described below. Class description: Implement the User_BST class. Method signatures and docstrings: - def simsearch(self, string): Simple similarity search for user tree Time complexity: O(n) - def treestr(self): Returns string of nested lists that can be used to build the tree (...
Implement the Python class `User_BST` described below. Class description: Implement the User_BST class. Method signatures and docstrings: - def simsearch(self, string): Simple similarity search for user tree Time complexity: O(n) - def treestr(self): Returns string of nested lists that can be used to build the tree (...
ec7d6fc488f7b82c35a073fe3ea374de2aa0b16a
<|skeleton|> class User_BST: def simsearch(self, string): """Simple similarity search for user tree Time complexity: O(n)""" <|body_0|> def treestr(self): """Returns string of nested lists that can be used to build the tree (using the Date treestr)""" <|body_1|> def treebu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class User_BST: def simsearch(self, string): """Simple similarity search for user tree Time complexity: O(n)""" for i in self._inOrderGen(self.root): if re.match(str(string), str(i[0])): yield i[0] def treestr(self): """Returns string of nested lists that can...
the_stack_v2_python_sparse
CEP Y3/Unit 2.10 Final Project/cds_attributetrees.py
HTY2003/CEP-Stuff
train
0
5b3df57af7d866caa2c602b96b6406c802bc3006
[ "user = request.user\narticle_id = get_object_or_404(Article, slug=slug)\nlike_article = request.data.get('like_article', None)\nif like_article is None:\n raise serializers.ValidationError('like_article field is required')\nif type(like_article) != bool:\n raise serializers.ValidationError('Value of like_art...
<|body_start_0|> user = request.user article_id = get_object_or_404(Article, slug=slug) like_article = request.data.get('like_article', None) if like_article is None: raise serializers.ValidationError('like_article field is required') if type(like_article) != bool: ...
Updates, retrieves and deletes an articlelikes instance
ArticleLikesView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleLikesView: """Updates, retrieves and deletes an articlelikes instance""" def put(self, request, slug): """Updates the article with the reader's feedback args: request (Request object): Django Request context slug (Article label): stores and generates a valid URL for the articl...
stack_v2_sparse_classes_75kplus_train_071445
11,020
permissive
[ { "docstring": "Updates the article with the reader's feedback args: request (Request object): Django Request context slug (Article label): stores and generates a valid URL for the article. Returns: HTTP Response message: A dictionary HTTP Status code: 201, 200", "name": "put", "signature": "def put(sel...
3
stack_v2_sparse_classes_30k_train_054344
Implement the Python class `ArticleLikesView` described below. Class description: Updates, retrieves and deletes an articlelikes instance Method signatures and docstrings: - def put(self, request, slug): Updates the article with the reader's feedback args: request (Request object): Django Request context slug (Articl...
Implement the Python class `ArticleLikesView` described below. Class description: Updates, retrieves and deletes an articlelikes instance Method signatures and docstrings: - def put(self, request, slug): Updates the article with the reader's feedback args: request (Request object): Django Request context slug (Articl...
60c830977fa39a7eea9ab978a9ba0c3beb0c4d88
<|skeleton|> class ArticleLikesView: """Updates, retrieves and deletes an articlelikes instance""" def put(self, request, slug): """Updates the article with the reader's feedback args: request (Request object): Django Request context slug (Article label): stores and generates a valid URL for the articl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArticleLikesView: """Updates, retrieves and deletes an articlelikes instance""" def put(self, request, slug): """Updates the article with the reader's feedback args: request (Request object): Django Request context slug (Article label): stores and generates a valid URL for the article. Returns: H...
the_stack_v2_python_sparse
authors/apps/articles/views/views.py
andela/Ah-backend-xmen
train
4
8c4de446496eb65a99774cced0d46f30416dca83
[ "if not a:\n return []\nn = len(a)\nleft, right = ([1] * n, [1] * n)\nfor i in range(1, n):\n left[i] = left[i - 1] * a[i - 1]\nfor i in range(n - 2, -1, -1):\n right[i] = right[i + 1] * a[i + 1]\nres = [0] * n\nfor i in range(n):\n res[i] = left[i] * right[i]\nreturn res", "if not a:\n return []\n...
<|body_start_0|> if not a: return [] n = len(a) left, right = ([1] * n, [1] * n) for i in range(1, n): left[i] = left[i - 1] * a[i - 1] for i in range(n - 2, -1, -1): right[i] = right[i + 1] * a[i + 1] res = [0] * n for i in ran...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def constructArr0(self, a): """:type a: List[int] :rtype: List[int]""" <|body_0|> def constructArr(self, a): """:type a: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not a: return [] n ...
stack_v2_sparse_classes_75kplus_train_071446
1,498
no_license
[ { "docstring": ":type a: List[int] :rtype: List[int]", "name": "constructArr0", "signature": "def constructArr0(self, a)" }, { "docstring": ":type a: List[int] :rtype: List[int]", "name": "constructArr", "signature": "def constructArr(self, a)" } ]
2
stack_v2_sparse_classes_30k_train_030191
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructArr0(self, a): :type a: List[int] :rtype: List[int] - def constructArr(self, a): :type a: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructArr0(self, a): :type a: List[int] :rtype: List[int] - def constructArr(self, a): :type a: List[int] :rtype: List[int] <|skeleton|> class Solution: def construc...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def constructArr0(self, a): """:type a: List[int] :rtype: List[int]""" <|body_0|> def constructArr(self, a): """:type a: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def constructArr0(self, a): """:type a: List[int] :rtype: List[int]""" if not a: return [] n = len(a) left, right = ([1] * n, [1] * n) for i in range(1, n): left[i] = left[i - 1] * a[i - 1] for i in range(n - 2, -1, -1): ...
the_stack_v2_python_sparse
剑指 Offer 66. 构建乘积数组.py
yangyuxiang1996/leetcode
train
0
fdb9af6308e60b7f913135329713a002b28acc66
[ "elem = deepcopy(elem)\nyld = elem.find('./YIELD')\nif yld is not None:\n yld.tag = 'YLD'\nreturn super(MFINFO, MFINFO).groom(elem)", "elem = deepcopy(elem)\nyld = elem.find('./YLD')\nif yld is not None:\n yld.tag = 'YIELD'\nreturn super(MFINFO, MFINFO).ungroom(elem)" ]
<|body_start_0|> elem = deepcopy(elem) yld = elem.find('./YIELD') if yld is not None: yld.tag = 'YLD' return super(MFINFO, MFINFO).groom(elem) <|end_body_0|> <|body_start_1|> elem = deepcopy(elem) yld = elem.find('./YLD') if yld is not None: ...
OFX section 13.8.5.3
MFINFO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MFINFO: """OFX section 13.8.5.3""" def groom(elem): """Rename all Elements tagged YIELD (reserved Python keyword) to YLD""" <|body_0|> def ungroom(elem): """Rename YLD back to YIELD""" <|body_1|> <|end_skeleton|> <|body_start_0|> elem = deepcopy...
stack_v2_sparse_classes_75kplus_train_071447
6,031
no_license
[ { "docstring": "Rename all Elements tagged YIELD (reserved Python keyword) to YLD", "name": "groom", "signature": "def groom(elem)" }, { "docstring": "Rename YLD back to YIELD", "name": "ungroom", "signature": "def ungroom(elem)" } ]
2
stack_v2_sparse_classes_30k_train_015509
Implement the Python class `MFINFO` described below. Class description: OFX section 13.8.5.3 Method signatures and docstrings: - def groom(elem): Rename all Elements tagged YIELD (reserved Python keyword) to YLD - def ungroom(elem): Rename YLD back to YIELD
Implement the Python class `MFINFO` described below. Class description: OFX section 13.8.5.3 Method signatures and docstrings: - def groom(elem): Rename all Elements tagged YIELD (reserved Python keyword) to YLD - def ungroom(elem): Rename YLD back to YIELD <|skeleton|> class MFINFO: """OFX section 13.8.5.3""" ...
67e688ea6510853657736c3804969d029c672c5c
<|skeleton|> class MFINFO: """OFX section 13.8.5.3""" def groom(elem): """Rename all Elements tagged YIELD (reserved Python keyword) to YLD""" <|body_0|> def ungroom(elem): """Rename YLD back to YIELD""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MFINFO: """OFX section 13.8.5.3""" def groom(elem): """Rename all Elements tagged YIELD (reserved Python keyword) to YLD""" elem = deepcopy(elem) yld = elem.find('./YIELD') if yld is not None: yld.tag = 'YLD' return super(MFINFO, MFINFO).groom(elem) ...
the_stack_v2_python_sparse
env/lib/python3.6/site-packages/ofxtools/models/invest/securities.py
yetaai/batchaccounting
train
0
ff79daf1a4ef52b2731218f8f93fbd105208a5a0
[ "self.data_dir = data_dir\nself.dims = dims\nself.channels = channels", "keys_to_features = {'volume': tf.FixedLenFeature(self.dims + [1], tf.float32), 'label': tf.FixedLenFeature(self.dims + [self.channels], tf.float32)}\nparsed = tf.parse_single_example(value, keys_to_features)\nprint(parsed['volume'].shape)\np...
<|body_start_0|> self.data_dir = data_dir self.dims = dims self.channels = channels <|end_body_0|> <|body_start_1|> keys_to_features = {'volume': tf.FixedLenFeature(self.dims + [1], tf.float32), 'label': tf.FixedLenFeature(self.dims + [self.channels], tf.float32)} parsed = tf.pa...
Reader reads from a tfrecord file to produce an image.
Reader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reader: """Reader reads from a tfrecord file to produce an image.""" def __init__(self, data_dir, dims, channels): """initialize the reader with a tfrecord dir and dims.""" <|body_0|> def dataset_parser(self, value): """parse the tfrecords.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_071448
2,755
no_license
[ { "docstring": "initialize the reader with a tfrecord dir and dims.", "name": "__init__", "signature": "def __init__(self, data_dir, dims, channels)" }, { "docstring": "parse the tfrecords.", "name": "dataset_parser", "signature": "def dataset_parser(self, value)" }, { "docstring...
4
stack_v2_sparse_classes_30k_train_047477
Implement the Python class `Reader` described below. Class description: Reader reads from a tfrecord file to produce an image. Method signatures and docstrings: - def __init__(self, data_dir, dims, channels): initialize the reader with a tfrecord dir and dims. - def dataset_parser(self, value): parse the tfrecords. -...
Implement the Python class `Reader` described below. Class description: Reader reads from a tfrecord file to produce an image. Method signatures and docstrings: - def __init__(self, data_dir, dims, channels): initialize the reader with a tfrecord dir and dims. - def dataset_parser(self, value): parse the tfrecords. -...
a7273c01d02528f5c547992fda482bbfb690fa6c
<|skeleton|> class Reader: """Reader reads from a tfrecord file to produce an image.""" def __init__(self, data_dir, dims, channels): """initialize the reader with a tfrecord dir and dims.""" <|body_0|> def dataset_parser(self, value): """parse the tfrecords.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Reader: """Reader reads from a tfrecord file to produce an image.""" def __init__(self, data_dir, dims, channels): """initialize the reader with a tfrecord dir and dims.""" self.data_dir = data_dir self.dims = dims self.channels = channels def dataset_parser(self, val...
the_stack_v2_python_sparse
records.py
drewlinsley/tpu_connectomics
train
0
7d7a6319c51776404ac0ff30766ac6dd8fe6ccf9
[ "self.broker_handler = broker_handler\nself.order_id = 0\nself.events = events\nself.fill_dict = {}", "try:\n order_id = response['order_id']\nexcept:\n order_id = -1\nself.fill_dict[str(order_id)] = {}\nfd = self.fill_dict[str(order_id)]\nfd['symbol'] = event.symbol\nfd['timestamp'] = response['timestamp']...
<|body_start_0|> self.broker_handler = broker_handler self.order_id = 0 self.events = events self.fill_dict = {} <|end_body_0|> <|body_start_1|> try: order_id = response['order_id'] except: order_id = -1 self.fill_dict[str(order_id)] = {} ...
.
MetatraderExecutionHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetatraderExecutionHandler: """.""" def __init__(self, context, events, broker_handler): """Initialises the handler, setting the event queues up internally. Parameters: events - The Queue of Event objects.""" <|body_0|> def create_fill(self, response, event): """...
stack_v2_sparse_classes_75kplus_train_071449
3,325
no_license
[ { "docstring": "Initialises the handler, setting the event queues up internally. Parameters: events - The Queue of Event objects.", "name": "__init__", "signature": "def __init__(self, context, events, broker_handler)" }, { "docstring": "Handles the creation of the FillEvent that will be placed ...
3
stack_v2_sparse_classes_30k_train_020625
Implement the Python class `MetatraderExecutionHandler` described below. Class description: . Method signatures and docstrings: - def __init__(self, context, events, broker_handler): Initialises the handler, setting the event queues up internally. Parameters: events - The Queue of Event objects. - def create_fill(sel...
Implement the Python class `MetatraderExecutionHandler` described below. Class description: . Method signatures and docstrings: - def __init__(self, context, events, broker_handler): Initialises the handler, setting the event queues up internally. Parameters: events - The Queue of Event objects. - def create_fill(sel...
1b88117961a3912aa9b2c0326aa5081a884d0a8d
<|skeleton|> class MetatraderExecutionHandler: """.""" def __init__(self, context, events, broker_handler): """Initialises the handler, setting the event queues up internally. Parameters: events - The Queue of Event objects.""" <|body_0|> def create_fill(self, response, event): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MetatraderExecutionHandler: """.""" def __init__(self, context, events, broker_handler): """Initialises the handler, setting the event queues up internally. Parameters: events - The Queue of Event objects.""" self.broker_handler = broker_handler self.order_id = 0 self.even...
the_stack_v2_python_sparse
htr/core/execution/metatrader.py
mglcampos/trader
train
0
36abf8c1e5baa99cc40dfce7f15fd15b0a60104f
[ "super(SetSegmentationRosParam, self).__init__(outcomes=['done'])\nself.ValueTable = ValueTableSegmentation\nself.ValueObject = ValueObjectSegmentation", "if self.ValueTable:\n rospy.set_param('/process_table_segmentation', self.ValueTable)\nelif rospy.has_param('/process_table_segmentation'):\n rospy.delet...
<|body_start_0|> super(SetSegmentationRosParam, self).__init__(outcomes=['done']) self.ValueTable = ValueTableSegmentation self.ValueObject = ValueObjectSegmentation <|end_body_0|> <|body_start_1|> if self.ValueTable: rospy.set_param('/process_table_segmentation', self.Value...
Set the Rosparams /process_table_segmentation and /process_object_segmentation to true or false to activate/desactivate the table/object segmentation. ># ValueTableSegmentation object The rosparam to set for table segmentation. ># ValueObjectSegmentation object The rosparam to set for object segmentation. <= done The r...
SetSegmentationRosParam
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SetSegmentationRosParam: """Set the Rosparams /process_table_segmentation and /process_object_segmentation to true or false to activate/desactivate the table/object segmentation. ># ValueTableSegmentation object The rosparam to set for table segmentation. ># ValueObjectSegmentation object The ros...
stack_v2_sparse_classes_75kplus_train_071450
1,486
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, ValueTableSegmentation, ValueObjectSegmentation)" }, { "docstring": "Execute this state", "name": "execute", "signature": "def execute(self, userdata)" } ]
2
stack_v2_sparse_classes_30k_train_024498
Implement the Python class `SetSegmentationRosParam` described below. Class description: Set the Rosparams /process_table_segmentation and /process_object_segmentation to true or false to activate/desactivate the table/object segmentation. ># ValueTableSegmentation object The rosparam to set for table segmentation. >#...
Implement the Python class `SetSegmentationRosParam` described below. Class description: Set the Rosparams /process_table_segmentation and /process_object_segmentation to true or false to activate/desactivate the table/object segmentation. ># ValueTableSegmentation object The rosparam to set for table segmentation. >#...
fcb55d274331915cd39d7d444546f17a39f85a44
<|skeleton|> class SetSegmentationRosParam: """Set the Rosparams /process_table_segmentation and /process_object_segmentation to true or false to activate/desactivate the table/object segmentation. ># ValueTableSegmentation object The rosparam to set for table segmentation. ># ValueObjectSegmentation object The ros...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SetSegmentationRosParam: """Set the Rosparams /process_table_segmentation and /process_object_segmentation to true or false to activate/desactivate the table/object segmentation. ># ValueTableSegmentation object The rosparam to set for table segmentation. ># ValueObjectSegmentation object The rosparam to set ...
the_stack_v2_python_sparse
sara_flexbe_states/src/sara_flexbe_states/SetSegmentationRosParam.py
WalkingMachine/sara_behaviors
train
5
a8a77f7990baae81c1f14b94acba6686c8029d72
[ "trips.sort(key=lambda x: (x[1], x[2]))\nocc = 0\nh = []\nfor p, s, e in trips:\n while h and h[0][0] <= s:\n occ -= heappop(h)[1]\n occ += p\n heappush(h, (e, p))\n if occ > capacity:\n return False\nreturn True", "changes = defaultdict(int)\nfor p, s, e in trips:\n changes[s] += p\n...
<|body_start_0|> trips.sort(key=lambda x: (x[1], x[2])) occ = 0 h = [] for p, s, e in trips: while h and h[0][0] <= s: occ -= heappop(h)[1] occ += p heappush(h, (e, p)) if occ > capacity: return False ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def carPooling(self, trips: List[List[int]], capacity: int) -> bool: """Heap Time complexity: O(nlogn) Space complexity: O(n)""" <|body_0|> def carPooling(self, trips: List[List[int]], capacity: int) -> bool: """Counter Time complexity: O(n) Space complexit...
stack_v2_sparse_classes_75kplus_train_071451
2,451
no_license
[ { "docstring": "Heap Time complexity: O(nlogn) Space complexity: O(n)", "name": "carPooling", "signature": "def carPooling(self, trips: List[List[int]], capacity: int) -> bool" }, { "docstring": "Counter Time complexity: O(n) Space complexity: O(n)", "name": "carPooling", "signature": "d...
2
stack_v2_sparse_classes_30k_train_019692
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def carPooling(self, trips: List[List[int]], capacity: int) -> bool: Heap Time complexity: O(nlogn) Space complexity: O(n) - def carPooling(self, trips: List[List[int]], capacity...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def carPooling(self, trips: List[List[int]], capacity: int) -> bool: Heap Time complexity: O(nlogn) Space complexity: O(n) - def carPooling(self, trips: List[List[int]], capacity...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def carPooling(self, trips: List[List[int]], capacity: int) -> bool: """Heap Time complexity: O(nlogn) Space complexity: O(n)""" <|body_0|> def carPooling(self, trips: List[List[int]], capacity: int) -> bool: """Counter Time complexity: O(n) Space complexit...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def carPooling(self, trips: List[List[int]], capacity: int) -> bool: """Heap Time complexity: O(nlogn) Space complexity: O(n)""" trips.sort(key=lambda x: (x[1], x[2])) occ = 0 h = [] for p, s, e in trips: while h and h[0][0] <= s: o...
the_stack_v2_python_sparse
leetcode/solved/1184_Car_Pooling/solution.py
sungminoh/algorithms
train
0
50c76df1667468735d33d5c30e574dbf22c39451
[ "if root is None:\n return 0\ndepth_left = self.maxDepth(root.left) + 1\ndepth_right = self.maxDepth(root.right) + 1\nreturn max(depth_left, depth_right)", "if root is None:\n return 0\nqueue = collections.deque([root])\nmax_depth = 0\nwhile queue:\n max_depth += 1\n for _ in range(len(queue)):\n ...
<|body_start_0|> if root is None: return 0 depth_left = self.maxDepth(root.left) + 1 depth_right = self.maxDepth(root.right) + 1 return max(depth_left, depth_right) <|end_body_0|> <|body_start_1|> if root is None: return 0 queue = collections.dequ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def maxDepth1(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root is None: return 0 depth_...
stack_v2_sparse_classes_75kplus_train_071452
1,143
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "maxDepth", "signature": "def maxDepth(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "maxDepth1", "signature": "def maxDepth1(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_027723
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root): :type root: TreeNode :rtype: int - def maxDepth1(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root): :type root: TreeNode :rtype: int - def maxDepth1(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def maxDepth(self, roo...
945274c5f1385415b2839da53a921d3e23f7efa3
<|skeleton|> class Solution: def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def maxDepth1(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxDepth(self, root): """:type root: TreeNode :rtype: int""" if root is None: return 0 depth_left = self.maxDepth(root.left) + 1 depth_right = self.maxDepth(root.right) + 1 return max(depth_left, depth_right) def maxDepth1(self, root): ...
the_stack_v2_python_sparse
leetcode/leetcode_104.py
reach950/data-structure-algorithm-in-python
train
0
3d1891aa9cd44a9d17d27e0ade3f91ed28630e5e
[ "if len(nums) == 0:\n self.zero = True\nself.nums = nums\nself.summary = [0] * len(nums)\nself.summary[0] = nums[0]\nfor i in range(1, len(nums)):\n self.summary[i] = self.summary[i - 1] + nums[i]\nself.updateDict = {}", "if self.zero:\n return\nif len(self.nums) == 1:\n self.nums[0] = val\n return...
<|body_start_0|> if len(nums) == 0: self.zero = True self.nums = nums self.summary = [0] * len(nums) self.summary[0] = nums[0] for i in range(1, len(nums)): self.summary[i] = self.summary[i - 1] + nums[i] self.updateDict = {} <|end_body_0|> <|body...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_75kplus_train_071453
1,475
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type val: int :rtype: void", "name": "update", "signature": "def update(self, i, val)" }, { "docstring": ":type i: int :type j: int :rtype: int", ...
3
stack_v2_sparse_classes_30k_train_036806
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
7a1c3aba65f338f6e11afd2864dabd2b26142b6c
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumArray: def __init__(self, nums): """:type nums: List[int]""" if len(nums) == 0: self.zero = True self.nums = nums self.summary = [0] * len(nums) self.summary[0] = nums[0] for i in range(1, len(nums)): self.summary[i] = self.summary[i -...
the_stack_v2_python_sparse
exercise/leetcode/python_src/by2017_Sep/Leet307.py
SS4G/AlgorithmTraining
train
2
48db867e72d375bf5ff7636ccaee02b378f5a668
[ "self.validate(locals())\nsuper().__init__()\nself._feature_dimension = feature_dimension\nself._num_qubits = next_power_of_2_base(feature_dimension)", "if not isinstance(x, np.ndarray):\n raise TypeError('x must be numpy array.')\nif x.ndim != 1:\n raise ValueError('x must be 1-D array.')\nif x.shape[0] !=...
<|body_start_0|> self.validate(locals()) super().__init__() self._feature_dimension = feature_dimension self._num_qubits = next_power_of_2_base(feature_dimension) <|end_body_0|> <|body_start_1|> if not isinstance(x, np.ndarray): raise TypeError('x must be numpy array...
Using raw feature vector as the initial state vector
RawFeatureVector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RawFeatureVector: """Using raw feature vector as the initial state vector""" def __init__(self, feature_dimension=2): """Constructor. Args: feature_vector: The raw feature vector""" <|body_0|> def construct_circuit(self, x, qr=None, inverse=False): """Construct t...
stack_v2_sparse_classes_75kplus_train_071454
2,820
permissive
[ { "docstring": "Constructor. Args: feature_vector: The raw feature vector", "name": "__init__", "signature": "def __init__(self, feature_dimension=2)" }, { "docstring": "Construct the second order expansion based on given data. Args: x (numpy.ndarray): 1-D to-be-encoded data. qr (QauntumRegister...
2
null
Implement the Python class `RawFeatureVector` described below. Class description: Using raw feature vector as the initial state vector Method signatures and docstrings: - def __init__(self, feature_dimension=2): Constructor. Args: feature_vector: The raw feature vector - def construct_circuit(self, x, qr=None, invers...
Implement the Python class `RawFeatureVector` described below. Class description: Using raw feature vector as the initial state vector Method signatures and docstrings: - def __init__(self, feature_dimension=2): Constructor. Args: feature_vector: The raw feature vector - def construct_circuit(self, x, qr=None, invers...
8c2bc57b78dec447faec3adbc966471a3206c2ef
<|skeleton|> class RawFeatureVector: """Using raw feature vector as the initial state vector""" def __init__(self, feature_dimension=2): """Constructor. Args: feature_vector: The raw feature vector""" <|body_0|> def construct_circuit(self, x, qr=None, inverse=False): """Construct t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RawFeatureVector: """Using raw feature vector as the initial state vector""" def __init__(self, feature_dimension=2): """Constructor. Args: feature_vector: The raw feature vector""" self.validate(locals()) super().__init__() self._feature_dimension = feature_dimension ...
the_stack_v2_python_sparse
qiskit/aqua/components/feature_maps/raw_feature_vector.py
Nick-Singstock/qiskit-aqua
train
1
ace94eee74d1e597d12c17a09cb675d6899aee62
[ "self.n = len(nums)\nself.tree = nums + nums\nfor i in range(self.n - 1, 0, -1):\n self.tree[i] = self.tree[2 * i] + self.tree[2 * i + 1]", "tree = self.tree\ni += self.n\ntree[i] = val\nwhile i > 0:\n left = right = i\n if i % 2 == 1:\n left -= 1\n else:\n right += 1\n tree[i / 2] = ...
<|body_start_0|> self.n = len(nums) self.tree = nums + nums for i in range(self.n - 1, 0, -1): self.tree[i] = self.tree[2 * i] + self.tree[2 * i + 1] <|end_body_0|> <|body_start_1|> tree = self.tree i += self.n tree[i] = val while i > 0: l...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: int""" <|body_1|> def sumRange(self, i, j): """sum of elements nums[i...
stack_v2_sparse_classes_75kplus_train_071455
1,416
no_license
[ { "docstring": "initialize your data structure here. :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type val: int :rtype: int", "name": "update", "signature": "def update(self, i, val)" }, { "docstring": "sum o...
3
stack_v2_sparse_classes_30k_train_010104
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): initialize your data structure here. :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: int - def sumRange(self, i, j...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): initialize your data structure here. :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: int - def sumRange(self, i, j...
036a29d681cc91f2317d454e04530d7375d55478
<|skeleton|> class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: int""" <|body_1|> def sumRange(self, i, j): """sum of elements nums[i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" self.n = len(nums) self.tree = nums + nums for i in range(self.n - 1, 0, -1): self.tree[i] = self.tree[2 * i] + self.tree[2 * i + 1] def update(self, i, val): ...
the_stack_v2_python_sparse
leetcode/range_sum_query_mutable_v1.py
myliu/python-algorithm
train
0
380b0542032b1d8f4b9b533cd874f563fa9d4aa3
[ "n = len(machines)\ntotal = sum(machines)\nif total % n:\n return -1\navg = total // n\nleft_sum, right_sum = (0, total)\nres = 0\nfor i in range(n):\n right_sum -= machines[i]\n toLeft = max(avg * i - left_sum, 0)\n toRight = max(avg * (n - i - 1) - right_sum, 0)\n res = max(toLeft + toRight, res)\n...
<|body_start_0|> n = len(machines) total = sum(machines) if total % n: return -1 avg = total // n left_sum, right_sum = (0, total) res = 0 for i in range(n): right_sum -= machines[i] toLeft = max(avg * i - left_sum, 0) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMinMoves(self, machines): """减少空间和计算量 :param machines: :return:""" <|body_0|> def findMinMoves2(self, machines): """:type machines: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(machines) tot...
stack_v2_sparse_classes_75kplus_train_071456
3,180
no_license
[ { "docstring": "减少空间和计算量 :param machines: :return:", "name": "findMinMoves", "signature": "def findMinMoves(self, machines)" }, { "docstring": ":type machines: List[int] :rtype: int", "name": "findMinMoves2", "signature": "def findMinMoves2(self, machines)" } ]
2
stack_v2_sparse_classes_30k_train_030145
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinMoves(self, machines): 减少空间和计算量 :param machines: :return: - def findMinMoves2(self, machines): :type machines: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinMoves(self, machines): 减少空间和计算量 :param machines: :return: - def findMinMoves2(self, machines): :type machines: List[int] :rtype: int <|skeleton|> class Solution: ...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def findMinMoves(self, machines): """减少空间和计算量 :param machines: :return:""" <|body_0|> def findMinMoves2(self, machines): """:type machines: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findMinMoves(self, machines): """减少空间和计算量 :param machines: :return:""" n = len(machines) total = sum(machines) if total % n: return -1 avg = total // n left_sum, right_sum = (0, total) res = 0 for i in range(n): ...
the_stack_v2_python_sparse
517_超级洗衣机.py
lovehhf/LeetCode
train
0
c0f4d193c1e2e8f81d96f8b6828a0c2890950c40
[ "self.res_ls = []\ncur_sum = 0\nfor i in nums:\n cur_sum += i\n self.res_ls.append(cur_sum)", "if i == 0:\n return self.res_ls[j]\nreturn self.res_ls[j] - self.res_ls[i - 1]" ]
<|body_start_0|> self.res_ls = [] cur_sum = 0 for i in nums: cur_sum += i self.res_ls.append(cur_sum) <|end_body_0|> <|body_start_1|> if i == 0: return self.res_ls[j] return self.res_ls[j] - self.res_ls[i - 1] <|end_body_1|>
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.res_ls = [] cur_sum = 0 for i in nums:...
stack_v2_sparse_classes_75kplus_train_071457
680
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
stack_v2_sparse_classes_30k_train_021706
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
2ecaeed38178819480388b5742bc2ea12009ae16
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumArray: def __init__(self, nums): """:type nums: List[int]""" self.res_ls = [] cur_sum = 0 for i in nums: cur_sum += i self.res_ls.append(cur_sum) def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" if i == 0: ...
the_stack_v2_python_sparse
303.range-sum-query-immutable.py
LouisYLWang/leetcode_python
train
0
fa1149e0e6a0977c9a7b2192743e5054971ef4f0
[ "self.size = size\nself.cnt = 0\nself.sum = 0\nself.history = []", "self.cnt += 1\nif self.cnt <= self.size:\n self.sum += val\n self.history.append(val)\n return float(self.sum) / self.cnt\nelse:\n self.sum += val\n self.sum -= self.history.pop(0)\n self.history.append(val)\n return float(se...
<|body_start_0|> self.size = size self.cnt = 0 self.sum = 0 self.history = [] <|end_body_0|> <|body_start_1|> self.cnt += 1 if self.cnt <= self.size: self.sum += val self.history.append(val) return float(self.sum) / self.cnt el...
MovingAverage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.size = size self.cnt = 0...
stack_v2_sparse_classes_75kplus_train_071458
1,191
no_license
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
stack_v2_sparse_classes_30k_val_002894
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
4d7e675c795c841f99ca95b8b60c4995bcb632fb
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.size = size self.cnt = 0 self.sum = 0 self.history = [] def next(self, val): """:type val: int :rtype: float""" self.cnt += 1 if self.cn...
the_stack_v2_python_sparse
346_MovingAveragefromDataStream.py
stephenchenxj/myLeetCode
train
0
fb1fb4c894d4500dcd26348b1275cd13bb4df206
[ "querydict = request.data\nclass_id = querydict.getlist('class_id')[0]\nclass_name = querydict.getlist('class_name')[0]\nclass_count = querydict.getlist('class_count')[0]\nprofess_name = querydict.getlist('profess_name')[0]\nprofess = profession_table.objects.filter(pname=profess_name)\nprofess_data = ProfessionSer...
<|body_start_0|> querydict = request.data class_id = querydict.getlist('class_id')[0] class_name = querydict.getlist('class_name')[0] class_count = querydict.getlist('class_count')[0] profess_name = querydict.getlist('profess_name')[0] profess = profession_table.objects.f...
班级创建/删除视图
ClassCreateDeleteView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassCreateDeleteView: """班级创建/删除视图""" def post(self, request): """班级创建视图 路由:POST classes/classcreatedelete/ 请求参数: class_id 班号 class_name 班名 class_count 人数 profess_name 班级对应专业""" <|body_0|> def delete(self, request): """班级删除视图 路由: DELETE /classes/classcreatedelet...
stack_v2_sparse_classes_75kplus_train_071459
8,225
permissive
[ { "docstring": "班级创建视图 路由:POST classes/classcreatedelete/ 请求参数: class_id 班号 class_name 班名 class_count 人数 profess_name 班级对应专业", "name": "post", "signature": "def post(self, request)" }, { "docstring": "班级删除视图 路由: DELETE /classes/classcreatedelete/", "name": "delete", "signature": "def del...
2
stack_v2_sparse_classes_30k_train_018214
Implement the Python class `ClassCreateDeleteView` described below. Class description: 班级创建/删除视图 Method signatures and docstrings: - def post(self, request): 班级创建视图 路由:POST classes/classcreatedelete/ 请求参数: class_id 班号 class_name 班名 class_count 人数 profess_name 班级对应专业 - def delete(self, request): 班级删除视图 路由: DELETE /cla...
Implement the Python class `ClassCreateDeleteView` described below. Class description: 班级创建/删除视图 Method signatures and docstrings: - def post(self, request): 班级创建视图 路由:POST classes/classcreatedelete/ 请求参数: class_id 班号 class_name 班名 class_count 人数 profess_name 班级对应专业 - def delete(self, request): 班级删除视图 路由: DELETE /cla...
0e926292d86070f6f42066e73374ea74e39ca169
<|skeleton|> class ClassCreateDeleteView: """班级创建/删除视图""" def post(self, request): """班级创建视图 路由:POST classes/classcreatedelete/ 请求参数: class_id 班号 class_name 班名 class_count 人数 profess_name 班级对应专业""" <|body_0|> def delete(self, request): """班级删除视图 路由: DELETE /classes/classcreatedelet...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClassCreateDeleteView: """班级创建/删除视图""" def post(self, request): """班级创建视图 路由:POST classes/classcreatedelete/ 请求参数: class_id 班号 class_name 班名 class_count 人数 profess_name 班级对应专业""" querydict = request.data class_id = querydict.getlist('class_id')[0] class_name = querydict.ge...
the_stack_v2_python_sparse
ETMS/ETMS/apps/classes/views.py
17605272633/ETMS
train
1
cb432ab3fc0831fd6f464381c702f51398b6794d
[ "start, end = (0, len(nums) - 1)\nwhile start <= end:\n if nums[start] == val:\n nums[start], nums[end] = (nums[end], nums[start])\n end -= 1\n else:\n start += 1\nreturn start", "index = 0\nfor i in range(0, len(nums)):\n if nums[i] != val:\n nums[index] = nums[i]\n in...
<|body_start_0|> start, end = (0, len(nums) - 1) while start <= end: if nums[start] == val: nums[start], nums[end] = (nums[end], nums[start]) end -= 1 else: start += 1 return start <|end_body_0|> <|body_start_1|> in...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeElement(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" <|body_0|> def removeElement1(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_071460
851
no_license
[ { "docstring": ":type nums: List[int] :type val: int :rtype: int", "name": "removeElement", "signature": "def removeElement(self, nums, val)" }, { "docstring": ":type nums: List[int] :type val: int :rtype: int", "name": "removeElement1", "signature": "def removeElement1(self, nums, val)"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement(self, nums, val): :type nums: List[int] :type val: int :rtype: int - def removeElement1(self, nums, val): :type nums: List[int] :type val: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement(self, nums, val): :type nums: List[int] :type val: int :rtype: int - def removeElement1(self, nums, val): :type nums: List[int] :type val: int :rtype: int <|sk...
ef1c3bae0f6b1087df51530ba2322cfc9c970cde
<|skeleton|> class Solution: def removeElement(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" <|body_0|> def removeElement1(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def removeElement(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" start, end = (0, len(nums) - 1) while start <= end: if nums[start] == val: nums[start], nums[end] = (nums[end], nums[start]) end -= 1 ...
the_stack_v2_python_sparse
Leetcode/LeetCode0/27. Remove Element.py
liugingko/LeetCode-Python
train
0
3ca38ffd1e8338c0bb56d99fe07cdc9eee4e59cf
[ "wordSet = set(wordList)\nif beginWord in wordSet:\n wordSet.remove(beginWord)\nqueue = [beginWord]\nlevel = 1\nwhile len(queue) > 0:\n neighbors = []\n for word in queue:\n if word == endWord:\n return level\n else:\n self._findNeighbors(word, neighbors, wordSet)\n l...
<|body_start_0|> wordSet = set(wordList) if beginWord in wordSet: wordSet.remove(beginWord) queue = [beginWord] level = 1 while len(queue) > 0: neighbors = [] for word in queue: if word == endWord: return lev...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int""" <|body_0|> def _findNeighbors(self, word, neighbors, wordSet): """:type word: str :type neighbors: list :type wordSet: ...
stack_v2_sparse_classes_75kplus_train_071461
5,496
no_license
[ { "docstring": ":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int", "name": "ladderLength", "signature": "def ladderLength(self, beginWord, endWord, wordList)" }, { "docstring": ":type word: str :type neighbors: list :type wordSet: set", "name": "_findNeighbors", ...
2
stack_v2_sparse_classes_30k_train_000864
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def ladderLength(self, beginWord, endWord, wordList): :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int - def _findNeighbors(self, word, neighbors, wo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def ladderLength(self, beginWord, endWord, wordList): :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int - def _findNeighbors(self, word, neighbors, wo...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int""" <|body_0|> def _findNeighbors(self, word, neighbors, wordSet): """:type word: str :type neighbors: list :type wordSet: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int""" wordSet = set(wordList) if beginWord in wordSet: wordSet.remove(beginWord) queue = [beginWord] level = 1 ...
the_stack_v2_python_sparse
code127WordLadder.py
cybelewang/leetcode-python
train
0
408a8b38d8852c9b3024f54ee4c1c4da0864b71e
[ "n = len(nums)\nself.arr = []\nif n == 0:\n return\nself.arr.append(nums[0])\nfor i in range(1, n):\n self.arr.append(self.arr[i - 1] + nums[i])", "if i == 0:\n return self.arr[j]\nreturn self.arr[j] - self.arr[i - 1]" ]
<|body_start_0|> n = len(nums) self.arr = [] if n == 0: return self.arr.append(nums[0]) for i in range(1, n): self.arr.append(self.arr[i - 1] + nums[i]) <|end_body_0|> <|body_start_1|> if i == 0: return self.arr[j] return self....
NumArray
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) self.arr = [] if n == 0: ...
stack_v2_sparse_classes_75kplus_train_071462
693
permissive
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
92156e4b48ba19e3f02e4286b9f733e9769a1dee
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumArray: def __init__(self, nums): """:type nums: List[int]""" n = len(nums) self.arr = [] if n == 0: return self.arr.append(nums[0]) for i in range(1, n): self.arr.append(self.arr[i - 1] + nums[i]) def sumRange(self, i, j): ...
the_stack_v2_python_sparse
src/Python/301-400/303.RangeSumQueryImmutable.py
AveryHuo/PeefyLeetCode
train
0
aa7834ccc127dff7ad92251faeb3773100a3235c
[ "super().__init__()\nself.coupling_map = coupling_map\nself.layout = layout\nself.ancilla_name = 'ancilla'", "self.layout = self.layout or self.property_set.get('layout')\nif self.layout is None:\n raise TranspilerError('FullAncilla pass requires property_set[\"layout\"] or \"layout\" parameter to run')\nlayou...
<|body_start_0|> super().__init__() self.coupling_map = coupling_map self.layout = layout self.ancilla_name = 'ancilla' <|end_body_0|> <|body_start_1|> self.layout = self.layout or self.property_set.get('layout') if self.layout is None: raise TranspilerError(...
Allocates all idle nodes from the coupling map as ancilla on the layout.
FullAncillaAllocation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FullAncillaAllocation: """Allocates all idle nodes from the coupling map as ancilla on the layout.""" def __init__(self, coupling_map, layout=None): """Extends a Layout with the idle nodes from coupling_map. Args: coupling_map (Coupling): directed graph representing a coupling map. l...
stack_v2_sparse_classes_75kplus_train_071463
3,499
permissive
[ { "docstring": "Extends a Layout with the idle nodes from coupling_map. Args: coupling_map (Coupling): directed graph representing a coupling map. layout (Layout): an existing layout. ancilla allocation occurs if the layout is smaller than the coupling_map.", "name": "__init__", "signature": "def __init...
2
null
Implement the Python class `FullAncillaAllocation` described below. Class description: Allocates all idle nodes from the coupling map as ancilla on the layout. Method signatures and docstrings: - def __init__(self, coupling_map, layout=None): Extends a Layout with the idle nodes from coupling_map. Args: coupling_map ...
Implement the Python class `FullAncillaAllocation` described below. Class description: Allocates all idle nodes from the coupling map as ancilla on the layout. Method signatures and docstrings: - def __init__(self, coupling_map, layout=None): Extends a Layout with the idle nodes from coupling_map. Args: coupling_map ...
abf6c23d4ab6c63f9c01c7434fb46321e6a69200
<|skeleton|> class FullAncillaAllocation: """Allocates all idle nodes from the coupling map as ancilla on the layout.""" def __init__(self, coupling_map, layout=None): """Extends a Layout with the idle nodes from coupling_map. Args: coupling_map (Coupling): directed graph representing a coupling map. l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FullAncillaAllocation: """Allocates all idle nodes from the coupling map as ancilla on the layout.""" def __init__(self, coupling_map, layout=None): """Extends a Layout with the idle nodes from coupling_map. Args: coupling_map (Coupling): directed graph representing a coupling map. layout (Layout...
the_stack_v2_python_sparse
qiskit/transpiler/passes/mapping/full_ancilla_allocation.py
indian-institute-of-science-qc/qiskit-aakash
train
37
9ad1c069c255193f392bf4932d9d9e2d4bbc38ed
[ "self.x_angle = random.random() * math.pi\nself.y_angle = random.random() * math.pi\nself.z_angle = random.random() * math.pi\nself.name = f'[X = {self.x_angle}, Y = {self.y_angle}, Z = {self.z_angle}]'", "circuit.rx(self.x_angle, qubit)\ncircuit.ry(self.y_angle, qubit)\ncircuit.rz(self.z_angle, qubit)", "circu...
<|body_start_0|> self.x_angle = random.random() * math.pi self.y_angle = random.random() * math.pi self.z_angle = random.random() * math.pi self.name = f'[X = {self.x_angle}, Y = {self.y_angle}, Z = {self.z_angle}]' <|end_body_0|> <|body_start_1|> circuit.rx(self.x_angle, qubit)...
This class represents a test case that rotates the qubit around all three axes of the Bloch sphere by random angles between 0 and pi.
RandomRotationTestState
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomRotationTestState: """This class represents a test case that rotates the qubit around all three axes of the Bloch sphere by random angles between 0 and pi.""" def __init__(self): """Creates a RandomRotationTestState instance.""" <|body_0|> def prepare_state(self, c...
stack_v2_sparse_classes_75kplus_train_071464
9,704
permissive
[ { "docstring": "Creates a RandomRotationTestState instance.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Prepares a qubit in the test state. Parameters: circuit (QuantumCircuit): The circuit to add the preparation gates to qubit (QuantumRegister): The qubit to prepa...
3
stack_v2_sparse_classes_30k_train_045224
Implement the Python class `RandomRotationTestState` described below. Class description: This class represents a test case that rotates the qubit around all three axes of the Bloch sphere by random angles between 0 and pi. Method signatures and docstrings: - def __init__(self): Creates a RandomRotationTestState insta...
Implement the Python class `RandomRotationTestState` described below. Class description: This class represents a test case that rotates the qubit around all three axes of the Bloch sphere by random angles between 0 and pi. Method signatures and docstrings: - def __init__(self): Creates a RandomRotationTestState insta...
941488f8f8a81a4b7d7fe28414ce14fa478a692a
<|skeleton|> class RandomRotationTestState: """This class represents a test case that rotates the qubit around all three axes of the Bloch sphere by random angles between 0 and pi.""" def __init__(self): """Creates a RandomRotationTestState instance.""" <|body_0|> def prepare_state(self, c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomRotationTestState: """This class represents a test case that rotates the qubit around all three axes of the Bloch sphere by random angles between 0 and pi.""" def __init__(self): """Creates a RandomRotationTestState instance.""" self.x_angle = random.random() * math.pi self....
the_stack_v2_python_sparse
Qiskit/QiskitErrorCorrection/ecc_test_implementation.py
taibah/qsfe
train
0
e0872f3505fff212efa78d8440a7709f3f9e2565
[ "env.filters['basename'] = os.path.basename\nenv.filters['dirname'] = os.path.dirname\nenv.filters['splitext'] = os.path.splitext\nenv.filters['combine'] = combine\nenv.filters['as_dict'] = as_dict\nenv.filters['ternary'] = ternary\nenv.globals['gpu_count'] = gpu_count\nenv.globals['load_json'] = create_load_json(s...
<|body_start_0|> env.filters['basename'] = os.path.basename env.filters['dirname'] = os.path.dirname env.filters['splitext'] = os.path.splitext env.filters['combine'] = combine env.filters['as_dict'] = as_dict env.filters['ternary'] = ternary env.globals['gpu_coun...
An evaluation engine which uses Jinja2 for templating.
JinjaEngine
[ "Apache-2.0", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JinjaEngine: """An evaluation engine which uses Jinja2 for templating.""" def register_custom_filters(self, env): """Adds our custom filters to the Jinja2 engine. Arguments --------- env: jinja2.Environment instance. The environment to add the custom filters to.""" <|body_0|>...
stack_v2_sparse_classes_75kplus_train_071465
6,185
permissive
[ { "docstring": "Adds our custom filters to the Jinja2 engine. Arguments --------- env: jinja2.Environment instance. The environment to add the custom filters to.", "name": "register_custom_filters", "signature": "def register_custom_filters(self, env)" }, { "docstring": "Creates a new Jinja2 tem...
3
stack_v2_sparse_classes_30k_train_046255
Implement the Python class `JinjaEngine` described below. Class description: An evaluation engine which uses Jinja2 for templating. Method signatures and docstrings: - def register_custom_filters(self, env): Adds our custom filters to the Jinja2 engine. Arguments --------- env: jinja2.Environment instance. The enviro...
Implement the Python class `JinjaEngine` described below. Class description: An evaluation engine which uses Jinja2 for templating. Method signatures and docstrings: - def register_custom_filters(self, env): Adds our custom filters to the Jinja2 engine. Arguments --------- env: jinja2.Environment instance. The enviro...
fd0c120e50815c1e5be64e5dde964dcd47234556
<|skeleton|> class JinjaEngine: """An evaluation engine which uses Jinja2 for templating.""" def register_custom_filters(self, env): """Adds our custom filters to the Jinja2 engine. Arguments --------- env: jinja2.Environment instance. The environment to add the custom filters to.""" <|body_0|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JinjaEngine: """An evaluation engine which uses Jinja2 for templating.""" def register_custom_filters(self, env): """Adds our custom filters to the Jinja2 engine. Arguments --------- env: jinja2.Environment instance. The environment to add the custom filters to.""" env.filters['basename']...
the_stack_v2_python_sparse
kur/engine/jinja_engine.py
deepgram/kur
train
873
38baa14094923e75e7328184a43ec8d97e07e958
[ "self.data_dir = data_dir\nself.lp = {'v': helpers.get_most_recent_file(self.data_dir, 'v'), 's': helpers.get_most_recent_file(self.data_dir, 's')}\nDs9('Spectrograph')\nDs9('Viewer')", "while os.path.isfile('{}/{}'.format(TMPDIR, NIRES_AUTODISPLAY_START)):\n self.run_inst('v')\n self.run_inst('s')\n sle...
<|body_start_0|> self.data_dir = data_dir self.lp = {'v': helpers.get_most_recent_file(self.data_dir, 'v'), 's': helpers.get_most_recent_file(self.data_dir, 's')} Ds9('Spectrograph') Ds9('Viewer') <|end_body_0|> <|body_start_1|> while os.path.isfile('{}/{}'.format(TMPDIR, NIRES_...
QuickLook
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuickLook: def __init__(self, data_dir='.'): """Setup the QuickLook windows and display first frames""" <|body_0|> def run(self): """run the system :return:""" <|body_1|> def run_inst(self, inst): """run commands for each display :param inst: :re...
stack_v2_sparse_classes_75kplus_train_071466
2,728
no_license
[ { "docstring": "Setup the QuickLook windows and display first frames", "name": "__init__", "signature": "def __init__(self, data_dir='.')" }, { "docstring": "run the system :return:", "name": "run", "signature": "def run(self)" }, { "docstring": "run commands for each display :pa...
4
stack_v2_sparse_classes_30k_train_053194
Implement the Python class `QuickLook` described below. Class description: Implement the QuickLook class. Method signatures and docstrings: - def __init__(self, data_dir='.'): Setup the QuickLook windows and display first frames - def run(self): run the system :return: - def run_inst(self, inst): run commands for eac...
Implement the Python class `QuickLook` described below. Class description: Implement the QuickLook class. Method signatures and docstrings: - def __init__(self, data_dir='.'): Setup the QuickLook windows and display first frames - def run(self): run the system :return: - def run_inst(self, inst): run commands for eac...
3f108a3789d397b0b4f55d646b827393cb457a02
<|skeleton|> class QuickLook: def __init__(self, data_dir='.'): """Setup the QuickLook windows and display first frames""" <|body_0|> def run(self): """run the system :return:""" <|body_1|> def run_inst(self, inst): """run commands for each display :param inst: :re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuickLook: def __init__(self, data_dir='.'): """Setup the QuickLook windows and display first frames""" self.data_dir = data_dir self.lp = {'v': helpers.get_most_recent_file(self.data_dir, 'v'), 's': helpers.get_most_recent_file(self.data_dir, 's')} Ds9('Spectrograph') ...
the_stack_v2_python_sparse
nires/displaytools/quicklook.py
jmel/nires-displaytools
train
0
00bce886a856ce19a4b8a5cb833bf2a087808ad8
[ "item = device or extra\nif not item:\n raise ValueError('Either device or extra is required')\nif start == '':\n start = date.today()\nif device:\n daily_cost = (device.cached_cost or 0) / 30.4\nelse:\n daily_cost = extra.cost / 30.4\nventure = item.venture\ncls.end_span(device=device, extra=extra, end...
<|body_start_0|> item = device or extra if not item: raise ValueError('Either device or extra is required') if start == '': start = date.today() if device: daily_cost = (device.cached_cost or 0) / 30.4 else: daily_cost = extra.cost ...
A single time span for historical cost and venture ownership of a device or an extra cost. ``start`` and ``end`` determine the time span during which the ``device`` (or ``extra`` cost) was onwed by venture ``venture`` and had cost of ``cost``. The time spans for a single device or extra cost should never overlap.
HistoryCost
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HistoryCost: """A single time span for historical cost and venture ownership of a device or an extra cost. ``start`` and ``end`` determine the time span during which the ``device`` (or ``extra`` cost) was onwed by venture ``venture`` and had cost of ``cost``. The time spans for a single device or...
stack_v2_sparse_classes_75kplus_train_071467
19,391
permissive
[ { "docstring": "Start a new time span with new valies for the given device or extra cost. It will automatically truncate the previous span if necessary. By default, the timespan is infinite towards the future -- possibly to be truncated by a later span, but an optional ``end`` parameter can be used to specify t...
3
null
Implement the Python class `HistoryCost` described below. Class description: A single time span for historical cost and venture ownership of a device or an extra cost. ``start`` and ``end`` determine the time span during which the ``device`` (or ``extra`` cost) was onwed by venture ``venture`` and had cost of ``cost``...
Implement the Python class `HistoryCost` described below. Class description: A single time span for historical cost and venture ownership of a device or an extra cost. ``start`` and ``end`` determine the time span during which the ``device`` (or ``extra`` cost) was onwed by venture ``venture`` and had cost of ``cost``...
bf7231ea096924332b874718b33cd1f43f9c783b
<|skeleton|> class HistoryCost: """A single time span for historical cost and venture ownership of a device or an extra cost. ``start`` and ``end`` determine the time span during which the ``device`` (or ``extra`` cost) was onwed by venture ``venture`` and had cost of ``cost``. The time spans for a single device or...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HistoryCost: """A single time span for historical cost and venture ownership of a device or an extra cost. ``start`` and ``end`` determine the time span during which the ``device`` (or ``extra`` cost) was onwed by venture ``venture`` and had cost of ``cost``. The time spans for a single device or extra cost s...
the_stack_v2_python_sparse
src/ralph/discovery/models_history.py
quamilek/ralph
train
0
7f6aee26e8392f0f0b4a221de2fbda8b8628e6cc
[ "from dscribe.descriptors import CoulombMatrix\nif 'type' not in desc_spec.keys() or desc_spec['type'] != 'CM':\n raise ValueError('Type is not CM or cannot find the type of the descriptor')\ntry:\n self.max_atoms = desc_spec['max_atoms']\nexcept:\n raise ValueError('Not enough information to intialize the...
<|body_start_0|> from dscribe.descriptors import CoulombMatrix if 'type' not in desc_spec.keys() or desc_spec['type'] != 'CM': raise ValueError('Type is not CM or cannot find the type of the descriptor') try: self.max_atoms = desc_spec['max_atoms'] except: ...
Global_Descriptor_CM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Global_Descriptor_CM: def __init__(self, desc_spec): """make a DScribe CM object""" <|body_0|> def create(self, frame): """compute the CM descriptor vector for a frame Parameters ---------- frame: ASE atom object. Coordinates of a frame. Returns ------- desc_dict: a ...
stack_v2_sparse_classes_75kplus_train_071468
11,729
permissive
[ { "docstring": "make a DScribe CM object", "name": "__init__", "signature": "def __init__(self, desc_spec)" }, { "docstring": "compute the CM descriptor vector for a frame Parameters ---------- frame: ASE atom object. Coordinates of a frame. Returns ------- desc_dict: a dictionary. each entry co...
2
stack_v2_sparse_classes_30k_train_029215
Implement the Python class `Global_Descriptor_CM` described below. Class description: Implement the Global_Descriptor_CM class. Method signatures and docstrings: - def __init__(self, desc_spec): make a DScribe CM object - def create(self, frame): compute the CM descriptor vector for a frame Parameters ---------- fram...
Implement the Python class `Global_Descriptor_CM` described below. Class description: Implement the Global_Descriptor_CM class. Method signatures and docstrings: - def __init__(self, desc_spec): make a DScribe CM object - def create(self, frame): compute the CM descriptor vector for a frame Parameters ---------- fram...
a9b494f5503853cd2206d4231b32a40514a8ce35
<|skeleton|> class Global_Descriptor_CM: def __init__(self, desc_spec): """make a DScribe CM object""" <|body_0|> def create(self, frame): """compute the CM descriptor vector for a frame Parameters ---------- frame: ASE atom object. Coordinates of a frame. Returns ------- desc_dict: a ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Global_Descriptor_CM: def __init__(self, desc_spec): """make a DScribe CM object""" from dscribe.descriptors import CoulombMatrix if 'type' not in desc_spec.keys() or desc_spec['type'] != 'CM': raise ValueError('Type is not CM or cannot find the type of the descriptor') ...
the_stack_v2_python_sparse
asaplib/descriptors/global_descriptors.py
BingqingCheng/ASAP
train
113
2fc34223ff7e19ba468a622f26857279da92dbc6
[ "super().__init__()\nself.n = n\nself.D = D\nself.W = W\nself.in_channels_xyz = in_channels_xyz\nself.in_channels_dir = in_channels_dir\nself.skips = skips\nif topk > 0:\n StackedFcLayers = StackedFcSlow\nelse:\n StackedFcLayers = StackedFcDense\nfor i in range(D):\n if i == 0:\n layer = StackedFcLa...
<|body_start_0|> super().__init__() self.n = n self.D = D self.W = W self.in_channels_xyz = in_channels_xyz self.in_channels_dir = in_channels_dir self.skips = skips if topk > 0: StackedFcLayers = StackedFcSlow else: Stacked...
Nerflets.
Nerflets
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Nerflets: """Nerflets.""" def __init__(self, n, D, W, in_channels_xyz=63, in_channels_dir=27, skips=[4], with_semantics=False, n_classes=6, topk=0): """n: number of nerflets D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: numbe...
stack_v2_sparse_classes_75kplus_train_071469
8,749
permissive
[ { "docstring": "n: number of nerflets D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: number of input channels for xyz (3+3*10*2=63 by default) in_channels_dir: number of input channels for direction (3+3*4*2=27 by default) skips: add skip connection in t...
2
stack_v2_sparse_classes_30k_train_049326
Implement the Python class `Nerflets` described below. Class description: Nerflets. Method signatures and docstrings: - def __init__(self, n, D, W, in_channels_xyz=63, in_channels_dir=27, skips=[4], with_semantics=False, n_classes=6, topk=0): n: number of nerflets D: number of layers for density (sigma) encoder W: nu...
Implement the Python class `Nerflets` described below. Class description: Nerflets. Method signatures and docstrings: - def __init__(self, n, D, W, in_channels_xyz=63, in_channels_dir=27, skips=[4], with_semantics=False, n_classes=6, topk=0): n: number of nerflets D: number of layers for density (sigma) encoder W: nu...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class Nerflets: """Nerflets.""" def __init__(self, n, D, W, in_channels_xyz=63, in_channels_dir=27, skips=[4], with_semantics=False, n_classes=6, topk=0): """n: number of nerflets D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: numbe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Nerflets: """Nerflets.""" def __init__(self, n, D, W, in_channels_xyz=63, in_channels_dir=27, skips=[4], with_semantics=False, n_classes=6, topk=0): """n: number of nerflets D: number of layers for density (sigma) encoder W: number of hidden units in each layer in_channels_xyz: number of input ch...
the_stack_v2_python_sparse
nerflets/models/nerf.py
Jimmy-INL/google-research
train
1
f205f72a5a2f1c99c7feeb6382cf60394749db43
[ "self.model_name = model\nstart_time = time.time()\nend_time = time.time()", "results = []\nresults.append({'label': [{'description': 'person', 'score': 1.0, 'class_idx': 0}], 'position': {'x': 30, 'y': 30, 'w': 100, 'h': 100}})\nresults.append({'label': [{'description': 'car', 'score': 1.0, 'class_idx': 1}], 'po...
<|body_start_0|> self.model_name = model start_time = time.time() end_time = time.time() <|end_body_0|> <|body_start_1|> results = [] results.append({'label': [{'description': 'person', 'score': 1.0, 'class_idx': 0}], 'position': {'x': 30, 'y': 30, 'w': 100, 'h': 100}}) ...
ObjectDetection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectDetection: def __init__(self, model='Template'): """:param model: model name :param category_num:""" <|body_0|> def inference_by_image(self, image, confidence_threshold=0.3): """:param image: input image :param confidence_threshold: confidence/score threshold f...
stack_v2_sparse_classes_75kplus_train_071470
1,335
no_license
[ { "docstring": ":param model: model name :param category_num:", "name": "__init__", "signature": "def __init__(self, model='Template')" }, { "docstring": ":param image: input image :param confidence_threshold: confidence/score threshold for object detection. :return: bounding box(x1, y1, x2, y2)...
2
stack_v2_sparse_classes_30k_train_032975
Implement the Python class `ObjectDetection` described below. Class description: Implement the ObjectDetection class. Method signatures and docstrings: - def __init__(self, model='Template'): :param model: model name :param category_num: - def inference_by_image(self, image, confidence_threshold=0.3): :param image: i...
Implement the Python class `ObjectDetection` described below. Class description: Implement the ObjectDetection class. Method signatures and docstrings: - def __init__(self, model='Template'): :param model: model name :param category_num: - def inference_by_image(self, image, confidence_threshold=0.3): :param image: i...
5016cbed9ff2ea5336c05817e8123ce770a23d12
<|skeleton|> class ObjectDetection: def __init__(self, model='Template'): """:param model: model name :param category_num:""" <|body_0|> def inference_by_image(self, image, confidence_threshold=0.3): """:param image: input image :param confidence_threshold: confidence/score threshold f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ObjectDetection: def __init__(self, model='Template'): """:param model: model name :param category_num:""" self.model_name = model start_time = time.time() end_time = time.time() def inference_by_image(self, image, confidence_threshold=0.3): """:param image: input ...
the_stack_v2_python_sparse
detector/object_detection/ObjectDetection.py
kdh4672/edge-analysis-module_old
train
0
fb7cf26530d0323e5dbfe9c83b339714ad96d1dc
[ "self.__oss_bucket = oss_bucket\nself.__access_keyid = oss_bucket.access_keyid\nself.__access_keysecret = oss_bucket.access_keysecret\nself.__bucket_name = self.__oss_bucket.bucket_name\nself.__main_host = self.__oss_bucket.main_host\nself.__vpc_host = self.__oss_bucket.vpc_host\nself.__auth = oss2.Auth(self.__acce...
<|body_start_0|> self.__oss_bucket = oss_bucket self.__access_keyid = oss_bucket.access_keyid self.__access_keysecret = oss_bucket.access_keysecret self.__bucket_name = self.__oss_bucket.bucket_name self.__main_host = self.__oss_bucket.main_host self.__vpc_host = self.__o...
阿里云OSS 接口
AliOssApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AliOssApi: """阿里云OSS 接口""" def __init__(self, oss_bucket): """生成oss auth""" <|body_0|> def upload_stream(self, file_ext, file_stream, headers={'Content-Type': 'application/octet-stream'}): """上传文件流""" <|body_1|> def upload_localfile(self, file_ext, f...
stack_v2_sparse_classes_75kplus_train_071471
6,240
no_license
[ { "docstring": "生成oss auth", "name": "__init__", "signature": "def __init__(self, oss_bucket)" }, { "docstring": "上传文件流", "name": "upload_stream", "signature": "def upload_stream(self, file_ext, file_stream, headers={'Content-Type': 'application/octet-stream'})" }, { "docstring":...
4
null
Implement the Python class `AliOssApi` described below. Class description: 阿里云OSS 接口 Method signatures and docstrings: - def __init__(self, oss_bucket): 生成oss auth - def upload_stream(self, file_ext, file_stream, headers={'Content-Type': 'application/octet-stream'}): 上传文件流 - def upload_localfile(self, file_ext, file_...
Implement the Python class `AliOssApi` described below. Class description: 阿里云OSS 接口 Method signatures and docstrings: - def __init__(self, oss_bucket): 生成oss auth - def upload_stream(self, file_ext, file_stream, headers={'Content-Type': 'application/octet-stream'}): 上传文件流 - def upload_localfile(self, file_ext, file_...
420ca91c5244b1be0557cf42de161158bbe53d1b
<|skeleton|> class AliOssApi: """阿里云OSS 接口""" def __init__(self, oss_bucket): """生成oss auth""" <|body_0|> def upload_stream(self, file_ext, file_stream, headers={'Content-Type': 'application/octet-stream'}): """上传文件流""" <|body_1|> def upload_localfile(self, file_ext, f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AliOssApi: """阿里云OSS 接口""" def __init__(self, oss_bucket): """生成oss auth""" self.__oss_bucket = oss_bucket self.__access_keyid = oss_bucket.access_keyid self.__access_keysecret = oss_bucket.access_keysecret self.__bucket_name = self.__oss_bucket.bucket_name ...
the_stack_v2_python_sparse
alioss/middleware/api.py
suzuke/signature
train
0
bd7829593ac3be50eafc356547d4d02ecefe805c
[ "super(Decoder, self).__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(input_dim=target_vocab, output_dim=dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dro...
<|body_start_0|> super(Decoder, self).__init__() self.N = N self.dm = dm self.embedding = tf.keras.layers.Embedding(input_dim=target_vocab, output_dim=dm) self.positional_encoding = positional_encoding(max_seq_len, dm) self.blocks = [DecoderBlock(dm, h, hidden, drop_rate)...
create encoder for transformer
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """create encoder for transformer""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully conne...
stack_v2_sparse_classes_75kplus_train_071472
3,185
no_license
[ { "docstring": "N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully connected layer target_vocab - the size of the target vocabulary max_seq_len - the maximum sequence length possible drop_rate - the dropout rate S...
2
stack_v2_sparse_classes_30k_train_010202
Implement the Python class `Decoder` described below. Class description: create encoder for transformer Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of hea...
Implement the Python class `Decoder` described below. Class description: create encoder for transformer Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of hea...
5114f884241b3406940b00450d8c71f55d5d6a70
<|skeleton|> class Decoder: """create encoder for transformer""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully conne...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Decoder: """create encoder for transformer""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully connected layer ta...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/10-transformer_decoder.py
icculp/holbertonschool-machine_learning
train
0
989875b13851df27bc8654709f1cf23c065a5cd3
[ "print('before init')\nsuper().__init__()\nprint('before get')\nresnet = get_visn_arch(arch)(pretrained=pretrained)\nprint('after get')\nfor param in resnet.parameters():\n param.requires_grad = False\nresnet.fc = nn.Identity()\nself.backbone = resnet", "x = self.backbone(img)\nx = x.detach()\nreturn x" ]
<|body_start_0|> print('before init') super().__init__() print('before get') resnet = get_visn_arch(arch)(pretrained=pretrained) print('after get') for param in resnet.parameters(): param.requires_grad = False resnet.fc = nn.Identity() self.bac...
VisnModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisnModel: def __init__(self, arch='resnet50', pretrained=True): """:param dim: dimension of the output :param arch: backbone architecture, :param pretrained: load feature with pre-trained vector :param finetuning: finetune the model""" <|body_0|> def forward(self, img): ...
stack_v2_sparse_classes_75kplus_train_071473
11,557
permissive
[ { "docstring": ":param dim: dimension of the output :param arch: backbone architecture, :param pretrained: load feature with pre-trained vector :param finetuning: finetune the model", "name": "__init__", "signature": "def __init__(self, arch='resnet50', pretrained=True)" }, { "docstring": ":para...
2
stack_v2_sparse_classes_30k_train_047880
Implement the Python class `VisnModel` described below. Class description: Implement the VisnModel class. Method signatures and docstrings: - def __init__(self, arch='resnet50', pretrained=True): :param dim: dimension of the output :param arch: backbone architecture, :param pretrained: load feature with pre-trained v...
Implement the Python class `VisnModel` described below. Class description: Implement the VisnModel class. Method signatures and docstrings: - def __init__(self, arch='resnet50', pretrained=True): :param dim: dimension of the output :param arch: backbone architecture, :param pretrained: load feature with pre-trained v...
51ac07d1de564c26fbf038b07031a55660bbcb27
<|skeleton|> class VisnModel: def __init__(self, arch='resnet50', pretrained=True): """:param dim: dimension of the output :param arch: backbone architecture, :param pretrained: load feature with pre-trained vector :param finetuning: finetune the model""" <|body_0|> def forward(self, img): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VisnModel: def __init__(self, arch='resnet50', pretrained=True): """:param dim: dimension of the output :param arch: backbone architecture, :param pretrained: load feature with pre-trained vector :param finetuning: finetune the model""" print('before init') super().__init__() p...
the_stack_v2_python_sparse
retrieval_model/vokenization/tmp_extract_vision_keys.py
CJJ2923/Maria
train
0
115372ce1ba434514f192991beded521e68a8483
[ "self.prefix_root = [set(), [None for _ in range(26)]]\nself.suffix_root = [set(), [None for _ in range(26)]]\nself.weights = {}\n\ndef insert(word, forwards):\n if forwards:\n node = self.prefix_root\n iterate_word = word\n else:\n node = self.suffix_root\n iterate_word = word[::-...
<|body_start_0|> self.prefix_root = [set(), [None for _ in range(26)]] self.suffix_root = [set(), [None for _ in range(26)]] self.weights = {} def insert(word, forwards): if forwards: node = self.prefix_root iterate_word = word els...
WordFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.prefix_root = [set(), [None for _ in ...
stack_v2_sparse_classes_75kplus_train_071474
2,884
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type prefix: str :type suffix: str :rtype: int", "name": "f", "signature": "def f(self, prefix, suffix)" } ]
2
stack_v2_sparse_classes_30k_train_049613
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int <|skeleton|> class WordFilter: def __in...
05e0beff0047f0ad399d0b46d625bb8d3459814e
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WordFilter: def __init__(self, words): """:type words: List[str]""" self.prefix_root = [set(), [None for _ in range(26)]] self.suffix_root = [set(), [None for _ in range(26)]] self.weights = {} def insert(word, forwards): if forwards: node =...
the_stack_v2_python_sparse
python_1_to_1000/745_Prefix_and_Suffix_Search.py
jakehoare/leetcode
train
58
e2b1b6a89ec072a72395ee0a10af0655ad9211e1
[ "test = (9, 10, 7, 8, 9, 9)\nd = BearSong(test)\nself.assertEqual(BearSong(test).calculate(), '3')\ntest = ''\ntest = ''\ntest = ''", "import random\nimport timeit\ntest = str(nmax) + ' ' + str(nmax) + '\\n'\nnumnums = [str(i) + ' ' + str(i + 1) for i in range(nmax)]\ntest += '\\n'.join(numnums) + '\\n'\nnums = [...
<|body_start_0|> test = (9, 10, 7, 8, 9, 9) d = BearSong(test) self.assertEqual(BearSong(test).calculate(), '3') test = '' test = '' test = '' <|end_body_0|> <|body_start_1|> import random import timeit test = str(nmax) + ' ' + str(nmax) + '\n' ...
unitTests
[ "Unlicense", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class unitTests: def test_single_test(self): """BearSong class testing""" <|body_0|> def time_limit_test(self, nmax): """Timelimit testing""" <|body_1|> <|end_skeleton|> <|body_start_0|> test = (9, 10, 7, 8, 9, 9) d = BearSong(test) self.a...
stack_v2_sparse_classes_75kplus_train_071475
2,604
permissive
[ { "docstring": "BearSong class testing", "name": "test_single_test", "signature": "def test_single_test(self)" }, { "docstring": "Timelimit testing", "name": "time_limit_test", "signature": "def time_limit_test(self, nmax)" } ]
2
stack_v2_sparse_classes_30k_train_049369
Implement the Python class `unitTests` described below. Class description: Implement the unitTests class. Method signatures and docstrings: - def test_single_test(self): BearSong class testing - def time_limit_test(self, nmax): Timelimit testing
Implement the Python class `unitTests` described below. Class description: Implement the unitTests class. Method signatures and docstrings: - def test_single_test(self): BearSong class testing - def time_limit_test(self, nmax): Timelimit testing <|skeleton|> class unitTests: def test_single_test(self): ...
ae02ea872ca91ef98630cc172a844b82cc56f621
<|skeleton|> class unitTests: def test_single_test(self): """BearSong class testing""" <|body_0|> def time_limit_test(self, nmax): """Timelimit testing""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class unitTests: def test_single_test(self): """BearSong class testing""" test = (9, 10, 7, 8, 9, 9) d = BearSong(test) self.assertEqual(BearSong(test).calculate(), '3') test = '' test = '' test = '' def time_limit_test(self, nmax): """Timelimit t...
the_stack_v2_python_sparse
topcoder/673A_BearSong.py
snsokolov/contests
train
1
c6002b52f3a9c2bd07517a96067827adeddbd7c2
[ "dirname = osp.dirname(__file__)\npyfile = osp.join(dirname, 'workers', 'unittestworker.py')\narguments = [pyfile, str(self.reader.port)]\nif single_test:\n arguments.append(single_test)\narguments += config.args\nreturn arguments", "self.config = config\nself.reader = ZmqStreamReader()\nself.reader.sig_receiv...
<|body_start_0|> dirname = osp.dirname(__file__) pyfile = osp.join(dirname, 'workers', 'unittestworker.py') arguments = [pyfile, str(self.reader.port)] if single_test: arguments.append(single_test) arguments += config.args return arguments <|end_body_0|> <|bo...
Class for running tests with unittest module in standard library.
UnittestRunner
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnittestRunner: """Class for running tests with unittest module in standard library.""" def create_argument_list(self, config: Config, cov_path: Optional[str], single_test: Optional[str]) -> list[str]: """Create argument list for testing process.""" <|body_0|> def start(...
stack_v2_sparse_classes_75kplus_train_071476
3,598
permissive
[ { "docstring": "Create argument list for testing process.", "name": "create_argument_list", "signature": "def create_argument_list(self, config: Config, cov_path: Optional[str], single_test: Optional[str]) -> list[str]" }, { "docstring": "Start process which will run the unit test suite.", "...
4
stack_v2_sparse_classes_30k_train_022786
Implement the Python class `UnittestRunner` described below. Class description: Class for running tests with unittest module in standard library. Method signatures and docstrings: - def create_argument_list(self, config: Config, cov_path: Optional[str], single_test: Optional[str]) -> list[str]: Create argument list f...
Implement the Python class `UnittestRunner` described below. Class description: Class for running tests with unittest module in standard library. Method signatures and docstrings: - def create_argument_list(self, config: Config, cov_path: Optional[str], single_test: Optional[str]) -> list[str]: Create argument list f...
5c91a7ef3358f1be31cf517c739ee88e733d2225
<|skeleton|> class UnittestRunner: """Class for running tests with unittest module in standard library.""" def create_argument_list(self, config: Config, cov_path: Optional[str], single_test: Optional[str]) -> list[str]: """Create argument list for testing process.""" <|body_0|> def start(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnittestRunner: """Class for running tests with unittest module in standard library.""" def create_argument_list(self, config: Config, cov_path: Optional[str], single_test: Optional[str]) -> list[str]: """Create argument list for testing process.""" dirname = osp.dirname(__file__) ...
the_stack_v2_python_sparse
spyder_unittest/backend/unittestrunner.py
spyder-ide/spyder-unittest
train
80
aa680cf315bec38b8666f6d4985ebfa7440b57ea
[ "self.scale = scale\nif samples is not None:\n ext = (samples - 1) * sample_spacing / 2\n x = e.arange(-ext, ext, sample_spacing, dtype=config.precision)\n y = e.arange(-ext, ext, sample_spacing, dtype=config.precision)\n coef = 1 / (scale * e.sqrt(2 * e.pi))\n xx, yy = e.meshgrid(x, y)\n rho, _ =...
<|body_start_0|> self.scale = scale if samples is not None: ext = (samples - 1) * sample_spacing / 2 x = e.arange(-ext, ext, sample_spacing, dtype=config.precision) y = e.arange(-ext, ext, sample_spacing, dtype=config.precision) coef = 1 / (scale * e.sqrt(...
Jitter (high frequency motion).
Jitter
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Jitter: """Jitter (high frequency motion).""" def __init__(self, scale, sample_spacing=None, samples=None): """Create a new Jitter instance. Parameters ---------- scale : `float` scale of the jitter, units of microns sample_spacing : `float`, optional center-to-center sample spacing,...
stack_v2_sparse_classes_75kplus_train_071477
2,808
permissive
[ { "docstring": "Create a new Jitter instance. Parameters ---------- scale : `float` scale of the jitter, units of microns sample_spacing : `float`, optional center-to-center sample spacing, units of microns samples : `int`, optional number of samples in X and Y", "name": "__init__", "signature": "def __...
2
null
Implement the Python class `Jitter` described below. Class description: Jitter (high frequency motion). Method signatures and docstrings: - def __init__(self, scale, sample_spacing=None, samples=None): Create a new Jitter instance. Parameters ---------- scale : `float` scale of the jitter, units of microns sample_spa...
Implement the Python class `Jitter` described below. Class description: Jitter (high frequency motion). Method signatures and docstrings: - def __init__(self, scale, sample_spacing=None, samples=None): Create a new Jitter instance. Parameters ---------- scale : `float` scale of the jitter, units of microns sample_spa...
01fb5572b7a1ac5e3ee095f89f133166050af719
<|skeleton|> class Jitter: """Jitter (high frequency motion).""" def __init__(self, scale, sample_spacing=None, samples=None): """Create a new Jitter instance. Parameters ---------- scale : `float` scale of the jitter, units of microns sample_spacing : `float`, optional center-to-center sample spacing,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Jitter: """Jitter (high frequency motion).""" def __init__(self, scale, sample_spacing=None, samples=None): """Create a new Jitter instance. Parameters ---------- scale : `float` scale of the jitter, units of microns sample_spacing : `float`, optional center-to-center sample spacing, units of mic...
the_stack_v2_python_sparse
prysm/degredations.py
JakobSilbermann/prysm
train
0
454e7320131d3d22076bba2e54d9153a2ffc2b67
[ "slug_name = kwargs['slug_name']\nself.gym = get_object_or_404(Gym, slug_name=slug_name)\nreturn super(MembershipViewSet, self).dispatch(request, *args, **kwargs)", "obj = get_object_or_404(Membership, paid_for__cc=self.kwargs['pk'], paid_in=self.gym, is_active=True)\nself.check_object_permissions(self.request, o...
<|body_start_0|> slug_name = kwargs['slug_name'] self.gym = get_object_or_404(Gym, slug_name=slug_name) return super(MembershipViewSet, self).dispatch(request, *args, **kwargs) <|end_body_0|> <|body_start_1|> obj = get_object_or_404(Membership, paid_for__cc=self.kwargs['pk'], paid_in=se...
Membership Model view set.
MembershipViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MembershipViewSet: """Membership Model view set.""" def dispatch(self, request, *args, **kwargs): """get object before running the whole view.""" <|body_0|> def get_object(self): """Return the gym client using the unique identity document.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_071478
2,587
permissive
[ { "docstring": "get object before running the whole view.", "name": "dispatch", "signature": "def dispatch(self, request, *args, **kwargs)" }, { "docstring": "Return the gym client using the unique identity document.", "name": "get_object", "signature": "def get_object(self)" }, { ...
5
stack_v2_sparse_classes_30k_train_034513
Implement the Python class `MembershipViewSet` described below. Class description: Membership Model view set. Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): get object before running the whole view. - def get_object(self): Return the gym client using the unique identity document. - ...
Implement the Python class `MembershipViewSet` described below. Class description: Membership Model view set. Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): get object before running the whole view. - def get_object(self): Return the gym client using the unique identity document. - ...
caf2b6f5e9a0ed9e98567a036bec9a34b44ecf13
<|skeleton|> class MembershipViewSet: """Membership Model view set.""" def dispatch(self, request, *args, **kwargs): """get object before running the whole view.""" <|body_0|> def get_object(self): """Return the gym client using the unique identity document.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MembershipViewSet: """Membership Model view set.""" def dispatch(self, request, *args, **kwargs): """get object before running the whole view.""" slug_name = kwargs['slug_name'] self.gym = get_object_or_404(Gym, slug_name=slug_name) return super(MembershipViewSet, self).di...
the_stack_v2_python_sparse
backend/admingym/memberships/views/memberships.py
Manuelhra/AdminGym
train
0
a11ce1094ffa5987f3dae60a21b362465db9cef7
[ "profiles = kwargs.pop('profiles', None)\nsuper(ProfileSelectForm, self).__init__(*args, **kwargs)\nchoices = []\nif profiles is not None:\n for p in profiles:\n choices.append((p.id, 'Profile {}'.format(p.id)))\n self.fields['profile'].choices = choices", "profile = self.cleaned_data.get('profile')\...
<|body_start_0|> profiles = kwargs.pop('profiles', None) super(ProfileSelectForm, self).__init__(*args, **kwargs) choices = [] if profiles is not None: for p in profiles: choices.append((p.id, 'Profile {}'.format(p.id))) self.fields['profile'].choi...
Form for running a profile.
ProfileSelectForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileSelectForm: """Form for running a profile.""" def __init__(self, *args, **kwargs): """Initialise method for ProfileSelectForm. :param args: argument :param kwargs: keyword arguments containing a scripts variable with Script objects""" <|body_0|> def clean_profile(...
stack_v2_sparse_classes_75kplus_train_071479
6,111
no_license
[ { "docstring": "Initialise method for ProfileSelectForm. :param args: argument :param kwargs: keyword arguments containing a scripts variable with Script objects", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Clean the profile variable in this form. :...
2
stack_v2_sparse_classes_30k_train_035847
Implement the Python class `ProfileSelectForm` described below. Class description: Form for running a profile. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialise method for ProfileSelectForm. :param args: argument :param kwargs: keyword arguments containing a scripts variable with Scr...
Implement the Python class `ProfileSelectForm` described below. Class description: Form for running a profile. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialise method for ProfileSelectForm. :param args: argument :param kwargs: keyword arguments containing a scripts variable with Scr...
f8ab95acf4c95fbf6311c76f598eda34cde6e552
<|skeleton|> class ProfileSelectForm: """Form for running a profile.""" def __init__(self, *args, **kwargs): """Initialise method for ProfileSelectForm. :param args: argument :param kwargs: keyword arguments containing a scripts variable with Script objects""" <|body_0|> def clean_profile(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProfileSelectForm: """Form for running a profile.""" def __init__(self, *args, **kwargs): """Initialise method for ProfileSelectForm. :param args: argument :param kwargs: keyword arguments containing a scripts variable with Script objects""" profiles = kwargs.pop('profiles', None) ...
the_stack_v2_python_sparse
equestria/scripts/forms.py
centre-for-language-speech-technology/CLST-2020
train
1
39ec83b74bef5822751e9993268bc0786529b1d9
[ "storage = get_storage()\nforecasts = storage.list_forecasts()\nreturn jsonify(ForecastSchema(many=True).dump(forecasts))", "data = request.get_json()\ntry:\n forecast = ForecastPostSchema().load(data)\nexcept ValidationError as err:\n raise BadAPIRequest(err.messages)\nelse:\n storage = get_storage()\n ...
<|body_start_0|> storage = get_storage() forecasts = storage.list_forecasts() return jsonify(ForecastSchema(many=True).dump(forecasts)) <|end_body_0|> <|body_start_1|> data = request.get_json() try: forecast = ForecastPostSchema().load(data) except Validation...
AllForecastsView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllForecastsView: def get(self, *args): """--- summary: List forecasts tags: - Forecasts responses: 200: description: Forecasts sucessfully retrieved. content: application/json: schema: type: array items: $ref: '#/components/schemas/ForecastMetadata' 401: $ref: '#/components/responses/40...
stack_v2_sparse_classes_75kplus_train_071480
33,198
permissive
[ { "docstring": "--- summary: List forecasts tags: - Forecasts responses: 200: description: Forecasts sucessfully retrieved. content: application/json: schema: type: array items: $ref: '#/components/schemas/ForecastMetadata' 401: $ref: '#/components/responses/401-Unauthorized'", "name": "get", "signature...
2
null
Implement the Python class `AllForecastsView` described below. Class description: Implement the AllForecastsView class. Method signatures and docstrings: - def get(self, *args): --- summary: List forecasts tags: - Forecasts responses: 200: description: Forecasts sucessfully retrieved. content: application/json: schem...
Implement the Python class `AllForecastsView` described below. Class description: Implement the AllForecastsView class. Method signatures and docstrings: - def get(self, *args): --- summary: List forecasts tags: - Forecasts responses: 200: description: Forecasts sucessfully retrieved. content: application/json: schem...
280800c73eb7cfd49029462b352887e78f1ff91b
<|skeleton|> class AllForecastsView: def get(self, *args): """--- summary: List forecasts tags: - Forecasts responses: 200: description: Forecasts sucessfully retrieved. content: application/json: schema: type: array items: $ref: '#/components/schemas/ForecastMetadata' 401: $ref: '#/components/responses/40...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AllForecastsView: def get(self, *args): """--- summary: List forecasts tags: - Forecasts responses: 200: description: Forecasts sucessfully retrieved. content: application/json: schema: type: array items: $ref: '#/components/schemas/ForecastMetadata' 401: $ref: '#/components/responses/401-Unauthorized...
the_stack_v2_python_sparse
sfa_api/forecasts.py
SolarArbiter/solarforecastarbiter-api
train
9
da709a1c054357d6c6d6994ade331852129e882c
[ "for res in self:\n if res.record_id:\n res.book_id = res.record_id.book_id.id\n res.borrow_number = res.record_id.borrow_number - res.record_id.return_number", "for res in self:\n if res.borrow_number > res.record_id.borrow_number:\n raise UserError('归还数量不能超过借阅的数量!')\n if res.borrow...
<|body_start_0|> for res in self: if res.record_id: res.book_id = res.record_id.book_id.id res.borrow_number = res.record_id.borrow_number - res.record_id.return_number <|end_body_0|> <|body_start_1|> for res in self: if res.borrow_number > res.re...
ReturnBooksTran
[ "GPL-3.0-only", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReturnBooksTran: def _onchange_record(self): """动态获取借阅记录值 :return:""" <|body_0|> def commit_return(self): """确认借阅 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> for res in self: if res.record_id: res.book_id = r...
stack_v2_sparse_classes_75kplus_train_071481
2,173
permissive
[ { "docstring": "动态获取借阅记录值 :return:", "name": "_onchange_record", "signature": "def _onchange_record(self)" }, { "docstring": "确认借阅 :return:", "name": "commit_return", "signature": "def commit_return(self)" } ]
2
stack_v2_sparse_classes_30k_train_013529
Implement the Python class `ReturnBooksTran` described below. Class description: Implement the ReturnBooksTran class. Method signatures and docstrings: - def _onchange_record(self): 动态获取借阅记录值 :return: - def commit_return(self): 确认借阅 :return:
Implement the Python class `ReturnBooksTran` described below. Class description: Implement the ReturnBooksTran class. Method signatures and docstrings: - def _onchange_record(self): 动态获取借阅记录值 :return: - def commit_return(self): 确认借阅 :return: <|skeleton|> class ReturnBooksTran: def _onchange_record(self): ...
8608aaeae7a8c86d53b68ce26b7b308f779c3dd8
<|skeleton|> class ReturnBooksTran: def _onchange_record(self): """动态获取借阅记录值 :return:""" <|body_0|> def commit_return(self): """确认借阅 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReturnBooksTran: def _onchange_record(self): """动态获取借阅记录值 :return:""" for res in self: if res.record_id: res.book_id = res.record_id.book_id.id res.borrow_number = res.record_id.borrow_number - res.record_id.return_number def commit_return(self)...
the_stack_v2_python_sparse
odoo_book_lending/wizard/return_books.py
niulinlnc/odooExtModel
train
4
52c9b76566500cea20db5a0f88432ef9581a160c
[ "super().__init__('DiseaseService')\nself.declare_parameter('model_file')\nself.declare_parameter('diseases')\nmodel_file = self.get_parameter('model_file').get_parameter_value().string_value\nself.get_logger().info('Loading Model %s' % model_file)\nself.model = tf.keras.models.load_model(model_file)\nself.bridge =...
<|body_start_0|> super().__init__('DiseaseService') self.declare_parameter('model_file') self.declare_parameter('diseases') model_file = self.get_parameter('model_file').get_parameter_value().string_value self.get_logger().info('Loading Model %s' % model_file) self.model ...
Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model.
DiseaseService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiseaseService: """Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model.""" def __init__(self): """Initialises the service by creating the cvBridge, loading the model from the given parameter and loading the list of va...
stack_v2_sparse_classes_75kplus_train_071482
4,255
no_license
[ { "docstring": "Initialises the service by creating the cvBridge, loading the model from the given parameter and loading the list of valid disease classes.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Callback for handeling incomeing requests. Basically updates dise...
3
stack_v2_sparse_classes_30k_train_042476
Implement the Python class `DiseaseService` described below. Class description: Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model. Method signatures and docstrings: - def __init__(self): Initialises the service by creating the cvBridge, loading the ...
Implement the Python class `DiseaseService` described below. Class description: Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model. Method signatures and docstrings: - def __init__(self): Initialises the service by creating the cvBridge, loading the ...
d8d6c05c52673dc90ed7296235196c544461d940
<|skeleton|> class DiseaseService: """Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model.""" def __init__(self): """Initialises the service by creating the cvBridge, loading the model from the given parameter and loading the list of va...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DiseaseService: """Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model.""" def __init__(self): """Initialises the service by creating the cvBridge, loading the model from the given parameter and loading the list of valid disease c...
the_stack_v2_python_sparse
fruit_detection_component/scripts/disease_service.py
robmosys-tum/PapPercComp
train
2
4a95abca6d84efe657b3eed1db39a5069d3aeb50
[ "self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\nself.verbose = verbose\nself.dark_player = dark_player\nself.move_map = self.generateMoveMap()\nself.cnn = OthelloCNN6().to(self.device)\nself.cnn.load_state_dict(torch.load('./DeepLearning/models/' + MODEL_NAME, map_location=self.device))...
<|body_start_0|> self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') self.verbose = verbose self.dark_player = dark_player self.move_map = self.generateMoveMap() self.cnn = OthelloCNN6().to(self.device) self.cnn.load_state_dict(torch.load('./DeepLea...
CNNPlayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CNNPlayer: def __init__(self, verbose, dark_player): """CNNPlayer constructor function Arguments: verbose {bool} -- Verbosity of the agent dark_player {bool} -- True if agent is dark pieces, false otherwise""" <|body_0|> def generateMoveMap(self): """Generates a dict...
stack_v2_sparse_classes_75kplus_train_071483
4,479
no_license
[ { "docstring": "CNNPlayer constructor function Arguments: verbose {bool} -- Verbosity of the agent dark_player {bool} -- True if agent is dark pieces, false otherwise", "name": "__init__", "signature": "def __init__(self, verbose, dark_player)" }, { "docstring": "Generates a dictionary for conve...
4
stack_v2_sparse_classes_30k_train_005230
Implement the Python class `CNNPlayer` described below. Class description: Implement the CNNPlayer class. Method signatures and docstrings: - def __init__(self, verbose, dark_player): CNNPlayer constructor function Arguments: verbose {bool} -- Verbosity of the agent dark_player {bool} -- True if agent is dark pieces,...
Implement the Python class `CNNPlayer` described below. Class description: Implement the CNNPlayer class. Method signatures and docstrings: - def __init__(self, verbose, dark_player): CNNPlayer constructor function Arguments: verbose {bool} -- Verbosity of the agent dark_player {bool} -- True if agent is dark pieces,...
288efe47dde96594b263bad2333b8627fc88b14b
<|skeleton|> class CNNPlayer: def __init__(self, verbose, dark_player): """CNNPlayer constructor function Arguments: verbose {bool} -- Verbosity of the agent dark_player {bool} -- True if agent is dark pieces, false otherwise""" <|body_0|> def generateMoveMap(self): """Generates a dict...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CNNPlayer: def __init__(self, verbose, dark_player): """CNNPlayer constructor function Arguments: verbose {bool} -- Verbosity of the agent dark_player {bool} -- True if agent is dark pieces, false otherwise""" self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') s...
the_stack_v2_python_sparse
Agents/othelloCNNPlayer.py
peterhessey/othelloML
train
0
99ddbe3f5c4929c644b6d0587598a77f23b4f087
[ "numerator = np.arange(1, MAX_NUMERATOR, dtype=float)\ndenominator = np.arange(1, MAX_DENOMINATOR, dtype=float)\nouter = np.outer(numerator, 1 / denominator)\nself.ratios = np.unique(outer[outer != 1])\nknown_pulsars = np.recfromcsv(KNOWNPSR_FILENM, delimiter=';', comments='#', usecols=(1, 2, 3, 4, 5))\nself.known_...
<|body_start_0|> numerator = np.arange(1, MAX_NUMERATOR, dtype=float) denominator = np.arange(1, MAX_DENOMINATOR, dtype=float) outer = np.outer(numerator, 1 / denominator) self.ratios = np.unique(outer[outer != 1]) known_pulsars = np.recfromcsv(KNOWNPSR_FILENM, delimiter=';', com...
KnownPulsarRater
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KnownPulsarRater: def _setup(self): """A setup method to be called when the Rater is initialised Inputs: None Outputs: None""" <|body_0|> def _compute_rating(self, cand): """Return a rating for the candidate. The rating value encodes how close the candidate's period ...
stack_v2_sparse_classes_75kplus_train_071484
3,629
no_license
[ { "docstring": "A setup method to be called when the Rater is initialised Inputs: None Outputs: None", "name": "_setup", "signature": "def _setup(self)" }, { "docstring": "Return a rating for the candidate. The rating value encodes how close the candidate's period and DM are to that of a known p...
2
stack_v2_sparse_classes_30k_train_006086
Implement the Python class `KnownPulsarRater` described below. Class description: Implement the KnownPulsarRater class. Method signatures and docstrings: - def _setup(self): A setup method to be called when the Rater is initialised Inputs: None Outputs: None - def _compute_rating(self, cand): Return a rating for the ...
Implement the Python class `KnownPulsarRater` described below. Class description: Implement the KnownPulsarRater class. Method signatures and docstrings: - def _setup(self): A setup method to be called when the Rater is initialised Inputs: None Outputs: None - def _compute_rating(self, cand): Return a rating for the ...
b66608054d3ac6d0d5c5f5c4c91383019ae8a41b
<|skeleton|> class KnownPulsarRater: def _setup(self): """A setup method to be called when the Rater is initialised Inputs: None Outputs: None""" <|body_0|> def _compute_rating(self, cand): """Return a rating for the candidate. The rating value encodes how close the candidate's period ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KnownPulsarRater: def _setup(self): """A setup method to be called when the Rater is initialised Inputs: None Outputs: None""" numerator = np.arange(1, MAX_NUMERATOR, dtype=float) denominator = np.arange(1, MAX_DENOMINATOR, dtype=float) outer = np.outer(numerator, 1 / denominat...
the_stack_v2_python_sparse
raters/known_pulsar.py
chitrangpatel/Ratings2.0
train
0
74c03562590cb1422291ab704e9c3c27c661cd2e
[ "self.kommunenr_field = kommunenr_field\nself.kommune_navn_field = kommune_navn_field\nself.gardnr_field = gardnr_field\nself.bruksnr_field = bruksnr_field\nself.festenr_field = festenr_field\nself.seksjonsnr_field = seksjonsnr_field\nself.type_field = type_field\nself.andel_field = andel_field\nself.additional_pro...
<|body_start_0|> self.kommunenr_field = kommunenr_field self.kommune_navn_field = kommune_navn_field self.gardnr_field = gardnr_field self.bruksnr_field = bruksnr_field self.festenr_field = festenr_field self.seksjonsnr_field = seksjonsnr_field self.type_field = t...
Implementation of the 'EiendomNorgeListe' model. TODO: type model description here. Attributes: kommunenr_field (int): TODO: type description here. kommune_navn_field (string): TODO: type description here. gardnr_field (int): TODO: type description here. bruksnr_field (int): TODO: type description here. festenr_field (...
EiendomNorgeListe
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EiendomNorgeListe: """Implementation of the 'EiendomNorgeListe' model. TODO: type model description here. Attributes: kommunenr_field (int): TODO: type description here. kommune_navn_field (string): TODO: type description here. gardnr_field (int): TODO: type description here. bruksnr_field (int):...
stack_v2_sparse_classes_75kplus_train_071485
3,823
permissive
[ { "docstring": "Constructor for the EiendomNorgeListe class", "name": "__init__", "signature": "def __init__(self, kommunenr_field=None, kommune_navn_field=None, gardnr_field=None, bruksnr_field=None, festenr_field=None, seksjonsnr_field=None, type_field=None, andel_field=None, additional_properties={})...
2
stack_v2_sparse_classes_30k_test_001785
Implement the Python class `EiendomNorgeListe` described below. Class description: Implementation of the 'EiendomNorgeListe' model. TODO: type model description here. Attributes: kommunenr_field (int): TODO: type description here. kommune_navn_field (string): TODO: type description here. gardnr_field (int): TODO: type...
Implement the Python class `EiendomNorgeListe` described below. Class description: Implementation of the 'EiendomNorgeListe' model. TODO: type model description here. Attributes: kommunenr_field (int): TODO: type description here. kommune_navn_field (string): TODO: type description here. gardnr_field (int): TODO: type...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class EiendomNorgeListe: """Implementation of the 'EiendomNorgeListe' model. TODO: type model description here. Attributes: kommunenr_field (int): TODO: type description here. kommune_navn_field (string): TODO: type description here. gardnr_field (int): TODO: type description here. bruksnr_field (int):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EiendomNorgeListe: """Implementation of the 'EiendomNorgeListe' model. TODO: type model description here. Attributes: kommunenr_field (int): TODO: type description here. kommune_navn_field (string): TODO: type description here. gardnr_field (int): TODO: type description here. bruksnr_field (int): TODO: type d...
the_stack_v2_python_sparse
idfy_rest_client/models/eiendom_norge_liste.py
dealflowteam/Idfy
train
0
7af57e1e87018b9cc2b626b1d6681680de862bab
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn CrossTenantAccessPolicy()", "from .cross_tenant_access_policy_configuration_default import CrossTenantAccessPolicyConfigurationDefault\nfrom .cross_tenant_access_policy_configuration_partner import CrossTenantAccessPolicyConfigurationP...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return CrossTenantAccessPolicy() <|end_body_0|> <|body_start_1|> from .cross_tenant_access_policy_configuration_default import CrossTenantAccessPolicyConfigurationDefault from .cross_tenant_acc...
CrossTenantAccessPolicy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrossTenantAccessPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CrossTenantAccessPolicy: """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 creat...
stack_v2_sparse_classes_75kplus_train_071486
3,845
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: CrossTenantAccessPolicy", "name": "create_from_discriminator_value", "signature": "def create_from_discrimin...
3
null
Implement the Python class `CrossTenantAccessPolicy` described below. Class description: Implement the CrossTenantAccessPolicy class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CrossTenantAccessPolicy: Creates a new instance of the appropriate clas...
Implement the Python class `CrossTenantAccessPolicy` described below. Class description: Implement the CrossTenantAccessPolicy class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CrossTenantAccessPolicy: Creates a new instance of the appropriate clas...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class CrossTenantAccessPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CrossTenantAccessPolicy: """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 creat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CrossTenantAccessPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CrossTenantAccessPolicy: """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 R...
the_stack_v2_python_sparse
msgraph/generated/models/cross_tenant_access_policy.py
microsoftgraph/msgraph-sdk-python
train
135
403fc7c3e60b09c88e863c364b9e5d7ff28f549f
[ "super(MLPClassifier, self).__init__()\nself.n_classes = n_classes\nself.dropout = nn.Dropout(0.2)\nself.fc1 = nn.Linear(69 * 69 * 3, 1024)\nself.fc2 = nn.Linear(1024, self.n_classes)", "x = x.view(-1, 3 * 69 * 69)\nx = self.dropout(x)\nx = self.fc1(x)\nx = self.dropout(x)\nx = self.fc2(x)\nreturn x" ]
<|body_start_0|> super(MLPClassifier, self).__init__() self.n_classes = n_classes self.dropout = nn.Dropout(0.2) self.fc1 = nn.Linear(69 * 69 * 3, 1024) self.fc2 = nn.Linear(1024, self.n_classes) <|end_body_0|> <|body_start_1|> x = x.view(-1, 3 * 69 * 69) x = sel...
A Convolutional Neural Network based classifier. Determines whether a snapshot is temporally distinguishable by viz.
MLPClassifier
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLPClassifier: """A Convolutional Neural Network based classifier. Determines whether a snapshot is temporally distinguishable by viz.""" def __init__(self, n_classes): """Initialization. Args: n_classes: number of classes""" <|body_0|> def forward(self, x): """F...
stack_v2_sparse_classes_75kplus_train_071487
31,608
permissive
[ { "docstring": "Initialization. Args: n_classes: number of classes", "name": "__init__", "signature": "def __init__(self, n_classes)" }, { "docstring": "Forward behavior of the network. Args: x: input tensor Returns: y: prediction probability vector sized (n_classes, 1)", "name": "forward", ...
2
null
Implement the Python class `MLPClassifier` described below. Class description: A Convolutional Neural Network based classifier. Determines whether a snapshot is temporally distinguishable by viz. Method signatures and docstrings: - def __init__(self, n_classes): Initialization. Args: n_classes: number of classes - de...
Implement the Python class `MLPClassifier` described below. Class description: A Convolutional Neural Network based classifier. Determines whether a snapshot is temporally distinguishable by viz. Method signatures and docstrings: - def __init__(self, n_classes): Initialization. Args: n_classes: number of classes - de...
ff165de95ec0f258ba444ff343d18d812a066b8f
<|skeleton|> class MLPClassifier: """A Convolutional Neural Network based classifier. Determines whether a snapshot is temporally distinguishable by viz.""" def __init__(self, n_classes): """Initialization. Args: n_classes: number of classes""" <|body_0|> def forward(self, x): """F...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MLPClassifier: """A Convolutional Neural Network based classifier. Determines whether a snapshot is temporally distinguishable by viz.""" def __init__(self, n_classes): """Initialization. Args: n_classes: number of classes""" super(MLPClassifier, self).__init__() self.n_classes = ...
the_stack_v2_python_sparse
src/core/models.py
spencerzhang91/GSPNet
train
0
06f491c27d7f21f03b84a28e7f38fd38fc4d81c8
[ "profit = 0\nfor low in range(len(prices)):\n for high in range(low, len(prices)):\n if prices[low] >= prices[high]:\n continue\n else:\n diff = prices[high] - prices[low]\n if profit < diff:\n profit = diff\nreturn profit", "n = len(prices)\nif n <...
<|body_start_0|> profit = 0 for low in range(len(prices)): for high in range(low, len(prices)): if prices[low] >= prices[high]: continue else: diff = prices[high] - prices[low] if profit < diff: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> def maxProfit2(self, prices): """:type prices: List[int] :rtype: int"""...
stack_v2_sparse_classes_75kplus_train_071488
1,752
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit1", "signature": "def maxProfit1(self, prices)" }, { "docstring": ":type prices: List[i...
3
stack_v2_sparse_classes_30k_train_047349
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit1(self, prices): :type prices: List[int] :rtype: int - def maxProfit2(self, prices): :type prices:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit1(self, prices): :type prices: List[int] :rtype: int - def maxProfit2(self, prices): :type prices:...
77bcf1237f1a66ef2614d5af4137c7ab629aa6ea
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> def maxProfit2(self, prices): """:type prices: List[int] :rtype: int"""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" profit = 0 for low in range(len(prices)): for high in range(low, len(prices)): if prices[low] >= prices[high]: continue else: ...
the_stack_v2_python_sparse
LeetCode/121 Best Time to Buy and Sell Store.py
LuffySir/Algorithms
train
0
5859329f95a5b116739413bc9b8faa5fd0b545b4
[ "is_uploaded = CaseProofHandler(kwargs.get('debate_uuid')).add(request.user, request.FILES)\nif is_uploaded:\n return Response(status=status.HTTP_201_CREATED, data={'message': 'Proofs uploaded successfully for the case.'})\nreturn Response(status=status.HTTP_400_BAD_REQUEST, data={'error': 'Proofs failed to uplo...
<|body_start_0|> is_uploaded = CaseProofHandler(kwargs.get('debate_uuid')).add(request.user, request.FILES) if is_uploaded: return Response(status=status.HTTP_201_CREATED, data={'message': 'Proofs uploaded successfully for the case.'}) return Response(status=status.HTTP_400_BAD_REQUE...
CaseProofView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CaseProofView: def post(self, request, *args, **kwargs): """Upload proof for the case.""" <|body_0|> def delete(self, request, *args, **kwargs): """Delete proof for the case.""" <|body_1|> <|end_skeleton|> <|body_start_0|> is_uploaded = CaseProofHan...
stack_v2_sparse_classes_75kplus_train_071489
3,676
no_license
[ { "docstring": "Upload proof for the case.", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "Delete proof for the case.", "name": "delete", "signature": "def delete(self, request, *args, **kwargs)" } ]
2
null
Implement the Python class `CaseProofView` described below. Class description: Implement the CaseProofView class. Method signatures and docstrings: - def post(self, request, *args, **kwargs): Upload proof for the case. - def delete(self, request, *args, **kwargs): Delete proof for the case.
Implement the Python class `CaseProofView` described below. Class description: Implement the CaseProofView class. Method signatures and docstrings: - def post(self, request, *args, **kwargs): Upload proof for the case. - def delete(self, request, *args, **kwargs): Delete proof for the case. <|skeleton|> class CasePr...
02bfc05a87462c288d0bc2b4c1f5269668961960
<|skeleton|> class CaseProofView: def post(self, request, *args, **kwargs): """Upload proof for the case.""" <|body_0|> def delete(self, request, *args, **kwargs): """Delete proof for the case.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CaseProofView: def post(self, request, *args, **kwargs): """Upload proof for the case.""" is_uploaded = CaseProofHandler(kwargs.get('debate_uuid')).add(request.user, request.FILES) if is_uploaded: return Response(status=status.HTTP_201_CREATED, data={'message': 'Proofs uplo...
the_stack_v2_python_sparse
proof/views/v1.py
Sunrit07/rozprava-backend
train
0
c2bc0651b395535a5535f985ac288ef282f7f7e2
[ "date_time = dfdatetime_time_elements.TimeElementsInMilliseconds()\ntry:\n date_time.CopyFromDateTimeString(date_time_string)\nexcept ValueError:\n raise errors.ParseError('Unsupported date and time string: {0!s}'.format(date_time_string))\nreturn date_time", "if len(row) < self._MINIMUM_NUMBER_OF_COLUMNS:\...
<|body_start_0|> date_time = dfdatetime_time_elements.TimeElementsInMilliseconds() try: date_time.CopyFromDateTimeString(date_time_string) except ValueError: raise errors.ParseError('Unsupported date and time string: {0!s}'.format(date_time_string)) return date_ti...
Shared code for parsing Program Compatibility Assistant (PCA) log files.
WindowsPCABaseParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsPCABaseParser: """Shared code for parsing Program Compatibility Assistant (PCA) log files.""" def _ParseDateTime(self, date_time_string): """Parses date and time elements of a log line. Args: date_time_string (string): date and time string. Returns: dfdatetime.TimeElements: da...
stack_v2_sparse_classes_75kplus_train_071490
5,467
permissive
[ { "docstring": "Parses date and time elements of a log line. Args: date_time_string (string): date and time string. Returns: dfdatetime.TimeElements: date and time value. Raises: ParseError: if a valid date and time value cannot be derived from the time elements.", "name": "_ParseDateTime", "signature":...
2
stack_v2_sparse_classes_30k_train_027102
Implement the Python class `WindowsPCABaseParser` described below. Class description: Shared code for parsing Program Compatibility Assistant (PCA) log files. Method signatures and docstrings: - def _ParseDateTime(self, date_time_string): Parses date and time elements of a log line. Args: date_time_string (string): d...
Implement the Python class `WindowsPCABaseParser` described below. Class description: Shared code for parsing Program Compatibility Assistant (PCA) log files. Method signatures and docstrings: - def _ParseDateTime(self, date_time_string): Parses date and time elements of a log line. Args: date_time_string (string): d...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class WindowsPCABaseParser: """Shared code for parsing Program Compatibility Assistant (PCA) log files.""" def _ParseDateTime(self, date_time_string): """Parses date and time elements of a log line. Args: date_time_string (string): date and time string. Returns: dfdatetime.TimeElements: da...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WindowsPCABaseParser: """Shared code for parsing Program Compatibility Assistant (PCA) log files.""" def _ParseDateTime(self, date_time_string): """Parses date and time elements of a log line. Args: date_time_string (string): date and time string. Returns: dfdatetime.TimeElements: date and time v...
the_stack_v2_python_sparse
plaso/parsers/winpca.py
log2timeline/plaso
train
1,506
472f04d47d5578cc55fa7fd848b0688250e4e2eb
[ "self._input = input_file\nself._spill = BufferedStream()\nself._zlib = zlib.compressobj(level=1, method=zlib.DEFLATED, wbits=-zlib.MAX_WBITS)\nself._crc = zlib.crc32(b'')\nself._read_size = 0\nif not mtime:\n mtime = time.time()\nself._spill.write(pack('<3sBL2s', b'\\x1f\\x8b\\x08', 8 if filename else 0, int(mt...
<|body_start_0|> self._input = input_file self._spill = BufferedStream() self._zlib = zlib.compressobj(level=1, method=zlib.DEFLATED, wbits=-zlib.MAX_WBITS) self._crc = zlib.crc32(b'') self._read_size = 0 if not mtime: mtime = time.time() self._spill.w...
Gzip-compressed stream from a readable stream
GzipStreamWrapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GzipStreamWrapper: """Gzip-compressed stream from a readable stream""" def __init__(self, input_file, mtime=None, filename: str=None): """Initialize the stream""" <|body_0|> def read(self, size=-1): """Read data from input and compress it""" <|body_1|> <...
stack_v2_sparse_classes_75kplus_train_071491
4,086
permissive
[ { "docstring": "Initialize the stream", "name": "__init__", "signature": "def __init__(self, input_file, mtime=None, filename: str=None)" }, { "docstring": "Read data from input and compress it", "name": "read", "signature": "def read(self, size=-1)" } ]
2
stack_v2_sparse_classes_30k_train_005610
Implement the Python class `GzipStreamWrapper` described below. Class description: Gzip-compressed stream from a readable stream Method signatures and docstrings: - def __init__(self, input_file, mtime=None, filename: str=None): Initialize the stream - def read(self, size=-1): Read data from input and compress it
Implement the Python class `GzipStreamWrapper` described below. Class description: Gzip-compressed stream from a readable stream Method signatures and docstrings: - def __init__(self, input_file, mtime=None, filename: str=None): Initialize the stream - def read(self, size=-1): Read data from input and compress it <|...
9c9040f6a173af5c495f5447889e9349fa56f234
<|skeleton|> class GzipStreamWrapper: """Gzip-compressed stream from a readable stream""" def __init__(self, input_file, mtime=None, filename: str=None): """Initialize the stream""" <|body_0|> def read(self, size=-1): """Read data from input and compress it""" <|body_1|> <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GzipStreamWrapper: """Gzip-compressed stream from a readable stream""" def __init__(self, input_file, mtime=None, filename: str=None): """Initialize the stream""" self._input = input_file self._spill = BufferedStream() self._zlib = zlib.compressobj(level=1, method=zlib.DEF...
the_stack_v2_python_sparse
tessia/server/lib/compression.py
tessia-project/tessia
train
10
fb00bdb3e18dfac7ceb21663aae124cdb418fe15
[ "if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.DCXPoly = DCXPoly\nself.DCYPoly = DCYPoly\nsuper(EBType, self).__init__(**kwargs)", "if self.DCXPoly is None or self.DCYPoly is None:\n return None\nreturn numpy.array...
<|body_start_0|> if '_xml_ns' in kwargs: self._xml_ns = kwargs['_xml_ns'] if '_xml_ns_key' in kwargs: self._xml_ns_key = kwargs['_xml_ns_key'] self.DCXPoly = DCXPoly self.DCYPoly = DCYPoly super(EBType, self).__init__(**kwargs) <|end_body_0|> <|body_start...
Electrical boresight (EB) steering directions for an electronically steered array.
EBType
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EBType: """Electrical boresight (EB) steering directions for an electronically steered array.""" def __init__(self, DCXPoly: Union[Poly1DType, numpy.ndarray, list, tuple]=None, DCYPoly: Union[Poly1DType, numpy.ndarray, list, tuple]=None, **kwargs): """Parameters ---------- DCXPoly : ...
stack_v2_sparse_classes_75kplus_train_071492
9,216
permissive
[ { "docstring": "Parameters ---------- DCXPoly : Poly1DType|numpy.ndarray|list|tuple DCYPoly : Poly1DType|numpy.ndarray|list|tuple kwargs", "name": "__init__", "signature": "def __init__(self, DCXPoly: Union[Poly1DType, numpy.ndarray, list, tuple]=None, DCYPoly: Union[Poly1DType, numpy.ndarray, list, tup...
2
stack_v2_sparse_classes_30k_train_030673
Implement the Python class `EBType` described below. Class description: Electrical boresight (EB) steering directions for an electronically steered array. Method signatures and docstrings: - def __init__(self, DCXPoly: Union[Poly1DType, numpy.ndarray, list, tuple]=None, DCYPoly: Union[Poly1DType, numpy.ndarray, list,...
Implement the Python class `EBType` described below. Class description: Electrical boresight (EB) steering directions for an electronically steered array. Method signatures and docstrings: - def __init__(self, DCXPoly: Union[Poly1DType, numpy.ndarray, list, tuple]=None, DCYPoly: Union[Poly1DType, numpy.ndarray, list,...
de1b1886f161a83b6c89aadc7a2c7cfc4892ef81
<|skeleton|> class EBType: """Electrical boresight (EB) steering directions for an electronically steered array.""" def __init__(self, DCXPoly: Union[Poly1DType, numpy.ndarray, list, tuple]=None, DCYPoly: Union[Poly1DType, numpy.ndarray, list, tuple]=None, **kwargs): """Parameters ---------- DCXPoly : ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EBType: """Electrical boresight (EB) steering directions for an electronically steered array.""" def __init__(self, DCXPoly: Union[Poly1DType, numpy.ndarray, list, tuple]=None, DCYPoly: Union[Poly1DType, numpy.ndarray, list, tuple]=None, **kwargs): """Parameters ---------- DCXPoly : Poly1DType|nu...
the_stack_v2_python_sparse
sarpy/io/complex/sicd_elements/Antenna.py
ngageoint/sarpy
train
192
d42ac7e52ee42df67e20171c3709f34a9f520005
[ "for cc in filter(lambda c: sum([self.segment(sn).length for sn in c]) < minlen, self.connected_components()):\n for s in cc:\n self.rm(s)", "for s in self.segments:\n c = s._connectivity()\n if s.length < minlen and (c[0] == 0 or c[1] == 0) and (not self.is_cut_segment(s)):\n self.rm(s)" ]
<|body_start_0|> for cc in filter(lambda c: sum([self.segment(sn).length for sn in c]) < minlen, self.connected_components()): for s in cc: self.rm(s) <|end_body_0|> <|body_start_1|> for s in self.segments: c = s._connectivity() if s.length < minlen a...
Artifacts
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Artifacts: def remove_small_components(self, minlen): """Remove connected components with combined segment length < minlen. Note: Connected components of the graph are computed, considering only dovetail overlaps as connection of segments. Parameters: minlen (int) : the minimal length of...
stack_v2_sparse_classes_75kplus_train_071493
1,242
permissive
[ { "docstring": "Remove connected components with combined segment length < minlen. Note: Connected components of the graph are computed, considering only dovetail overlaps as connection of segments. Parameters: minlen (int) : the minimal length of the components to keep.", "name": "remove_small_components",...
2
stack_v2_sparse_classes_30k_train_048422
Implement the Python class `Artifacts` described below. Class description: Implement the Artifacts class. Method signatures and docstrings: - def remove_small_components(self, minlen): Remove connected components with combined segment length < minlen. Note: Connected components of the graph are computed, considering ...
Implement the Python class `Artifacts` described below. Class description: Implement the Artifacts class. Method signatures and docstrings: - def remove_small_components(self, minlen): Remove connected components with combined segment length < minlen. Note: Connected components of the graph are computed, considering ...
12b31daac26ab137b6ee4a29b4f14554ba962dcb
<|skeleton|> class Artifacts: def remove_small_components(self, minlen): """Remove connected components with combined segment length < minlen. Note: Connected components of the graph are computed, considering only dovetail overlaps as connection of segments. Parameters: minlen (int) : the minimal length of...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Artifacts: def remove_small_components(self, minlen): """Remove connected components with combined segment length < minlen. Note: Connected components of the graph are computed, considering only dovetail overlaps as connection of segments. Parameters: minlen (int) : the minimal length of the component...
the_stack_v2_python_sparse
gfapy/graph_operations/artifacts.py
ggonnella/gfapy
train
63
0843bf18c14e2fc49b139f7786f80294759ebb62
[ "self.wallx = 400\nself.pineUp = pygame.image.load('pipelineUp.png')\nself.pineDown = pygame.image.load('pipelineDown.png')", "self.wallx -= 5\nif self.wallx < -80:\n global score\n score += 1\n self.wallx = 400" ]
<|body_start_0|> self.wallx = 400 self.pineUp = pygame.image.load('pipelineUp.png') self.pineDown = pygame.image.load('pipelineDown.png') <|end_body_0|> <|body_start_1|> self.wallx -= 5 if self.wallx < -80: global score score += 1 self.wallx =...
定义一个管道类
Pipline
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pipline: """定义一个管道类""" def __init__(self): """定义初始化方法""" <|body_0|> def updatePipline(self): """水平移动""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.wallx = 400 self.pineUp = pygame.image.load('pipelineUp.png') self.pineDown...
stack_v2_sparse_classes_75kplus_train_071494
5,166
no_license
[ { "docstring": "定义初始化方法", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "水平移动", "name": "updatePipline", "signature": "def updatePipline(self)" } ]
2
stack_v2_sparse_classes_30k_train_034649
Implement the Python class `Pipline` described below. Class description: 定义一个管道类 Method signatures and docstrings: - def __init__(self): 定义初始化方法 - def updatePipline(self): 水平移动
Implement the Python class `Pipline` described below. Class description: 定义一个管道类 Method signatures and docstrings: - def __init__(self): 定义初始化方法 - def updatePipline(self): 水平移动 <|skeleton|> class Pipline: """定义一个管道类""" def __init__(self): """定义初始化方法""" <|body_0|> def updatePipline(self)...
5700235cb75a2a0497e47d9c65e043613409fb20
<|skeleton|> class Pipline: """定义一个管道类""" def __init__(self): """定义初始化方法""" <|body_0|> def updatePipline(self): """水平移动""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Pipline: """定义一个管道类""" def __init__(self): """定义初始化方法""" self.wallx = 400 self.pineUp = pygame.image.load('pipelineUp.png') self.pineDown = pygame.image.load('pipelineDown.png') def updatePipline(self): """水平移动""" self.wallx -= 5 if self.wallx ...
the_stack_v2_python_sparse
Python/FlyBird/FlappyBird.py
Wangminjun0207/practice
train
1
835c6a48b1e3ec48fba6dc1e46224544165a4300
[ "if not root or not root.left:\n return root\npre = root\nwhile pre.left:\n cur = pre\n while cur:\n cur.left.next = cur.right\n if cur.next:\n cur.right.next = cur.next.left\n cur = cur.next\n pre = pre.left\nreturn root", "if not root:\n return root\nqueue = [(root...
<|body_start_0|> if not root or not root.left: return root pre = root while pre.left: cur = pre while cur: cur.left.next = cur.right if cur.next: cur.right.next = cur.next.left cur = cur.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def connect(self, root): """' 修已改版bfs 只使用常数项空间 经有上一层的next了,所以就不需要队列来存储了 :type root: Node :rtype: Node""" <|body_0|> def connect2(self, root): """bfs遍历每一层 下一个节点在同一个节点的时候next指向下一个节点 不符合常数空间要求 :type root: Node :rtype: Node""" <|body_1|> def connec...
stack_v2_sparse_classes_75kplus_train_071495
3,426
no_license
[ { "docstring": "' 修已改版bfs 只使用常数项空间 经有上一层的next了,所以就不需要队列来存储了 :type root: Node :rtype: Node", "name": "connect", "signature": "def connect(self, root)" }, { "docstring": "bfs遍历每一层 下一个节点在同一个节点的时候next指向下一个节点 不符合常数空间要求 :type root: Node :rtype: Node", "name": "connect2", "signature": "def conn...
3
stack_v2_sparse_classes_30k_train_008239
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def connect(self, root): ' 修已改版bfs 只使用常数项空间 经有上一层的next了,所以就不需要队列来存储了 :type root: Node :rtype: Node - def connect2(self, root): bfs遍历每一层 下一个节点在同一个节点的时候next指向下一个节点 不符合常数空间要求 :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def connect(self, root): ' 修已改版bfs 只使用常数项空间 经有上一层的next了,所以就不需要队列来存储了 :type root: Node :rtype: Node - def connect2(self, root): bfs遍历每一层 下一个节点在同一个节点的时候next指向下一个节点 不符合常数空间要求 :type ...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def connect(self, root): """' 修已改版bfs 只使用常数项空间 经有上一层的next了,所以就不需要队列来存储了 :type root: Node :rtype: Node""" <|body_0|> def connect2(self, root): """bfs遍历每一层 下一个节点在同一个节点的时候next指向下一个节点 不符合常数空间要求 :type root: Node :rtype: Node""" <|body_1|> def connec...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def connect(self, root): """' 修已改版bfs 只使用常数项空间 经有上一层的next了,所以就不需要队列来存储了 :type root: Node :rtype: Node""" if not root or not root.left: return root pre = root while pre.left: cur = pre while cur: cur.left.next = cur.r...
the_stack_v2_python_sparse
116_填充每个节点的下一个右侧节点指针.py
lovehhf/LeetCode
train
0
0412c6362afa29e8eba90d98a37b8e0e1fba42dc
[ "super(EmitterReceiverCoupled, self).__init__()\nself.n_nodes = n_nodes\nself.embedding_size = embedding_size\nself.n_arms = n_arms\nself.n_sign = n_sign\nself.l1_size = 10\nself.embeddings = nn.ModuleList([nn.Embedding(self.n_nodes, self.embedding_size) for i in range(n_arms)])\nself.encode_BN1 = nn.ModuleList([nn...
<|body_start_0|> super(EmitterReceiverCoupled, self).__init__() self.n_nodes = n_nodes self.embedding_size = embedding_size self.n_arms = n_arms self.n_sign = n_sign self.l1_size = 10 self.embeddings = nn.ModuleList([nn.Embedding(self.n_nodes, self.embedding_size)...
EmitterReceiverCoupled
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmitterReceiverCoupled: def __init__(self, n_nodes, n_sign, embedding_size, n_arms): """Args: n_nodes: total number of nodes in the graph embedding_size: dimension of the latent space n_arms: number of arms""" <|body_0|> def encoder(self, first_node, second_node, index_2_wor...
stack_v2_sparse_classes_75kplus_train_071496
19,893
no_license
[ { "docstring": "Args: n_nodes: total number of nodes in the graph embedding_size: dimension of the latent space n_arms: number of arms", "name": "__init__", "signature": "def __init__(self, n_nodes, n_sign, embedding_size, n_arms)" }, { "docstring": "Encoder is just a look up for first and secon...
4
stack_v2_sparse_classes_30k_train_030375
Implement the Python class `EmitterReceiverCoupled` described below. Class description: Implement the EmitterReceiverCoupled class. Method signatures and docstrings: - def __init__(self, n_nodes, n_sign, embedding_size, n_arms): Args: n_nodes: total number of nodes in the graph embedding_size: dimension of the latent...
Implement the Python class `EmitterReceiverCoupled` described below. Class description: Implement the EmitterReceiverCoupled class. Method signatures and docstrings: - def __init__(self, n_nodes, n_sign, embedding_size, n_arms): Args: n_nodes: total number of nodes in the graph embedding_size: dimension of the latent...
5ce0ad23a6bd6e241f95a3a6f29a4e361247d605
<|skeleton|> class EmitterReceiverCoupled: def __init__(self, n_nodes, n_sign, embedding_size, n_arms): """Args: n_nodes: total number of nodes in the graph embedding_size: dimension of the latent space n_arms: number of arms""" <|body_0|> def encoder(self, first_node, second_node, index_2_wor...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EmitterReceiverCoupled: def __init__(self, n_nodes, n_sign, embedding_size, n_arms): """Args: n_nodes: total number of nodes in the graph embedding_size: dimension of the latent space n_arms: number of arms""" super(EmitterReceiverCoupled, self).__init__() self.n_nodes = n_nodes ...
the_stack_v2_python_sparse
Word2vec/Signed_E_R_v1.py
Fahimeh1983/celltypes
train
0
1a95452d54eca5438e7d45b6efae4a30bcbc4296
[ "self.old_username = self.instance.username\nself.old_file_root = self.instance.file_root()\nif User.objects.filter(username__iexact=self.cleaned_data['username']):\n raise forms.ValidationError('A user with that username already exists.')\nreturn self.cleaned_data['username'].lower()", "new_username = self.cl...
<|body_start_0|> self.old_username = self.instance.username self.old_file_root = self.instance.file_root() if User.objects.filter(username__iexact=self.cleaned_data['username']): raise forms.ValidationError('A user with that username already exists.') return self.cleaned_data...
Updating the username filed
UsernameChangeForm
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UsernameChangeForm: """Updating the username filed""" def clean_username(self): """Record the original username in case it is needed""" <|body_0|> def save(self): """Change the media file directory name and photo name if any, to match the new username""" ...
stack_v2_sparse_classes_75kplus_train_071497
31,906
permissive
[ { "docstring": "Record the original username in case it is needed", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring": "Change the media file directory name and photo name if any, to match the new username", "name": "save", "signature": "def save(self)" ...
2
null
Implement the Python class `UsernameChangeForm` described below. Class description: Updating the username filed Method signatures and docstrings: - def clean_username(self): Record the original username in case it is needed - def save(self): Change the media file directory name and photo name if any, to match the new...
Implement the Python class `UsernameChangeForm` described below. Class description: Updating the username filed Method signatures and docstrings: - def clean_username(self): Record the original username in case it is needed - def save(self): Change the media file directory name and photo name if any, to match the new...
304e093dc550da8636552dc601d6545c07ffc771
<|skeleton|> class UsernameChangeForm: """Updating the username filed""" def clean_username(self): """Record the original username in case it is needed""" <|body_0|> def save(self): """Change the media file directory name and photo name if any, to match the new username""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UsernameChangeForm: """Updating the username filed""" def clean_username(self): """Record the original username in case it is needed""" self.old_username = self.instance.username self.old_file_root = self.instance.file_root() if User.objects.filter(username__iexact=self.cl...
the_stack_v2_python_sparse
physionet-django/user/forms.py
MIT-LCP/physionet-build
train
50
ae253d0b7621d6b22015a372f5cee03e755da699
[ "super(Generator3D, self).__init__()\nn_tr = 6 + 3 + 3\nn_feat = len(primitive)\nn_hidden = [128, 256, 512]\nself.n_prim = n_prim\nself.bg_cube = bg_cube\nself.n_hidden_bg = n_hidden_bg\nself.primitive = primitive\nself.z_dim_half = z_dim_half = z_dim // 2\nself.prim_size_max = 0.6\nself.prim_size_min = 0.1\nmlp_tr...
<|body_start_0|> super(Generator3D, self).__init__() n_tr = 6 + 3 + 3 n_feat = len(primitive) n_hidden = [128, 256, 512] self.n_prim = n_prim self.bg_cube = bg_cube self.n_hidden_bg = n_hidden_bg self.primitive = primitive self.z_dim_half = z_dim_h...
3D Generator that generates a set of primitives as well as a background sphere
Generator3D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator3D: """3D Generator that generates a set of primitives as well as a background sphere""" def __init__(self, z_dim, n_prim, primitive, bg_cube, n_hidden_bg=128, template_bg='controllable_gan/templates/sphere_642.obj'): """3D Generator initialization Args: z_dim (int): Dimensi...
stack_v2_sparse_classes_75kplus_train_071498
7,694
permissive
[ { "docstring": "3D Generator initialization Args: z_dim (int): Dimension of the noise vector n_prim (int): Number of foreground primitives primitive (Primitive): Primitive class with template and configurations bg_cube (bool): Use background sphere or not n_hidden_bg (int, optional): Dimension of the latent spa...
4
stack_v2_sparse_classes_30k_train_028681
Implement the Python class `Generator3D` described below. Class description: 3D Generator that generates a set of primitives as well as a background sphere Method signatures and docstrings: - def __init__(self, z_dim, n_prim, primitive, bg_cube, n_hidden_bg=128, template_bg='controllable_gan/templates/sphere_642.obj'...
Implement the Python class `Generator3D` described below. Class description: 3D Generator that generates a set of primitives as well as a background sphere Method signatures and docstrings: - def __init__(self, z_dim, n_prim, primitive, bg_cube, n_hidden_bg=128, template_bg='controllable_gan/templates/sphere_642.obj'...
296fd5115ec385f9fcb94529afff2c138abae3c8
<|skeleton|> class Generator3D: """3D Generator that generates a set of primitives as well as a background sphere""" def __init__(self, z_dim, n_prim, primitive, bg_cube, n_hidden_bg=128, template_bg='controllable_gan/templates/sphere_642.obj'): """3D Generator initialization Args: z_dim (int): Dimensi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Generator3D: """3D Generator that generates a set of primitives as well as a background sphere""" def __init__(self, z_dim, n_prim, primitive, bg_cube, n_hidden_bg=128, template_bg='controllable_gan/templates/sphere_642.obj'): """3D Generator initialization Args: z_dim (int): Dimension of the noi...
the_stack_v2_python_sparse
controllable_gan/models/generator_3d.py
ErikValle/controllable_image_synthesis
train
0
73fbca25865c6b145413f090fa2423d6cc41ef97
[ "if instance.type == 'B':\n return 'Bus'\nelif instance.type == 'C':\n return 'Cycle'\nelse:\n return instance.type", "first_id = self.context.get('first_stop') if self.context.get('first_stop', False) else instance.first_stop.id\nfirst = WaypointOnRoute.objects.get(pk=first_id)\nreturn {'name': first.wa...
<|body_start_0|> if instance.type == 'B': return 'Bus' elif instance.type == 'C': return 'Cycle' else: return instance.type <|end_body_0|> <|body_start_1|> first_id = self.context.get('first_stop') if self.context.get('first_stop', False) else instanc...
ModelSerializer for the Route model. Returns the list of waypoints (actually serialized by WaypointOnRouteSerializer), plus the name, type (Bus or Cycle), and the first and last stops of the route. Note that rather than using a direct many-to-many mapping to Waypoint objects, Route has a one-to-many mapping to Waypoint...
RouteSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RouteSerializer: """ModelSerializer for the Route model. Returns the list of waypoints (actually serialized by WaypointOnRouteSerializer), plus the name, type (Bus or Cycle), and the first and last stops of the route. Note that rather than using a direct many-to-many mapping to Waypoint objects, ...
stack_v2_sparse_classes_75kplus_train_071499
25,352
no_license
[ { "docstring": "Translates from the short representation of route-type stored in the DB to the full name (Bus/Cycle).", "name": "get_type", "signature": "def get_type(self, instance)" }, { "docstring": "Two of the parameters that can be passed via the URL string to the API is `first_stop` and `l...
4
stack_v2_sparse_classes_30k_train_005297
Implement the Python class `RouteSerializer` described below. Class description: ModelSerializer for the Route model. Returns the list of waypoints (actually serialized by WaypointOnRouteSerializer), plus the name, type (Bus or Cycle), and the first and last stops of the route. Note that rather than using a direct man...
Implement the Python class `RouteSerializer` described below. Class description: ModelSerializer for the Route model. Returns the list of waypoints (actually serialized by WaypointOnRouteSerializer), plus the name, type (Bus or Cycle), and the first and last stops of the route. Note that rather than using a direct man...
8178ba2bf31bf7aa9cc4a0cf542b5cfc8bf183a9
<|skeleton|> class RouteSerializer: """ModelSerializer for the Route model. Returns the list of waypoints (actually serialized by WaypointOnRouteSerializer), plus the name, type (Bus or Cycle), and the first and last stops of the route. Note that rather than using a direct many-to-many mapping to Waypoint objects, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RouteSerializer: """ModelSerializer for the Route model. Returns the list of waypoints (actually serialized by WaypointOnRouteSerializer), plus the name, type (Bus or Cycle), and the first and last stops of the route. Note that rather than using a direct many-to-many mapping to Waypoint objects, Route has a o...
the_stack_v2_python_sparse
Cultural-Tours/backend/tours/serializers.py
talkymeat/Cultural-Tours
train
0