blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
0998a0eed73dfcda986b11e1d807208cc8ff9813
[ "self.threads = []\nif thread is not None:\n self.threads.append(thread)\nif threads is not None:\n for t in threads:\n self.threads.append(t)", "if thread is None:\n thread = Thread()\nself.threads.append(thread)\nreturn thread", "threads = []\nfor thread in self.threads:\n threads.append(th...
<|body_start_0|> self.threads = [] if thread is not None: self.threads.append(thread) if threads is not None: for t in threads: self.threads.append(t) <|end_body_0|> <|body_start_1|> if thread is None: thread = Thread() self.th...
Defines a test vector in a testbench
TestVector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestVector: """Defines a test vector in a testbench""" def __init__(self, thread=None, threads=None): """Initializes a TestVector object Args: thread (Thread, optional): Defaults to None. An initial Thread to initialize with threads (Iterable of Threads, optional): Defaults to None. ...
stack_v2_sparse_classes_36k_train_022700
20,729
permissive
[ { "docstring": "Initializes a TestVector object Args: thread (Thread, optional): Defaults to None. An initial Thread to initialize with threads (Iterable of Threads, optional): Defaults to None. Initialize TestVector with all Threads in this iterable", "name": "__init__", "signature": "def __init__(self...
3
stack_v2_sparse_classes_30k_train_013183
Implement the Python class `TestVector` described below. Class description: Defines a test vector in a testbench Method signatures and docstrings: - def __init__(self, thread=None, threads=None): Initializes a TestVector object Args: thread (Thread, optional): Defaults to None. An initial Thread to initialize with th...
Implement the Python class `TestVector` described below. Class description: Defines a test vector in a testbench Method signatures and docstrings: - def __init__(self, thread=None, threads=None): Initializes a TestVector object Args: thread (Thread, optional): Defaults to None. An initial Thread to initialize with th...
99de16dd16d0aa77734584e67263c78a37abef86
<|skeleton|> class TestVector: """Defines a test vector in a testbench""" def __init__(self, thread=None, threads=None): """Initializes a TestVector object Args: thread (Thread, optional): Defaults to None. An initial Thread to initialize with threads (Iterable of Threads, optional): Defaults to None. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestVector: """Defines a test vector in a testbench""" def __init__(self, thread=None, threads=None): """Initializes a TestVector object Args: thread (Thread, optional): Defaults to None. An initial Thread to initialize with threads (Iterable of Threads, optional): Defaults to None. Initialize Te...
the_stack_v2_python_sparse
sonar/testbench.py
Zyk-Hyphen/sonar
train
0
2814fac3fba92e37576e616520bb00f0de005f37
[ "self.change_password_on_next_logon = change_password_on_next_logon\nself.leave_state_disabled = leave_state_disabled\nself.object_guids = object_guids\nself.organization_unit_path = organization_unit_path\nself.password = password", "if dictionary is None:\n return None\nchange_password_on_next_logon = dictio...
<|body_start_0|> self.change_password_on_next_logon = change_password_on_next_logon self.leave_state_disabled = leave_state_disabled self.object_guids = object_guids self.organization_unit_path = organization_unit_path self.password = password <|end_body_0|> <|body_start_1|> ...
Implementation of the 'AdObjectRestoreParameters' model. AdObjectRestoreParameters are the parameters to restore AD objects from recycle bin or from a mounted AD snapshot database. Attributes: change_password_on_next_logon (bool): Specifies the option for AD 'user' type of objects to change password when they next logo...
AdObjectRestoreParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdObjectRestoreParameters: """Implementation of the 'AdObjectRestoreParameters' model. AdObjectRestoreParameters are the parameters to restore AD objects from recycle bin or from a mounted AD snapshot database. Attributes: change_password_on_next_logon (bool): Specifies the option for AD 'user' t...
stack_v2_sparse_classes_36k_train_022701
4,435
permissive
[ { "docstring": "Constructor for the AdObjectRestoreParameters class", "name": "__init__", "signature": "def __init__(self, change_password_on_next_logon=None, leave_state_disabled=None, object_guids=None, organization_unit_path=None, password=None)" }, { "docstring": "Creates an instance of this...
2
stack_v2_sparse_classes_30k_train_004176
Implement the Python class `AdObjectRestoreParameters` described below. Class description: Implementation of the 'AdObjectRestoreParameters' model. AdObjectRestoreParameters are the parameters to restore AD objects from recycle bin or from a mounted AD snapshot database. Attributes: change_password_on_next_logon (bool...
Implement the Python class `AdObjectRestoreParameters` described below. Class description: Implementation of the 'AdObjectRestoreParameters' model. AdObjectRestoreParameters are the parameters to restore AD objects from recycle bin or from a mounted AD snapshot database. Attributes: change_password_on_next_logon (bool...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AdObjectRestoreParameters: """Implementation of the 'AdObjectRestoreParameters' model. AdObjectRestoreParameters are the parameters to restore AD objects from recycle bin or from a mounted AD snapshot database. Attributes: change_password_on_next_logon (bool): Specifies the option for AD 'user' t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdObjectRestoreParameters: """Implementation of the 'AdObjectRestoreParameters' model. AdObjectRestoreParameters are the parameters to restore AD objects from recycle bin or from a mounted AD snapshot database. Attributes: change_password_on_next_logon (bool): Specifies the option for AD 'user' type of object...
the_stack_v2_python_sparse
cohesity_management_sdk/models/ad_object_restore_parameters.py
cohesity/management-sdk-python
train
24
22c719006d20e68b90015539ff215c79185d0ba6
[ "self.level_vectors = level_vectors\nself.labels = labels\nself.pairs_df = pairs_df\nself.weights = np.ones(level_vectors.shape[1])\nself.best_weights = np.ones(level_vectors.shape[1])\nself.least_diff = -1\nself.comparator = comparator.Comparator(self.level_vectors, self.labels, self.pairs_df)", "print('Optimizi...
<|body_start_0|> self.level_vectors = level_vectors self.labels = labels self.pairs_df = pairs_df self.weights = np.ones(level_vectors.shape[1]) self.best_weights = np.ones(level_vectors.shape[1]) self.least_diff = -1 self.comparator = comparator.Comparator(self.l...
WeightOptimizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeightOptimizer: def __init__(self, level_vectors, labels, pairs_df): """Class for optimizing the weights vector for MTS level analysis Args: level_vectors: ndarray containing dense vector representations of all levels labels: ndarray containing labels for respectively indexed vectors pa...
stack_v2_sparse_classes_36k_train_022702
3,954
permissive
[ { "docstring": "Class for optimizing the weights vector for MTS level analysis Args: level_vectors: ndarray containing dense vector representations of all levels labels: ndarray containing labels for respectively indexed vectors pairs_df: dataframe containing pair indices and respective mean scores", "name"...
3
stack_v2_sparse_classes_30k_train_011611
Implement the Python class `WeightOptimizer` described below. Class description: Implement the WeightOptimizer class. Method signatures and docstrings: - def __init__(self, level_vectors, labels, pairs_df): Class for optimizing the weights vector for MTS level analysis Args: level_vectors: ndarray containing dense ve...
Implement the Python class `WeightOptimizer` described below. Class description: Implement the WeightOptimizer class. Method signatures and docstrings: - def __init__(self, level_vectors, labels, pairs_df): Class for optimizing the weights vector for MTS level analysis Args: level_vectors: ndarray containing dense ve...
cc9b28b8741b41bea1273c8bc9b4d265d79a1dca
<|skeleton|> class WeightOptimizer: def __init__(self, level_vectors, labels, pairs_df): """Class for optimizing the weights vector for MTS level analysis Args: level_vectors: ndarray containing dense vector representations of all levels labels: ndarray containing labels for respectively indexed vectors pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WeightOptimizer: def __init__(self, level_vectors, labels, pairs_df): """Class for optimizing the weights vector for MTS level analysis Args: level_vectors: ndarray containing dense vector representations of all levels labels: ndarray containing labels for respectively indexed vectors pairs_df: datafr...
the_stack_v2_python_sparse
autoencoder/optimizer.py
xingchen1106/match3-level-similarity
train
0
b8173d8f3c95d53202e04eb9aeac4ea64e95ce78
[ "dists = np.array(distance_chunk)\nmin_dist = 1e-12\nmask = dists < min_dist\nif mask.sum() > 0:\n logger.info(f'{np.sum(mask)} of {np.product(mask.shape)} distances are zero.')\ndists[mask] = min_dist\nweights = 1 / dists\nnorm = np.sum(weights, axis=-1)\nout = np.einsum('ijk,jk->ij', values, weights) / norm\nr...
<|body_start_0|> dists = np.array(distance_chunk) min_dist = 1e-12 mask = dists < min_dist if mask.sum() > 0: logger.info(f'{np.sum(mask)} of {np.product(mask.shape)} distances are zero.') dists[mask] = min_dist weights = 1 / dists norm = np.sum(weight...
Regridder class for mapping list of coordinates to another. Includes weights and indicies used to map from source grid to each point in the new grid
Regridder
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Regridder: """Regridder class for mapping list of coordinates to another. Includes weights and indicies used to map from source grid to each point in the new grid""" def interpolate(distance_chunk, values): """Interpolate to a new coordinate based on distances from that coordinate an...
stack_v2_sparse_classes_36k_train_022703
29,957
permissive
[ { "docstring": "Interpolate to a new coordinate based on distances from that coordinate and the values of the points at those distances Parameters ---------- distance_chunk : ndarray Chunk of the full array of distances where distances[i] gives the list of distances to the source coordinates to be used for inte...
2
stack_v2_sparse_classes_30k_train_013839
Implement the Python class `Regridder` described below. Class description: Regridder class for mapping list of coordinates to another. Includes weights and indicies used to map from source grid to each point in the new grid Method signatures and docstrings: - def interpolate(distance_chunk, values): Interpolate to a ...
Implement the Python class `Regridder` described below. Class description: Regridder class for mapping list of coordinates to another. Includes weights and indicies used to map from source grid to each point in the new grid Method signatures and docstrings: - def interpolate(distance_chunk, values): Interpolate to a ...
f3803a823c7bb0afd7ab6064625908dca0be3476
<|skeleton|> class Regridder: """Regridder class for mapping list of coordinates to another. Includes weights and indicies used to map from source grid to each point in the new grid""" def interpolate(distance_chunk, values): """Interpolate to a new coordinate based on distances from that coordinate an...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Regridder: """Regridder class for mapping list of coordinates to another. Includes weights and indicies used to map from source grid to each point in the new grid""" def interpolate(distance_chunk, values): """Interpolate to a new coordinate based on distances from that coordinate and the values ...
the_stack_v2_python_sparse
sup3r/utilities/regridder.py
NREL/sup3r
train
20
9b02c6ec8cc9ca31b86dd9965ad4ac986762edd9
[ "python_type = cls.omg_types_to_python_types.get(omg_type_name)\nif python_type is None:\n raise UnsupportedTypeOmgError(omg_type_name)\nif value is None:\n return\ncls.ensure_type(prop_name, python_type, omg_type_name, value, action_resolution_chain)", "omg_type = expected_output.get('type')\nif omg_type !...
<|body_start_0|> python_type = cls.omg_types_to_python_types.get(omg_type_name) if python_type is None: raise UnsupportedTypeOmgError(omg_type_name) if value is None: return cls.ensure_type(prop_name, python_type, omg_type_name, value, action_resolution_chain) <|e...
Class to verify the output of a service.
ServiceOutputValidator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceOutputValidator: """Class to verify the output of a service.""" def raise_for_type_mismatch(cls, prop_name, omg_type_name, value, action_resolution_chain): """Ensures that the value matches the expected type as listed on https://microservice.guide/schema/actions/#arguments. Su...
stack_v2_sparse_classes_36k_train_022704
3,922
permissive
[ { "docstring": "Ensures that the value matches the expected type as listed on https://microservice.guide/schema/actions/#arguments. Supported types: int, float, number, string, list, map, boolean, or any", "name": "raise_for_type_mismatch", "signature": "def raise_for_type_mismatch(cls, prop_name, omg_t...
3
stack_v2_sparse_classes_30k_test_000060
Implement the Python class `ServiceOutputValidator` described below. Class description: Class to verify the output of a service. Method signatures and docstrings: - def raise_for_type_mismatch(cls, prop_name, omg_type_name, value, action_resolution_chain): Ensures that the value matches the expected type as listed on...
Implement the Python class `ServiceOutputValidator` described below. Class description: Class to verify the output of a service. Method signatures and docstrings: - def raise_for_type_mismatch(cls, prop_name, omg_type_name, value, action_resolution_chain): Ensures that the value matches the expected type as listed on...
b2c9ab9d39e6d16a0116e4cdf7d65fda45dfce8c
<|skeleton|> class ServiceOutputValidator: """Class to verify the output of a service.""" def raise_for_type_mismatch(cls, prop_name, omg_type_name, value, action_resolution_chain): """Ensures that the value matches the expected type as listed on https://microservice.guide/schema/actions/#arguments. Su...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServiceOutputValidator: """Class to verify the output of a service.""" def raise_for_type_mismatch(cls, prop_name, omg_type_name, value, action_resolution_chain): """Ensures that the value matches the expected type as listed on https://microservice.guide/schema/actions/#arguments. Supported types...
the_stack_v2_python_sparse
storyruntime/omg/ServiceOutputValidator.py
wilzbach/platform-engine
train
0
a13ff8321e2ec3565f098d518775e1050daa7090
[ "self.plugins = []\nif plugins:\n for plugin in plugins:\n self.load_plugin(plugin)", "if plname == '':\n return\ntrig = NextTrigger()\nmod = import_module(plname)\nif trig.IsSet():\n raise PluginError('Plugin %s has a trigger on outside the function plugin_setup(), which is not allowed' % plname)...
<|body_start_0|> self.plugins = [] if plugins: for plugin in plugins: self.load_plugin(plugin) <|end_body_0|> <|body_start_1|> if plname == '': return trig = NextTrigger() mod = import_module(plname) if trig.IsSet(): ra...
PluginManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PluginManager: def __init__(self, plugins=None): """Load plugins as default Args: plugins (list): list of plugins given with module, default to None Example:: PluginManager(["screpl.plugins.unit", "screpl.plugins.location"])""" <|body_0|> def load_plugin(self, plname): ...
stack_v2_sparse_classes_36k_train_022705
3,072
permissive
[ { "docstring": "Load plugins as default Args: plugins (list): list of plugins given with module, default to None Example:: PluginManager([\"screpl.plugins.unit\", \"screpl.plugins.location\"])", "name": "__init__", "signature": "def __init__(self, plugins=None)" }, { "docstring": "Load screpl pl...
2
null
Implement the Python class `PluginManager` described below. Class description: Implement the PluginManager class. Method signatures and docstrings: - def __init__(self, plugins=None): Load plugins as default Args: plugins (list): list of plugins given with module, default to None Example:: PluginManager(["screpl.plug...
Implement the Python class `PluginManager` described below. Class description: Implement the PluginManager class. Method signatures and docstrings: - def __init__(self, plugins=None): Load plugins as default Args: plugins (list): list of plugins given with module, default to None Example:: PluginManager(["screpl.plug...
37b4d03069f074ae6b9b1caa3526730b30740de3
<|skeleton|> class PluginManager: def __init__(self, plugins=None): """Load plugins as default Args: plugins (list): list of plugins given with module, default to None Example:: PluginManager(["screpl.plugins.unit", "screpl.plugins.location"])""" <|body_0|> def load_plugin(self, plname): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PluginManager: def __init__(self, plugins=None): """Load plugins as default Args: plugins (list): list of plugins given with module, default to None Example:: PluginManager(["screpl.plugins.unit", "screpl.plugins.location"])""" self.plugins = [] if plugins: for plugin in pl...
the_stack_v2_python_sparse
screpl/plugin.py
mighty1231/screpl
train
8
f533d650c1b590d5013187cff13577032f0c9519
[ "super(MatchPublisherThread, self).__init__()\nself.theMatch = theMatch\nself.spectatorURL = spectatorURL", "try:\n MatchPublisher.publishToSpectatorServer(self.spectatorURL, self.theMatch)\nexcept IOException as e:\n e.printStackTrace()" ]
<|body_start_0|> super(MatchPublisherThread, self).__init__() self.theMatch = theMatch self.spectatorURL = spectatorURL <|end_body_0|> <|body_start_1|> try: MatchPublisher.publishToSpectatorServer(self.spectatorURL, self.theMatch) except IOException as e: ...
generated source for class MatchPublisherThread
MatchPublisherThread
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatchPublisherThread: """generated source for class MatchPublisherThread""" def __init__(self, spectatorURL, theMatch): """generated source for method __init__""" <|body_0|> def run(self): """generated source for method run""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_36k_train_022706
2,784
permissive
[ { "docstring": "generated source for method __init__", "name": "__init__", "signature": "def __init__(self, spectatorURL, theMatch)" }, { "docstring": "generated source for method run", "name": "run", "signature": "def run(self)" } ]
2
null
Implement the Python class `MatchPublisherThread` described below. Class description: generated source for class MatchPublisherThread Method signatures and docstrings: - def __init__(self, spectatorURL, theMatch): generated source for method __init__ - def run(self): generated source for method run
Implement the Python class `MatchPublisherThread` described below. Class description: generated source for class MatchPublisherThread Method signatures and docstrings: - def __init__(self, spectatorURL, theMatch): generated source for method __init__ - def run(self): generated source for method run <|skeleton|> clas...
4e6e6e876c3a4294cd711647051da2d9c1836b60
<|skeleton|> class MatchPublisherThread: """generated source for class MatchPublisherThread""" def __init__(self, spectatorURL, theMatch): """generated source for method __init__""" <|body_0|> def run(self): """generated source for method run""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MatchPublisherThread: """generated source for class MatchPublisherThread""" def __init__(self, spectatorURL, theMatch): """generated source for method __init__""" super(MatchPublisherThread, self).__init__() self.theMatch = theMatch self.spectatorURL = spectatorURL de...
the_stack_v2_python_sparse
ggpy/cruft/autocode/MatchPublisher.py
hobson/ggpy
train
1
93840b41a3b3537419e39eaeeda0fc911ee26c2d
[ "try:\n user = get_user_model().objects.get(username=username)\nexcept ObjectDoesNotExist:\n raise Http404()\nprofile = Profile.objects.get(user=user)\nif not profile.user.pk == request.user.id:\n return Response({'detail': 'You are not allowed to update this user'}, status=status.HTTP_403_FORBIDDEN)\nseri...
<|body_start_0|> try: user = get_user_model().objects.get(username=username) except ObjectDoesNotExist: raise Http404() profile = Profile.objects.get(user=user) if not profile.user.pk == request.user.id: return Response({'detail': 'You are not allowed ...
View for Updating the user's profile
ProfileRetrieveUpdate
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileRetrieveUpdate: """View for Updating the user's profile""" def put(self, request, username, format=None): """get the user object from the passed in username get the profile belonging to the passed in username pass the request data through the serializer check if valid and save...
stack_v2_sparse_classes_36k_train_022707
3,909
permissive
[ { "docstring": "get the user object from the passed in username get the profile belonging to the passed in username pass the request data through the serializer check if valid and save", "name": "put", "signature": "def put(self, request, username, format=None)" }, { "docstring": "get the user o...
2
null
Implement the Python class `ProfileRetrieveUpdate` described below. Class description: View for Updating the user's profile Method signatures and docstrings: - def put(self, request, username, format=None): get the user object from the passed in username get the profile belonging to the passed in username pass the re...
Implement the Python class `ProfileRetrieveUpdate` described below. Class description: View for Updating the user's profile Method signatures and docstrings: - def put(self, request, username, format=None): get the user object from the passed in username get the profile belonging to the passed in username pass the re...
e8438b78b88c52d108520429d0b67cd3d13e0824
<|skeleton|> class ProfileRetrieveUpdate: """View for Updating the user's profile""" def put(self, request, username, format=None): """get the user object from the passed in username get the profile belonging to the passed in username pass the request data through the serializer check if valid and save...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProfileRetrieveUpdate: """View for Updating the user's profile""" def put(self, request, username, format=None): """get the user object from the passed in username get the profile belonging to the passed in username pass the request data through the serializer check if valid and save""" t...
the_stack_v2_python_sparse
authors/apps/profiles/views.py
andela/ah-sealteam
train
1
d9f02dec76cfd21b957f160dc008a6f2ae24d6a3
[ "self.conf = conf\nself.model = None\nself.optimizer = None\nself.criterion = None", "self.model = external.FCN8s(in_channels=1, n_class=2).cuda()\nself.criterion = torch.nn.CrossEntropyLoss().cuda()\nself.optimizer = torch.optim.Adam(self.model.parameters(), self.conf['learning_rate'])\ncudnn.benchmark = True", ...
<|body_start_0|> self.conf = conf self.model = None self.optimizer = None self.criterion = None <|end_body_0|> <|body_start_1|> self.model = external.FCN8s(in_channels=1, n_class=2).cuda() self.criterion = torch.nn.CrossEntropyLoss().cuda() self.optimizer = torch...
Wrapper for model that ensures training is done with storing best models, logging results during training for each epoch,
ModelWrapper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelWrapper: """Wrapper for model that ensures training is done with storing best models, logging results during training for each epoch,""" def __init__(self, conf): """:param dict[str, Any] conf: Configuration file. Should contain keys ["learning_rate", "workers", "batch_size", "e...
stack_v2_sparse_classes_36k_train_022708
5,426
no_license
[ { "docstring": ":param dict[str, Any] conf: Configuration file. Should contain keys [\"learning_rate\", \"workers\", \"batch_size\", \"epochs\"]", "name": "__init__", "signature": "def __init__(self, conf)" }, { "docstring": "Defines used model, loss function and optimizer", "name": "get_mod...
6
stack_v2_sparse_classes_30k_train_002392
Implement the Python class `ModelWrapper` described below. Class description: Wrapper for model that ensures training is done with storing best models, logging results during training for each epoch, Method signatures and docstrings: - def __init__(self, conf): :param dict[str, Any] conf: Configuration file. Should c...
Implement the Python class `ModelWrapper` described below. Class description: Wrapper for model that ensures training is done with storing best models, logging results during training for each epoch, Method signatures and docstrings: - def __init__(self, conf): :param dict[str, Any] conf: Configuration file. Should c...
5bc2e0f95af605d88c97dc8ed41490bc6964cdb2
<|skeleton|> class ModelWrapper: """Wrapper for model that ensures training is done with storing best models, logging results during training for each epoch,""" def __init__(self, conf): """:param dict[str, Any] conf: Configuration file. Should contain keys ["learning_rate", "workers", "batch_size", "e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelWrapper: """Wrapper for model that ensures training is done with storing best models, logging results during training for each epoch,""" def __init__(self, conf): """:param dict[str, Any] conf: Configuration file. Should contain keys ["learning_rate", "workers", "batch_size", "epochs"]""" ...
the_stack_v2_python_sparse
ventricle_segmentation/model_wrapper.py
tomasprinda/ventricle_segmentation
train
0
994759d9e670c492143de7d01e73649296e47679
[ "self.models = models\nself.coord = coord\nself.orig_coord = deepcopy(coord)", "T, R, pivot = fit_to_mean(models=self.models, coord=self.coord, centroid=params, verbosity=0)\nval = atomic_rmsd(self.coord)\nself.coord = deepcopy(self.orig_coord)\nreturn val" ]
<|body_start_0|> self.models = models self.coord = coord self.orig_coord = deepcopy(coord) <|end_body_0|> <|body_start_1|> T, R, pivot = fit_to_mean(models=self.models, coord=self.coord, centroid=params, verbosity=0) val = atomic_rmsd(self.coord) self.coord = deepcopy(se...
Class for finding the optimal pivot point for motions between the given models.
Pivot_finder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pivot_finder: """Class for finding the optimal pivot point for motions between the given models.""" def __init__(self, models, coord): """Set up the class for pivot point optimisation for an ensemble of structures. @keyword models: The list of models to use. If set to None, then all ...
stack_v2_sparse_classes_36k_train_022709
3,384
no_license
[ { "docstring": "Set up the class for pivot point optimisation for an ensemble of structures. @keyword models: The list of models to use. If set to None, then all models will be used. @type models: list of int or None @keyword coord: The array of molecular coordinates. The first dimension corresponds to the mode...
2
null
Implement the Python class `Pivot_finder` described below. Class description: Class for finding the optimal pivot point for motions between the given models. Method signatures and docstrings: - def __init__(self, models, coord): Set up the class for pivot point optimisation for an ensemble of structures. @keyword mod...
Implement the Python class `Pivot_finder` described below. Class description: Class for finding the optimal pivot point for motions between the given models. Method signatures and docstrings: - def __init__(self, models, coord): Set up the class for pivot point optimisation for an ensemble of structures. @keyword mod...
c317326ddeacd1a1c608128769676899daeae531
<|skeleton|> class Pivot_finder: """Class for finding the optimal pivot point for motions between the given models.""" def __init__(self, models, coord): """Set up the class for pivot point optimisation for an ensemble of structures. @keyword models: The list of models to use. If set to None, then all ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pivot_finder: """Class for finding the optimal pivot point for motions between the given models.""" def __init__(self, models, coord): """Set up the class for pivot point optimisation for an ensemble of structures. @keyword models: The list of models to use. If set to None, then all models will b...
the_stack_v2_python_sparse
target_functions/ens_pivot_finder.py
jlec/relax
train
4
20a5f6a70f8cfff97b42bfca47adc83319c0195a
[ "Thread.__init__(self)\nself.tasks = tasks\nself.daemon = True\nself.start()", "while 1:\n func, args, kargs = self.tasks.get()\n try:\n func(*args, **kargs)\n except Exception as e:\n print(e)\n finally:\n self.tasks.task_done()" ]
<|body_start_0|> Thread.__init__(self) self.tasks = tasks self.daemon = True self.start() <|end_body_0|> <|body_start_1|> while 1: func, args, kargs = self.tasks.get() try: func(*args, **kargs) except Exception as e: ...
Thread executing tasks from a given tasks queue
Worker
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Worker: """Thread executing tasks from a given tasks queue""" def __init__(self, tasks): """Constructor :param tasks: queue containing tasks to execute""" <|body_0|> def run(self): """Run the worker thread""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_022710
2,523
permissive
[ { "docstring": "Constructor :param tasks: queue containing tasks to execute", "name": "__init__", "signature": "def __init__(self, tasks)" }, { "docstring": "Run the worker thread", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_val_000922
Implement the Python class `Worker` described below. Class description: Thread executing tasks from a given tasks queue Method signatures and docstrings: - def __init__(self, tasks): Constructor :param tasks: queue containing tasks to execute - def run(self): Run the worker thread
Implement the Python class `Worker` described below. Class description: Thread executing tasks from a given tasks queue Method signatures and docstrings: - def __init__(self, tasks): Constructor :param tasks: queue containing tasks to execute - def run(self): Run the worker thread <|skeleton|> class Worker: """T...
09692f8d2300172c41ce25331361875c56d0ba4a
<|skeleton|> class Worker: """Thread executing tasks from a given tasks queue""" def __init__(self, tasks): """Constructor :param tasks: queue containing tasks to execute""" <|body_0|> def run(self): """Run the worker thread""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Worker: """Thread executing tasks from a given tasks queue""" def __init__(self, tasks): """Constructor :param tasks: queue containing tasks to execute""" Thread.__init__(self) self.tasks = tasks self.daemon = True self.start() def run(self): """Run th...
the_stack_v2_python_sparse
DEVS Modelling and Simulation/pythonpdevs/src/pypdevs/threadpool.py
baturayo/Modeling-of-Software-Intensive-Systems
train
2
b6fd5d32b0168cd5333d304423e1bf3ad90d25a8
[ "gt_labels = self.data_infos[idx]['gt_label']\ncat_ids = np.where(gt_labels == 1)[0].tolist()\nreturn cat_ids", "if metric_options is None or metric_options == {}:\n metric_options = {'thr': 0.5}\nif isinstance(metric, str):\n metrics = [metric]\nelse:\n metrics = metric\nallowed_metrics = ['mAP', 'CP', ...
<|body_start_0|> gt_labels = self.data_infos[idx]['gt_label'] cat_ids = np.where(gt_labels == 1)[0].tolist() return cat_ids <|end_body_0|> <|body_start_1|> if metric_options is None or metric_options == {}: metric_options = {'thr': 0.5} if isinstance(metric, str): ...
Multi-label Dataset.
MultiLabelDataset
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiLabelDataset: """Multi-label Dataset.""" def get_cat_ids(self, idx: int) -> List[int]: """Get category ids by index. Args: idx (int): Index of data. Returns: cat_ids (List[int]): Image categories of specified index.""" <|body_0|> def evaluate(self, results, metric='...
stack_v2_sparse_classes_36k_train_022711
2,802
permissive
[ { "docstring": "Get category ids by index. Args: idx (int): Index of data. Returns: cat_ids (List[int]): Image categories of specified index.", "name": "get_cat_ids", "signature": "def get_cat_ids(self, idx: int) -> List[int]" }, { "docstring": "Evaluate the dataset. Args: results (list): Testin...
2
stack_v2_sparse_classes_30k_train_000784
Implement the Python class `MultiLabelDataset` described below. Class description: Multi-label Dataset. Method signatures and docstrings: - def get_cat_ids(self, idx: int) -> List[int]: Get category ids by index. Args: idx (int): Index of data. Returns: cat_ids (List[int]): Image categories of specified index. - def ...
Implement the Python class `MultiLabelDataset` described below. Class description: Multi-label Dataset. Method signatures and docstrings: - def get_cat_ids(self, idx: int) -> List[int]: Get category ids by index. Args: idx (int): Index of data. Returns: cat_ids (List[int]): Image categories of specified index. - def ...
2b8882b2da41d4e175fe49a33fcefad1423216f4
<|skeleton|> class MultiLabelDataset: """Multi-label Dataset.""" def get_cat_ids(self, idx: int) -> List[int]: """Get category ids by index. Args: idx (int): Index of data. Returns: cat_ids (List[int]): Image categories of specified index.""" <|body_0|> def evaluate(self, results, metric='...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiLabelDataset: """Multi-label Dataset.""" def get_cat_ids(self, idx: int) -> List[int]: """Get category ids by index. Args: idx (int): Index of data. Returns: cat_ids (List[int]): Image categories of specified index.""" gt_labels = self.data_infos[idx]['gt_label'] cat_ids = np...
the_stack_v2_python_sparse
mmcls/datasets/multi_label.py
ChenhongyiYang/GPViT
train
78
4680d7ec4bc549f26190f435f836c40f67c7d3ce
[ "from CortexCoreIR import handle_prevalence_command, Client\nmock_client = Client(base_url=f'{Core_URL}/xsiam/', headers={})\nmock_res = load_test_data('./test_data/prevalence_response.json')\nmocker.patch.object(mock_client, 'get_prevalence', return_value=mock_res.get('domain'))\nres = handle_prevalence_command(mo...
<|body_start_0|> from CortexCoreIR import handle_prevalence_command, Client mock_client = Client(base_url=f'{Core_URL}/xsiam/', headers={}) mock_res = load_test_data('./test_data/prevalence_response.json') mocker.patch.object(mock_client, 'get_prevalence', return_value=mock_res.get('doma...
TestPrevalenceCommands
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPrevalenceCommands: def test_get_domain_analytics(self, mocker): """Given: - A domain name. When: - Calling handle_prevalence_command as part of core-get-domain-analytics-prevalence command. Then: - Verify response is as expected.""" <|body_0|> def test_get_ip_analytics(...
stack_v2_sparse_classes_36k_train_022712
3,844
permissive
[ { "docstring": "Given: - A domain name. When: - Calling handle_prevalence_command as part of core-get-domain-analytics-prevalence command. Then: - Verify response is as expected.", "name": "test_get_domain_analytics", "signature": "def test_get_domain_analytics(self, mocker)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_014136
Implement the Python class `TestPrevalenceCommands` described below. Class description: Implement the TestPrevalenceCommands class. Method signatures and docstrings: - def test_get_domain_analytics(self, mocker): Given: - A domain name. When: - Calling handle_prevalence_command as part of core-get-domain-analytics-pr...
Implement the Python class `TestPrevalenceCommands` described below. Class description: Implement the TestPrevalenceCommands class. Method signatures and docstrings: - def test_get_domain_analytics(self, mocker): Given: - A domain name. When: - Calling handle_prevalence_command as part of core-get-domain-analytics-pr...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestPrevalenceCommands: def test_get_domain_analytics(self, mocker): """Given: - A domain name. When: - Calling handle_prevalence_command as part of core-get-domain-analytics-prevalence command. Then: - Verify response is as expected.""" <|body_0|> def test_get_ip_analytics(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPrevalenceCommands: def test_get_domain_analytics(self, mocker): """Given: - A domain name. When: - Calling handle_prevalence_command as part of core-get-domain-analytics-prevalence command. Then: - Verify response is as expected.""" from CortexCoreIR import handle_prevalence_command, Clie...
the_stack_v2_python_sparse
Packs/Core/Integrations/CortexCoreIR/CortexCoreIR_test.py
demisto/content
train
1,023
8a9de19a2119078c81cba6df4f4827a60f1dbd3e
[ "if category.prevent_custom_triggers_default:\n kwargs['initial'] = {'prevent_custom_triggers': True}\nsuper().__init__(*args, **kwargs)\nqs = Goal.objects.packages(categories=category)\nself.fields['packaged_goals'].queryset = qs\nif not category.display_prevent_custom_triggers_option:\n self.fields['prevent...
<|body_start_0|> if category.prevent_custom_triggers_default: kwargs['initial'] = {'prevent_custom_triggers': True} super().__init__(*args, **kwargs) qs = Goal.objects.packages(categories=category) self.fields['packaged_goals'].queryset = qs if not category.display_pr...
Allows input of email addresses (in a text box) and the selection of one or more Categories--those of which have been designated as packaged content. Requires that it's first argument is a Category, the parent (or package) of the goals to be selected.
PackageEnrollmentForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PackageEnrollmentForm: """Allows input of email addresses (in a text box) and the selection of one or more Categories--those of which have been designated as packaged content. Requires that it's first argument is a Category, the parent (or package) of the goals to be selected.""" def __init_...
stack_v2_sparse_classes_36k_train_022713
33,751
permissive
[ { "docstring": "Provide a specific category for this for in order to enroll users in it's set of Goals.", "name": "__init__", "signature": "def __init__(self, category, *args, **kwargs)" }, { "docstring": "Returns a list of email addresses.", "name": "clean_email_addresses", "signature":...
2
stack_v2_sparse_classes_30k_test_000451
Implement the Python class `PackageEnrollmentForm` described below. Class description: Allows input of email addresses (in a text box) and the selection of one or more Categories--those of which have been designated as packaged content. Requires that it's first argument is a Category, the parent (or package) of the go...
Implement the Python class `PackageEnrollmentForm` described below. Class description: Allows input of email addresses (in a text box) and the selection of one or more Categories--those of which have been designated as packaged content. Requires that it's first argument is a Category, the parent (or package) of the go...
3d22179c581ab3da18900483930d5ecc0a5fca73
<|skeleton|> class PackageEnrollmentForm: """Allows input of email addresses (in a text box) and the selection of one or more Categories--those of which have been designated as packaged content. Requires that it's first argument is a Category, the parent (or package) of the goals to be selected.""" def __init_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PackageEnrollmentForm: """Allows input of email addresses (in a text box) and the selection of one or more Categories--those of which have been designated as packaged content. Requires that it's first argument is a Category, the parent (or package) of the goals to be selected.""" def __init__(self, categ...
the_stack_v2_python_sparse
tndata_backend/goals/forms.py
tndatacommons/tndata_backend
train
1
b4f70da76591db28efa93b379092294c8fd09fc5
[ "self._check_permission(Permissions.users_view)\nusers = await User.all()\nreturn ResponseUsers(users)", "self._check_permission(Permissions.users_edit)\ndata = await self.get_json()\nrequest_model = RequestUser(**data)\nkwargs = {}\nif request_model.password:\n kwargs['pass_hash'] = User.get_pass_hash(request...
<|body_start_0|> self._check_permission(Permissions.users_view) users = await User.all() return ResponseUsers(users) <|end_body_0|> <|body_start_1|> self._check_permission(Permissions.users_edit) data = await self.get_json() request_model = RequestUser(**data) kw...
UsersView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UsersView: async def get(self): """--- description: Get list of users tags: - users responses: '200': description: ok content: application/json: schema: $ref: '#/components/schemas/ResponseUsers' '400': description: Bad request content: application/json: schema: $ref: '#/components/schem...
stack_v2_sparse_classes_36k_train_022714
5,428
no_license
[ { "docstring": "--- description: Get list of users tags: - users responses: '200': description: ok content: application/json: schema: $ref: '#/components/schemas/ResponseUsers' '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ResponseError' '401': description: Unaut...
2
stack_v2_sparse_classes_30k_train_004141
Implement the Python class `UsersView` described below. Class description: Implement the UsersView class. Method signatures and docstrings: - async def get(self): --- description: Get list of users tags: - users responses: '200': description: ok content: application/json: schema: $ref: '#/components/schemas/ResponseU...
Implement the Python class `UsersView` described below. Class description: Implement the UsersView class. Method signatures and docstrings: - async def get(self): --- description: Get list of users tags: - users responses: '200': description: ok content: application/json: schema: $ref: '#/components/schemas/ResponseU...
d4abeb5b87ab00c4b371d501f3d117feb5e4d72c
<|skeleton|> class UsersView: async def get(self): """--- description: Get list of users tags: - users responses: '200': description: ok content: application/json: schema: $ref: '#/components/schemas/ResponseUsers' '400': description: Bad request content: application/json: schema: $ref: '#/components/schem...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UsersView: async def get(self): """--- description: Get list of users tags: - users responses: '200': description: ok content: application/json: schema: $ref: '#/components/schemas/ResponseUsers' '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ResponseErr...
the_stack_v2_python_sparse
app/services/web/views/users.py
Ravillatypov/asterisk-integration-api
train
2
1f359129b560510dff37ed267cdf4862d8cc925c
[ "self.created_time_msecs = created_time_msecs\nself.description = description\nself.is_custom_role = is_custom_role\nself.label = label\nself.last_updated_time_msecs = last_updated_time_msecs\nself.name = name\nself.privileges = privileges\nself.tenant_id = tenant_id\nself.tenant_ids = tenant_ids", "if dictionary...
<|body_start_0|> self.created_time_msecs = created_time_msecs self.description = description self.is_custom_role = is_custom_role self.label = label self.last_updated_time_msecs = last_updated_time_msecs self.name = name self.privileges = privileges self.t...
Implementation of the 'Role' model. Specifies information about role such as the category, privileges, description, etc. A role can be a default system role or a custom role. Custom roles are user-defined roles that are created using the Cohesity Dashboard, the REST API or the CLI. System roles are provided by default ...
Role
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Role: """Implementation of the 'Role' model. Specifies information about role such as the category, privileges, description, etc. A role can be a default system role or a custom role. Custom roles are user-defined roles that are created using the Cohesity Dashboard, the REST API or the CLI. Syste...
stack_v2_sparse_classes_36k_train_022715
4,509
permissive
[ { "docstring": "Constructor for the Role class", "name": "__init__", "signature": "def __init__(self, created_time_msecs=None, description=None, is_custom_role=None, label=None, last_updated_time_msecs=None, name=None, privileges=None, tenant_id=None, tenant_ids=None)" }, { "docstring": "Creates...
2
null
Implement the Python class `Role` described below. Class description: Implementation of the 'Role' model. Specifies information about role such as the category, privileges, description, etc. A role can be a default system role or a custom role. Custom roles are user-defined roles that are created using the Cohesity Da...
Implement the Python class `Role` described below. Class description: Implementation of the 'Role' model. Specifies information about role such as the category, privileges, description, etc. A role can be a default system role or a custom role. Custom roles are user-defined roles that are created using the Cohesity Da...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class Role: """Implementation of the 'Role' model. Specifies information about role such as the category, privileges, description, etc. A role can be a default system role or a custom role. Custom roles are user-defined roles that are created using the Cohesity Dashboard, the REST API or the CLI. Syste...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Role: """Implementation of the 'Role' model. Specifies information about role such as the category, privileges, description, etc. A role can be a default system role or a custom role. Custom roles are user-defined roles that are created using the Cohesity Dashboard, the REST API or the CLI. System roles are p...
the_stack_v2_python_sparse
cohesity_management_sdk/models/role.py
cohesity/management-sdk-python
train
24
9b1b60a94c34ff4b295439abdff7378bfeabbe87
[ "self.file_data = []\nself.header = {}\ntot_filepath = 'Data/WDCGG-SurfaceData/' + country + '/'\ntot_filepath += load_filename + '.dat'\nwith open(tot_filepath, 'rb') as file:\n for row in file:\n string_row = row.decode()\n if string_row[0] == 'C':\n try:\n key, value = ...
<|body_start_0|> self.file_data = [] self.header = {} tot_filepath = 'Data/WDCGG-SurfaceData/' + country + '/' tot_filepath += load_filename + '.dat' with open(tot_filepath, 'rb') as file: for row in file: string_row = row.decode() if s...
Defines a child class of AtmosGasTS, with methods used to read in and parse the .dat files used by the WDCGG: http://ds.data.jma.go.jp/gmd/wdcgg/wdcgg.html
WDCGG_TS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WDCGG_TS: """Defines a child class of AtmosGasTS, with methods used to read in and parse the .dat files used by the WDCGG: http://ds.data.jma.go.jp/gmd/wdcgg/wdcgg.html""" def __init__(self, country, load_filename): """Initialises the class based on data found in the .dat files. coun...
stack_v2_sparse_classes_36k_train_022716
28,351
no_license
[ { "docstring": "Initialises the class based on data found in the .dat files. country -- string; the nation where the data came from, this will be used in filepaths and plot titles; so make sure the folders exit before run time. load_filename -- string; the file name/file path + file name where the .dat file is ...
2
stack_v2_sparse_classes_30k_train_015396
Implement the Python class `WDCGG_TS` described below. Class description: Defines a child class of AtmosGasTS, with methods used to read in and parse the .dat files used by the WDCGG: http://ds.data.jma.go.jp/gmd/wdcgg/wdcgg.html Method signatures and docstrings: - def __init__(self, country, load_filename): Initiali...
Implement the Python class `WDCGG_TS` described below. Class description: Defines a child class of AtmosGasTS, with methods used to read in and parse the .dat files used by the WDCGG: http://ds.data.jma.go.jp/gmd/wdcgg/wdcgg.html Method signatures and docstrings: - def __init__(self, country, load_filename): Initiali...
69c3beb334cb64b257c4496607a9b70dd220098b
<|skeleton|> class WDCGG_TS: """Defines a child class of AtmosGasTS, with methods used to read in and parse the .dat files used by the WDCGG: http://ds.data.jma.go.jp/gmd/wdcgg/wdcgg.html""" def __init__(self, country, load_filename): """Initialises the class based on data found in the .dat files. coun...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WDCGG_TS: """Defines a child class of AtmosGasTS, with methods used to read in and parse the .dat files used by the WDCGG: http://ds.data.jma.go.jp/gmd/wdcgg/wdcgg.html""" def __init__(self, country, load_filename): """Initialises the class based on data found in the .dat files. country -- string...
the_stack_v2_python_sparse
ScriptsMisc/AtmosGasTSclass (old).py
tmed2/Atmos2016
train
0
ad043916760f147af32ec349d478ca7f3ed6a06c
[ "Parametre.__init__(self, 'détruire', 'destroy')\nself.schema = '<element_observable>'\nself.aide_courte = 'détruit votre bonhomme de neige'\nself.aide_longue = 'Cette commande permet de détruire un bonhomme de neige dont vous êtes le créateur. Vous ne pouvez utiliser cette commande pour détruire les bonhommes des ...
<|body_start_0|> Parametre.__init__(self, 'détruire', 'destroy') self.schema = '<element_observable>' self.aide_courte = 'détruit votre bonhomme de neige' self.aide_longue = 'Cette commande permet de détruire un bonhomme de neige dont vous êtes le créateur. Vous ne pouvez utiliser cette ...
Commande 'neige détruire'
PrmDetruire
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmDetruire: """Commande 'neige détruire'""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022717
3,697
permissive
[ { "docstring": "Constructeur du paramètre.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Méthode d'interprétation de commande", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
stack_v2_sparse_classes_30k_train_018172
Implement the Python class `PrmDetruire` described below. Class description: Commande 'neige détruire' Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande
Implement the Python class `PrmDetruire` described below. Class description: Commande 'neige détruire' Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande <|skeleton|> class PrmDetruire: """Comma...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmDetruire: """Commande 'neige détruire'""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmDetruire: """Commande 'neige détruire'""" def __init__(self): """Constructeur du paramètre.""" Parametre.__init__(self, 'détruire', 'destroy') self.schema = '<element_observable>' self.aide_courte = 'détruit votre bonhomme de neige' self.aide_longue = 'Cette com...
the_stack_v2_python_sparse
src/primaires/salle/commandes/neige/detruire.py
vincent-lg/tsunami
train
5
a01b187426a4943e961f3ee5147b9f65bdcd16a2
[ "scores = tf.linalg.matmul(user_embeddings, candidate_embeddings, transpose_b=True)\nscores = tf.math.reduce_max(scores, axis=1)\nbatch_size = tf.shape(scores)[0]\nnum_candidates = tf.shape(scores)[-1]\nlabels = tf.eye(batch_size, num_candidates)\nif self._temperature is not None:\n scores = scores / self._tempe...
<|body_start_0|> scores = tf.linalg.matmul(user_embeddings, candidate_embeddings, transpose_b=True) scores = tf.math.reduce_max(scores, axis=1) batch_size = tf.shape(scores)[0] num_candidates = tf.shape(scores)[-1] labels = tf.eye(batch_size, num_candidates) if self._temp...
Extends the tfrs retrieval task to support multiple user representation (MUR). This class modifies the call function to support MUR. See base class for more details. For details on MUR see http://shortn/_PO6OdvUuAs.
MultiShotRetrievalTask
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiShotRetrievalTask: """Extends the tfrs retrieval task to support multiple user representation (MUR). This class modifies the call function to support MUR. See base class for more details. For details on MUR see http://shortn/_PO6OdvUuAs.""" def call(self, user_embeddings, candidate_embe...
stack_v2_sparse_classes_36k_train_022718
10,488
permissive
[ { "docstring": "Computes the loss function for next-item prediction. While computing the loss, the next-item's embedding is used as positive, while remaining items in the batch are negatives (in-batch negatives). Args: user_embeddings: User Embeddings [B, H, D] from the user tower, where H corresponds to the nu...
2
null
Implement the Python class `MultiShotRetrievalTask` described below. Class description: Extends the tfrs retrieval task to support multiple user representation (MUR). This class modifies the call function to support MUR. See base class for more details. For details on MUR see http://shortn/_PO6OdvUuAs. Method signatu...
Implement the Python class `MultiShotRetrievalTask` described below. Class description: Extends the tfrs retrieval task to support multiple user representation (MUR). This class modifies the call function to support MUR. See base class for more details. For details on MUR see http://shortn/_PO6OdvUuAs. Method signatu...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class MultiShotRetrievalTask: """Extends the tfrs retrieval task to support multiple user representation (MUR). This class modifies the call function to support MUR. See base class for more details. For details on MUR see http://shortn/_PO6OdvUuAs.""" def call(self, user_embeddings, candidate_embe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiShotRetrievalTask: """Extends the tfrs retrieval task to support multiple user representation (MUR). This class modifies the call function to support MUR. See base class for more details. For details on MUR see http://shortn/_PO6OdvUuAs.""" def call(self, user_embeddings, candidate_embeddings, sampl...
the_stack_v2_python_sparse
multiple_user_representations/models/task.py
Jimmy-INL/google-research
train
1
0cbb2057d014f5c58a1cc4fd64588a9067d597ab
[ "data = '{\"sex\":\"S01\",\"isFather\":\"F04\",\"attributeValue\":\"V00\",\"grade\":\"G07\",\"belongSchoolId\":24,\"intentLevel\":\"I02\",\"businessType\":\"B01\",\"custStatus\":\"S01\",\"custType\":\"T00\",\"custName\":\"%s\",\"schoolId\":\"33\",\"schoolName\":\"四基初级中学\",\"infoId\":1073,\"infoType\":\"T01\",\"info...
<|body_start_0|> data = '{"sex":"S01","isFather":"F04","attributeValue":"V00","grade":"G07","belongSchoolId":24,"intentLevel":"I02","businessType":"B01","custStatus":"S01","custType":"T00","custName":"%s","schoolId":"33","schoolName":"四基初级中学","infoId":1073,"infoType":"T01","infoName":"高分云信息单","phoneInfo":"13800...
CrmRequest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrmRequest: def save_customer_info(customer_name): """输入客户名称生成客户信息 @param customer_name: @return:""" <|body_0|> def allot_order(customer_id): """将客户id分单给高分云顾问2 @param customer_id: @return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = '{"se...
stack_v2_sparse_classes_36k_train_022719
1,384
no_license
[ { "docstring": "输入客户名称生成客户信息 @param customer_name: @return:", "name": "save_customer_info", "signature": "def save_customer_info(customer_name)" }, { "docstring": "将客户id分单给高分云顾问2 @param customer_id: @return:", "name": "allot_order", "signature": "def allot_order(customer_id)" } ]
2
stack_v2_sparse_classes_30k_train_013717
Implement the Python class `CrmRequest` described below. Class description: Implement the CrmRequest class. Method signatures and docstrings: - def save_customer_info(customer_name): 输入客户名称生成客户信息 @param customer_name: @return: - def allot_order(customer_id): 将客户id分单给高分云顾问2 @param customer_id: @return:
Implement the Python class `CrmRequest` described below. Class description: Implement the CrmRequest class. Method signatures and docstrings: - def save_customer_info(customer_name): 输入客户名称生成客户信息 @param customer_name: @return: - def allot_order(customer_id): 将客户id分单给高分云顾问2 @param customer_id: @return: <|skeleton|> c...
16bd1ecf5d1c7afa02a3721effb8a0bf078aed67
<|skeleton|> class CrmRequest: def save_customer_info(customer_name): """输入客户名称生成客户信息 @param customer_name: @return:""" <|body_0|> def allot_order(customer_id): """将客户id分单给高分云顾问2 @param customer_id: @return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrmRequest: def save_customer_info(customer_name): """输入客户名称生成客户信息 @param customer_name: @return:""" data = '{"sex":"S01","isFather":"F04","attributeValue":"V00","grade":"G07","belongSchoolId":24,"intentLevel":"I02","businessType":"B01","custStatus":"S01","custType":"T00","custName":"%s","scho...
the_stack_v2_python_sparse
func/api_request.py
quanbanno2/new_crm_poium
train
0
0164f46ccddbd5226c11e19a91b49259827a35e3
[ "n = len(array)\nif k > n:\n return []\nresult = []\nfor i in range(n - k + 1):\n window = set()\n for j in range(i, i + k):\n window.add(array[j])\n result.append(len(window))\nreturn result", "n = len(array)\nif k > n:\n return []\nwindow = dict()\nfor i in range(k):\n window[array[i]] ...
<|body_start_0|> n = len(array) if k > n: return [] result = [] for i in range(n - k + 1): window = set() for j in range(i, i + k): window.add(array[j]) result.append(len(window)) return result <|end_body_0|> <|body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def count_distinct_brute(self, array, k): """Brute force algorithm. Time complexity: O(n * k). Space complexity: O(k), n is len(array).""" <|body_0|> def count_distinct(self, array, k): """Improved algorithm using dictionary. Time complexity: O(n). Space co...
stack_v2_sparse_classes_36k_train_022720
2,318
no_license
[ { "docstring": "Brute force algorithm. Time complexity: O(n * k). Space complexity: O(k), n is len(array).", "name": "count_distinct_brute", "signature": "def count_distinct_brute(self, array, k)" }, { "docstring": "Improved algorithm using dictionary. Time complexity: O(n). Space complexity: O(...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def count_distinct_brute(self, array, k): Brute force algorithm. Time complexity: O(n * k). Space complexity: O(k), n is len(array). - def count_distinct(self, array, k): Improve...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def count_distinct_brute(self, array, k): Brute force algorithm. Time complexity: O(n * k). Space complexity: O(k), n is len(array). - def count_distinct(self, array, k): Improve...
71b722ddfe8da04572e527b055cf8723d5c87bbf
<|skeleton|> class Solution: def count_distinct_brute(self, array, k): """Brute force algorithm. Time complexity: O(n * k). Space complexity: O(k), n is len(array).""" <|body_0|> def count_distinct(self, array, k): """Improved algorithm using dictionary. Time complexity: O(n). Space co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def count_distinct_brute(self, array, k): """Brute force algorithm. Time complexity: O(n * k). Space complexity: O(k), n is len(array).""" n = len(array) if k > n: return [] result = [] for i in range(n - k + 1): window = set() ...
the_stack_v2_python_sparse
Hashing/distinct_numbers_in_window.py
vladn90/Algorithms
train
0
ef8eb5e374ad0d9bd213a7d745fa9d6a90801a0e
[ "script_dir = os.path.dirname(__file__)\nprint('Training faces. It will take a few seconds.') if config.DEBUG else None\nself.__image_paths = [os.path.join(script_dir, 'Images/1.jpg'), os.path.join(script_dir, 'Images/2.jpg'), os.path.join(script_dir, 'Images/3.jpg'), os.path.join(script_dir, 'Images/4.jpg'), os.pa...
<|body_start_0|> script_dir = os.path.dirname(__file__) print('Training faces. It will take a few seconds.') if config.DEBUG else None self.__image_paths = [os.path.join(script_dir, 'Images/1.jpg'), os.path.join(script_dir, 'Images/2.jpg'), os.path.join(script_dir, 'Images/3.jpg'), os.path.join(...
FaceTraining
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaceTraining: def __init__(self): """init the model for training and init the images path.""" <|body_0|> def __train_images_and_labels(self): """get the faces from the image & set the id of a face [we set it to 1]""" <|body_1|> def __save_train_data(self...
stack_v2_sparse_classes_36k_train_022721
2,254
no_license
[ { "docstring": "init the model for training and init the images path.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "get the faces from the image & set the id of a face [we set it to 1]", "name": "__train_images_and_labels", "signature": "def __train_images_an...
3
stack_v2_sparse_classes_30k_train_005464
Implement the Python class `FaceTraining` described below. Class description: Implement the FaceTraining class. Method signatures and docstrings: - def __init__(self): init the model for training and init the images path. - def __train_images_and_labels(self): get the faces from the image & set the id of a face [we s...
Implement the Python class `FaceTraining` described below. Class description: Implement the FaceTraining class. Method signatures and docstrings: - def __init__(self): init the model for training and init the images path. - def __train_images_and_labels(self): get the faces from the image & set the id of a face [we s...
607e459d737ac689d6974bf05f452abf89cbdfe2
<|skeleton|> class FaceTraining: def __init__(self): """init the model for training and init the images path.""" <|body_0|> def __train_images_and_labels(self): """get the faces from the image & set the id of a face [we set it to 1]""" <|body_1|> def __save_train_data(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FaceTraining: def __init__(self): """init the model for training and init the images path.""" script_dir = os.path.dirname(__file__) print('Training faces. It will take a few seconds.') if config.DEBUG else None self.__image_paths = [os.path.join(script_dir, 'Images/1.jpg'), os...
the_stack_v2_python_sparse
Measurements/FaceRecognition/faceTraining.py
alexshachor/TheBackEye
train
0
59042286e6ae0651a423c76820fd3678c5ad77ed
[ "m, n = (len(s), len(t))\nres = 0\nfor i in range(m):\n for j in range(n):\n k = 0\n diff = 0\n while i + k < m and j + k < n:\n if s[i + k] != t[j + k]:\n diff += 1\n if diff >= 2:\n break\n if diff == 1:\n res +=...
<|body_start_0|> m, n = (len(s), len(t)) res = 0 for i in range(m): for j in range(n): k = 0 diff = 0 while i + k < m and j + k < n: if s[i + k] != t[j + k]: diff += 1 if d...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countSubstrings(self, s: str, t: str) -> int: """只有一个字符不同的子串对数""" <|body_0|> def countSubstrings2(self, s: str, t: str) -> int: """不同字符=相同前缀+不同字符+相同后缀 因此需要处理出前后缀的lcp(最长公共前缀)""" <|body_1|> <|end_skeleton|> <|body_start_0|> m, n = (len(s...
stack_v2_sparse_classes_36k_train_022722
2,414
no_license
[ { "docstring": "只有一个字符不同的子串对数", "name": "countSubstrings", "signature": "def countSubstrings(self, s: str, t: str) -> int" }, { "docstring": "不同字符=相同前缀+不同字符+相同后缀 因此需要处理出前后缀的lcp(最长公共前缀)", "name": "countSubstrings2", "signature": "def countSubstrings2(self, s: str, t: str) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubstrings(self, s: str, t: str) -> int: 只有一个字符不同的子串对数 - def countSubstrings2(self, s: str, t: str) -> int: 不同字符=相同前缀+不同字符+相同后缀 因此需要处理出前后缀的lcp(最长公共前缀)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubstrings(self, s: str, t: str) -> int: 只有一个字符不同的子串对数 - def countSubstrings2(self, s: str, t: str) -> int: 不同字符=相同前缀+不同字符+相同后缀 因此需要处理出前后缀的lcp(最长公共前缀) <|skeleton|> clas...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def countSubstrings(self, s: str, t: str) -> int: """只有一个字符不同的子串对数""" <|body_0|> def countSubstrings2(self, s: str, t: str) -> int: """不同字符=相同前缀+不同字符+相同后缀 因此需要处理出前后缀的lcp(最长公共前缀)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countSubstrings(self, s: str, t: str) -> int: """只有一个字符不同的子串对数""" m, n = (len(s), len(t)) res = 0 for i in range(m): for j in range(n): k = 0 diff = 0 while i + k < m and j + k < n: if...
the_stack_v2_python_sparse
22_专题/枚举/1638. 统计只差一个字符的子串数目-枚举起点.py
981377660LMT/algorithm-study
train
225
da4755eb92e28f2125378c1a23502faca25d19e2
[ "specs_adhesion_flex: AdhesionFlexPlugin = self.specs.adhesion_flex\nmolecules = specs_adhesion_flex.molecules\nfor idx1 in range(len(molecules)):\n for idx2 in range(idx1, len(molecules)):\n m1, m2 = (molecules[idx1], molecules[idx2])\n self.add_steering_param(name=f'{m1}-{m2}', val=specs_adhesion...
<|body_start_0|> specs_adhesion_flex: AdhesionFlexPlugin = self.specs.adhesion_flex molecules = specs_adhesion_flex.molecules for idx1 in range(len(molecules)): for idx2 in range(idx1, len(molecules)): m1, m2 = (molecules[idx1], molecules[idx2]) self.a...
AdhesionDemoSteppable
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdhesionDemoSteppable: def add_steering_panel(self): """Adds a steering panel and populates with available data in AdhesionFlex plugin for changing parameters on-the-fly by the user during simulation execution.""" <|body_0|> def process_steering_panel_data(self): """...
stack_v2_sparse_classes_36k_train_022723
4,321
permissive
[ { "docstring": "Adds a steering panel and populates with available data in AdhesionFlex plugin for changing parameters on-the-fly by the user during simulation execution.", "name": "add_steering_panel", "signature": "def add_steering_panel(self)" }, { "docstring": "Updates AdhesionFlex plugin da...
2
null
Implement the Python class `AdhesionDemoSteppable` described below. Class description: Implement the AdhesionDemoSteppable class. Method signatures and docstrings: - def add_steering_panel(self): Adds a steering panel and populates with available data in AdhesionFlex plugin for changing parameters on-the-fly by the u...
Implement the Python class `AdhesionDemoSteppable` described below. Class description: Implement the AdhesionDemoSteppable class. Method signatures and docstrings: - def add_steering_panel(self): Adds a steering panel and populates with available data in AdhesionFlex plugin for changing parameters on-the-fly by the u...
65a65eaa693a6d2b3aab303f9b41e71819f4eed4
<|skeleton|> class AdhesionDemoSteppable: def add_steering_panel(self): """Adds a steering panel and populates with available data in AdhesionFlex plugin for changing parameters on-the-fly by the user during simulation execution.""" <|body_0|> def process_steering_panel_data(self): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdhesionDemoSteppable: def add_steering_panel(self): """Adds a steering panel and populates with available data in AdhesionFlex plugin for changing parameters on-the-fly by the user during simulation execution.""" specs_adhesion_flex: AdhesionFlexPlugin = self.specs.adhesion_flex molec...
the_stack_v2_python_sparse
CompuCell3D/core/Demos/PyCoreSpecs/AdhesionDemo/Simulation/AdhesionDemo.py
CompuCell3D/CompuCell3D
train
51
6023e48a5387ae6c1ee868f7b9d784c25b6d5513
[ "self.base_uri = clean_url.clean_url(app_server, self.BASE_PATH)\nself.app_server = app_server\nself.header_factory = header_factory", "endpoint = 'applicationLogs/search'\nuri = f'{self.base_uri}/{endpoint}'\nparams = {'expand': expand, 'level': level, 'loginId': loginid, 'machineName': machine_name, 'orderBy': ...
<|body_start_0|> self.base_uri = clean_url.clean_url(app_server, self.BASE_PATH) self.app_server = app_server self.header_factory = header_factory <|end_body_0|> <|body_start_1|> endpoint = 'applicationLogs/search' uri = f'{self.base_uri}/{endpoint}' params = {'expand': ...
This operation returns application logs, based on the data passed in the request.
ApplicationLogs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplicationLogs: """This operation returns application logs, based on the data passed in the request.""" def __init__(self, app_server, header_factory): """Parameters ---------- app_server: str, optional This is the FQDN of the target QNXT app server header_factory: qnxt.authenticati...
stack_v2_sparse_classes_36k_train_022724
33,787
no_license
[ { "docstring": "Parameters ---------- app_server: str, optional This is the FQDN of the target QNXT app server header_factory: qnxt.authentication.RequestHeader, required This is a callable that generates the appropriate authentication headers for QNXT API requests", "name": "__init__", "signature": "de...
2
stack_v2_sparse_classes_30k_test_001134
Implement the Python class `ApplicationLogs` described below. Class description: This operation returns application logs, based on the data passed in the request. Method signatures and docstrings: - def __init__(self, app_server, header_factory): Parameters ---------- app_server: str, optional This is the FQDN of the...
Implement the Python class `ApplicationLogs` described below. Class description: This operation returns application logs, based on the data passed in the request. Method signatures and docstrings: - def __init__(self, app_server, header_factory): Parameters ---------- app_server: str, optional This is the FQDN of the...
711b83a8091a50f86c09e0ed414c0fefceb39f36
<|skeleton|> class ApplicationLogs: """This operation returns application logs, based on the data passed in the request.""" def __init__(self, app_server, header_factory): """Parameters ---------- app_server: str, optional This is the FQDN of the target QNXT app server header_factory: qnxt.authenticati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApplicationLogs: """This operation returns application logs, based on the data passed in the request.""" def __init__(self, app_server, header_factory): """Parameters ---------- app_server: str, optional This is the FQDN of the target QNXT app server header_factory: qnxt.authentication.RequestHea...
the_stack_v2_python_sparse
qnxt/api/PlanIntegration.py
agenovia/QNXT-API
train
0
c5aee47b26e10a6e78da39850cca9d7be94dbc94
[ "word_set = set(wordDict)\ncache = {}\nreturn self.ans_1(s, word_set, cache)", "if not s:\n return True\nfor i in range(len(s)):\n word = s[:i + 1]\n if word in word_set:\n tmp = self.ans_basic(s[i + 1:], word_set)\n if tmp is True:\n return True\nreturn False", "if not s:\n ...
<|body_start_0|> word_set = set(wordDict) cache = {} return self.ans_1(s, word_set, cache) <|end_body_0|> <|body_start_1|> if not s: return True for i in range(len(s)): word = s[:i + 1] if word in word_set: tmp = self.ans_basic...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_0|> def ans_basic(self, s, word_set): """brute force :param s: :param word_set: :return:""" <|body_1|> def ans(self, s, word_set, cache): ...
stack_v2_sparse_classes_36k_train_022725
4,334
no_license
[ { "docstring": ":type s: str :type wordDict: List[str] :rtype: bool", "name": "wordBreak", "signature": "def wordBreak(self, s, wordDict)" }, { "docstring": "brute force :param s: :param word_set: :return:", "name": "ans_basic", "signature": "def ans_basic(self, s, word_set)" }, { ...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool - def ans_basic(self, s, word_set): brute force :param s: :param word_set: :return: - def an...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool - def ans_basic(self, s, word_set): brute force :param s: :param word_set: :return: - def an...
cf4235170db3629b65790fd0855a8a72ac5886f7
<|skeleton|> class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_0|> def ans_basic(self, s, word_set): """brute force :param s: :param word_set: :return:""" <|body_1|> def ans(self, s, word_set, cache): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" word_set = set(wordDict) cache = {} return self.ans_1(s, word_set, cache) def ans_basic(self, s, word_set): """brute force :param s: :param word_set: :return:""" ...
the_stack_v2_python_sparse
word_break.py
buxizhizhoum/leetcode
train
1
074f616a41123d13a08d584651f97c99aad3f450
[ "self._filename: str = filename\nself._seen_so_far: float = 0\nself._lock = threading.Lock()\nself._size: float = 0\nif bucket and client:\n if not version_id:\n self._size = client.head_object(Bucket=bucket, Key=filename).get('ContentLength')\n else:\n self._size = client.head_object(Bucket=buc...
<|body_start_0|> self._filename: str = filename self._seen_so_far: float = 0 self._lock = threading.Lock() self._size: float = 0 if bucket and client: if not version_id: self._size = client.head_object(Bucket=bucket, Key=filename).get('ContentLength') ...
The progress bar for s3 transfering. Helper class for displaying s3 upload/download/copy percentage. Upload: spcify the filename only. Download/Copy: require a bucket and client parameter as well as the filename. This class should be used within the callback of the S3Transfer class from boto. references: https://boto3....
S3Progress
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class S3Progress: """The progress bar for s3 transfering. Helper class for displaying s3 upload/download/copy percentage. Upload: spcify the filename only. Download/Copy: require a bucket and client parameter as well as the filename. This class should be used within the callback of the S3Transfer class...
stack_v2_sparse_classes_36k_train_022726
3,490
permissive
[ { "docstring": "Construct the progress bar instance.", "name": "__init__", "signature": "def __init__(self, filename: str, bucket: str=None, client=None, version_id: str=None) -> None" }, { "docstring": "Create the bar. Locking the thread to a single file.", "name": "__call__", "signatur...
3
stack_v2_sparse_classes_30k_train_020730
Implement the Python class `S3Progress` described below. Class description: The progress bar for s3 transfering. Helper class for displaying s3 upload/download/copy percentage. Upload: spcify the filename only. Download/Copy: require a bucket and client parameter as well as the filename. This class should be used with...
Implement the Python class `S3Progress` described below. Class description: The progress bar for s3 transfering. Helper class for displaying s3 upload/download/copy percentage. Upload: spcify the filename only. Download/Copy: require a bucket and client parameter as well as the filename. This class should be used with...
4abefb2301f7b489b11ed3f0b303faafa5941d5b
<|skeleton|> class S3Progress: """The progress bar for s3 transfering. Helper class for displaying s3 upload/download/copy percentage. Upload: spcify the filename only. Download/Copy: require a bucket and client parameter as well as the filename. This class should be used within the callback of the S3Transfer class...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class S3Progress: """The progress bar for s3 transfering. Helper class for displaying s3 upload/download/copy percentage. Upload: spcify the filename only. Download/Copy: require a bucket and client parameter as well as the filename. This class should be used within the callback of the S3Transfer class from boto. r...
the_stack_v2_python_sparse
fzfaws/s3/helper/s3progress.py
kazhala/fzf.aws
train
68
390da47d77e1ccf961ac44f2f4ed5033cad2d1e7
[ "if browser is None:\n self._browser_type = settings.DEFAULT_BROWSER\nelse:\n self._browser_type = browser\nself._driver = None", "if self._browser_type.lower() == 'chrome':\n self._driver = webdriver.Chrome()\nelif self._browser_type.lower() == 'firefox':\n self._driver = webdriver.Firefox()\nelif se...
<|body_start_0|> if browser is None: self._browser_type = settings.DEFAULT_BROWSER else: self._browser_type = browser self._driver = None <|end_body_0|> <|body_start_1|> if self._browser_type.lower() == 'chrome': self._driver = webdriver.Chrome() ...
BrowserEngine
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrowserEngine: def __init__(self, browser=None): """初始化浏览器类型 :param browser:""" <|body_0|> def init_driver(self): """初始化驱动器 :return: 返回驱动器""" <|body_1|> <|end_skeleton|> <|body_start_0|> if browser is None: self._browser_type = settings....
stack_v2_sparse_classes_36k_train_022727
1,198
permissive
[ { "docstring": "初始化浏览器类型 :param browser:", "name": "__init__", "signature": "def __init__(self, browser=None)" }, { "docstring": "初始化驱动器 :return: 返回驱动器", "name": "init_driver", "signature": "def init_driver(self)" } ]
2
stack_v2_sparse_classes_30k_train_016193
Implement the Python class `BrowserEngine` described below. Class description: Implement the BrowserEngine class. Method signatures and docstrings: - def __init__(self, browser=None): 初始化浏览器类型 :param browser: - def init_driver(self): 初始化驱动器 :return: 返回驱动器
Implement the Python class `BrowserEngine` described below. Class description: Implement the BrowserEngine class. Method signatures and docstrings: - def __init__(self, browser=None): 初始化浏览器类型 :param browser: - def init_driver(self): 初始化驱动器 :return: 返回驱动器 <|skeleton|> class BrowserEngine: def __init__(self, bro...
ed360d5aa7f733991fbbc8ab5af96e739c9e1142
<|skeleton|> class BrowserEngine: def __init__(self, browser=None): """初始化浏览器类型 :param browser:""" <|body_0|> def init_driver(self): """初始化驱动器 :return: 返回驱动器""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BrowserEngine: def __init__(self, browser=None): """初始化浏览器类型 :param browser:""" if browser is None: self._browser_type = settings.DEFAULT_BROWSER else: self._browser_type = browser self._driver = None def init_driver(self): """初始化驱动器 :return...
the_stack_v2_python_sparse
automated_testing/selenium_unittest_test/app/ui/base/browser_engine.py
tzytammy/requests_unittest
train
0
54cc47145c7dbb42c270432a4dbb8f12c5b962fe
[ "limit = request.GET.get('limit', 0)\npage = request.GET.get('page', 0)\nread = request.GET.get('read')\nevent_types = request.GET.getlist('eventTypes')\nquery_params = {}\nif read is not None:\n query_params['read'] = read\nif event_types:\n notifs = Notification.objects.filter(event_type__in=event_types, de...
<|body_start_0|> limit = request.GET.get('limit', 0) page = request.GET.get('page', 0) read = request.GET.get('read') event_types = request.GET.getlist('eventTypes') query_params = {} if read is not None: query_params['read'] = read if event_types: ...
ManageNotificationsView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManageNotificationsView: def get(self, request, *args, **kwargs): """List all notifications of a certain event type.""" <|body_0|> def patch(self, request, *args, **kwargs): """Mark notifications as read.""" <|body_1|> def delete(self, request, pk, *args...
stack_v2_sparse_classes_36k_train_022728
3,880
no_license
[ { "docstring": "List all notifications of a certain event type.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Mark notifications as read.", "name": "patch", "signature": "def patch(self, request, *args, **kwargs)" }, { "docstring": "Ma...
3
null
Implement the Python class `ManageNotificationsView` described below. Class description: Implement the ManageNotificationsView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): List all notifications of a certain event type. - def patch(self, request, *args, **kwargs): Mark notificat...
Implement the Python class `ManageNotificationsView` described below. Class description: Implement the ManageNotificationsView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): List all notifications of a certain event type. - def patch(self, request, *args, **kwargs): Mark notificat...
83f452436d5586b99ef2a9f327aab833ee794d1e
<|skeleton|> class ManageNotificationsView: def get(self, request, *args, **kwargs): """List all notifications of a certain event type.""" <|body_0|> def patch(self, request, *args, **kwargs): """Mark notifications as read.""" <|body_1|> def delete(self, request, pk, *args...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ManageNotificationsView: def get(self, request, *args, **kwargs): """List all notifications of a certain event type.""" limit = request.GET.get('limit', 0) page = request.GET.get('page', 0) read = request.GET.get('read') event_types = request.GET.getlist('eventTypes') ...
the_stack_v2_python_sparse
server/portal/apps/notifications/views.py
Avila0000/Core-Portal
train
0
74e5c00dc399a0e241c416a4322a12f8a3d93523
[ "self.assertEqual(Hit.objects.count(), 0)\ndata = {'id': -1, 'name': 'New York'}\nadd_or_create_from_uiselect(Hit, 'name', data)\nself.assertEqual(Hit.objects.count(), 1)\ntry:\n hit = Hit.objects.get(name='New York')\nexcept Hit.DoesNotExist:\n self.fail('Hit was not properly created by add_or_create_from_ui...
<|body_start_0|> self.assertEqual(Hit.objects.count(), 0) data = {'id': -1, 'name': 'New York'} add_or_create_from_uiselect(Hit, 'name', data) self.assertEqual(Hit.objects.count(), 1) try: hit = Hit.objects.get(name='New York') except Hit.DoesNotExist: ...
HitFormTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HitFormTests: def test_add_or_create_ui_select_new(self): """If the data from a UI Select form is -1, this means no model was selected. A new model should be created""" <|body_0|> def test_add_or_create_ui_select_get(self): """if passed a different id, it should fetc...
stack_v2_sparse_classes_36k_train_022729
11,225
permissive
[ { "docstring": "If the data from a UI Select form is -1, this means no model was selected. A new model should be created", "name": "test_add_or_create_ui_select_new", "signature": "def test_add_or_create_ui_select_new(self)" }, { "docstring": "if passed a different id, it should fetch that objec...
2
null
Implement the Python class `HitFormTests` described below. Class description: Implement the HitFormTests class. Method signatures and docstrings: - def test_add_or_create_ui_select_new(self): If the data from a UI Select form is -1, this means no model was selected. A new model should be created - def test_add_or_cre...
Implement the Python class `HitFormTests` described below. Class description: Implement the HitFormTests class. Method signatures and docstrings: - def test_add_or_create_ui_select_new(self): If the data from a UI Select form is -1, this means no model was selected. A new model should be created - def test_add_or_cre...
07455a660fb2cb8bc91a54f7f12d150923678157
<|skeleton|> class HitFormTests: def test_add_or_create_ui_select_new(self): """If the data from a UI Select form is -1, this means no model was selected. A new model should be created""" <|body_0|> def test_add_or_create_ui_select_get(self): """if passed a different id, it should fetc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HitFormTests: def test_add_or_create_ui_select_new(self): """If the data from a UI Select form is -1, this means no model was selected. A new model should be created""" self.assertEqual(Hit.objects.count(), 0) data = {'id': -1, 'name': 'New York'} add_or_create_from_uiselect(Hi...
the_stack_v2_python_sparse
otcore/hit/tests.py
NYULibraries/dlts-enm-tct-backend
train
0
a7a143974d7e072629cb0c492ede1794dad54509
[ "n = len(array)\nleft = [1] * n\nfor i in range(1, n):\n left[i] = left[i - 1] * array[i - 1]\nright = [1] * n\nfor i in range(n - 2, -1, -1):\n right[i] = right[i + 1] * array[i + 1]\nreturn [left[i] * right[i] for i in range(n)]", "n = len(array)\nresult = [1] * n\nfor i in range(1, n):\n result[i] = r...
<|body_start_0|> n = len(array) left = [1] * n for i in range(1, n): left[i] = left[i - 1] * array[i - 1] right = [1] * n for i in range(n - 2, -1, -1): right[i] = right[i + 1] * array[i + 1] return [left[i] * right[i] for i in range(n)] <|end_body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def product_except_self_1(self, array): """Time complexity: O(n). Space complexity: O(n), n is len(array).""" <|body_0|> def product_except_self_2(self, array): """Time complexity: O(n). Space complexity: O(1), n is len(array). Output array isn't included i...
stack_v2_sparse_classes_36k_train_022730
2,824
no_license
[ { "docstring": "Time complexity: O(n). Space complexity: O(n), n is len(array).", "name": "product_except_self_1", "signature": "def product_except_self_1(self, array)" }, { "docstring": "Time complexity: O(n). Space complexity: O(1), n is len(array). Output array isn't included in space complex...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def product_except_self_1(self, array): Time complexity: O(n). Space complexity: O(n), n is len(array). - def product_except_self_2(self, array): Time complexity: O(n). Space com...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def product_except_self_1(self, array): Time complexity: O(n). Space complexity: O(n), n is len(array). - def product_except_self_2(self, array): Time complexity: O(n). Space com...
71b722ddfe8da04572e527b055cf8723d5c87bbf
<|skeleton|> class Solution: def product_except_self_1(self, array): """Time complexity: O(n). Space complexity: O(n), n is len(array).""" <|body_0|> def product_except_self_2(self, array): """Time complexity: O(n). Space complexity: O(1), n is len(array). Output array isn't included i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def product_except_self_1(self, array): """Time complexity: O(n). Space complexity: O(n), n is len(array).""" n = len(array) left = [1] * n for i in range(1, n): left[i] = left[i - 1] * array[i - 1] right = [1] * n for i in range(n - 2, -1,...
the_stack_v2_python_sparse
Arrays/product_array_except_self.py
vladn90/Algorithms
train
0
b1d88b1b73c3eac45e4a80b8428c5aeaec4aae90
[ "has_cycle = False\none_step = head\ntwo_step = head\nwhile two_step and two_step.next:\n one_step = one_step.next\n two_step = two_step.next.next\n if one_step == two_step:\n has_cycle = True\n break\nif not has_cycle:\n return None\np = head\nstart = one_step.next\nwhile start:\n if s...
<|body_start_0|> has_cycle = False one_step = head two_step = head while two_step and two_step.next: one_step = one_step.next two_step = two_step.next.next if one_step == two_step: has_cycle = True break if not h...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def detectCycle1(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> has_cycle = False one_step =...
stack_v2_sparse_classes_36k_train_022731
1,566
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "detectCycle1", "signature": "def detectCycle1(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "detectCycle", "signature": "def detectCycle(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_013796
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def detectCycle1(self, head): :type head: ListNode :rtype: ListNode - def detectCycle(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def detectCycle1(self, head): :type head: ListNode :rtype: ListNode - def detectCycle(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: def de...
e5b018493bbd12edcdcd0434f35d9c358106d391
<|skeleton|> class Solution: def detectCycle1(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def detectCycle1(self, head): """:type head: ListNode :rtype: ListNode""" has_cycle = False one_step = head two_step = head while two_step and two_step.next: one_step = one_step.next two_step = two_step.next.next if one_step...
the_stack_v2_python_sparse
py/leetcode/142.py
wfeng1991/learnpy
train
0
593d7b30c5101b1b2c6f40305679d16a06bdd81f
[ "version = version.strip()\nself.repo.get_ready()\nmessage = ''\nif version == '0.17':\n message += f'There are {self.repo.number_of_016_files}'\nelif version == '0.16':\n message += f'There are {self.repo.number_of_017_files}'\nelse:\n num_016 = self.repo.number_of_016_files\n num_017 = self.repo.numbe...
<|body_start_0|> version = version.strip() self.repo.get_ready() message = '' if version == '0.17': message += f'There are {self.repo.number_of_016_files}' elif version == '0.16': message += f'There are {self.repo.number_of_017_files}' else: ...
ElmExtensions
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElmExtensions: def elm_progress(self, channel: str, version: str) -> ChannelMessages: """give a version of elm to get me to tell you how many number files are on master""" <|body_0|> def elm_progress_on(self, channel: str, branch_name: str) -> ChannelMessages: """giv...
stack_v2_sparse_classes_36k_train_022732
17,998
permissive
[ { "docstring": "give a version of elm to get me to tell you how many number files are on master", "name": "elm_progress", "signature": "def elm_progress(self, channel: str, version: str) -> ChannelMessages" }, { "docstring": "give a version of elm to get me to tell you how many number files are ...
4
stack_v2_sparse_classes_30k_train_013385
Implement the Python class `ElmExtensions` described below. Class description: Implement the ElmExtensions class. Method signatures and docstrings: - def elm_progress(self, channel: str, version: str) -> ChannelMessages: give a version of elm to get me to tell you how many number files are on master - def elm_progres...
Implement the Python class `ElmExtensions` described below. Class description: Implement the ElmExtensions class. Method signatures and docstrings: - def elm_progress(self, channel: str, version: str) -> ChannelMessages: give a version of elm to get me to tell you how many number files are on master - def elm_progres...
3db3d5eaedc8d7a1aa6d4adfff79385988717eec
<|skeleton|> class ElmExtensions: def elm_progress(self, channel: str, version: str) -> ChannelMessages: """give a version of elm to get me to tell you how many number files are on master""" <|body_0|> def elm_progress_on(self, channel: str, branch_name: str) -> ChannelMessages: """giv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElmExtensions: def elm_progress(self, channel: str, version: str) -> ChannelMessages: """give a version of elm to get me to tell you how many number files are on master""" version = version.strip() self.repo.get_ready() message = '' if version == '0.17': mes...
the_stack_v2_python_sparse
slack_today_i_did/extensions.py
eeue56/slack-today-i-did
train
3
e60364b51f045bc9254cc9b1ad0d7b9a90fb3113
[ "if not already_authorized(request):\n response = self.wrap_json_response(code=ReturnCode.UNAUTHORIZED)\n return JsonResponse(response, safe=False)\nopen_id = request.session.get('open_id')\nuser = User.objects.get(open_id=open_id)\ndata = {}\ndata['open_id'] = user.open_id\ndata['focus'] = {}\ndata['focus'][...
<|body_start_0|> if not already_authorized(request): response = self.wrap_json_response(code=ReturnCode.UNAUTHORIZED) return JsonResponse(response, safe=False) open_id = request.session.get('open_id') user = User.objects.get(open_id=open_id) data = {} data...
关注的城市、股票和星座
UserView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserView: """关注的城市、股票和星座""" def get(self, request): """获取用户的数据""" <|body_0|> def post(self, request): """修改用户的数据""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not already_authorized(request): response = self.wrap_json_response(c...
stack_v2_sparse_classes_36k_train_022733
5,687
no_license
[ { "docstring": "获取用户的数据", "name": "get", "signature": "def get(self, request)" }, { "docstring": "修改用户的数据", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_002670
Implement the Python class `UserView` described below. Class description: 关注的城市、股票和星座 Method signatures and docstrings: - def get(self, request): 获取用户的数据 - def post(self, request): 修改用户的数据
Implement the Python class `UserView` described below. Class description: 关注的城市、股票和星座 Method signatures and docstrings: - def get(self, request): 获取用户的数据 - def post(self, request): 修改用户的数据 <|skeleton|> class UserView: """关注的城市、股票和星座""" def get(self, request): """获取用户的数据""" <|body_0|> de...
9d0d27e6e29671bd5d38305dac828a61b01095cb
<|skeleton|> class UserView: """关注的城市、股票和星座""" def get(self, request): """获取用户的数据""" <|body_0|> def post(self, request): """修改用户的数据""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserView: """关注的城市、股票和星座""" def get(self, request): """获取用户的数据""" if not already_authorized(request): response = self.wrap_json_response(code=ReturnCode.UNAUTHORIZED) return JsonResponse(response, safe=False) open_id = request.session.get('open_id') ...
the_stack_v2_python_sparse
backend_ch3_sec1/authorization/views.py
liuwenwen163/django_wx_mini_program
train
0
4e4b1a7ff5ce756e7f2fee2ea11ec8f8bd3d1408
[ "self.params = params\nself.task_labels = task_labels\nself.cache_dir = tempfile.gettempdir()", "tf.compat.v1.reset_default_graph()\nconfig = transformers.BertConfig.from_pretrained(os.path.join(self.params.bert_path, 'config.json'), cache_dir=self.cache_dir)\nmodel = transformers.TFBertModel.from_pretrained(os.p...
<|body_start_0|> self.params = params self.task_labels = task_labels self.cache_dir = tempfile.gettempdir() <|end_body_0|> <|body_start_1|> tf.compat.v1.reset_default_graph() config = transformers.BertConfig.from_pretrained(os.path.join(self.params.bert_path, 'config.json'), cac...
Classifier can be single-task, or multi-task.
Classifier
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Classifier: """Classifier can be single-task, or multi-task.""" def __init__(self, params, task_labels='majority'): """Creates a Classifier instance for predicting task_labels. Args: params: a Params instance which includes the hyperparameters of the model task_labels: list of label ...
stack_v2_sparse_classes_36k_train_022734
7,260
permissive
[ { "docstring": "Creates a Classifier instance for predicting task_labels. Args: params: a Params instance which includes the hyperparameters of the model task_labels: list of label names to be predicted from text.", "name": "__init__", "signature": "def __init__(self, params, task_labels='majority')" ...
5
stack_v2_sparse_classes_30k_train_003865
Implement the Python class `Classifier` described below. Class description: Classifier can be single-task, or multi-task. Method signatures and docstrings: - def __init__(self, params, task_labels='majority'): Creates a Classifier instance for predicting task_labels. Args: params: a Params instance which includes the...
Implement the Python class `Classifier` described below. Class description: Classifier can be single-task, or multi-task. Method signatures and docstrings: - def __init__(self, params, task_labels='majority'): Creates a Classifier instance for predicting task_labels. Args: params: a Params instance which includes the...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class Classifier: """Classifier can be single-task, or multi-task.""" def __init__(self, params, task_labels='majority'): """Creates a Classifier instance for predicting task_labels. Args: params: a Params instance which includes the hyperparameters of the model task_labels: list of label ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Classifier: """Classifier can be single-task, or multi-task.""" def __init__(self, params, task_labels='majority'): """Creates a Classifier instance for predicting task_labels. Args: params: a Params instance which includes the hyperparameters of the model task_labels: list of label names to be p...
the_stack_v2_python_sparse
multi_annotator/classifier.py
Jimmy-INL/google-research
train
1
a47f9498120a29e4f16877eea28280dd4f216978
[ "if self.INDEX_NAME is None:\n raise Exception('Name of the index cannot be empty.Redefine index name in child class')\nif self.FIELDS is None:\n raise Exception('Fields cannot be empty. Redefine fields in child class')", "if ES_CLIENT is None:\n logging.warning('Elasticsearch is disabled. In order to pr...
<|body_start_0|> if self.INDEX_NAME is None: raise Exception('Name of the index cannot be empty.Redefine index name in child class') if self.FIELDS is None: raise Exception('Fields cannot be empty. Redefine fields in child class') <|end_body_0|> <|body_start_1|> if ES_CL...
Base service for searching.
SearchService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchService: """Base service for searching.""" def __init__(self): """Initialize instance. Raise exception if index name or index fields are empty.""" <|body_0|> def find(self, query_string, *companies): """Search by given string.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k_train_022735
1,536
no_license
[ { "docstring": "Initialize instance. Raise exception if index name or index fields are empty.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Search by given string.", "name": "find", "signature": "def find(self, query_string, *companies)" } ]
2
null
Implement the Python class `SearchService` described below. Class description: Base service for searching. Method signatures and docstrings: - def __init__(self): Initialize instance. Raise exception if index name or index fields are empty. - def find(self, query_string, *companies): Search by given string.
Implement the Python class `SearchService` described below. Class description: Base service for searching. Method signatures and docstrings: - def __init__(self): Initialize instance. Raise exception if index name or index fields are empty. - def find(self, query_string, *companies): Search by given string. <|skelet...
252b0ebd77eefbcc945a0efc3068cc3421f46d5f
<|skeleton|> class SearchService: """Base service for searching.""" def __init__(self): """Initialize instance. Raise exception if index name or index fields are empty.""" <|body_0|> def find(self, query_string, *companies): """Search by given string.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SearchService: """Base service for searching.""" def __init__(self): """Initialize instance. Raise exception if index name or index fields are empty.""" if self.INDEX_NAME is None: raise Exception('Name of the index cannot be empty.Redefine index name in child class') ...
the_stack_v2_python_sparse
common/services/search_service.py
vsokoltsov/Interview360Server
train
2
7a801e9acdcc8f475f7c970f255d822778380653
[ "self.logger = logger\nself.is_trained = False\nself.supported_formats = ['pkl', 'onnx', 'pmml']\nself.name = 'DSVM'\nself.centroids = None\nself.weights = None\nself.sigma = None", "NP = X_b.shape[0]\nNC = self.centroids.shape[0]\nXC2 = -2 * np.dot(X_b, self.centroids.T)\nXC2 += np.sum(np.multiply(X_b, X_b), axi...
<|body_start_0|> self.logger = logger self.is_trained = False self.supported_formats = ['pkl', 'onnx', 'pmml'] self.name = 'DSVM' self.centroids = None self.weights = None self.sigma = None <|end_body_0|> <|body_start_1|> NP = X_b.shape[0] NC = se...
This class contains the Distributed SVM model.
DSVM_model
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DSVM_model: """This class contains the Distributed SVM model.""" def __init__(self, logger): """Create a :class:`DSVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.""" <|body_0|> def predict(self, X_b): """Use th...
stack_v2_sparse_classes_36k_train_022736
19,645
permissive
[ { "docstring": "Create a :class:`DSVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.", "name": "__init__", "signature": "def __init__(self, logger)" }, { "docstring": "Use the model to predict new outputs given for an unlabeled dataset. Paramete...
2
stack_v2_sparse_classes_30k_train_011192
Implement the Python class `DSVM_model` described below. Class description: This class contains the Distributed SVM model. Method signatures and docstrings: - def __init__(self, logger): Create a :class:`DSVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance. - def predi...
Implement the Python class `DSVM_model` described below. Class description: This class contains the Distributed SVM model. Method signatures and docstrings: - def __init__(self, logger): Create a :class:`DSVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance. - def predi...
ccc0a7674a04ae0d00bedc38893b33184c5f68c6
<|skeleton|> class DSVM_model: """This class contains the Distributed SVM model.""" def __init__(self, logger): """Create a :class:`DSVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.""" <|body_0|> def predict(self, X_b): """Use th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DSVM_model: """This class contains the Distributed SVM model.""" def __init__(self, logger): """Create a :class:`DSVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.""" self.logger = logger self.is_trained = False self.supp...
the_stack_v2_python_sparse
MMLL/models/POM1/DSVM/DSVM.py
Musketeer-H2020/MMLL-Robust
train
0
41d20cd35e9631d277dae0697dec0164458843dd
[ "_sorted = [0] * len(_list)\nc_length = max(_list) + 1\nc_list = [0] * c_length\n' Populate c list from provided unsorted list'\nfor number in _list:\n c_list[number] += 1\nc_list = self.run_c_prime(c_list)\n' Populate sorted list'\nfor each in _list:\n _sorted[c_list[each] - 1] = each\n c_list[each] -= 1\...
<|body_start_0|> _sorted = [0] * len(_list) c_length = max(_list) + 1 c_list = [0] * c_length ' Populate c list from provided unsorted list' for number in _list: c_list[number] += 1 c_list = self.run_c_prime(c_list) ' Populate sorted list' for ...
countSort
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class countSort: def run_sort(self, _list): """Sort list of positive integers using the countSort Algorithm""" <|body_0|> def run_c_prime(self, c_list): """Build C` list by summing the x and x-1 elements of the list""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_022737
1,107
no_license
[ { "docstring": "Sort list of positive integers using the countSort Algorithm", "name": "run_sort", "signature": "def run_sort(self, _list)" }, { "docstring": "Build C` list by summing the x and x-1 elements of the list", "name": "run_c_prime", "signature": "def run_c_prime(self, c_list)"...
2
stack_v2_sparse_classes_30k_train_009400
Implement the Python class `countSort` described below. Class description: Implement the countSort class. Method signatures and docstrings: - def run_sort(self, _list): Sort list of positive integers using the countSort Algorithm - def run_c_prime(self, c_list): Build C` list by summing the x and x-1 elements of the ...
Implement the Python class `countSort` described below. Class description: Implement the countSort class. Method signatures and docstrings: - def run_sort(self, _list): Sort list of positive integers using the countSort Algorithm - def run_c_prime(self, c_list): Build C` list by summing the x and x-1 elements of the ...
ea03e60b111423fb2c88a2ea4034560ea7318d51
<|skeleton|> class countSort: def run_sort(self, _list): """Sort list of positive integers using the countSort Algorithm""" <|body_0|> def run_c_prime(self, c_list): """Build C` list by summing the x and x-1 elements of the list""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class countSort: def run_sort(self, _list): """Sort list of positive integers using the countSort Algorithm""" _sorted = [0] * len(_list) c_length = max(_list) + 1 c_list = [0] * c_length ' Populate c list from provided unsorted list' for number in _list: ...
the_stack_v2_python_sparse
countSort/Python/countSort.py
johncanthony/sorts
train
0
98d1d8a708a1b16ac650b4e544af3495781d7e19
[ "tenant_id = request.user.tenant_id\nvpnservices = api.vpn.vpnservice_list(request, tenant_id=tenant_id)\nreturn {'items': [u.to_dict() for u in vpnservices]}", "new_vpnservice = api.vpn.vpnservice_create(request, **request.DATA)\nif new_vpnservice:\n new_vpnservice = api.vpn.vpnservice_get(request, new_vpnser...
<|body_start_0|> tenant_id = request.user.tenant_id vpnservices = api.vpn.vpnservice_list(request, tenant_id=tenant_id) return {'items': [u.to_dict() for u in vpnservices]} <|end_body_0|> <|body_start_1|> new_vpnservice = api.vpn.vpnservice_create(request, **request.DATA) if new...
API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html
VPNServices
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VPNServices: """API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html""" def get(self, request): """Get a list of ikepolicies for a project The listing result is an object with property "items". Each item is a network.""" <|body_0|> def post(...
stack_v2_sparse_classes_36k_train_022738
11,907
permissive
[ { "docstring": "Get a list of ikepolicies for a project The listing result is an object with property \"items\". Each item is a network.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Create VPNService :param request: request context :param admin_state_up: admin state ...
2
stack_v2_sparse_classes_30k_test_000499
Implement the Python class `VPNServices` described below. Class description: API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html Method signatures and docstrings: - def get(self, request): Get a list of ikepolicies for a project The listing result is an object with property "items". Eac...
Implement the Python class `VPNServices` described below. Class description: API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html Method signatures and docstrings: - def get(self, request): Get a list of ikepolicies for a project The listing result is an object with property "items". Eac...
9524f1952461c83db485d5d1702c350b158d7ce0
<|skeleton|> class VPNServices: """API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html""" def get(self, request): """Get a list of ikepolicies for a project The listing result is an object with property "items". Each item is a network.""" <|body_0|> def post(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VPNServices: """API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html""" def get(self, request): """Get a list of ikepolicies for a project The listing result is an object with property "items". Each item is a network.""" tenant_id = request.user.tenant_id ...
the_stack_v2_python_sparse
easystack_dashboard/api/rest/vpn.py
oksbsb/horizon-acc
train
0
f6b1e71ade3babfa4e6a0ca4f0478177dddbdc0a
[ "self.div = float(div)\nself.offset = float(offset)\nself.mult = float(mult)\nsuper(rt_sensor, self).__init__(var, bad_val)", "if abs(self.variable) >= 6999:\n self.result = self.bad_value\n return\nself.result = (self.variable / self.div + self.offset) / self.mult" ]
<|body_start_0|> self.div = float(div) self.offset = float(offset) self.mult = float(mult) super(rt_sensor, self).__init__(var, bad_val) <|end_body_0|> <|body_start_1|> if abs(self.variable) >= 6999: self.result = self.bad_value return self.result...
This class represnts a sensor calibration given by the function processed value = ( ( data_element / val_a ) + val_b ) / val_c
rt_sensor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class rt_sensor: """This class represnts a sensor calibration given by the function processed value = ( ( data_element / val_a ) + val_b ) / val_c""" def __init__(self, var, div, offset, mult, bad_val=6999): """Class initializer Arguments: var: (convertible to float) the domain value div: ...
stack_v2_sparse_classes_36k_train_022739
17,830
no_license
[ { "docstring": "Class initializer Arguments: var: (convertible to float) the domain value div: (convertible to float) a divisor offset: (convertible to float) an offset mult: (convertible to float) a multiplier bad_val: (convertible to int) the value to indicate a bad data item", "name": "__init__", "si...
2
stack_v2_sparse_classes_30k_train_019842
Implement the Python class `rt_sensor` described below. Class description: This class represnts a sensor calibration given by the function processed value = ( ( data_element / val_a ) + val_b ) / val_c Method signatures and docstrings: - def __init__(self, var, div, offset, mult, bad_val=6999): Class initializer Argu...
Implement the Python class `rt_sensor` described below. Class description: This class represnts a sensor calibration given by the function processed value = ( ( data_element / val_a ) + val_b ) / val_c Method signatures and docstrings: - def __init__(self, var, div, offset, mult, bad_val=6999): Class initializer Argu...
95d0c102d649c5b028d262f5254106f997a7c77a
<|skeleton|> class rt_sensor: """This class represnts a sensor calibration given by the function processed value = ( ( data_element / val_a ) + val_b ) / val_c""" def __init__(self, var, div, offset, mult, bad_val=6999): """Class initializer Arguments: var: (convertible to float) the domain value div: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class rt_sensor: """This class represnts a sensor calibration given by the function processed value = ( ( data_element / val_a ) + val_b ) / val_c""" def __init__(self, var, div, offset, mult, bad_val=6999): """Class initializer Arguments: var: (convertible to float) the domain value div: (convertible ...
the_stack_v2_python_sparse
csv_lib/equations.py
rwspicer/csv_utilities
train
1
e4f73538a2c1bbb67fdf791e80a2fd5589b38d54
[ "self.interpreter = tf.lite.Interpreter(model_path=model_path)\nself.interpreter.allocate_tensors()\nself.input_index = self.interpreter.get_input_details()[0]['index']\nself.output_index = self.interpreter.get_output_details()[0]['index']", "self.interpreter.set_tensor(self.input_index, image)\nself.interpreter....
<|body_start_0|> self.interpreter = tf.lite.Interpreter(model_path=model_path) self.interpreter.allocate_tensors() self.input_index = self.interpreter.get_input_details()[0]['index'] self.output_index = self.interpreter.get_output_details()[0]['index'] <|end_body_0|> <|body_start_1|> ...
Wrapper to run TFLite model.
TFLiteRunner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TFLiteRunner: """Wrapper to run TFLite model.""" def __init__(self, model_path): """Init. Args: model_path: str, path to tflite model.""" <|body_0|> def run(self, image): """Run inference on a single images. Args: image: numpy.ndarray of shape [1, H, W, C]. Retur...
stack_v2_sparse_classes_36k_train_022740
3,244
permissive
[ { "docstring": "Init. Args: model_path: str, path to tflite model.", "name": "__init__", "signature": "def __init__(self, model_path)" }, { "docstring": "Run inference on a single images. Args: image: numpy.ndarray of shape [1, H, W, C]. Returns: prediction: numpy.ndarray of shape [1, num_detect...
2
stack_v2_sparse_classes_30k_train_004526
Implement the Python class `TFLiteRunner` described below. Class description: Wrapper to run TFLite model. Method signatures and docstrings: - def __init__(self, model_path): Init. Args: model_path: str, path to tflite model. - def run(self, image): Run inference on a single images. Args: image: numpy.ndarray of shap...
Implement the Python class `TFLiteRunner` described below. Class description: Wrapper to run TFLite model. Method signatures and docstrings: - def __init__(self, model_path): Init. Args: model_path: str, path to tflite model. - def run(self, image): Run inference on a single images. Args: image: numpy.ndarray of shap...
c7392f2bab3165244d1c565b66409fa11fa82367
<|skeleton|> class TFLiteRunner: """Wrapper to run TFLite model.""" def __init__(self, model_path): """Init. Args: model_path: str, path to tflite model.""" <|body_0|> def run(self, image): """Run inference on a single images. Args: image: numpy.ndarray of shape [1, H, W, C]. Retur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TFLiteRunner: """Wrapper to run TFLite model.""" def __init__(self, model_path): """Init. Args: model_path: str, path to tflite model.""" self.interpreter = tf.lite.Interpreter(model_path=model_path) self.interpreter.allocate_tensors() self.input_index = self.interpreter.g...
the_stack_v2_python_sparse
efficientdet/run_tflite.py
google/automl
train
6,415
aa7b06d4c33494cafd7a746fa40b3329c1105c38
[ "nn.Module.__init__(self)\nself.params = {'side': side, 'scale': scale}\nvoxels = torch.zeros((1, 4, side, side, side), dtype=torch.float32)\nself.voxels = nn.Parameter(voxels)\nbias = torch.zeros(4, dtype=torch.float32)\nbias[:3] = torch.logit(torch.FloatTensor([1e-05, 1e-05, 1e-05]))\nbias[3] = -2\nself.bias = nn...
<|body_start_0|> nn.Module.__init__(self) self.params = {'side': side, 'scale': scale} voxels = torch.zeros((1, 4, side, side, side), dtype=torch.float32) self.voxels = nn.Parameter(voxels) bias = torch.zeros(4, dtype=torch.float32) bias[:3] = torch.logit(torch.FloatTenso...
A voxel based radiance field model.
Voxels
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Voxels: """A voxel based radiance field model.""" def __init__(self, side: int, scale: float): """Constructor. Args: side (int): The number of voxels on one side of a cube. scale (float): The scale of the voxel volume, equivalent to half of one side of the volume, i.e. a scale of 1 i...
stack_v2_sparse_classes_36k_train_022741
17,353
no_license
[ { "docstring": "Constructor. Args: side (int): The number of voxels on one side of a cube. scale (float): The scale of the voxel volume, equivalent to half of one side of the volume, i.e. a scale of 1 indicates a volume of size 2x2x2.", "name": "__init__", "signature": "def __init__(self, side: int, sca...
3
null
Implement the Python class `Voxels` described below. Class description: A voxel based radiance field model. Method signatures and docstrings: - def __init__(self, side: int, scale: float): Constructor. Args: side (int): The number of voxels on one side of a cube. scale (float): The scale of the voxel volume, equivale...
Implement the Python class `Voxels` described below. Class description: A voxel based radiance field model. Method signatures and docstrings: - def __init__(self, side: int, scale: float): Constructor. Args: side (int): The number of voxels on one side of a cube. scale (float): The scale of the voxel volume, equivale...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class Voxels: """A voxel based radiance field model.""" def __init__(self, side: int, scale: float): """Constructor. Args: side (int): The number of voxels on one side of a cube. scale (float): The scale of the voxel volume, equivalent to half of one side of the volume, i.e. a scale of 1 i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Voxels: """A voxel based radiance field model.""" def __init__(self, side: int, scale: float): """Constructor. Args: side (int): The number of voxels on one side of a cube. scale (float): The scale of the voxel volume, equivalent to half of one side of the volume, i.e. a scale of 1 indicates a vo...
the_stack_v2_python_sparse
generated/test_matajoh_fourier_feature_nets.py
jansel/pytorch-jit-paritybench
train
35
184a439cb9211ffe1c6a0a9cbd78e290bb067ddb
[ "self.defaultElementWidth, self.defaultElementHeight = (50, 50)\nself.defaultLabelWidth, self.defaultLabelHeight = (30, 10)\nself.context = context\nself.context.new_path()", "if alpha is None:\n context.set_source_rgb(float(r) / 255.0, float(g) / 255.0, float(b) / 255.0)\nelse:\n context.set_source_rgba(fl...
<|body_start_0|> self.defaultElementWidth, self.defaultElementHeight = (50, 50) self.defaultLabelWidth, self.defaultLabelHeight = (30, 10) self.context = context self.context.new_path() <|end_body_0|> <|body_start_1|> if alpha is None: context.set_source_rgb(float(r)...
Base class for drawing objects
CBaseDrawing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CBaseDrawing: """Base class for drawing objects""" def __init__(self, context): """Constructor @type context: CairoContext @param context: cairo context, will be painted on this context""" <|body_0|> def ChangeColor(self, context, r, g, b, alpha=None): """Change ...
stack_v2_sparse_classes_36k_train_022742
1,264
no_license
[ { "docstring": "Constructor @type context: CairoContext @param context: cairo context, will be painted on this context", "name": "__init__", "signature": "def __init__(self, context)" }, { "docstring": "Change color on given context @type context: CairoContext @param context: cairo context on wh...
2
stack_v2_sparse_classes_30k_train_019161
Implement the Python class `CBaseDrawing` described below. Class description: Base class for drawing objects Method signatures and docstrings: - def __init__(self, context): Constructor @type context: CairoContext @param context: cairo context, will be painted on this context - def ChangeColor(self, context, r, g, b,...
Implement the Python class `CBaseDrawing` described below. Class description: Base class for drawing objects Method signatures and docstrings: - def __init__(self, context): Constructor @type context: CairoContext @param context: cairo context, will be painted on this context - def ChangeColor(self, context, r, g, b,...
eb050a93ef955b8fbc184a437cb0e6fae54264cd
<|skeleton|> class CBaseDrawing: """Base class for drawing objects""" def __init__(self, context): """Constructor @type context: CairoContext @param context: cairo context, will be painted on this context""" <|body_0|> def ChangeColor(self, context, r, g, b, alpha=None): """Change ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CBaseDrawing: """Base class for drawing objects""" def __init__(self, context): """Constructor @type context: CairoContext @param context: cairo context, will be painted on this context""" self.defaultElementWidth, self.defaultElementHeight = (50, 50) self.defaultLabelWidth, self....
the_stack_v2_python_sparse
plugin/gui/BaseDrawing.py
umlfri-old/addon_team
train
0
1785389d5818d508743bd63d5053077ab499dba3
[ "super(LstmSeqClassificationModel, self).__init__()\nself.padding_idx = padding_idx\nself.embedder = nn.Embedding(vocab_size, emb_dim, padding_idx=padding_idx)\nself.layer_norm = nn.LayerNorm(normalized_shape=emb_dim, epsilon=epsilon)\nself.dropout = nn.Dropout(p=dropout_rate)\ndirection = 'bidirectional' if is_bid...
<|body_start_0|> super(LstmSeqClassificationModel, self).__init__() self.padding_idx = padding_idx self.embedder = nn.Embedding(vocab_size, emb_dim, padding_idx=padding_idx) self.layer_norm = nn.LayerNorm(normalized_shape=emb_dim, epsilon=epsilon) self.dropout = nn.Dropout(p=drop...
Lstm model for seq classification task.
LstmSeqClassificationModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LstmSeqClassificationModel: """Lstm model for seq classification task.""" def __init__(self, vocab_size, num_class, emb_dim=512, hidden_size=512, n_lstm_layer=3, is_bidirectory=True, padding_idx=0, epsilon=1e-05, dropout_rate=0.1): """Init model Args: vocab_size (int): vocab size. nu...
stack_v2_sparse_classes_36k_train_022743
10,112
permissive
[ { "docstring": "Init model Args: vocab_size (int): vocab size. num_class (int): num of classes. emb_dim (int, optional): embedding dimmension. Defaults to 512. hidden_size (int, optional): hidden size. Defaults to 512. n_lstm_layer (int, optional): number of lstm layer. Defaults to 3. is_bidirectory (bool, opti...
4
stack_v2_sparse_classes_30k_val_000400
Implement the Python class `LstmSeqClassificationModel` described below. Class description: Lstm model for seq classification task. Method signatures and docstrings: - def __init__(self, vocab_size, num_class, emb_dim=512, hidden_size=512, n_lstm_layer=3, is_bidirectory=True, padding_idx=0, epsilon=1e-05, dropout_rat...
Implement the Python class `LstmSeqClassificationModel` described below. Class description: Lstm model for seq classification task. Method signatures and docstrings: - def __init__(self, vocab_size, num_class, emb_dim=512, hidden_size=512, n_lstm_layer=3, is_bidirectory=True, padding_idx=0, epsilon=1e-05, dropout_rat...
1c84ea6d51625d2d66b3eef1d9a7cc9a87c99e0e
<|skeleton|> class LstmSeqClassificationModel: """Lstm model for seq classification task.""" def __init__(self, vocab_size, num_class, emb_dim=512, hidden_size=512, n_lstm_layer=3, is_bidirectory=True, padding_idx=0, epsilon=1e-05, dropout_rate=0.1): """Init model Args: vocab_size (int): vocab size. nu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LstmSeqClassificationModel: """Lstm model for seq classification task.""" def __init__(self, vocab_size, num_class, emb_dim=512, hidden_size=512, n_lstm_layer=3, is_bidirectory=True, padding_idx=0, epsilon=1e-05, dropout_rate=0.1): """Init model Args: vocab_size (int): vocab size. num_class (int)...
the_stack_v2_python_sparse
apps/pretrained_protein/tape_dynamic/protein_sequence_model_dynamic.py
RuikangSun/PaddleHelix
train
0
da6597fde34803c359fcf0a6b6d46bba2acfe257
[ "response = self.client.post('/users/signup', {'email': self.email, 'password': self.password, 'confirm_password': self.password, 'firstname': 'Andrew', 'phone': self.phone})\ndata = response.content\ndata = loads(data)\nreturn data", "response = self.client.post('/users/signin', {'email': self.email, 'password':...
<|body_start_0|> response = self.client.post('/users/signup', {'email': self.email, 'password': self.password, 'confirm_password': self.password, 'firstname': 'Andrew', 'phone': self.phone}) data = response.content data = loads(data) return data <|end_body_0|> <|body_start_1|> r...
Products test. Tests for .
TestProductsView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestProductsView: """Products test. Tests for .""" def signUp_user(self): """Signup fixture. A fixture that signs up a user first""" <|body_0|> def logs_user_in(self, signUp_user): """Log a user in.""" <|body_1|> def test_empty_productName(self, logs...
stack_v2_sparse_classes_36k_train_022744
3,468
permissive
[ { "docstring": "Signup fixture. A fixture that signs up a user first", "name": "signUp_user", "signature": "def signUp_user(self)" }, { "docstring": "Log a user in.", "name": "logs_user_in", "signature": "def logs_user_in(self, signUp_user)" }, { "docstring": "Tests an empty prod...
6
stack_v2_sparse_classes_30k_train_013356
Implement the Python class `TestProductsView` described below. Class description: Products test. Tests for . Method signatures and docstrings: - def signUp_user(self): Signup fixture. A fixture that signs up a user first - def logs_user_in(self, signUp_user): Log a user in. - def test_empty_productName(self, logs_use...
Implement the Python class `TestProductsView` described below. Class description: Products test. Tests for . Method signatures and docstrings: - def signUp_user(self): Signup fixture. A fixture that signs up a user first - def logs_user_in(self, signUp_user): Log a user in. - def test_empty_productName(self, logs_use...
a5f5b3df935d35c7d874b41bffb57069239dcdfd
<|skeleton|> class TestProductsView: """Products test. Tests for .""" def signUp_user(self): """Signup fixture. A fixture that signs up a user first""" <|body_0|> def logs_user_in(self, signUp_user): """Log a user in.""" <|body_1|> def test_empty_productName(self, logs...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestProductsView: """Products test. Tests for .""" def signUp_user(self): """Signup fixture. A fixture that signs up a user first""" response = self.client.post('/users/signup', {'email': self.email, 'password': self.password, 'confirm_password': self.password, 'firstname': 'Andrew', 'pho...
the_stack_v2_python_sparse
items/tests.py
Njaya2019/Store
train
0
fa1427fa9a6d84ce1a50449404e9fe79792ff85a
[ "def gcd(a, b):\n while b != 0:\n tmp = b\n b = a % b\n a = tmp\n return a\nif x + y < z:\n return False\nif x == z or y == z or x + y == z:\n return True\nreturn z % gcd(x, y) == 0", "import collections\nvisited = collections.defaultdict(dict)\nq = collections.deque([(0, 0)])\nwh...
<|body_start_0|> def gcd(a, b): while b != 0: tmp = b b = a % b a = tmp return a if x + y < z: return False if x == z or y == z or x + y == z: return True return z % gcd(x, y) == 0 <|end_body_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canMeasureWater(self, x, y, z): """:type x: int :type y: int :type z: int :rtype: bool""" <|body_0|> def canMeasureWater_BFS(self, x, y, z): """:type x: int :type y: int :type z: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_022745
2,358
no_license
[ { "docstring": ":type x: int :type y: int :type z: int :rtype: bool", "name": "canMeasureWater", "signature": "def canMeasureWater(self, x, y, z)" }, { "docstring": ":type x: int :type y: int :type z: int :rtype: bool", "name": "canMeasureWater_BFS", "signature": "def canMeasureWater_BFS...
2
stack_v2_sparse_classes_30k_train_008026
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canMeasureWater(self, x, y, z): :type x: int :type y: int :type z: int :rtype: bool - def canMeasureWater_BFS(self, x, y, z): :type x: int :type y: int :type z: int :rtype: b...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canMeasureWater(self, x, y, z): :type x: int :type y: int :type z: int :rtype: bool - def canMeasureWater_BFS(self, x, y, z): :type x: int :type y: int :type z: int :rtype: b...
0a7aa09a2b95e4caca5b5123fb735ceb5c01e992
<|skeleton|> class Solution: def canMeasureWater(self, x, y, z): """:type x: int :type y: int :type z: int :rtype: bool""" <|body_0|> def canMeasureWater_BFS(self, x, y, z): """:type x: int :type y: int :type z: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canMeasureWater(self, x, y, z): """:type x: int :type y: int :type z: int :rtype: bool""" def gcd(a, b): while b != 0: tmp = b b = a % b a = tmp return a if x + y < z: return False ...
the_stack_v2_python_sparse
water-and-jug-problem.py
onestarshang/leetcode
train
0
0e8cbfb84dec57524f22488932eaf20f592fc9d5
[ "with tf.variable_scope(name, reuse=tf.AUTO_REUSE):\n self.wa = tf.get_variable('Wa', shape=[hidden_dim, hidden_dim])\n self.ba = tf.get_variable('ba', shape=[hidden_dim], initializer=tf.zeros_initializer())\n self.wx = tf.get_variable('Wx', shape=[input_dim, hidden_dim])\n self.T = T\n self.input_di...
<|body_start_0|> with tf.variable_scope(name, reuse=tf.AUTO_REUSE): self.wa = tf.get_variable('Wa', shape=[hidden_dim, hidden_dim]) self.ba = tf.get_variable('ba', shape=[hidden_dim], initializer=tf.zeros_initializer()) self.wx = tf.get_variable('Wx', shape=[input_dim, hidden...
RNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNN: def __init__(self, T=40, input_dim=1000, hidden_dim=512, name='rnn'): """:param T:how many steps :param input_dim: :param hidden_dim: :param name: variable scope name :return NOne :define Wa,Wx,Ba,with shape[hidde,hidden],[input,hidden],[hidde]""" <|body_0|> def _rnnCel...
stack_v2_sparse_classes_36k_train_022746
1,501
no_license
[ { "docstring": ":param T:how many steps :param input_dim: :param hidden_dim: :param name: variable scope name :return NOne :define Wa,Wx,Ba,with shape[hidde,hidden],[input,hidden],[hidde]", "name": "__init__", "signature": "def __init__(self, T=40, input_dim=1000, hidden_dim=512, name='rnn')" }, { ...
3
null
Implement the Python class `RNN` described below. Class description: Implement the RNN class. Method signatures and docstrings: - def __init__(self, T=40, input_dim=1000, hidden_dim=512, name='rnn'): :param T:how many steps :param input_dim: :param hidden_dim: :param name: variable scope name :return NOne :define Wa,...
Implement the Python class `RNN` described below. Class description: Implement the RNN class. Method signatures and docstrings: - def __init__(self, T=40, input_dim=1000, hidden_dim=512, name='rnn'): :param T:how many steps :param input_dim: :param hidden_dim: :param name: variable scope name :return NOne :define Wa,...
24e60f24b6e442db22507adddd6bf3e2c343c013
<|skeleton|> class RNN: def __init__(self, T=40, input_dim=1000, hidden_dim=512, name='rnn'): """:param T:how many steps :param input_dim: :param hidden_dim: :param name: variable scope name :return NOne :define Wa,Wx,Ba,with shape[hidde,hidden],[input,hidden],[hidde]""" <|body_0|> def _rnnCel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNN: def __init__(self, T=40, input_dim=1000, hidden_dim=512, name='rnn'): """:param T:how many steps :param input_dim: :param hidden_dim: :param name: variable scope name :return NOne :define Wa,Wx,Ba,with shape[hidde,hidden],[input,hidden],[hidde]""" with tf.variable_scope(name, reuse=tf.AUT...
the_stack_v2_python_sparse
daily/8/DeepLearning/project/rnn/Rnn.py
mckjzhangxk/deepAI
train
1
1f48ed023f0819fd5b96a6281bfa6273d7c8204f
[ "try:\n import netifaces\nexcept ImportError:\n raise ImportError('netifaces must be installed to configure WiFi')\nself.wifi_port = None\nnet_device_list = netifaces.interfaces()\nif interface in net_device_list:\n self.wifi_port = interface\nelse:\n for net_device in net_device_list:\n if net_d...
<|body_start_0|> try: import netifaces except ImportError: raise ImportError('netifaces must be installed to configure WiFi') self.wifi_port = None net_device_list = netifaces.interfaces() if interface in net_device_list: self.wifi_port = inter...
This class controls the WiFi connection. For USB WiFi, RALink RT5370 devices are recommended. Note ---- Administrator rights are necessary to create network interface file Attributes ---------- wifi_port : str string identifier of the wireless network device
Wifi
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Wifi: """This class controls the WiFi connection. For USB WiFi, RALink RT5370 devices are recommended. Note ---- Administrator rights are necessary to create network interface file Attributes ---------- wifi_port : str string identifier of the wireless network device""" def __init__(self, in...
stack_v2_sparse_classes_36k_train_022747
6,783
permissive
[ { "docstring": "Initializes the wireless connection and assign devices identifier. Network devices are checked to find wireless components. Program will first try the default wireless interface name `wlan0`; if not found, it will look for interface name starting from `wl`. Parameters ---------- interface : str ...
4
stack_v2_sparse_classes_30k_train_004105
Implement the Python class `Wifi` described below. Class description: This class controls the WiFi connection. For USB WiFi, RALink RT5370 devices are recommended. Note ---- Administrator rights are necessary to create network interface file Attributes ---------- wifi_port : str string identifier of the wireless netwo...
Implement the Python class `Wifi` described below. Class description: This class controls the WiFi connection. For USB WiFi, RALink RT5370 devices are recommended. Note ---- Administrator rights are necessary to create network interface file Attributes ---------- wifi_port : str string identifier of the wireless netwo...
38e9fcee46f0839e83e123cf22af76b13671a574
<|skeleton|> class Wifi: """This class controls the WiFi connection. For USB WiFi, RALink RT5370 devices are recommended. Note ---- Administrator rights are necessary to create network interface file Attributes ---------- wifi_port : str string identifier of the wireless network device""" def __init__(self, in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Wifi: """This class controls the WiFi connection. For USB WiFi, RALink RT5370 devices are recommended. Note ---- Administrator rights are necessary to create network interface file Attributes ---------- wifi_port : str string identifier of the wireless network device""" def __init__(self, interface='wlan...
the_stack_v2_python_sparse
pynq/lib/wifi.py
yunqu/PYNQ
train
8
ae2ea5c8d15cdc3752b837d279f94b4e5b1a7ad8
[ "self.utils = utils.SearchUtils()\nself.logger = self.utils.logger\nself._coordinate = coordinate_search_handler.CoordinateSearch()\nself._geplaces = geplaces_search_handler.PlacesSearch()\nself._style = self._geplaces.style", "search_results = ''\nsearch_status = False\nparameters = self.utils.GetParameters(envi...
<|body_start_0|> self.utils = utils.SearchUtils() self.logger = self.utils.logger self._coordinate = coordinate_search_handler.CoordinateSearch() self._geplaces = geplaces_search_handler.PlacesSearch() self._style = self._geplaces.style <|end_body_0|> <|body_start_1|> se...
Class for performing the Federated search. We initially submit the search against the CoordinateSearch, stopping there if any positive results are returned. If not, we issue our search against the GEPlacesSearch. If there is a valid response from any of the searches, we use it. If not, then we can assume that 'location...
FederatedSearch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FederatedSearch: """Class for performing the Federated search. We initially submit the search against the CoordinateSearch, stopping there if any positive results are returned. If not, we issue our search against the GEPlacesSearch. If there is a valid response from any of the searches, we use it...
stack_v2_sparse_classes_36k_train_022748
5,027
permissive
[ { "docstring": "Inits FederatedSearch. Initializes the logger \"ge_search\".", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Fetches the search tokens from form and performs the federated search. Args: environ: A list of environment variables as supplied by the WSGI in...
3
stack_v2_sparse_classes_30k_train_018656
Implement the Python class `FederatedSearch` described below. Class description: Class for performing the Federated search. We initially submit the search against the CoordinateSearch, stopping there if any positive results are returned. If not, we issue our search against the GEPlacesSearch. If there is a valid respo...
Implement the Python class `FederatedSearch` described below. Class description: Class for performing the Federated search. We initially submit the search against the CoordinateSearch, stopping there if any positive results are returned. If not, we issue our search against the GEPlacesSearch. If there is a valid respo...
f7ea83f769485d9c28021b951fec8f15f641b16c
<|skeleton|> class FederatedSearch: """Class for performing the Federated search. We initially submit the search against the CoordinateSearch, stopping there if any positive results are returned. If not, we issue our search against the GEPlacesSearch. If there is a valid response from any of the searches, we use it...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FederatedSearch: """Class for performing the Federated search. We initially submit the search against the CoordinateSearch, stopping there if any positive results are returned. If not, we issue our search against the GEPlacesSearch. If there is a valid response from any of the searches, we use it. If not, the...
the_stack_v2_python_sparse
earth_enterprise/src/server/wsgi/search/plugin/federated_search_handler.py
tst-ccamp/earthenterprise
train
2
9fe18658a43d2b99dd84819b1e9aa2b603f41a22
[ "super(Mixer, self).__init__()\nself.n_agents = agent_num\nself.state_dim = state_dim\nself.embed_dim = mixing_embed_dim\nself.hyper_w_1 = nn.Sequential(nn.Linear(self.state_dim, hypernet_embed), nn.ReLU(), nn.Linear(hypernet_embed, self.embed_dim * self.n_agents))\nself.hyper_w_final = nn.Sequential(nn.Linear(self...
<|body_start_0|> super(Mixer, self).__init__() self.n_agents = agent_num self.state_dim = state_dim self.embed_dim = mixing_embed_dim self.hyper_w_1 = nn.Sequential(nn.Linear(self.state_dim, hypernet_embed), nn.ReLU(), nn.Linear(hypernet_embed, self.embed_dim * self.n_agents)) ...
Overview: mixer network in QMIX, which mix up the independent q_value of each agent to a total q_value Interface: __init__, forward
Mixer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mixer: """Overview: mixer network in QMIX, which mix up the independent q_value of each agent to a total q_value Interface: __init__, forward""" def __init__(self, agent_num, state_dim, mixing_embed_dim, hypernet_embed=64): """Overview: initialize pymarl mixer network Arguments: - ag...
stack_v2_sparse_classes_36k_train_022749
27,383
permissive
[ { "docstring": "Overview: initialize pymarl mixer network Arguments: - agent_num (:obj:`int`): the number of agent - state_dim(:obj:`int`): the dimension of global observation state - mixing_embed_dim (:obj:`int`): the dimension of mixing state emdedding - hypernet_embed (:obj:`int`): the dimension of hypernet ...
2
stack_v2_sparse_classes_30k_train_007528
Implement the Python class `Mixer` described below. Class description: Overview: mixer network in QMIX, which mix up the independent q_value of each agent to a total q_value Interface: __init__, forward Method signatures and docstrings: - def __init__(self, agent_num, state_dim, mixing_embed_dim, hypernet_embed=64): ...
Implement the Python class `Mixer` described below. Class description: Overview: mixer network in QMIX, which mix up the independent q_value of each agent to a total q_value Interface: __init__, forward Method signatures and docstrings: - def __init__(self, agent_num, state_dim, mixing_embed_dim, hypernet_embed=64): ...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class Mixer: """Overview: mixer network in QMIX, which mix up the independent q_value of each agent to a total q_value Interface: __init__, forward""" def __init__(self, agent_num, state_dim, mixing_embed_dim, hypernet_embed=64): """Overview: initialize pymarl mixer network Arguments: - ag...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mixer: """Overview: mixer network in QMIX, which mix up the independent q_value of each agent to a total q_value Interface: __init__, forward""" def __init__(self, agent_num, state_dim, mixing_embed_dim, hypernet_embed=64): """Overview: initialize pymarl mixer network Arguments: - agent_num (:obj...
the_stack_v2_python_sparse
ding/model/template/qmix.py
shengxuesun/DI-engine
train
1
0e696fdedb301998bdb810f81561e5c587b8e6c2
[ "f = 1.0\nr = 0\nwhile i > 0:\n f = f / b\n r = r + f * (i % b)\n i = floor(i / float(b))\nreturn r", "self.npart = npart\nself.ndim = ndim\nself.bounds = bounds\nself.k = k\nself.jitter = jitter\nself.primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 9...
<|body_start_0|> f = 1.0 r = 0 while i > 0: f = f / b r = r + f * (i % b) i = floor(i / float(b)) return r <|end_body_0|> <|body_start_1|> self.npart = npart self.ndim = ndim self.bounds = bounds self.k = k self...
Initialize a swarm quasirandomly
QuasirandomInitializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuasirandomInitializer: """Initialize a swarm quasirandomly""" def Halton(self, i, b): """Return i-th Halton number for the given base""" <|body_0|> def __init__(self, npart=10, ndim=3, bounds=None, k=1, jitter=0.0): """Constructor""" <|body_1|> def ...
stack_v2_sparse_classes_36k_train_022750
2,701
permissive
[ { "docstring": "Return i-th Halton number for the given base", "name": "Halton", "signature": "def Halton(self, i, b)" }, { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, npart=10, ndim=3, bounds=None, k=1, jitter=0.0)" }, { "docstring": "Return ...
3
stack_v2_sparse_classes_30k_train_013724
Implement the Python class `QuasirandomInitializer` described below. Class description: Initialize a swarm quasirandomly Method signatures and docstrings: - def Halton(self, i, b): Return i-th Halton number for the given base - def __init__(self, npart=10, ndim=3, bounds=None, k=1, jitter=0.0): Constructor - def Init...
Implement the Python class `QuasirandomInitializer` described below. Class description: Initialize a swarm quasirandomly Method signatures and docstrings: - def Halton(self, i, b): Return i-th Halton number for the given base - def __init__(self, npart=10, ndim=3, bounds=None, k=1, jitter=0.0): Constructor - def Init...
5445b6f90ab49339ca0fdb71e98d44e6827c95a8
<|skeleton|> class QuasirandomInitializer: """Initialize a swarm quasirandomly""" def Halton(self, i, b): """Return i-th Halton number for the given base""" <|body_0|> def __init__(self, npart=10, ndim=3, bounds=None, k=1, jitter=0.0): """Constructor""" <|body_1|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuasirandomInitializer: """Initialize a swarm quasirandomly""" def Halton(self, i, b): """Return i-th Halton number for the given base""" f = 1.0 r = 0 while i > 0: f = f / b r = r + f * (i % b) i = floor(i / float(b)) return r ...
the_stack_v2_python_sparse
QuasirandomInitializer.py
dayoladejo/SwarmOptimization
train
0
876d1d26635d85f2f94a706ea78757ce80e3824d
[ "if 'odd' == 'odd':\n arrayextension = 5\nelse:\n arrayextension = 0\narraylength = 96 + arrayextension\nMaxVal = 255\nMinVal = 0\nself.gentest = bytearray([MaxVal // 2] * arraylength)", "with self.assertRaises(TypeError):\n result = bytesfunc.bmin(1)\nwith self.assertRaises(TypeError):\n result = min...
<|body_start_0|> if 'odd' == 'odd': arrayextension = 5 else: arrayextension = 0 arraylength = 96 + arrayextension MaxVal = 255 MinVal = 0 self.gentest = bytearray([MaxVal // 2] * arraylength) <|end_body_0|> <|body_start_1|> with self.asser...
Test bmin for basic parameter tests. op_template_params
bmin_parameter_odd_arraysize_with_simd_bytearray
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class bmin_parameter_odd_arraysize_with_simd_bytearray: """Test bmin for basic parameter tests. op_template_params""" def setUp(self): """Initialise.""" <|body_0|> def test_bmin_param_function_01(self): """Test bmin - Sequence type bytearray. Test invalid parameter typ...
stack_v2_sparse_classes_36k_train_022751
49,998
permissive
[ { "docstring": "Initialise.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test bmin - Sequence type bytearray. Test invalid parameter type odd length array with SIMD.", "name": "test_bmin_param_function_01", "signature": "def test_bmin_param_function_01(self)" },...
5
stack_v2_sparse_classes_30k_train_014711
Implement the Python class `bmin_parameter_odd_arraysize_with_simd_bytearray` described below. Class description: Test bmin for basic parameter tests. op_template_params Method signatures and docstrings: - def setUp(self): Initialise. - def test_bmin_param_function_01(self): Test bmin - Sequence type bytearray. Test ...
Implement the Python class `bmin_parameter_odd_arraysize_with_simd_bytearray` described below. Class description: Test bmin for basic parameter tests. op_template_params Method signatures and docstrings: - def setUp(self): Initialise. - def test_bmin_param_function_01(self): Test bmin - Sequence type bytearray. Test ...
28fe0705fc59b0646a4d44e539c919173e8e8b99
<|skeleton|> class bmin_parameter_odd_arraysize_with_simd_bytearray: """Test bmin for basic parameter tests. op_template_params""" def setUp(self): """Initialise.""" <|body_0|> def test_bmin_param_function_01(self): """Test bmin - Sequence type bytearray. Test invalid parameter typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class bmin_parameter_odd_arraysize_with_simd_bytearray: """Test bmin for basic parameter tests. op_template_params""" def setUp(self): """Initialise.""" if 'odd' == 'odd': arrayextension = 5 else: arrayextension = 0 arraylength = 96 + arrayextension ...
the_stack_v2_python_sparse
unittest/test_bmin.py
m1griffin/bytesfunc
train
2
fba92b565b0b80e6da232dba71044d76188fa657
[ "user = self.request.user\nif not user.profile.has_backdated:\n backdate_user(user.profile)\nreturn user", "user = self.request.user\ncontext = super().get_context_data(**kwargs)\nif not user.profile.has_backdated:\n backdate_user(user.profile)\nmemberships = user.membership_set.all().order_by('group__name'...
<|body_start_0|> user = self.request.user if not user.profile.has_backdated: backdate_user(user.profile) return user <|end_body_0|> <|body_start_1|> user = self.request.user context = super().get_context_data(**kwargs) if not user.profile.has_backdated: ...
View for a user's dashboard.
UserDetailView
[ "MIT", "AGPL-3.0-only", "ISC", "LGPL-2.1-or-later", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserDetailView: """View for a user's dashboard.""" def get_object(self): """Get object for template.""" <|body_0|> def get_context_data(self, **kwargs): """Get additional context data for template.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022752
16,961
permissive
[ { "docstring": "Get object for template.", "name": "get_object", "signature": "def get_object(self)" }, { "docstring": "Get additional context data for template.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
null
Implement the Python class `UserDetailView` described below. Class description: View for a user's dashboard. Method signatures and docstrings: - def get_object(self): Get object for template. - def get_context_data(self, **kwargs): Get additional context data for template.
Implement the Python class `UserDetailView` described below. Class description: View for a user's dashboard. Method signatures and docstrings: - def get_object(self): Get object for template. - def get_context_data(self, **kwargs): Get additional context data for template. <|skeleton|> class UserDetailView: """V...
5b668eb66449e2ebaeb2177237b9a55a14d69efb
<|skeleton|> class UserDetailView: """View for a user's dashboard.""" def get_object(self): """Get object for template.""" <|body_0|> def get_context_data(self, **kwargs): """Get additional context data for template.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserDetailView: """View for a user's dashboard.""" def get_object(self): """Get object for template.""" user = self.request.user if not user.profile.has_backdated: backdate_user(user.profile) return user def get_context_data(self, **kwargs): """Get...
the_stack_v2_python_sparse
codewof/users/views.py
uccser/codewof
train
7
c1c91c5e57ec59ebc0286711031602876e1e37e7
[ "actions = self._default_attribute_actions.copy()\nactions['href'] = 'must'\nactions['title'] = 'drop'\nactions['class'] = 'keep'\nconverted = self._visit_open(node, children, actions)\nattrs = converted.attributes.attrs\nif 'href' in attrs:\n href = attrs['href'].value\n if href and href[0] == '/':\n ...
<|body_start_0|> actions = self._default_attribute_actions.copy() actions['href'] = 'must' actions['title'] = 'drop' actions['class'] = 'keep' converted = self._visit_open(node, children, actions) attrs = converted.attributes.attrs if 'href' in attrs: ...
Extract HTML structure from a MDN Kuma raw fragment. Include extra policy for scraping pages for the importer: - Converts <span>content</span> to "content", with issues - Validate and cleanup <a> tags - Keeps <div id="foo">, for detecting compat divs - Keeps <td colspan=# rowspan=#>, for detecting spanning compat cells...
KumaVisitor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KumaVisitor: """Extract HTML structure from a MDN Kuma raw fragment. Include extra policy for scraping pages for the importer: - Converts <span>content</span> to "content", with issues - Validate and cleanup <a> tags - Keeps <div id="foo">, for detecting compat divs - Keeps <td colspan=# rowspan=...
stack_v2_sparse_classes_36k_train_022753
38,117
no_license
[ { "docstring": "Validate and cleanup <a> open tags.", "name": "visit_a_open", "signature": "def visit_a_open(self, node, children)" }, { "docstring": "Retain id attribute of <div> tags.", "name": "visit_div_open", "signature": "def visit_div_open(self, node, children)" }, { "docs...
5
stack_v2_sparse_classes_30k_train_019831
Implement the Python class `KumaVisitor` described below. Class description: Extract HTML structure from a MDN Kuma raw fragment. Include extra policy for scraping pages for the importer: - Converts <span>content</span> to "content", with issues - Validate and cleanup <a> tags - Keeps <div id="foo">, for detecting com...
Implement the Python class `KumaVisitor` described below. Class description: Extract HTML structure from a MDN Kuma raw fragment. Include extra policy for scraping pages for the importer: - Converts <span>content</span> to "content", with issues - Validate and cleanup <a> tags - Keeps <div id="foo">, for detecting com...
bc092964153b03381aaff74a4d80f43a2b2dec19
<|skeleton|> class KumaVisitor: """Extract HTML structure from a MDN Kuma raw fragment. Include extra policy for scraping pages for the importer: - Converts <span>content</span> to "content", with issues - Validate and cleanup <a> tags - Keeps <div id="foo">, for detecting compat divs - Keeps <td colspan=# rowspan=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KumaVisitor: """Extract HTML structure from a MDN Kuma raw fragment. Include extra policy for scraping pages for the importer: - Converts <span>content</span> to "content", with issues - Validate and cleanup <a> tags - Keeps <div id="foo">, for detecting compat divs - Keeps <td colspan=# rowspan=#>, for detec...
the_stack_v2_python_sparse
browsercompat/mdn/kumascript.py
WeilerWebServices/MDN-Web-Docs
train
1
790b4ef362190da006623b1aa1a5ce396ecd9608
[ "self._build_info_path = control.get('build_info_path')\nself._build_label_pattern = control.get('build_label_pattern')\nself._build_version_pattern = control.get('build_version_pattern')\nself._capture_groups = control.get('capture_groups')\nself._fallback_build_label = control.get('fallback_build_label') or None\...
<|body_start_0|> self._build_info_path = control.get('build_info_path') self._build_label_pattern = control.get('build_label_pattern') self._build_version_pattern = control.get('build_version_pattern') self._capture_groups = control.get('capture_groups') self._fallback_build_labe...
Implements the core functionality of the versioning tool.
VersionTool
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersionTool: """Implements the core functionality of the versioning tool.""" def __init__(self, control): """Initializes VersionTool with the given control options. Args: control: The dictionary of options used to control the tool. Please see the moduledoc for a description of the fo...
stack_v2_sparse_classes_36k_train_022754
9,887
permissive
[ { "docstring": "Initializes VersionTool with the given control options. Args: control: The dictionary of options used to control the tool. Please see the moduledoc for a description of the format of this dictionary.", "name": "__init__", "signature": "def __init__(self, control)" }, { "docstring...
4
stack_v2_sparse_classes_30k_train_015864
Implement the Python class `VersionTool` described below. Class description: Implements the core functionality of the versioning tool. Method signatures and docstrings: - def __init__(self, control): Initializes VersionTool with the given control options. Args: control: The dictionary of options used to control the t...
Implement the Python class `VersionTool` described below. Class description: Implements the core functionality of the versioning tool. Method signatures and docstrings: - def __init__(self, control): Initializes VersionTool with the given control options. Args: control: The dictionary of options used to control the t...
55cf5c2bec04b05b9ab435e24174834c5681be12
<|skeleton|> class VersionTool: """Implements the core functionality of the versioning tool.""" def __init__(self, control): """Initializes VersionTool with the given control options. Args: control: The dictionary of options used to control the tool. Please see the moduledoc for a description of the fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VersionTool: """Implements the core functionality of the versioning tool.""" def __init__(self, control): """Initializes VersionTool with the given control options. Args: control: The dictionary of options used to control the tool. Please see the moduledoc for a description of the format of this ...
the_stack_v2_python_sparse
tools/versiontool/versiontool.py
bazelbuild/rules_apple
train
449
f0f2f4cbeecaf0caed9ee83525a021dd4d2d591e
[ "self.editable = editable\nself.verbose = verbose\nself.install_dev_sh = f'{T_SYSTEM_PATH}/../install-dev.sh'\nself.install_sh = f'{T_SYSTEM_PATH}/../install.sh'\nif self.editable:\n self.last_hash = self.__get_hash_of(self.install_dev_sh)\nelse:\n self.last_hash = self.__get_hash_of(self.install_sh)", "if ...
<|body_start_0|> self.editable = editable self.verbose = verbose self.install_dev_sh = f'{T_SYSTEM_PATH}/../install-dev.sh' self.install_sh = f'{T_SYSTEM_PATH}/../install.sh' if self.editable: self.last_hash = self.__get_hash_of(self.install_dev_sh) else: ...
Class to define an installer of tracking system itself. This class provides necessary initiations and functions named :func:`t_system.updation.Installer.install` as the install point for the changed install scripts and named :func:`t_system.updation.Installer.__get_hash_of` for creating SHA-256 hash of the given file.
Installer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Installer: """Class to define an installer of tracking system itself. This class provides necessary initiations and functions named :func:`t_system.updation.Installer.install` as the install point for the changed install scripts and named :func:`t_system.updation.Installer.__get_hash_of` for crea...
stack_v2_sparse_classes_36k_train_022755
26,721
permissive
[ { "docstring": "Initialization method of :class:`t_system.updation.Installer` class. Args: editable: Editable updation mode flag. verbose: Verbosity flag about printing debug messages.", "name": "__init__", "signature": "def __init__(self, editable, verbose)" }, { "docstring": "Method to install...
3
stack_v2_sparse_classes_30k_train_021408
Implement the Python class `Installer` described below. Class description: Class to define an installer of tracking system itself. This class provides necessary initiations and functions named :func:`t_system.updation.Installer.install` as the install point for the changed install scripts and named :func:`t_system.upd...
Implement the Python class `Installer` described below. Class description: Class to define an installer of tracking system itself. This class provides necessary initiations and functions named :func:`t_system.updation.Installer.install` as the install point for the changed install scripts and named :func:`t_system.upd...
4cf34572b8f8eac54d6c339f37aa72b6a13d8934
<|skeleton|> class Installer: """Class to define an installer of tracking system itself. This class provides necessary initiations and functions named :func:`t_system.updation.Installer.install` as the install point for the changed install scripts and named :func:`t_system.updation.Installer.__get_hash_of` for crea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Installer: """Class to define an installer of tracking system itself. This class provides necessary initiations and functions named :func:`t_system.updation.Installer.install` as the install point for the changed install scripts and named :func:`t_system.updation.Installer.__get_hash_of` for creating SHA-256 ...
the_stack_v2_python_sparse
t_system/updation.py
LookAtMe-Genius-Cameraman/T_System
train
9
ca3e6c50ee6c12dfed3588318923f3633bf9dc9a
[ "try:\n verify_token(request.headers)\nexcept Exception as err:\n ns.abort(401, message=err)\ntry:\n obs = observaciones_ires_cytg.read(id)\nexcept psycopg2.Error as err:\n ns.abort(400, message=get_msg_pgerror(err))\nexcept EmptySetError:\n ns.abort(404, message=ObservacionCyTG.obs_not_found)\nexcep...
<|body_start_0|> try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: obs = observaciones_ires_cytg.read(id) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except Emp...
ObservacionCyTG
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservacionCyTG: def get(self, id): """To fetch an observation (CyTG (resultados))""" <|body_0|> def put(self, id): """To update an observation (CyTG (resultados))""" <|body_1|> def delete(self, id): """To delete an observation (CyTG (resultados)...
stack_v2_sparse_classes_36k_train_022756
18,120
no_license
[ { "docstring": "To fetch an observation (CyTG (resultados))", "name": "get", "signature": "def get(self, id)" }, { "docstring": "To update an observation (CyTG (resultados))", "name": "put", "signature": "def put(self, id)" }, { "docstring": "To delete an observation (CyTG (resul...
3
stack_v2_sparse_classes_30k_train_011871
Implement the Python class `ObservacionCyTG` described below. Class description: Implement the ObservacionCyTG class. Method signatures and docstrings: - def get(self, id): To fetch an observation (CyTG (resultados)) - def put(self, id): To update an observation (CyTG (resultados)) - def delete(self, id): To delete a...
Implement the Python class `ObservacionCyTG` described below. Class description: Implement the ObservacionCyTG class. Method signatures and docstrings: - def get(self, id): To fetch an observation (CyTG (resultados)) - def put(self, id): To update an observation (CyTG (resultados)) - def delete(self, id): To delete a...
e00610fac26ef3ca078fd037c0649b70fa0e9a09
<|skeleton|> class ObservacionCyTG: def get(self, id): """To fetch an observation (CyTG (resultados))""" <|body_0|> def put(self, id): """To update an observation (CyTG (resultados))""" <|body_1|> def delete(self, id): """To delete an observation (CyTG (resultados)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObservacionCyTG: def get(self, id): """To fetch an observation (CyTG (resultados))""" try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: obs = observaciones_ires_cytg.read(id) except psycopg2.E...
the_stack_v2_python_sparse
DOS/soa/service/genl/endpoints/observaciones_ires_cytg.py
Telematica/knight-rider
train
1
4e24d5ac9f01c88edc528b55b9773936cea181b6
[ "def is_palindrone(i, j):\n return s[i:j + 1] == s[i:j + 1][::-1]\nn = len(s)\nresult = 0\nfor i in range(n):\n for j in range(i, n):\n if is_palindrone(i, j):\n result += 1\nreturn result", "@lru_cache(None)\ndef is_palindrone(i, j):\n if j <= i:\n return True\n return s[i] =...
<|body_start_0|> def is_palindrone(i, j): return s[i:j + 1] == s[i:j + 1][::-1] n = len(s) result = 0 for i in range(n): for j in range(i, n): if is_palindrone(i, j): result += 1 return result <|end_body_0|> <|body_star...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countSubstrings(self, s: str) -> int: """Brute Force, Time: O(n^3), Space: O(1)""" <|body_0|> def countSubstrings(self, s: str) -> int: """Top-Down DP for is_palindrone, Time: O(n^2), Space: O(n^2)""" <|body_1|> def countSubstrings(self, s:...
stack_v2_sparse_classes_36k_train_022757
1,729
no_license
[ { "docstring": "Brute Force, Time: O(n^3), Space: O(1)", "name": "countSubstrings", "signature": "def countSubstrings(self, s: str) -> int" }, { "docstring": "Top-Down DP for is_palindrone, Time: O(n^2), Space: O(n^2)", "name": "countSubstrings", "signature": "def countSubstrings(self, s...
3
stack_v2_sparse_classes_30k_train_002504
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubstrings(self, s: str) -> int: Brute Force, Time: O(n^3), Space: O(1) - def countSubstrings(self, s: str) -> int: Top-Down DP for is_palindrone, Time: O(n^2), Space: O...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubstrings(self, s: str) -> int: Brute Force, Time: O(n^3), Space: O(1) - def countSubstrings(self, s: str) -> int: Top-Down DP for is_palindrone, Time: O(n^2), Space: O...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def countSubstrings(self, s: str) -> int: """Brute Force, Time: O(n^3), Space: O(1)""" <|body_0|> def countSubstrings(self, s: str) -> int: """Top-Down DP for is_palindrone, Time: O(n^2), Space: O(n^2)""" <|body_1|> def countSubstrings(self, s:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countSubstrings(self, s: str) -> int: """Brute Force, Time: O(n^3), Space: O(1)""" def is_palindrone(i, j): return s[i:j + 1] == s[i:j + 1][::-1] n = len(s) result = 0 for i in range(n): for j in range(i, n): if is_p...
the_stack_v2_python_sparse
python/647-Palindromic Substrings.py
cwza/leetcode
train
0
be040a6c45b0b0e208208e836746cab345f81f3c
[ "if not isinstance(query, SearchQueryBuilder):\n raise ImapInvalidArgument('query', query)\nself.__search_query = query\nself.__charset = charset", "typ, data = imap_obj.search(self.__charset, str(self.__search_query))\nself.check_response(typ, data)\nif not data:\n return []\nfor uid in data[0].split(b' ')...
<|body_start_0|> if not isinstance(query, SearchQueryBuilder): raise ImapInvalidArgument('query', query) self.__search_query = query self.__charset = charset <|end_body_0|> <|body_start_1|> typ, data = imap_obj.search(self.__charset, str(self.__search_query)) self.ch...
Executes IMAP SEARCH cammand
ImapSearchCommand
[ "WTFPL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImapSearchCommand: """Executes IMAP SEARCH cammand""" def __init__(self, query: SearchQueryBuilder, charset=None): """Creates instance of SEARCH IMAP command Raises: ImapRuntimeError - if :param query is not instance of SearchQueryBuilder :param query: FetchQueryBuilder :param charse...
stack_v2_sparse_classes_36k_train_022758
1,437
permissive
[ { "docstring": "Creates instance of SEARCH IMAP command Raises: ImapRuntimeError - if :param query is not instance of SearchQueryBuilder :param query: FetchQueryBuilder :param charset: Any :return:", "name": "__init__", "signature": "def __init__(self, query: SearchQueryBuilder, charset=None)" }, { ...
2
stack_v2_sparse_classes_30k_train_016568
Implement the Python class `ImapSearchCommand` described below. Class description: Executes IMAP SEARCH cammand Method signatures and docstrings: - def __init__(self, query: SearchQueryBuilder, charset=None): Creates instance of SEARCH IMAP command Raises: ImapRuntimeError - if :param query is not instance of SearchQ...
Implement the Python class `ImapSearchCommand` described below. Class description: Executes IMAP SEARCH cammand Method signatures and docstrings: - def __init__(self, query: SearchQueryBuilder, charset=None): Creates instance of SEARCH IMAP command Raises: ImapRuntimeError - if :param query is not instance of SearchQ...
002a916494591e31ec9a0c2dbef66427a72bc036
<|skeleton|> class ImapSearchCommand: """Executes IMAP SEARCH cammand""" def __init__(self, query: SearchQueryBuilder, charset=None): """Creates instance of SEARCH IMAP command Raises: ImapRuntimeError - if :param query is not instance of SearchQueryBuilder :param query: FetchQueryBuilder :param charse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImapSearchCommand: """Executes IMAP SEARCH cammand""" def __init__(self, query: SearchQueryBuilder, charset=None): """Creates instance of SEARCH IMAP command Raises: ImapRuntimeError - if :param query is not instance of SearchQueryBuilder :param query: FetchQueryBuilder :param charset: Any :retur...
the_stack_v2_python_sparse
pymaillib/imap/commands/search.py
pussbb/pymaillib
train
0
475b3f7924f7eb75612dd97a0062976ab35630fd
[ "self.buf = buf\nself.ptr = ptr\nself.endian = endian\nself._cache = {}", "pkst = self._cache.get(fmt)\nif pkst is None:\n if self.endian is None or fmt[0] in _ENDIAN_CODES:\n pkst = Struct(fmt)\n else:\n endian_fmt = self.endian + fmt\n pkst = Struct(endian_fmt)\n self._cache[en...
<|body_start_0|> self.buf = buf self.ptr = ptr self.endian = endian self._cache = {} <|end_body_0|> <|body_start_1|> pkst = self._cache.get(fmt) if pkst is None: if self.endian is None or fmt[0] in _ENDIAN_CODES: pkst = Struct(fmt) ...
Class to unpack values from buffer object The buffer object is usually a string. Caches compiled :mod:`struct` format strings so that repeated unpacking with the same format string should be faster than using ``struct.unpack`` directly. Examples -------- >>> a = b'1234567890' >>> upk = Unpacker(a) >>> upk.unpack('2s') ...
Unpacker
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Unpacker: """Class to unpack values from buffer object The buffer object is usually a string. Caches compiled :mod:`struct` format strings so that repeated unpacking with the same format string should be faster than using ``struct.unpack`` directly. Examples -------- >>> a = b'1234567890' >>> upk...
stack_v2_sparse_classes_36k_train_022759
3,580
permissive
[ { "docstring": "Initialize unpacker Parameters ---------- buf : buffer object implementing buffer protocol (e.g. str) ptr : int, optional offset at which to begin reads from `buf` endian : None or str, optional endian code to prepend to format, as for ``unpack`` endian codes. None (the default) corresponds to t...
3
stack_v2_sparse_classes_30k_train_018365
Implement the Python class `Unpacker` described below. Class description: Class to unpack values from buffer object The buffer object is usually a string. Caches compiled :mod:`struct` format strings so that repeated unpacking with the same format string should be faster than using ``struct.unpack`` directly. Examples...
Implement the Python class `Unpacker` described below. Class description: Class to unpack values from buffer object The buffer object is usually a string. Caches compiled :mod:`struct` format strings so that repeated unpacking with the same format string should be faster than using ``struct.unpack`` directly. Examples...
3c3acc55de8ba741e673063378e6cbaf10b64c7a
<|skeleton|> class Unpacker: """Class to unpack values from buffer object The buffer object is usually a string. Caches compiled :mod:`struct` format strings so that repeated unpacking with the same format string should be faster than using ``struct.unpack`` directly. Examples -------- >>> a = b'1234567890' >>> upk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Unpacker: """Class to unpack values from buffer object The buffer object is usually a string. Caches compiled :mod:`struct` format strings so that repeated unpacking with the same format string should be faster than using ``struct.unpack`` directly. Examples -------- >>> a = b'1234567890' >>> upk = Unpacker(a...
the_stack_v2_python_sparse
env/lib/python3.6/site-packages/nibabel/nicom/structreader.py
Raniac/NEURO-LEARN
train
9
c3e0ec8e769fac78c27f034ae5662ddd58b220d0
[ "super().__init__(parent, store)\nself.frame1_label = tk.Label(self.frame1, text='Login with password', font=('Arial', 20, 'bold'))\nself.password_label = tk.Label(self.frame1, text='Password: ')\nself.password_field = tk.StringVar()\nself.password_entry = tk.Entry(self.frame1, textvariable=self.password_field, sho...
<|body_start_0|> super().__init__(parent, store) self.frame1_label = tk.Label(self.frame1, text='Login with password', font=('Arial', 20, 'bold')) self.password_label = tk.Label(self.frame1, text='Password: ') self.password_field = tk.StringVar() self.password_entry = tk.Entry(se...
The second screen when the app opens. It has 2 frame, the left frame is for login normally, and the right frame is for login with face. User can click on the open cam button to use this feature. Attributes: ---------- frame1 : tkinter frame The container for the left page frame2 : tkinter frame The container for the ri...
Screen2
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Screen2: """The second screen when the app opens. It has 2 frame, the left frame is for login normally, and the right frame is for login with face. User can click on the open cam button to use this feature. Attributes: ---------- frame1 : tkinter frame The container for the left page frame2 : tki...
stack_v2_sparse_classes_36k_train_022760
8,263
permissive
[ { "docstring": "Init the screen 2 with 2 frame on. The first frame is for login with password and the second frame is for login with face. This only load the recognizer and pca if the user has the face added and the device has camera. Params: ------- parent: tkinter frame or tk() The parent frame attach to this...
4
stack_v2_sparse_classes_30k_train_011533
Implement the Python class `Screen2` described below. Class description: The second screen when the app opens. It has 2 frame, the left frame is for login normally, and the right frame is for login with face. User can click on the open cam button to use this feature. Attributes: ---------- frame1 : tkinter frame The c...
Implement the Python class `Screen2` described below. Class description: The second screen when the app opens. It has 2 frame, the left frame is for login normally, and the right frame is for login with face. User can click on the open cam button to use this feature. Attributes: ---------- frame1 : tkinter frame The c...
e4478a6ca8ca15ab99fc251b40e64307302bffeb
<|skeleton|> class Screen2: """The second screen when the app opens. It has 2 frame, the left frame is for login normally, and the right frame is for login with face. User can click on the open cam button to use this feature. Attributes: ---------- frame1 : tkinter frame The container for the left page frame2 : tki...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Screen2: """The second screen when the app opens. It has 2 frame, the left frame is for login normally, and the right frame is for login with face. User can click on the open cam button to use this feature. Attributes: ---------- frame1 : tkinter frame The container for the left page frame2 : tkinter frame Th...
the_stack_v2_python_sparse
screen2.py
athan37/LoginSystemWithFace
train
1
52199d5344bb74983cb53ee0493b9ae79490b3d4
[ "username = request.user.get_username()\nserializer = RepoSerializer(username, repo_base, request)\nif username == repo_base:\n return Response(serializer.user_owned_repos())\nelse:\n return Response(serializer.specific_collab_repos(repo_base))", "username = request.user.get_username()\nserializer = RepoSer...
<|body_start_0|> username = request.user.get_username() serializer = RepoSerializer(username, repo_base, request) if username == repo_base: return Response(serializer.user_owned_repos()) else: return Response(serializer.specific_collab_repos(repo_base)) <|end_body...
Repos of the specified user.
ReposForUser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReposForUser: """Repos of the specified user.""" def get(self, request, repo_base, format=None): """Repos of the specified user that are visible to the logged in user""" <|body_0|> def post(self, request, repo_base, format=None): """Create a repo for the specifie...
stack_v2_sparse_classes_36k_train_022761
31,465
permissive
[ { "docstring": "Repos of the specified user that are visible to the logged in user", "name": "get", "signature": "def get(self, request, repo_base, format=None)" }, { "docstring": "Create a repo for the specified user. --- omit_serializer: true parameters: - name: repo_name in: body type: string...
2
stack_v2_sparse_classes_30k_train_002611
Implement the Python class `ReposForUser` described below. Class description: Repos of the specified user. Method signatures and docstrings: - def get(self, request, repo_base, format=None): Repos of the specified user that are visible to the logged in user - def post(self, request, repo_base, format=None): Create a ...
Implement the Python class `ReposForUser` described below. Class description: Repos of the specified user. Method signatures and docstrings: - def get(self, request, repo_base, format=None): Repos of the specified user that are visible to the logged in user - def post(self, request, repo_base, format=None): Create a ...
f066b472c2b66cc3b868bbe433aed2d4557aea32
<|skeleton|> class ReposForUser: """Repos of the specified user.""" def get(self, request, repo_base, format=None): """Repos of the specified user that are visible to the logged in user""" <|body_0|> def post(self, request, repo_base, format=None): """Create a repo for the specifie...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReposForUser: """Repos of the specified user.""" def get(self, request, repo_base, format=None): """Repos of the specified user that are visible to the logged in user""" username = request.user.get_username() serializer = RepoSerializer(username, repo_base, request) if use...
the_stack_v2_python_sparse
src/api/views.py
datahuborg/datahub
train
199
4ac97982e032778ca48dd1c6a1bf82b7696eb07b
[ "N, H = (len(needle), len(haystack))\nif N == 0:\n return 0\npH = 0\nwhile pH < H - N + 1:\n while pH < H - N + 1 and haystack[pH] != needle[0]:\n pH += 1\n pN = 0\n while pN < N and pH < H and (haystack[pH] == needle[pN]):\n pN += 1\n pH += 1\n if pN == N:\n return pH - N...
<|body_start_0|> N, H = (len(needle), len(haystack)) if N == 0: return 0 pH = 0 while pH < H - N + 1: while pH < H - N + 1 and haystack[pH] != needle[0]: pH += 1 pN = 0 while pN < N and pH < H and (haystack[pH] == needle[pN]...
Strstr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Strstr: def get_needle_index_(self, haystack: str, needle: str) -> int: """Approach: Two Pointers - Linear Time Slice Time Complexity: O((N - H) N) Space Complexity: O(1) :param haystack: :param needle: :return:""" <|body_0|> def get_needle_index__(self, haystack: str, needl...
stack_v2_sparse_classes_36k_train_022762
1,717
no_license
[ { "docstring": "Approach: Two Pointers - Linear Time Slice Time Complexity: O((N - H) N) Space Complexity: O(1) :param haystack: :param needle: :return:", "name": "get_needle_index_", "signature": "def get_needle_index_(self, haystack: str, needle: str) -> int" }, { "docstring": "Approach: Subst...
2
null
Implement the Python class `Strstr` described below. Class description: Implement the Strstr class. Method signatures and docstrings: - def get_needle_index_(self, haystack: str, needle: str) -> int: Approach: Two Pointers - Linear Time Slice Time Complexity: O((N - H) N) Space Complexity: O(1) :param haystack: :para...
Implement the Python class `Strstr` described below. Class description: Implement the Strstr class. Method signatures and docstrings: - def get_needle_index_(self, haystack: str, needle: str) -> int: Approach: Two Pointers - Linear Time Slice Time Complexity: O((N - H) N) Space Complexity: O(1) :param haystack: :para...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Strstr: def get_needle_index_(self, haystack: str, needle: str) -> int: """Approach: Two Pointers - Linear Time Slice Time Complexity: O((N - H) N) Space Complexity: O(1) :param haystack: :param needle: :return:""" <|body_0|> def get_needle_index__(self, haystack: str, needl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Strstr: def get_needle_index_(self, haystack: str, needle: str) -> int: """Approach: Two Pointers - Linear Time Slice Time Complexity: O((N - H) N) Space Complexity: O(1) :param haystack: :param needle: :return:""" N, H = (len(needle), len(haystack)) if N == 0: return 0 ...
the_stack_v2_python_sparse
revisited/math_and_strings/strings/str_str.py
Shiv2157k/leet_code
train
1
91dacf26f4827d2e5dca7d9bf3ed15454aafedf7
[ "self.n = n\nself.discount = discount\nself.prices = {k: v for k, v in zip(products, prices)}\nself.c = 1", "s = 0\nfor p, c in zip(product, amount):\n s += self.prices[p] * c\nif self.c == self.n:\n s *= 1 - self.discount / 100.0\n self.c = 1\nelse:\n self.c += 1\nreturn s" ]
<|body_start_0|> self.n = n self.discount = discount self.prices = {k: v for k, v in zip(products, prices)} self.c = 1 <|end_body_0|> <|body_start_1|> s = 0 for p, c in zip(product, amount): s += self.prices[p] * c if self.c == self.n: s *...
Cashier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" <|body_0|> def getBill(self, product, amount): """:type product: List[int] :type amount: List[int] :rtype: float""" ...
stack_v2_sparse_classes_36k_train_022763
3,686
no_license
[ { "docstring": ":type n: int :type discount: int :type products: List[int] :type prices: List[int]", "name": "__init__", "signature": "def __init__(self, n, discount, products, prices)" }, { "docstring": ":type product: List[int] :type amount: List[int] :rtype: float", "name": "getBill", ...
2
stack_v2_sparse_classes_30k_train_013432
Implement the Python class `Cashier` described below. Class description: Implement the Cashier class. Method signatures and docstrings: - def __init__(self, n, discount, products, prices): :type n: int :type discount: int :type products: List[int] :type prices: List[int] - def getBill(self, product, amount): :type pr...
Implement the Python class `Cashier` described below. Class description: Implement the Cashier class. Method signatures and docstrings: - def __init__(self, n, discount, products, prices): :type n: int :type discount: int :type products: List[int] :type prices: List[int] - def getBill(self, product, amount): :type pr...
f2bf9b13508cd01c8f383789569e55a438f77202
<|skeleton|> class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" <|body_0|> def getBill(self, product, amount): """:type product: List[int] :type amount: List[int] :rtype: float""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" self.n = n self.discount = discount self.prices = {k: v for k, v in zip(products, prices)} self.c = 1 def getBill(se...
the_stack_v2_python_sparse
version1/1357_Apply_Discount_Every_n_Orders.py
moontree/leetcode
train
1
daf7ce02d1a3d3a275d7e2a771f708388619e0df
[ "self.log.info('login from GitHub')\ncode = context.get('code')\nif not code:\n return None\naccess_token = self.get_token(code)\nself.log.info('Successfully get access token from github using code %s' % code)\nuser_info = self.get_user_info(access_token)\nemail_list = self.get_emails(access_token)\nself.log.inf...
<|body_start_0|> self.log.info('login from GitHub') code = context.get('code') if not code: return None access_token = self.get_token(code) self.log.info('Successfully get access token from github using code %s' % code) user_info = self.get_user_info(access_to...
Sign in with github docs: https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow .. notes::
GithubLogin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GithubLogin: """Sign in with github docs: https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow .. notes::""" def login(self, context): """github Login :type context: Context :param context: :rtype: dict :return: token and instance of user...
stack_v2_sparse_classes_36k_train_022764
17,886
permissive
[ { "docstring": "github Login :type context: Context :param context: :rtype: dict :return: token and instance of user", "name": "login", "signature": "def login(self, context)" }, { "docstring": "Get github access token :type code: str :param code: :rtype: str :return: access token", "name": ...
4
stack_v2_sparse_classes_30k_train_014582
Implement the Python class `GithubLogin` described below. Class description: Sign in with github docs: https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow .. notes:: Method signatures and docstrings: - def login(self, context): github Login :type context: Context :param ...
Implement the Python class `GithubLogin` described below. Class description: Sign in with github docs: https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow .. notes:: Method signatures and docstrings: - def login(self, context): github Login :type context: Context :param ...
945c4fd2755f5b0dea11e54eb649eeb37ec93d01
<|skeleton|> class GithubLogin: """Sign in with github docs: https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow .. notes::""" def login(self, context): """github Login :type context: Context :param context: :rtype: dict :return: token and instance of user...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GithubLogin: """Sign in with github docs: https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow .. notes::""" def login(self, context): """github Login :type context: Context :param context: :rtype: dict :return: token and instance of user""" s...
the_stack_v2_python_sparse
open-hackathon-server/src/hackathon/user/oauth_login.py
kaiyuanshe/open-hackathon
train
46
199df07e13b13d9b2b855b8205e71c1ffdabe5e3
[ "batch_size = input.shape[2]\noutput = np.dsplit(input, batch_size)\nfor i in range(batch_size):\n output[i] = output[i][:, :, 0]\nreturn output", "batch_size = len(input)\nfor i in range(batch_size):\n input[i] = input[i][..., None]\noutput = np.dstack(input)\nreturn output" ]
<|body_start_0|> batch_size = input.shape[2] output = np.dsplit(input, batch_size) for i in range(batch_size): output[i] = output[i][:, :, 0] return output <|end_body_0|> <|body_start_1|> batch_size = len(input) for i in range(batch_size): input[i...
Module is an abstract class. It handles numpy array data. Assumes working with consistent data format for all inputs and outputs: mxnxb numpy array b refers to batch m,n are arbitrary
Module
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Module: """Module is an abstract class. It handles numpy array data. Assumes working with consistent data format for all inputs and outputs: mxnxb numpy array b refers to batch m,n are arbitrary""" def __unbatch__(self, input): """Takes a mxnxb numpy array and returns a list of b mxn...
stack_v2_sparse_classes_36k_train_022765
1,100
no_license
[ { "docstring": "Takes a mxnxb numpy array and returns a list of b mxn numpy arrays. This is useful for separating the 3-d numpy array into a list of 2-d arrays to perform some operation on each 2-d array. Args: input: mxnxb numpy array Returns: list of b mxn numpy arrays", "name": "__unbatch__", "signat...
2
stack_v2_sparse_classes_30k_train_007898
Implement the Python class `Module` described below. Class description: Module is an abstract class. It handles numpy array data. Assumes working with consistent data format for all inputs and outputs: mxnxb numpy array b refers to batch m,n are arbitrary Method signatures and docstrings: - def __unbatch__(self, inpu...
Implement the Python class `Module` described below. Class description: Module is an abstract class. It handles numpy array data. Assumes working with consistent data format for all inputs and outputs: mxnxb numpy array b refers to batch m,n are arbitrary Method signatures and docstrings: - def __unbatch__(self, inpu...
9d964dceadb0f5182f456886eaa5476e185dd818
<|skeleton|> class Module: """Module is an abstract class. It handles numpy array data. Assumes working with consistent data format for all inputs and outputs: mxnxb numpy array b refers to batch m,n are arbitrary""" def __unbatch__(self, input): """Takes a mxnxb numpy array and returns a list of b mxn...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Module: """Module is an abstract class. It handles numpy array data. Assumes working with consistent data format for all inputs and outputs: mxnxb numpy array b refers to batch m,n are arbitrary""" def __unbatch__(self, input): """Takes a mxnxb numpy array and returns a list of b mxn numpy arrays...
the_stack_v2_python_sparse
assignment2/module.py
mqtlam/osu-cs519-006
train
4
7188f4eb39c5c7021e91919d10da159d2f547c47
[ "kw = super(ProjectTaskView, self).get_form_kwargs()\nkw.update({'organization': self.request.user.organization})\nreturn kw", "context = super(ProjectTaskView, self).get_context_data(**kwargs)\nproject = get_object_or_404(Project, id=self.kwargs['pk'])\ntasks = project.task_set.all()\ncount = tasks.count()\niden...
<|body_start_0|> kw = super(ProjectTaskView, self).get_form_kwargs() kw.update({'organization': self.request.user.organization}) return kw <|end_body_0|> <|body_start_1|> context = super(ProjectTaskView, self).get_context_data(**kwargs) project = get_object_or_404(Project, id=se...
Create a project task.
ProjectTaskView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectTaskView: """Create a project task.""" def get_form_kwargs(self): """Pass organization to form.""" <|body_0|> def get_context_data(self, **kwargs): """Return tasks belonging to the story.""" <|body_1|> <|end_skeleton|> <|body_start_0|> kw...
stack_v2_sparse_classes_36k_train_022766
11,257
permissive
[ { "docstring": "Pass organization to form.", "name": "get_form_kwargs", "signature": "def get_form_kwargs(self)" }, { "docstring": "Return tasks belonging to the story.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_val_001021
Implement the Python class `ProjectTaskView` described below. Class description: Create a project task. Method signatures and docstrings: - def get_form_kwargs(self): Pass organization to form. - def get_context_data(self, **kwargs): Return tasks belonging to the story.
Implement the Python class `ProjectTaskView` described below. Class description: Create a project task. Method signatures and docstrings: - def get_form_kwargs(self): Pass organization to form. - def get_context_data(self, **kwargs): Return tasks belonging to the story. <|skeleton|> class ProjectTaskView: """Cre...
dc6bc79d450f7e2bdf59cfbcd306d05a736e4db9
<|skeleton|> class ProjectTaskView: """Create a project task.""" def get_form_kwargs(self): """Pass organization to form.""" <|body_0|> def get_context_data(self, **kwargs): """Return tasks belonging to the story.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectTaskView: """Create a project task.""" def get_form_kwargs(self): """Pass organization to form.""" kw = super(ProjectTaskView, self).get_form_kwargs() kw.update({'organization': self.request.user.organization}) return kw def get_context_data(self, **kwargs): ...
the_stack_v2_python_sparse
project/editorial/views/tasks.py
ProjectFacet/facet
train
25
ff83553c0628dee449bfe723f6d0cbc7698c1a00
[ "context = super().get_context_data()\ncontext['datasource'] = models.DataSource.objects.get(pk=self.kwargs['pk'])\nreturn context", "self.datasource = models.DataSource.objects.get(pk=self.kwargs['pk'])\nuser = self.request.user\nif self.request.user == self.datasource.owner or self.request.user.is_superuser:\n ...
<|body_start_0|> context = super().get_context_data() context['datasource'] = models.DataSource.objects.get(pk=self.kwargs['pk']) return context <|end_body_0|> <|body_start_1|> self.datasource = models.DataSource.objects.get(pk=self.kwargs['pk']) user = self.request.user ...
Request access to a data source, or request changes to an existing permission. Provides a form view to edit permission requests, but permissions may also be requested using an AJAX POST request.
DataSourceAccessRequestView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataSourceAccessRequestView: """Request access to a data source, or request changes to an existing permission. Provides a form view to edit permission requests, but permissions may also be requested using an AJAX POST request.""" def get_context_data(self, **kwargs): """Add data sour...
stack_v2_sparse_classes_36k_train_022767
7,233
permissive
[ { "docstring": "Add data source to the context.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Get or create a permission object for the relevant user.", "name": "get_object", "signature": "def get_object(self, queryset=None)" }, ...
5
stack_v2_sparse_classes_30k_train_003781
Implement the Python class `DataSourceAccessRequestView` described below. Class description: Request access to a data source, or request changes to an existing permission. Provides a form view to edit permission requests, but permissions may also be requested using an AJAX POST request. Method signatures and docstrin...
Implement the Python class `DataSourceAccessRequestView` described below. Class description: Request access to a data source, or request changes to an existing permission. Provides a form view to edit permission requests, but permissions may also be requested using an AJAX POST request. Method signatures and docstrin...
25a111ac7cf4b23fee50ad8eac6ea21564954859
<|skeleton|> class DataSourceAccessRequestView: """Request access to a data source, or request changes to an existing permission. Provides a form view to edit permission requests, but permissions may also be requested using an AJAX POST request.""" def get_context_data(self, **kwargs): """Add data sour...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataSourceAccessRequestView: """Request access to a data source, or request changes to an existing permission. Provides a form view to edit permission requests, but permissions may also be requested using an AJAX POST request.""" def get_context_data(self, **kwargs): """Add data source to the con...
the_stack_v2_python_sparse
datasources/views/user_permission_link.py
PEDASI/PEDASI
train
0
30d30150ac10063ee1a4e816b3ba2661930c94c1
[ "checksum = crc(path, content)\ntry:\n fobj = File.objects.get(path=path)\nexcept File.DoesNotExist:\n return True\nelse:\n return str(fobj.checksum) != checksum", "checksum = crc(path, content)\ntry:\n fobj = File.objects.get(path=path)\nexcept File.DoesNotExist:\n fobj = File(path=path)\nfobj.che...
<|body_start_0|> checksum = crc(path, content) try: fobj = File.objects.get(path=path) except File.DoesNotExist: return True else: return str(fobj.checksum) != checksum <|end_body_0|> <|body_start_1|> checksum = crc(path, content) try:...
FileManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileManager: def is_changed(self, path, content=None): """Compare checksum of the file stored in DB and the actual file on the disk. `is_changed` is always true if no info about the file is stored in DB.""" <|body_0|> def save_file(self, path, content=None): """Save ...
stack_v2_sparse_classes_36k_train_022768
1,644
no_license
[ { "docstring": "Compare checksum of the file stored in DB and the actual file on the disk. `is_changed` is always true if no info about the file is stored in DB.", "name": "is_changed", "signature": "def is_changed(self, path, content=None)" }, { "docstring": "Save checksum of the file.", "n...
2
null
Implement the Python class `FileManager` described below. Class description: Implement the FileManager class. Method signatures and docstrings: - def is_changed(self, path, content=None): Compare checksum of the file stored in DB and the actual file on the disk. `is_changed` is always true if no info about the file i...
Implement the Python class `FileManager` described below. Class description: Implement the FileManager class. Method signatures and docstrings: - def is_changed(self, path, content=None): Compare checksum of the file stored in DB and the actual file on the disk. `is_changed` is always true if no info about the file i...
40313d4b413a219ff2f7dfc9775258f23608b2cc
<|skeleton|> class FileManager: def is_changed(self, path, content=None): """Compare checksum of the file stored in DB and the actual file on the disk. `is_changed` is always true if no info about the file is stored in DB.""" <|body_0|> def save_file(self, path, content=None): """Save ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileManager: def is_changed(self, path, content=None): """Compare checksum of the file stored in DB and the actual file on the disk. `is_changed` is always true if no info about the file is stored in DB.""" checksum = crc(path, content) try: fobj = File.objects.get(path=pat...
the_stack_v2_python_sparse
parser/models.py
govtrack/govtrack.us-web
train
310
41c90b097d5e3d50c2e8234ba740ef99038953b2
[ "self.driver = driver\nself.comp_name = comp_name\nself.element = self.get_component()", "self.hide_activity_box()\nself.element.click()\nreturn self.find_elems('select[name=\"' + self.comp_name + '\"] option')", "self.hide_activity_box()\ndeptlist = self.get_department_list()\nif deptlist:\n deptlist[num].c...
<|body_start_0|> self.driver = driver self.comp_name = comp_name self.element = self.get_component() <|end_body_0|> <|body_start_1|> self.hide_activity_box() self.element.click() return self.find_elems('select[name="' + self.comp_name + '"] option') <|end_body_1|> <|bod...
部门选择框控件
DepartmentPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DepartmentPage: """部门选择框控件""" def __init__(self, driver, comp_name): """类初始化执行""" <|body_0|> def get_department_list(self): """获取部门选择框的选项""" <|body_1|> def select_department_num(self, num): """获取某个部门的选择值""" <|body_2|> def get_dep...
stack_v2_sparse_classes_36k_train_022769
2,660
no_license
[ { "docstring": "类初始化执行", "name": "__init__", "signature": "def __init__(self, driver, comp_name)" }, { "docstring": "获取部门选择框的选项", "name": "get_department_list", "signature": "def get_department_list(self)" }, { "docstring": "获取某个部门的选择值", "name": "select_department_num", "...
5
stack_v2_sparse_classes_30k_train_014936
Implement the Python class `DepartmentPage` described below. Class description: 部门选择框控件 Method signatures and docstrings: - def __init__(self, driver, comp_name): 类初始化执行 - def get_department_list(self): 获取部门选择框的选项 - def select_department_num(self, num): 获取某个部门的选择值 - def get_department_list_name(self): 获取部门选择框的选项 - de...
Implement the Python class `DepartmentPage` described below. Class description: 部门选择框控件 Method signatures and docstrings: - def __init__(self, driver, comp_name): 类初始化执行 - def get_department_list(self): 获取部门选择框的选项 - def select_department_num(self, num): 获取某个部门的选择值 - def get_department_list_name(self): 获取部门选择框的选项 - de...
78768989a79a14013b983024cf6e4838d51ed595
<|skeleton|> class DepartmentPage: """部门选择框控件""" def __init__(self, driver, comp_name): """类初始化执行""" <|body_0|> def get_department_list(self): """获取部门选择框的选项""" <|body_1|> def select_department_num(self, num): """获取某个部门的选择值""" <|body_2|> def get_dep...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DepartmentPage: """部门选择框控件""" def __init__(self, driver, comp_name): """类初始化执行""" self.driver = driver self.comp_name = comp_name self.element = self.get_component() def get_department_list(self): """获取部门选择框的选项""" self.hide_activity_box() self....
the_stack_v2_python_sparse
test_case/page_obj/form/department_page.py
pylk/pythonSelenium
train
0
e216afe13dbbfdfda64a40e22bb733a09002e788
[ "super(MultiAgentEnvironment, self).__init__(environment)\nself._agent_name = agent_name\nself._other_agents = other_agents", "obs = self.observation()\naction_dict = {k: agent.step(obs) for k, agent in self._other_agents.items()}\naction_dict[self._agent_name] = action\nreturn self._environment.step(action_dict)...
<|body_start_0|> super(MultiAgentEnvironment, self).__init__(environment) self._agent_name = agent_name self._other_agents = other_agents <|end_body_0|> <|body_start_1|> obs = self.observation() action_dict = {k: agent.step(obs) for k, agent in self._other_agents.items()} ...
Environment class for converting multi-agent into single-agent task.
MultiAgentEnvironment
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiAgentEnvironment: """Environment class for converting multi-agent into single-agent task.""" def __init__(self, environment, agent_name, **other_agents): """Constructor. Args: environment: Instance of ../moog/environment.Environment. Should have a Composite action space. agent_n...
stack_v2_sparse_classes_36k_train_022770
1,972
permissive
[ { "docstring": "Constructor. Args: environment: Instance of ../moog/environment.Environment. Should have a Composite action space. agent_name: Name of the agent being controlled by the player's joystick in the demo. Specifically, this is the key used for the joystick action value when passed into the Composite ...
2
stack_v2_sparse_classes_30k_train_007565
Implement the Python class `MultiAgentEnvironment` described below. Class description: Environment class for converting multi-agent into single-agent task. Method signatures and docstrings: - def __init__(self, environment, agent_name, **other_agents): Constructor. Args: environment: Instance of ../moog/environment.E...
Implement the Python class `MultiAgentEnvironment` described below. Class description: Environment class for converting multi-agent into single-agent task. Method signatures and docstrings: - def __init__(self, environment, agent_name, **other_agents): Constructor. Args: environment: Instance of ../moog/environment.E...
3e89e46a5918d59475851f9d4f1558956c110d38
<|skeleton|> class MultiAgentEnvironment: """Environment class for converting multi-agent into single-agent task.""" def __init__(self, environment, agent_name, **other_agents): """Constructor. Args: environment: Instance of ../moog/environment.Environment. Should have a Composite action space. agent_n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiAgentEnvironment: """Environment class for converting multi-agent into single-agent task.""" def __init__(self, environment, agent_name, **other_agents): """Constructor. Args: environment: Instance of ../moog/environment.Environment. Should have a Composite action space. agent_name: Name of ...
the_stack_v2_python_sparse
moog/env_wrappers/multi_agent.py
hokysung/moog.github.io
train
0
7c1050fd1d624f8ab51e1d2319a4add9fb590816
[ "if not root:\n return '-1001'\nreturn str(root.val) + ',' + self.serialize(root.left) + ',' + self.serialize(root.right)", "def helper(dq):\n value = dq.popleft()\n if value == -1001:\n return None\n node = TreeNode(value)\n node.left = helper(dq)\n node.right = helper(dq)\n return no...
<|body_start_0|> if not root: return '-1001' return str(root.val) + ',' + self.serialize(root.left) + ',' + self.serialize(root.right) <|end_body_0|> <|body_start_1|> def helper(dq): value = dq.popleft() if value == -1001: return None ...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_022771
1,962
permissive
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_011860
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
08f3bd22923b652f9d676ffa2af3dc037eed6d73
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '-1001' return str(root.val) + ',' + self.serialize(root.left) + ',' + self.serialize(root.right) def deserialize(self, data): """Dec...
the_stack_v2_python_sparse
LeetCode/Serialize-Deserialize-Binary-Tree.py
sethmh82/SethDevelopment
train
0
18214815ed8c9b59de74f43bef956f828b735b9f
[ "base.Action.__init__(self, self.__openNotebooks)\nself.enabled = ENABLED\nself.__overlayList = overlayList\nself.__displayCtx = displayCtx\nself.__frame = frame\nself.__kernel = None\nself.__server = None", "if self.__kernel is not None and (not self.__kernel.is_alive()):\n self.__kernel = None\nif self.__ser...
<|body_start_0|> base.Action.__init__(self, self.__openNotebooks) self.enabled = ENABLED self.__overlayList = overlayList self.__displayCtx = displayCtx self.__frame = frame self.__kernel = None self.__server = None <|end_body_0|> <|body_start_1|> if self...
The ``NotebookAction`` is an :class:`.Action` which (if necessary) starts an embedded IPython kernel and a jupyter notebook server, and opens the server home page in a web browser allowing the user to interact with FSLeyes via notebooks.
NotebookAction
[ "BSD-3-Clause", "CC-BY-3.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotebookAction: """The ``NotebookAction`` is an :class:`.Action` which (if necessary) starts an embedded IPython kernel and a jupyter notebook server, and opens the server home page in a web browser allowing the user to interact with FSLeyes via notebooks.""" def __init__(self, overlayList, ...
stack_v2_sparse_classes_36k_train_022772
22,260
permissive
[ { "docstring": "Create a ``NotebookAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The master :class:`.DisplayContext`. :arg frame: The :class:`.FSLeyesFrame`.", "name": "__init__", "signature": "def __init__(self, overlayList, displayCtx, frame)" }, { "docstring": "Calle...
5
null
Implement the Python class `NotebookAction` described below. Class description: The ``NotebookAction`` is an :class:`.Action` which (if necessary) starts an embedded IPython kernel and a jupyter notebook server, and opens the server home page in a web browser allowing the user to interact with FSLeyes via notebooks. ...
Implement the Python class `NotebookAction` described below. Class description: The ``NotebookAction`` is an :class:`.Action` which (if necessary) starts an embedded IPython kernel and a jupyter notebook server, and opens the server home page in a web browser allowing the user to interact with FSLeyes via notebooks. ...
46ccb4fe2b2346eb57576247f49714032b61307a
<|skeleton|> class NotebookAction: """The ``NotebookAction`` is an :class:`.Action` which (if necessary) starts an embedded IPython kernel and a jupyter notebook server, and opens the server home page in a web browser allowing the user to interact with FSLeyes via notebooks.""" def __init__(self, overlayList, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotebookAction: """The ``NotebookAction`` is an :class:`.Action` which (if necessary) starts an embedded IPython kernel and a jupyter notebook server, and opens the server home page in a web browser allowing the user to interact with FSLeyes via notebooks.""" def __init__(self, overlayList, displayCtx, f...
the_stack_v2_python_sparse
fsleyes/actions/notebook.py
sanjayankur31/fsleyes
train
1
283c6f90c1997c7114004350326be1de7b6141d9
[ "parameters = json_parameters(optional=True)\nestimate_ttc = param_get(parameters, 'estimate_ttc', default=False)\nif estimate_ttc:\n return generate_http_error_flask(501, 'NotImplemented', exc_msg='estimate_ttc is not implemented!')\ntry:\n rule = get_replication_rule(rule_id, issuer=request.environ.get('iss...
<|body_start_0|> parameters = json_parameters(optional=True) estimate_ttc = param_get(parameters, 'estimate_ttc', default=False) if estimate_ttc: return generate_http_error_flask(501, 'NotImplemented', exc_msg='estimate_ttc is not implemented!') try: rule = get_re...
REST APIs for replication rules.
Rule
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rule: """REST APIs for replication rules.""" def get(self, rule_id): """--- summary: Return a Rule tags: - Rule parameters: - name: rule_id in: path description: The id of the replication rule. schema: type: string style: simple responses: 200: description: OK content: application/js...
stack_v2_sparse_classes_36k_train_022773
31,808
permissive
[ { "docstring": "--- summary: Return a Rule tags: - Rule parameters: - name: rule_id in: path description: The id of the replication rule. schema: type: string style: simple responses: 200: description: OK content: application/json: schema: type: string 406: description: Not Acceptable 401: description: Invalid ...
3
null
Implement the Python class `Rule` described below. Class description: REST APIs for replication rules. Method signatures and docstrings: - def get(self, rule_id): --- summary: Return a Rule tags: - Rule parameters: - name: rule_id in: path description: The id of the replication rule. schema: type: string style: simpl...
Implement the Python class `Rule` described below. Class description: REST APIs for replication rules. Method signatures and docstrings: - def get(self, rule_id): --- summary: Return a Rule tags: - Rule parameters: - name: rule_id in: path description: The id of the replication rule. schema: type: string style: simpl...
7f0d229ac0b3bc7dec12c6e158bea2b82d414a3b
<|skeleton|> class Rule: """REST APIs for replication rules.""" def get(self, rule_id): """--- summary: Return a Rule tags: - Rule parameters: - name: rule_id in: path description: The id of the replication rule. schema: type: string style: simple responses: 200: description: OK content: application/js...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Rule: """REST APIs for replication rules.""" def get(self, rule_id): """--- summary: Return a Rule tags: - Rule parameters: - name: rule_id in: path description: The id of the replication rule. schema: type: string style: simple responses: 200: description: OK content: application/json: schema: t...
the_stack_v2_python_sparse
lib/rucio/web/rest/flaskapi/v1/rules.py
rucio/rucio
train
232
df2a3038d307c16f6c7ea0ef1ccd4e11876e461a
[ "self.face_cascade = cv.CascadeClassifier(cascade_file_path)\nif self.face_cascade.empty():\n print(\"Classifier failed to load '{}' filepath\".format(cascade_file_path))\n raise", "rows, cols = frame.shape[:2]\nself.all_faces = self.face_cascade.detectMultiScale(frame, scaleFactor=1.3, minNeighbors=5)\nif ...
<|body_start_0|> self.face_cascade = cv.CascadeClassifier(cascade_file_path) if self.face_cascade.empty(): print("Classifier failed to load '{}' filepath".format(cascade_file_path)) raise <|end_body_0|> <|body_start_1|> rows, cols = frame.shape[:2] self.all_faces...
Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces.
FaceDetector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaceDetector: """Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces.""" def __init__(self, cascade_file_path=default...
stack_v2_sparse_classes_36k_train_022774
3,297
permissive
[ { "docstring": "Loads the image classifier and raises an exception if the classifier fails to load the xml classifier file. When using a different classifier xml, make sure to take into account relative file paths to avoid raising an exception.", "name": "__init__", "signature": "def __init__(self, casc...
2
stack_v2_sparse_classes_30k_train_007996
Implement the Python class `FaceDetector` described below. Class description: Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces. Method signa...
Implement the Python class `FaceDetector` described below. Class description: Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces. Method signa...
c9cf67c7c502406465d647d013f0d98cad2d4c44
<|skeleton|> class FaceDetector: """Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces.""" def __init__(self, cascade_file_path=default...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FaceDetector: """Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces.""" def __init__(self, cascade_file_path=default_cascade_file...
the_stack_v2_python_sparse
ComputerVisionServer/moedx/facial_detection/face_detector.py
mobiledgex/edge-cloud-sampleapps
train
12
43521002cadebc97931bef20f52c89d39e0106af
[ "if not genre:\n return random.choice(VIDEOS)\nelse:\n songs = [song for song in VIDEOS if genre.casefold() in song['genre']]\n try:\n return random.choice(songs)\n except IndexError:\n log.info('No videos for that genre.')", "anthem = self.get_video(genre)\nif anthem:\n await ctx.sen...
<|body_start_0|> if not genre: return random.choice(VIDEOS) else: songs = [song for song in VIDEOS if genre.casefold() in song['genre']] try: return random.choice(songs) except IndexError: log.info('No videos for that genre....
Embed a random youtube video for a gay anthem!
PrideAnthem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrideAnthem: """Embed a random youtube video for a gay anthem!""" def get_video(self, genre: Optional[str]=None) -> dict: """Picks a random anthem from the list. If `genre` is supplied, it will pick from videos attributed with that genre. If none can be found, it will log this as wel...
stack_v2_sparse_classes_36k_train_022775
1,572
permissive
[ { "docstring": "Picks a random anthem from the list. If `genre` is supplied, it will pick from videos attributed with that genre. If none can be found, it will log this as well as provide that information to the user.", "name": "get_video", "signature": "def get_video(self, genre: Optional[str]=None) ->...
2
stack_v2_sparse_classes_30k_train_009603
Implement the Python class `PrideAnthem` described below. Class description: Embed a random youtube video for a gay anthem! Method signatures and docstrings: - def get_video(self, genre: Optional[str]=None) -> dict: Picks a random anthem from the list. If `genre` is supplied, it will pick from videos attributed with ...
Implement the Python class `PrideAnthem` described below. Class description: Embed a random youtube video for a gay anthem! Method signatures and docstrings: - def get_video(self, genre: Optional[str]=None) -> dict: Picks a random anthem from the list. If `genre` is supplied, it will pick from videos attributed with ...
7aaf8f406fcb6cbe89e4b6742eff6c3efa754993
<|skeleton|> class PrideAnthem: """Embed a random youtube video for a gay anthem!""" def get_video(self, genre: Optional[str]=None) -> dict: """Picks a random anthem from the list. If `genre` is supplied, it will pick from videos attributed with that genre. If none can be found, it will log this as wel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrideAnthem: """Embed a random youtube video for a gay anthem!""" def get_video(self, genre: Optional[str]=None) -> dict: """Picks a random anthem from the list. If `genre` is supplied, it will pick from videos attributed with that genre. If none can be found, it will log this as well as provide ...
the_stack_v2_python_sparse
bot/exts/pride/pride_anthem.py
Lynchly/sir-lancebot
train
1
ea97491740fdb756629ae14602b1db028a3c93fa
[ "leoTkinterDialog.__init__(self, 'Enter unique id', resizeable=False, canClose=False)\nself.id_entry = None\nself.answer = None\nself.createTopFrame()\nself.top.bind('<Key>', self.onKey)\nmessage = 'leoID.txt not found\\n\\n' + 'Please enter an id that identifies you uniquely.\\n' + 'Your cvs login name is a good c...
<|body_start_0|> leoTkinterDialog.__init__(self, 'Enter unique id', resizeable=False, canClose=False) self.id_entry = None self.answer = None self.createTopFrame() self.top.bind('<Key>', self.onKey) message = 'leoID.txt not found\n\n' + 'Please enter an id that identifies...
A class that creates the Tkinter About Leo dialog.
tkinterAskLeoID
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tkinterAskLeoID: """A class that creates the Tkinter About Leo dialog.""" def __init__(self): """Create the Leo Id dialog.""" <|body_0|> def createFrame(self, message): """Create the frame for the Leo Id dialog.""" <|body_1|> def onButton(self): ...
stack_v2_sparse_classes_36k_train_022776
25,997
no_license
[ { "docstring": "Create the Leo Id dialog.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create the frame for the Leo Id dialog.", "name": "createFrame", "signature": "def createFrame(self, message)" }, { "docstring": "Handle clicks in the Leo Id close...
4
stack_v2_sparse_classes_30k_test_000852
Implement the Python class `tkinterAskLeoID` described below. Class description: A class that creates the Tkinter About Leo dialog. Method signatures and docstrings: - def __init__(self): Create the Leo Id dialog. - def createFrame(self, message): Create the frame for the Leo Id dialog. - def onButton(self): Handle c...
Implement the Python class `tkinterAskLeoID` described below. Class description: A class that creates the Tkinter About Leo dialog. Method signatures and docstrings: - def __init__(self): Create the Leo Id dialog. - def createFrame(self, message): Create the frame for the Leo Id dialog. - def onButton(self): Handle c...
28c22721e1bc313c120a8a6c288893bc566a5c67
<|skeleton|> class tkinterAskLeoID: """A class that creates the Tkinter About Leo dialog.""" def __init__(self): """Create the Leo Id dialog.""" <|body_0|> def createFrame(self, message): """Create the frame for the Leo Id dialog.""" <|body_1|> def onButton(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class tkinterAskLeoID: """A class that creates the Tkinter About Leo dialog.""" def __init__(self): """Create the Leo Id dialog.""" leoTkinterDialog.__init__(self, 'Enter unique id', resizeable=False, canClose=False) self.id_entry = None self.answer = None self.createTop...
the_stack_v2_python_sparse
Projects/jyleo/src/leoTkinterDialog.py
leo-editor/leo-editor-contrib
train
6
a39b52fc67acb608709f1f240e28d2c48e34a1c6
[ "if not root:\n return []\nstack, res = ([], [])\nstack.append(root)\nlevel = 0\nwhile stack:\n row, next_stack = ([], [])\n for node in stack:\n row.append(node.val)\n if node.left:\n next_stack.append(node.left)\n if node.right:\n next_stack.append(node.right)\n...
<|body_start_0|> if not root: return [] stack, res = ([], []) stack.append(root) level = 0 while stack: row, next_stack = ([], []) for node in stack: row.append(node.val) if node.left: next_st...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrderBottom(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def levelOrderBottom_reverse_102(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> i...
stack_v2_sparse_classes_36k_train_022777
1,479
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "levelOrderBottom", "signature": "def levelOrderBottom(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "levelOrderBottom_reverse_102", "signature": "def levelOrderBottom_reverse_...
2
stack_v2_sparse_classes_30k_train_006390
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrderBottom(self, root): :type root: TreeNode :rtype: List[List[int]] - def levelOrderBottom_reverse_102(self, root): :type root: TreeNode :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrderBottom(self, root): :type root: TreeNode :rtype: List[List[int]] - def levelOrderBottom_reverse_102(self, root): :type root: TreeNode :rtype: List[List[int]] <|ske...
1a3c1f4d6e9d3444039f087763b93241f4ba7892
<|skeleton|> class Solution: def levelOrderBottom(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def levelOrderBottom_reverse_102(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def levelOrderBottom(self, root): """:type root: TreeNode :rtype: List[List[int]]""" if not root: return [] stack, res = ([], []) stack.append(root) level = 0 while stack: row, next_stack = ([], []) for node in stack...
the_stack_v2_python_sparse
Algorithm/107_Binary_Tree_Level_Order_Traversal_II.py
Gi1ia/TechNoteBook
train
7
c06e86f717ba1f7db12ca21f7a94919476c21298
[ "self.api_version = api_version or DEFAULT_VERSION\nself.client = apis.GetClientInstance(API_NAME, self.api_version)\nself.messages = apis.GetMessagesModule(API_NAME, self.api_version)", "occurrence_iter = list_pager.YieldFromList(self.client.projects_notes_occurrences, request=self.messages.ContaineranalysisProj...
<|body_start_0|> self.api_version = api_version or DEFAULT_VERSION self.client = apis.GetClientInstance(API_NAME, self.api_version) self.messages = apis.GetMessagesModule(API_NAME, self.api_version) <|end_body_0|> <|body_start_1|> occurrence_iter = list_pager.YieldFromList(self.client.p...
A client to access containeranalysis for binauthz purposes.
Client
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Client: """A client to access containeranalysis for binauthz purposes.""" def __init__(self, api_version=None): """Creates a ContainerAnalysisClient. Args: api_version: The containeranalysis API version to use.""" <|body_0|> def YieldAttestations(self, note_ref, artifact...
stack_v2_sparse_classes_36k_train_022778
9,068
permissive
[ { "docstring": "Creates a ContainerAnalysisClient. Args: api_version: The containeranalysis API version to use.", "name": "__init__", "signature": "def __init__(self, api_version=None)" }, { "docstring": "Yields occurrences associated with given AA Note. Args: note_ref: The Note reference that w...
5
null
Implement the Python class `Client` described below. Class description: A client to access containeranalysis for binauthz purposes. Method signatures and docstrings: - def __init__(self, api_version=None): Creates a ContainerAnalysisClient. Args: api_version: The containeranalysis API version to use. - def YieldAttes...
Implement the Python class `Client` described below. Class description: A client to access containeranalysis for binauthz purposes. Method signatures and docstrings: - def __init__(self, api_version=None): Creates a ContainerAnalysisClient. Args: api_version: The containeranalysis API version to use. - def YieldAttes...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class Client: """A client to access containeranalysis for binauthz purposes.""" def __init__(self, api_version=None): """Creates a ContainerAnalysisClient. Args: api_version: The containeranalysis API version to use.""" <|body_0|> def YieldAttestations(self, note_ref, artifact...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Client: """A client to access containeranalysis for binauthz purposes.""" def __init__(self, api_version=None): """Creates a ContainerAnalysisClient. Args: api_version: The containeranalysis API version to use.""" self.api_version = api_version or DEFAULT_VERSION self.client = api...
the_stack_v2_python_sparse
google-cloud-sdk/lib/googlecloudsdk/api_lib/container/binauthz/containeranalysis.py
bopopescu/socialliteapp
train
0
36d005638c04e322a358545e4258028c2e388bcc
[ "errors = []\nif not HAS_TEXTFSM:\n errors.append(missing_required_lib('textfsm'))\nreturn {'errors': errors}", "cli_output = self._task_args.get('text')\nres = self._check_reqs()\nif res.get('errors'):\n return {'errors': res.get('errors')}\ntry:\n template = open(self._task_args.get('parser').get('temp...
<|body_start_0|> errors = [] if not HAS_TEXTFSM: errors.append(missing_required_lib('textfsm')) return {'errors': errors} <|end_body_0|> <|body_start_1|> cli_output = self._task_args.get('text') res = self._check_reqs() if res.get('errors'): retur...
The textfsm parser class Convert raw text to structured data using textfsm
CliParser
[ "GPL-3.0-or-later", "GPL-3.0-only", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CliParser: """The textfsm parser class Convert raw text to structured data using textfsm""" def _check_reqs(): """Check the prerequisites for the textfsm parser :return dict: A dict with errors or a template_path""" <|body_0|> def parse(self, *_args, **_kwargs): ...
stack_v2_sparse_classes_36k_train_022779
2,009
permissive
[ { "docstring": "Check the prerequisites for the textfsm parser :return dict: A dict with errors or a template_path", "name": "_check_reqs", "signature": "def _check_reqs()" }, { "docstring": "Std entry point for a cli_parse parse execution :return: Errors or parsed text as structured data :rtype...
2
null
Implement the Python class `CliParser` described below. Class description: The textfsm parser class Convert raw text to structured data using textfsm Method signatures and docstrings: - def _check_reqs(): Check the prerequisites for the textfsm parser :return dict: A dict with errors or a template_path - def parse(se...
Implement the Python class `CliParser` described below. Class description: The textfsm parser class Convert raw text to structured data using textfsm Method signatures and docstrings: - def _check_reqs(): Check the prerequisites for the textfsm parser :return dict: A dict with errors or a template_path - def parse(se...
2ea7d4f00212f502bc684ac257371ada73da1ca9
<|skeleton|> class CliParser: """The textfsm parser class Convert raw text to structured data using textfsm""" def _check_reqs(): """Check the prerequisites for the textfsm parser :return dict: A dict with errors or a template_path""" <|body_0|> def parse(self, *_args, **_kwargs): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CliParser: """The textfsm parser class Convert raw text to structured data using textfsm""" def _check_reqs(): """Check the prerequisites for the textfsm parser :return dict: A dict with errors or a template_path""" errors = [] if not HAS_TEXTFSM: errors.append(missing...
the_stack_v2_python_sparse
intro-ansible/venv3/lib/python3.8/site-packages/ansible_collections/ansible/netcommon/plugins/cli_parsers/textfsm_parser.py
SimonFangCisco/dne-dna-code
train
0
a639412340c7c976da22e0ae2f1cb875ddf94df8
[ "r = Round.query.get(round_id)\nif r is not None:\n return r.progress_data()\nabort(404, 'Unknown round_id')", "previous_round = Round.query.get(round_id)\nif previous_round is not None:\n r = Round()\n r.type = api.payload['type']\n r.set_marks(api.payload['min_marks'], api.payload['max_marks'])\n ...
<|body_start_0|> r = Round.query.get(round_id) if r is not None: return r.progress_data() abort(404, 'Unknown round_id') <|end_body_0|> <|body_start_1|> previous_round = Round.query.get(round_id) if previous_round is not None: r = Round() r.ty...
RoundAPIProgress
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoundAPIProgress: def get(self, round_id): """Get progress data""" <|body_0|> def post(self, round_id): """Create the next round""" <|body_1|> def patch(self, round_id): """Create the next round after a general look""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_022780
25,303
no_license
[ { "docstring": "Get progress data", "name": "get", "signature": "def get(self, round_id)" }, { "docstring": "Create the next round", "name": "post", "signature": "def post(self, round_id)" }, { "docstring": "Create the next round after a general look", "name": "patch", "s...
3
null
Implement the Python class `RoundAPIProgress` described below. Class description: Implement the RoundAPIProgress class. Method signatures and docstrings: - def get(self, round_id): Get progress data - def post(self, round_id): Create the next round - def patch(self, round_id): Create the next round after a general lo...
Implement the Python class `RoundAPIProgress` described below. Class description: Implement the RoundAPIProgress class. Method signatures and docstrings: - def get(self, round_id): Get progress data - def post(self, round_id): Create the next round - def patch(self, round_id): Create the next round after a general lo...
079b109fd13683a31d1d632faa5ab72cf0e78ddf
<|skeleton|> class RoundAPIProgress: def get(self, round_id): """Get progress data""" <|body_0|> def post(self, round_id): """Create the next round""" <|body_1|> def patch(self, round_id): """Create the next round after a general look""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RoundAPIProgress: def get(self, round_id): """Get progress data""" r = Round.query.get(round_id) if r is not None: return r.progress_data() abort(404, 'Unknown round_id') def post(self, round_id): """Create the next round""" previous_round = Rou...
the_stack_v2_python_sparse
backend/apis/round/apis.py
AlenAlic/DANCE
train
0
3814f2821dcb4975da508bac93a117dce594b283
[ "if m == 1 or n == 1:\n return 1\ndp = [[0] * (n + 1) for i in range(m + 1)]\ndp[1][2] = 1\ndp[2][1] = 1\nfor i in range(1, m + 1):\n for j in range(1, n + 1):\n if dp[i][j] != 0:\n continue\n dp[i][j] = dp[i - 1][j] + dp[i][j - 1]\nreturn dp[m][n]", "direct = [[1, 0], [0, 1]]\nx, y...
<|body_start_0|> if m == 1 or n == 1: return 1 dp = [[0] * (n + 1) for i in range(m + 1)] dp[1][2] = 1 dp[2][1] = 1 for i in range(1, m + 1): for j in range(1, n + 1): if dp[i][j] != 0: continue dp[i][j] ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def uniquePaths1(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if m == 1 or n == 1: ret...
stack_v2_sparse_classes_36k_train_022781
1,083
permissive
[ { "docstring": ":type m: int :type n: int :rtype: int", "name": "uniquePaths", "signature": "def uniquePaths(self, m, n)" }, { "docstring": ":type m: int :type n: int :rtype: int", "name": "uniquePaths1", "signature": "def uniquePaths1(self, m, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int - def uniquePaths1(self, m, n): :type m: int :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int - def uniquePaths1(self, m, n): :type m: int :type n: int :rtype: int <|skeleton|> class Solution: def un...
64847cbb1adcaca4561b949e8acc52e8e031a6cb
<|skeleton|> class Solution: def uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def uniquePaths1(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int""" if m == 1 or n == 1: return 1 dp = [[0] * (n + 1) for i in range(m + 1)] dp[1][2] = 1 dp[2][1] = 1 for i in range(1, m + 1): for j in range(1, n + 1): ...
the_stack_v2_python_sparse
UniquePaths62.py
Bit64L/LeetCode-Python-
train
0
1b359b11eba1efb9e4f787f074d9e7165a756920
[ "self.matrix = matrix\nrow = len(matrix)\nif row:\n col = len(matrix[0])\n for i in range(0, row):\n for j in range(0, col):\n if i > 0 and j > 0:\n matrix[i][j] = matrix[i][j - 1] + matrix[i - 1][j] + matrix[i][j] - matrix[i - 1][j - 1]\n if i == 0 and j > 0:\n ...
<|body_start_0|> self.matrix = matrix row = len(matrix) if row: col = len(matrix[0]) for i in range(0, row): for j in range(0, col): if i > 0 and j > 0: matrix[i][j] = matrix[i][j - 1] + matrix[i - 1][j] + matrix...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :type row2: int :type col2: int :rtype: ...
stack_v2_sparse_classes_36k_train_022782
1,417
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": "sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", ...
2
stack_v2_sparse_classes_30k_train_017185
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1...
4599634f31d78a0372cf0ff6fb7935d054d5ecb5
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :type row2: int :type col2: int :rtype: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" self.matrix = matrix row = len(matrix) if row: col = len(matrix[0]) for i in range(0, row): for j in range(0, col): if i > 0 and j > 0: ...
the_stack_v2_python_sparse
medium/range_sum_query_2d.py
jhgdike/leetCode
train
3
82f1aa672511dbda1c943d39236384025f773ffc
[ "jane = Player(name='Jane')\nself.assertIsNotNone(jane)\nself.assertEqual(str(jane), 'Jane')\nphil = Player(name='Phil')\nself.assertIsNotNone(phil)\nself.assertEqual(str(phil), 'Phil')", "player = Player(name='Bob')\nself.assertIsNotNone(player)\nself.assertEqual(str(player), 'Bob')\nself.assertTrue(player.is_si...
<|body_start_0|> jane = Player(name='Jane') self.assertIsNotNone(jane) self.assertEqual(str(jane), 'Jane') phil = Player(name='Phil') self.assertIsNotNone(phil) self.assertEqual(str(phil), 'Phil') <|end_body_0|> <|body_start_1|> player = Player(name='Bob') ...
TestSequenceFunctions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSequenceFunctions: def test_new_Player(self): """Test basic Player construction.""" <|body_0|> def test_Player(self): """Test Player class""" <|body_1|> def test_deal_card(self): """Test Player.deal_card() method""" <|body_2|> de...
stack_v2_sparse_classes_36k_train_022783
5,537
no_license
[ { "docstring": "Test basic Player construction.", "name": "test_new_Player", "signature": "def test_new_Player(self)" }, { "docstring": "Test Player class", "name": "test_Player", "signature": "def test_Player(self)" }, { "docstring": "Test Player.deal_card() method", "name":...
6
stack_v2_sparse_classes_30k_train_021600
Implement the Python class `TestSequenceFunctions` described below. Class description: Implement the TestSequenceFunctions class. Method signatures and docstrings: - def test_new_Player(self): Test basic Player construction. - def test_Player(self): Test Player class - def test_deal_card(self): Test Player.deal_card(...
Implement the Python class `TestSequenceFunctions` described below. Class description: Implement the TestSequenceFunctions class. Method signatures and docstrings: - def test_new_Player(self): Test basic Player construction. - def test_Player(self): Test Player class - def test_deal_card(self): Test Player.deal_card(...
3176f59c665d87afe5bf4bed68ec8afa44fddf6c
<|skeleton|> class TestSequenceFunctions: def test_new_Player(self): """Test basic Player construction.""" <|body_0|> def test_Player(self): """Test Player class""" <|body_1|> def test_deal_card(self): """Test Player.deal_card() method""" <|body_2|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSequenceFunctions: def test_new_Player(self): """Test basic Player construction.""" jane = Player(name='Jane') self.assertIsNotNone(jane) self.assertEqual(str(jane), 'Jane') phil = Player(name='Phil') self.assertIsNotNone(phil) self.assertEqual(str(p...
the_stack_v2_python_sparse
unittests/test-Player.py
von/pyPoker
train
4
3a051a1c4ce25e982c280ef41be418ccf49fc96c
[ "if '.' not in encoder:\n encoder = '.'.join(__name__.split('.')[:-1]) + '.' + encoder.capitalize() + 'Encoder'\nreturn Resolver()(encoder)", "if encoder is True:\n return Encoder()\nreturn EncoderFactory.get(encoder)()" ]
<|body_start_0|> if '.' not in encoder: encoder = '.'.join(__name__.split('.')[:-1]) + '.' + encoder.capitalize() + 'Encoder' return Resolver()(encoder) <|end_body_0|> <|body_start_1|> if encoder is True: return Encoder() return EncoderFactory.get(encoder)() <|en...
Encoder factory. Creates new Encoder instances.
EncoderFactory
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderFactory: """Encoder factory. Creates new Encoder instances.""" def get(encoder): """Gets a new instance of encoder class. Args: encoder: Encoder instance class Returns: Encoder class""" <|body_0|> def create(encoder): """Creates a new Encoder instance. Arg...
stack_v2_sparse_classes_36k_train_022784
1,001
permissive
[ { "docstring": "Gets a new instance of encoder class. Args: encoder: Encoder instance class Returns: Encoder class", "name": "get", "signature": "def get(encoder)" }, { "docstring": "Creates a new Encoder instance. Args: encoder: Encoder instance class Returns: Encoder", "name": "create", ...
2
null
Implement the Python class `EncoderFactory` described below. Class description: Encoder factory. Creates new Encoder instances. Method signatures and docstrings: - def get(encoder): Gets a new instance of encoder class. Args: encoder: Encoder instance class Returns: Encoder class - def create(encoder): Creates a new ...
Implement the Python class `EncoderFactory` described below. Class description: Encoder factory. Creates new Encoder instances. Method signatures and docstrings: - def get(encoder): Gets a new instance of encoder class. Args: encoder: Encoder instance class Returns: Encoder class - def create(encoder): Creates a new ...
789a4555cb60ee9cdfa69afae5a5236d197e2b07
<|skeleton|> class EncoderFactory: """Encoder factory. Creates new Encoder instances.""" def get(encoder): """Gets a new instance of encoder class. Args: encoder: Encoder instance class Returns: Encoder class""" <|body_0|> def create(encoder): """Creates a new Encoder instance. Arg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderFactory: """Encoder factory. Creates new Encoder instances.""" def get(encoder): """Gets a new instance of encoder class. Args: encoder: Encoder instance class Returns: Encoder class""" if '.' not in encoder: encoder = '.'.join(__name__.split('.')[:-1]) + '.' + encoder....
the_stack_v2_python_sparse
src/python/txtai/database/encoder/factory.py
neuml/txtai
train
4,804
bae3ebeb2007b1032f63180a2691e26875352db5
[ "DataFrame.__init__(self, rows=rows, list_x_min=list_x_min, list_x_max=list_x_max, list_x_delta=list_x_delta)\nself.listXDelta = list_x_delta\nsum_probs = 0\nfor row in rows:\n sum_probs += row[-1]\nif sum_probs < 0.99999 or sum_probs > 1.000001:\n raise ValueError('Sum of probabilities should add to 1.')", ...
<|body_start_0|> DataFrame.__init__(self, rows=rows, list_x_min=list_x_min, list_x_max=list_x_max, list_x_delta=list_x_delta) self.listXDelta = list_x_delta sum_probs = 0 for row in rows: sum_probs += row[-1] if sum_probs < 0.99999 or sum_probs > 1.000001: ...
example: age, sex, probability 0, 0, 0.1, 0, 1, 0.2, 5, 0, 0.3, 5, 1, 0.4,
DataFrameWithEmpiricalDist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataFrameWithEmpiricalDist: """example: age, sex, probability 0, 0, 0.1, 0, 1, 0.2, 5, 0, 0.3, 5, 1, 0.4,""" def __init__(self, rows, list_x_min, list_x_max, list_x_delta): """:param rows: (list of list) the table above :param list_x_min: list of minimum value of x (in example above:...
stack_v2_sparse_classes_36k_train_022785
22,072
no_license
[ { "docstring": ":param rows: (list of list) the table above :param list_x_min: list of minimum value of x (in example above: [0, 0]) :param list_x_max: list of maximum value of x (in example above: [10, 1]) :param list_x_delta: list of interval between break points of x if set to 'int', x is treated as categori...
2
stack_v2_sparse_classes_30k_train_019893
Implement the Python class `DataFrameWithEmpiricalDist` described below. Class description: example: age, sex, probability 0, 0, 0.1, 0, 1, 0.2, 5, 0, 0.3, 5, 1, 0.4, Method signatures and docstrings: - def __init__(self, rows, list_x_min, list_x_max, list_x_delta): :param rows: (list of list) the table above :param ...
Implement the Python class `DataFrameWithEmpiricalDist` described below. Class description: example: age, sex, probability 0, 0, 0.1, 0, 1, 0.2, 5, 0, 0.3, 5, 1, 0.4, Method signatures and docstrings: - def __init__(self, rows, list_x_min, list_x_max, list_x_delta): :param rows: (list of list) the table above :param ...
2c456d92741ba751af6bc90c49608b49f524182d
<|skeleton|> class DataFrameWithEmpiricalDist: """example: age, sex, probability 0, 0, 0.1, 0, 1, 0.2, 5, 0, 0.3, 5, 1, 0.4,""" def __init__(self, rows, list_x_min, list_x_max, list_x_delta): """:param rows: (list of list) the table above :param list_x_min: list of minimum value of x (in example above:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataFrameWithEmpiricalDist: """example: age, sex, probability 0, 0, 0.1, 0, 1, 0.2, 5, 0, 0.3, 5, 1, 0.4,""" def __init__(self, rows, list_x_min, list_x_max, list_x_delta): """:param rows: (list of list) the table above :param list_x_min: list of minimum value of x (in example above: [0, 0]) :par...
the_stack_v2_python_sparse
SimPy/DataFrames.py
yaesoubilab/SimPy
train
6
5603fa9f26469a0df0856bed53f1b25e7cd9403e
[ "super(Net, self).__init__()\nself.cfgs = cfgs\nself.embedding = nn.Embedding(num_embeddings=token_size, embedding_dim=cfgs.word_emb_size)\nif cfgs.pretrained_emb['name']:\n self.embedding.weight.data.copy_(torch.from_numpy(pretrained_emb))\nself.encode_lang = nn.GRU(input_size=cfgs.word_emb_size, hidden_size=cf...
<|body_start_0|> super(Net, self).__init__() self.cfgs = cfgs self.embedding = nn.Embedding(num_embeddings=token_size, embedding_dim=cfgs.word_emb_size) if cfgs.pretrained_emb['name']: self.embedding.weight.data.copy_(torch.from_numpy(pretrained_emb)) self.encode_lang...
Net
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Net: def __init__(self, cfgs, pretrained_emb, token_size): """:param cfgs: configurations of XTQA. :param pretrained_emb: :param token_size: the size of vocabulary table.""" <|body_0|> def forward(self, que_ix, opt_ix, dia, dia_node_ix, ins_dia, cp_ix): """:param que...
stack_v2_sparse_classes_36k_train_022786
3,745
no_license
[ { "docstring": ":param cfgs: configurations of XTQA. :param pretrained_emb: :param token_size: the size of vocabulary table.", "name": "__init__", "signature": "def __init__(self, cfgs, pretrained_emb, token_size)" }, { "docstring": ":param que_ix: the index of questions :param opt_ix: the index...
2
stack_v2_sparse_classes_30k_train_001685
Implement the Python class `Net` described below. Class description: Implement the Net class. Method signatures and docstrings: - def __init__(self, cfgs, pretrained_emb, token_size): :param cfgs: configurations of XTQA. :param pretrained_emb: :param token_size: the size of vocabulary table. - def forward(self, que_i...
Implement the Python class `Net` described below. Class description: Implement the Net class. Method signatures and docstrings: - def __init__(self, cfgs, pretrained_emb, token_size): :param cfgs: configurations of XTQA. :param pretrained_emb: :param token_size: the size of vocabulary table. - def forward(self, que_i...
fca8f4ef64752f48dd73a98be48e99a21a933049
<|skeleton|> class Net: def __init__(self, cfgs, pretrained_emb, token_size): """:param cfgs: configurations of XTQA. :param pretrained_emb: :param token_size: the size of vocabulary table.""" <|body_0|> def forward(self, que_ix, opt_ix, dia, dia_node_ix, ins_dia, cp_ix): """:param que...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Net: def __init__(self, cfgs, pretrained_emb, token_size): """:param cfgs: configurations of XTQA. :param pretrained_emb: :param token_size: the size of vocabulary table.""" super(Net, self).__init__() self.cfgs = cfgs self.embedding = nn.Embedding(num_embeddings=token_size, em...
the_stack_v2_python_sparse
opentqa/models/dqa/mutan/net.py
TrellixVulnTeam/opentqa_DYRZ
train
0
97eb4b976a8690d4f30bdd3946dbcf022ccdb28d
[ "global url\nsess = session()\nparams = {'parameter': {'recognize_class': 'update', 'rate_grade': '高', 'update_propertiy': {'cn_id': 'true', 'cn_bank': 'true', 'cn_email': 'true', 'cn_date': 'false', 'cn_telephone': 'true', 'cn_passport': 'false'}}}\ns_get = sess.put(url, json=params)\njson_data = json.loads(s_get....
<|body_start_0|> global url sess = session() params = {'parameter': {'recognize_class': 'update', 'rate_grade': '高', 'update_propertiy': {'cn_id': 'true', 'cn_bank': 'true', 'cn_email': 'true', 'cn_date': 'false', 'cn_telephone': 'true', 'cn_passport': 'false'}}} s_get = sess.put(url, js...
TestApiPorpertySensitive
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestApiPorpertySensitive: def test_update_property(self): """参数: 修改类别为update,id和bank为true,其他为false 期望结果: 返回的识别信息列表有两个信息cn_id和cn_bank""" <|body_0|> def test_default_property(self): """参数: 修改类别为defalut, 期望结果: 返回的识别信息列表有四个信息cn_id、cn_bank、cn_email、cn_telephon""" ...
stack_v2_sparse_classes_36k_train_022787
2,846
no_license
[ { "docstring": "参数: 修改类别为update,id和bank为true,其他为false 期望结果: 返回的识别信息列表有两个信息cn_id和cn_bank", "name": "test_update_property", "signature": "def test_update_property(self)" }, { "docstring": "参数: 修改类别为defalut, 期望结果: 返回的识别信息列表有四个信息cn_id、cn_bank、cn_email、cn_telephon", "name": "test_default_property...
2
stack_v2_sparse_classes_30k_train_017293
Implement the Python class `TestApiPorpertySensitive` described below. Class description: Implement the TestApiPorpertySensitive class. Method signatures and docstrings: - def test_update_property(self): 参数: 修改类别为update,id和bank为true,其他为false 期望结果: 返回的识别信息列表有两个信息cn_id和cn_bank - def test_default_property(self): 参数: 修改类...
Implement the Python class `TestApiPorpertySensitive` described below. Class description: Implement the TestApiPorpertySensitive class. Method signatures and docstrings: - def test_update_property(self): 参数: 修改类别为update,id和bank为true,其他为false 期望结果: 返回的识别信息列表有两个信息cn_id和cn_bank - def test_default_property(self): 参数: 修改类...
fb268cf7901322bb16b8b295f2c791628665bfb8
<|skeleton|> class TestApiPorpertySensitive: def test_update_property(self): """参数: 修改类别为update,id和bank为true,其他为false 期望结果: 返回的识别信息列表有两个信息cn_id和cn_bank""" <|body_0|> def test_default_property(self): """参数: 修改类别为defalut, 期望结果: 返回的识别信息列表有四个信息cn_id、cn_bank、cn_email、cn_telephon""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestApiPorpertySensitive: def test_update_property(self): """参数: 修改类别为update,id和bank为true,其他为false 期望结果: 返回的识别信息列表有两个信息cn_id和cn_bank""" global url sess = session() params = {'parameter': {'recognize_class': 'update', 'rate_grade': '高', 'update_propertiy': {'cn_id': 'true', 'cn_...
the_stack_v2_python_sparse
aladdin-cas/unit_test/test_api_property_privacy.py
ARES3366/aladdin
train
0
7716ee073940c81c419afe2f163e081402a256c9
[ "if dungeon is None or len(dungeon) == 0:\n return 0\nm = len(dungeon)\nn = len(dungeon[0])\nhp = [[0 for j in range(n)] for i in range(m)]\nhp[m - 1][n - 1] = abs(dungeon[m - 1][n - 1]) + 1 if dungeon[m - 1][n - 1] < 0 else 1\nfor j in range(n - 2, -1, -1):\n need = hp[m - 1][j + 1] - dungeon[m - 1][j]\n ...
<|body_start_0|> if dungeon is None or len(dungeon) == 0: return 0 m = len(dungeon) n = len(dungeon[0]) hp = [[0 for j in range(n)] for i in range(m)] hp[m - 1][n - 1] = abs(dungeon[m - 1][n - 1]) + 1 if dungeon[m - 1][n - 1] < 0 else 1 for j in range(n - 2, -...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def calculateMinimumHP(self, dungeon): """:type dungeon: List[List[int]] :rtype: int""" <|body_0|> def calculateMinimumHP2(self, dungeon): """:type dungeon: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if dun...
stack_v2_sparse_classes_36k_train_022788
2,309
no_license
[ { "docstring": ":type dungeon: List[List[int]] :rtype: int", "name": "calculateMinimumHP", "signature": "def calculateMinimumHP(self, dungeon)" }, { "docstring": ":type dungeon: List[List[int]] :rtype: int", "name": "calculateMinimumHP2", "signature": "def calculateMinimumHP2(self, dunge...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calculateMinimumHP(self, dungeon): :type dungeon: List[List[int]] :rtype: int - def calculateMinimumHP2(self, dungeon): :type dungeon: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calculateMinimumHP(self, dungeon): :type dungeon: List[List[int]] :rtype: int - def calculateMinimumHP2(self, dungeon): :type dungeon: List[List[int]] :rtype: int <|skeleton...
54d3d9530b25272d4a2e5dc33e7035c44f506dc5
<|skeleton|> class Solution: def calculateMinimumHP(self, dungeon): """:type dungeon: List[List[int]] :rtype: int""" <|body_0|> def calculateMinimumHP2(self, dungeon): """:type dungeon: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def calculateMinimumHP(self, dungeon): """:type dungeon: List[List[int]] :rtype: int""" if dungeon is None or len(dungeon) == 0: return 0 m = len(dungeon) n = len(dungeon[0]) hp = [[0 for j in range(n)] for i in range(m)] hp[m - 1][n - 1] =...
the_stack_v2_python_sparse
old/DungeonGame.py
MaxIakovliev/algorithms
train
0
857000e92d7ad62ebd5760e74541e080c926b205
[ "weightValue = {}\nfor i in range(len(weight)):\n key = weight[i]\n if key not in weightValue.keys():\n weightValue[key] = value[i]\n elif value[i] > weightValue[key]:\n weightValue[key] = value[i]\n else:\n continue\nprint('物品体积价值对应比:', weightValue, list(weightValue.items()))\nweig...
<|body_start_0|> weightValue = {} for i in range(len(weight)): key = weight[i] if key not in weightValue.keys(): weightValue[key] = value[i] elif value[i] > weightValue[key]: weightValue[key] = value[i] else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getdict(self, weight, value): """0-1背包转为完全背包问题:有限变无限""" <|body_0|> def BagMaxValue(self, num, WeightLimit, weight, value): """完全背包问题""" <|body_1|> <|end_skeleton|> <|body_start_0|> weightValue = {} for i in range(len(weight)): ...
stack_v2_sparse_classes_36k_train_022789
3,707
no_license
[ { "docstring": "0-1背包转为完全背包问题:有限变无限", "name": "getdict", "signature": "def getdict(self, weight, value)" }, { "docstring": "完全背包问题", "name": "BagMaxValue", "signature": "def BagMaxValue(self, num, WeightLimit, weight, value)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getdict(self, weight, value): 0-1背包转为完全背包问题:有限变无限 - def BagMaxValue(self, num, WeightLimit, weight, value): 完全背包问题
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getdict(self, weight, value): 0-1背包转为完全背包问题:有限变无限 - def BagMaxValue(self, num, WeightLimit, weight, value): 完全背包问题 <|skeleton|> class Solution: def getdict(self, weight...
4e4f739402b95691f6c91411da26d7d3bfe042b6
<|skeleton|> class Solution: def getdict(self, weight, value): """0-1背包转为完全背包问题:有限变无限""" <|body_0|> def BagMaxValue(self, num, WeightLimit, weight, value): """完全背包问题""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getdict(self, weight, value): """0-1背包转为完全背包问题:有限变无限""" weightValue = {} for i in range(len(weight)): key = weight[i] if key not in weightValue.keys(): weightValue[key] = value[i] elif value[i] > weightValue[key]: ...
the_stack_v2_python_sparse
other_code_programe/16.完全背包问题.py
hugechuanqi/Algorithms-and-Data-Structures
train
3
9b1cd2e0ddb85a6749c2e37c5a725f0fc527879d
[ "if n < 3:\n return 0\noutput = [1] * n\noutput[0], output[1] = (0, 0)\nfor i in range(2, int(n ** 0.5) + 1):\n if output[i] == 1:\n print(i ** 2, n, i)\n output[i ** 2:n:i] = [0] * len(output[i ** 2:n:i])\nreturn sum(output)", "if n <= 2:\n return 0\nprime_list = [2]\nfor i in range(3, n):...
<|body_start_0|> if n < 3: return 0 output = [1] * n output[0], output[1] = (0, 0) for i in range(2, int(n ** 0.5) + 1): if output[i] == 1: print(i ** 2, n, i) output[i ** 2:n:i] = [0] * len(output[i ** 2:n:i]) return sum(ou...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countPrimes(self, n: int) -> int: """这题搜到一个非常牛逼的算法,叫做厄拉多塞筛法. 比如说求20以内质数的个数,首先0,1不是质数.2是第一个质数,然后把20以内所有2的倍数划去. 2后面紧跟的数即为下一个质数3,然后把3所有的倍数划去.3后面紧跟的数即为下一个质数5,再把5所有的倍数划去.以此类推. 在上面遍历索引的时候用到了一个非常好的技巧. 即i是从(2,int(n**0.5)+1)而非(2,n).这个技巧是可以验证的,比如说求9以内的质数个数, 那么只要划掉sqrt(9)以内的质数倍数,剩下的即全...
stack_v2_sparse_classes_36k_train_022790
2,396
no_license
[ { "docstring": "这题搜到一个非常牛逼的算法,叫做厄拉多塞筛法. 比如说求20以内质数的个数,首先0,1不是质数.2是第一个质数,然后把20以内所有2的倍数划去. 2后面紧跟的数即为下一个质数3,然后把3所有的倍数划去.3后面紧跟的数即为下一个质数5,再把5所有的倍数划去.以此类推. 在上面遍历索引的时候用到了一个非常好的技巧. 即i是从(2,int(n**0.5)+1)而非(2,n).这个技巧是可以验证的,比如说求9以内的质数个数, 那么只要划掉sqrt(9)以内的质数倍数,剩下的即全为质数. 所以在划去倍数的时候也是从i*i开始划掉,而不是i+i. 代码的实现上用了非常好的技巧: :param n:...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countPrimes(self, n: int) -> int: 这题搜到一个非常牛逼的算法,叫做厄拉多塞筛法. 比如说求20以内质数的个数,首先0,1不是质数.2是第一个质数,然后把20以内所有2的倍数划去. 2后面紧跟的数即为下一个质数3,然后把3所有的倍数划去.3后面紧跟的数即为下一个质数5,再把5所有的倍数划去.以此类推. 在上面遍历索...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countPrimes(self, n: int) -> int: 这题搜到一个非常牛逼的算法,叫做厄拉多塞筛法. 比如说求20以内质数的个数,首先0,1不是质数.2是第一个质数,然后把20以内所有2的倍数划去. 2后面紧跟的数即为下一个质数3,然后把3所有的倍数划去.3后面紧跟的数即为下一个质数5,再把5所有的倍数划去.以此类推. 在上面遍历索...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def countPrimes(self, n: int) -> int: """这题搜到一个非常牛逼的算法,叫做厄拉多塞筛法. 比如说求20以内质数的个数,首先0,1不是质数.2是第一个质数,然后把20以内所有2的倍数划去. 2后面紧跟的数即为下一个质数3,然后把3所有的倍数划去.3后面紧跟的数即为下一个质数5,再把5所有的倍数划去.以此类推. 在上面遍历索引的时候用到了一个非常好的技巧. 即i是从(2,int(n**0.5)+1)而非(2,n).这个技巧是可以验证的,比如说求9以内的质数个数, 那么只要划掉sqrt(9)以内的质数倍数,剩下的即全...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countPrimes(self, n: int) -> int: """这题搜到一个非常牛逼的算法,叫做厄拉多塞筛法. 比如说求20以内质数的个数,首先0,1不是质数.2是第一个质数,然后把20以内所有2的倍数划去. 2后面紧跟的数即为下一个质数3,然后把3所有的倍数划去.3后面紧跟的数即为下一个质数5,再把5所有的倍数划去.以此类推. 在上面遍历索引的时候用到了一个非常好的技巧. 即i是从(2,int(n**0.5)+1)而非(2,n).这个技巧是可以验证的,比如说求9以内的质数个数, 那么只要划掉sqrt(9)以内的质数倍数,剩下的即全为质数. 所以在划去倍数的时...
the_stack_v2_python_sparse
204_计数质数.py
lovehhf/LeetCode
train
0
48b6bfdf3841c55d1521e60891df82f07dde1335
[ "n = len(nums)\n\ndef dfs(a, cur):\n nonlocal res\n if a == (1 << n) - 1:\n res.append(cur)\n for i in range(n):\n if a & 1 << i:\n continue\n dfs(a | 1 << i, cur + [nums[i]])\nres = []\ndfs(0, [])\nreturn res", "n = len(nums)\n\ndef dfs(start):\n nonlocal res\n if s...
<|body_start_0|> n = len(nums) def dfs(a, cur): nonlocal res if a == (1 << n) - 1: res.append(cur) for i in range(n): if a & 1 << i: continue dfs(a | 1 << i, cur + [nums[i]]) res = [] ...
[46. 全排列](https://leetcode-cn.com/problems/permutations/)
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """[46. 全排列](https://leetcode-cn.com/problems/permutations/)""" def permute(self, nums: List[int]) -> List[List[int]]: """思路:回溯算法,由于没有重复的数字,每次传一个值,用二进制代表哪个位置被选过""" <|body_0|> def permute2(self, nums: List[int]) -> List[List[int]]: """思路:回溯算法,大佬的交换法,可以随递...
stack_v2_sparse_classes_36k_train_022791
1,469
no_license
[ { "docstring": "思路:回溯算法,由于没有重复的数字,每次传一个值,用二进制代表哪个位置被选过", "name": "permute", "signature": "def permute(self, nums: List[int]) -> List[List[int]]" }, { "docstring": "思路:回溯算法,大佬的交换法,可以随递归深度缩小遍历次数", "name": "permute2", "signature": "def permute2(self, nums: List[int]) -> List[List[int]]" }...
2
stack_v2_sparse_classes_30k_train_017964
Implement the Python class `Solution` described below. Class description: [46. 全排列](https://leetcode-cn.com/problems/permutations/) Method signatures and docstrings: - def permute(self, nums: List[int]) -> List[List[int]]: 思路:回溯算法,由于没有重复的数字,每次传一个值,用二进制代表哪个位置被选过 - def permute2(self, nums: List[int]) -> List[List[int]]...
Implement the Python class `Solution` described below. Class description: [46. 全排列](https://leetcode-cn.com/problems/permutations/) Method signatures and docstrings: - def permute(self, nums: List[int]) -> List[List[int]]: 思路:回溯算法,由于没有重复的数字,每次传一个值,用二进制代表哪个位置被选过 - def permute2(self, nums: List[int]) -> List[List[int]]...
dbe8eb449e5b112a71bc1cd4eabfd138304de4a3
<|skeleton|> class Solution: """[46. 全排列](https://leetcode-cn.com/problems/permutations/)""" def permute(self, nums: List[int]) -> List[List[int]]: """思路:回溯算法,由于没有重复的数字,每次传一个值,用二进制代表哪个位置被选过""" <|body_0|> def permute2(self, nums: List[int]) -> List[List[int]]: """思路:回溯算法,大佬的交换法,可以随递...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """[46. 全排列](https://leetcode-cn.com/problems/permutations/)""" def permute(self, nums: List[int]) -> List[List[int]]: """思路:回溯算法,由于没有重复的数字,每次传一个值,用二进制代表哪个位置被选过""" n = len(nums) def dfs(a, cur): nonlocal res if a == (1 << n) - 1: ...
the_stack_v2_python_sparse
leetcode/1-300/46.py
Rivarrl/leetcode_python
train
3
e37c7a2b403a5ea08a4c4dca7671bbb891921288
[ "super(Encoder, self).__init__()\nself.attention = Attention(hidden_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio)\nself.latent = LatentModule(hidden_size, interm_size)\nself.output = Output(interm_size, hidden_size, hidden_dropout_ratio)", "attention_temp = self.attention(hidden_states...
<|body_start_0|> super(Encoder, self).__init__() self.attention = Attention(hidden_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio) self.latent = LatentModule(hidden_size, interm_size) self.output = Output(interm_size, hidden_size, hidden_dropout_ratio) <|end_bod...
Encoder
Encoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Encoder""" def __init__(self, hidden_size, interm_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio): """Initialization""" <|body_0|> def forward(self, hidden_states, attention_mask): """Encoder block""" <|body_1|> <|en...
stack_v2_sparse_classes_36k_train_022792
12,741
permissive
[ { "docstring": "Initialization", "name": "__init__", "signature": "def __init__(self, hidden_size, interm_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio)" }, { "docstring": "Encoder block", "name": "forward", "signature": "def forward(self, hidden_states, attent...
2
null
Implement the Python class `Encoder` described below. Class description: Encoder Method signatures and docstrings: - def __init__(self, hidden_size, interm_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio): Initialization - def forward(self, hidden_states, attention_mask): Encoder block
Implement the Python class `Encoder` described below. Class description: Encoder Method signatures and docstrings: - def __init__(self, hidden_size, interm_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio): Initialization - def forward(self, hidden_states, attention_mask): Encoder block <|ske...
e6ab0261eb719c21806bbadfd94001ecfe27de45
<|skeleton|> class Encoder: """Encoder""" def __init__(self, hidden_size, interm_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio): """Initialization""" <|body_0|> def forward(self, hidden_states, attention_mask): """Encoder block""" <|body_1|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: """Encoder""" def __init__(self, hidden_size, interm_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio): """Initialization""" super(Encoder, self).__init__() self.attention = Attention(hidden_size, num_attention_heads, attention_dropout_ratio, hidde...
the_stack_v2_python_sparse
apps/drug_target_interaction/moltrans_dti/double_towers.py
PaddlePaddle/PaddleHelix
train
771
a976c960d4ceeda54ce5e50459a71e4ede2e46b6
[ "if 'formatter' not in overrides:\n overrides['formatter'] = ScalarFormatter()\nsuper().__init__(**overrides)", "start, end = (self.start, self.end)\ndomain = abs(end - start)\nmajor_step = self.major_step\nif major_step is UNDEF:\n major_step = step_size(domain, self.major_count, self.major_splits)\nminor_...
<|body_start_0|> if 'formatter' not in overrides: overrides['formatter'] = ScalarFormatter() super().__init__(**overrides) <|end_body_0|> <|body_start_1|> start, end = (self.start, self.end) domain = abs(end - start) major_step = self.major_step if major_step...
This type of ticker generates nice looking ticks and labels according to linear scale. The major and the minor steps are calculated automatically according to current range, however, both can be specified if needed. The label 'formatter' is by default set to pero.ScalarFormatter, but can be changed if needed. Propertie...
LinTicker
[ "LicenseRef-scancode-philippe-de-muyter", "LicenseRef-scancode-commercial-license", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinTicker: """This type of ticker generates nice looking ticks and labels according to linear scale. The major and the minor steps are calculated automatically according to current range, however, both can be specified if needed. The label 'formatter' is by default set to pero.ScalarFormatter, bu...
stack_v2_sparse_classes_36k_train_022793
4,293
permissive
[ { "docstring": "Initializes a new instance of LinTicker.", "name": "__init__", "signature": "def __init__(self, **overrides)" }, { "docstring": "Generates ticks according to current settings. Returns: (float,), (float,) Generated major and minor ticks.", "name": "make_ticks", "signature"...
3
stack_v2_sparse_classes_30k_train_018823
Implement the Python class `LinTicker` described below. Class description: This type of ticker generates nice looking ticks and labels according to linear scale. The major and the minor steps are calculated automatically according to current range, however, both can be specified if needed. The label 'formatter' is by ...
Implement the Python class `LinTicker` described below. Class description: This type of ticker generates nice looking ticks and labels according to linear scale. The major and the minor steps are calculated automatically according to current range, however, both can be specified if needed. The label 'formatter' is by ...
d59b1bc056f3037b7b7ab635b6deb41120612965
<|skeleton|> class LinTicker: """This type of ticker generates nice looking ticks and labels according to linear scale. The major and the minor steps are calculated automatically according to current range, however, both can be specified if needed. The label 'formatter' is by default set to pero.ScalarFormatter, bu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinTicker: """This type of ticker generates nice looking ticks and labels according to linear scale. The major and the minor steps are calculated automatically according to current range, however, both can be specified if needed. The label 'formatter' is by default set to pero.ScalarFormatter, but can be chan...
the_stack_v2_python_sparse
pero/tickers/linear.py
xxao/pero
train
31
a1a9ba52b07d22412429f349408fae2f564274e2
[ "if not filename:\n raise ValueError(f'{filename} is not a valid file')\nwith open(filename, encoding='utf8') as fname:\n try:\n self.profile = yaml.safe_load(fname)\n except yaml.YAMLError as ex:\n raise ValueError('f{filename} is not a valid YAML file: {ex}') from ex\n if self.profile is...
<|body_start_0|> if not filename: raise ValueError(f'{filename} is not a valid file') with open(filename, encoding='utf8') as fname: try: self.profile = yaml.safe_load(fname) except yaml.YAMLError as ex: raise ValueError('f{filename} is...
Manages which scan levels are run for packages.
Profile
[ "CC0-1.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Profile: """Manages which scan levels are run for packages.""" def __init__(self, filename: str) -> None: """Initialize profile.""" <|body_0|> def get_package_level(self, package: Package) -> Union[str, Any]: """Get which scan level to use for a given package."""...
stack_v2_sparse_classes_36k_train_022794
1,305
permissive
[ { "docstring": "Initialize profile.", "name": "__init__", "signature": "def __init__(self, filename: str) -> None" }, { "docstring": "Get which scan level to use for a given package.", "name": "get_package_level", "signature": "def get_package_level(self, package: Package) -> Union[str, ...
2
stack_v2_sparse_classes_30k_train_016498
Implement the Python class `Profile` described below. Class description: Manages which scan levels are run for packages. Method signatures and docstrings: - def __init__(self, filename: str) -> None: Initialize profile. - def get_package_level(self, package: Package) -> Union[str, Any]: Get which scan level to use fo...
Implement the Python class `Profile` described below. Class description: Manages which scan levels are run for packages. Method signatures and docstrings: - def __init__(self, filename: str) -> None: Initialize profile. - def get_package_level(self, package: Package) -> Union[str, Any]: Get which scan level to use fo...
25225188b04dbdebb04674d0b3c8af886ccf87c3
<|skeleton|> class Profile: """Manages which scan levels are run for packages.""" def __init__(self, filename: str) -> None: """Initialize profile.""" <|body_0|> def get_package_level(self, package: Package) -> Union[str, Any]: """Get which scan level to use for a given package."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Profile: """Manages which scan levels are run for packages.""" def __init__(self, filename: str) -> None: """Initialize profile.""" if not filename: raise ValueError(f'{filename} is not a valid file') with open(filename, encoding='utf8') as fname: try: ...
the_stack_v2_python_sparse
statick_tool/profile.py
sscpac/statick
train
73
f875997e46b97d8657a0dc76d3f9cfda6612767a
[ "if None is gpb_msg_class:\n raise AttributeError('No GPB message class specified')\nif gpb_msg_class not in [t_ItApiRpdMessage, t_ItApiServiceSuiteMessage]:\n raise AttributeError('Unknown GPB message class passed')\nif None is rx_cb:\n raise AttributeError('No rx_cb specified')\nif None is disp:\n sel...
<|body_start_0|> if None is gpb_msg_class: raise AttributeError('No GPB message class specified') if gpb_msg_class not in [t_ItApiRpdMessage, t_ItApiServiceSuiteMessage]: raise AttributeError('Unknown GPB message class passed') if None is rx_cb: raise Attribut...
Implements server side of the IT (Integration Testing) API.
ItApiServer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItApiServer: """Implements server side of the IT (Integration Testing) API.""" def __init__(self, gpb_msg_class, rx_cb, disp=None): """Opens socket on the IT API port and listen for GPB messages. :param gpb_msg_class: A class of GPB messages which will be exchanged. :param rx_cb: Use...
stack_v2_sparse_classes_36k_train_022795
10,996
permissive
[ { "docstring": "Opens socket on the IT API port and listen for GPB messages. :param gpb_msg_class: A class of GPB messages which will be exchanged. :param rx_cb: User's RX callback which is called when some GPB message was received. The callback expects the GPB message as argument. :param disp: Dispatcher. New ...
5
null
Implement the Python class `ItApiServer` described below. Class description: Implements server side of the IT (Integration Testing) API. Method signatures and docstrings: - def __init__(self, gpb_msg_class, rx_cb, disp=None): Opens socket on the IT API port and listen for GPB messages. :param gpb_msg_class: A class o...
Implement the Python class `ItApiServer` described below. Class description: Implements server side of the IT (Integration Testing) API. Method signatures and docstrings: - def __init__(self, gpb_msg_class, rx_cb, disp=None): Opens socket on the IT API port and listen for GPB messages. :param gpb_msg_class: A class o...
70cf84df92347aba0493f506c0d059c0c041cba8
<|skeleton|> class ItApiServer: """Implements server side of the IT (Integration Testing) API.""" def __init__(self, gpb_msg_class, rx_cb, disp=None): """Opens socket on the IT API port and listen for GPB messages. :param gpb_msg_class: A class of GPB messages which will be exchanged. :param rx_cb: Use...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ItApiServer: """Implements server side of the IT (Integration Testing) API.""" def __init__(self, gpb_msg_class, rx_cb, disp=None): """Opens socket on the IT API port and listen for GPB messages. :param gpb_msg_class: A class of GPB messages which will be exchanged. :param rx_cb: User's RX callba...
the_stack_v2_python_sparse
openrpd/rpd/it_api/it_api.py
hujiangyi/or
train
0
d3632ebd40241fda99094287aabf6db9336f438c
[ "super(LeNet1, self).__init__()\nself.conv1 = paddle.nn.Conv2D(in_channels=1, out_channels=16, kernel_size=3, stride=1, padding=1)\nself.max_pool1 = paddle.nn.MaxPool2D(kernel_size=2, stride=2)\nself.conv2 = paddle.nn.Conv2D(in_channels=16, out_channels=16, kernel_size=3, stride=1, padding=1)\nself.max_pool2 = padd...
<|body_start_0|> super(LeNet1, self).__init__() self.conv1 = paddle.nn.Conv2D(in_channels=1, out_channels=16, kernel_size=3, stride=1, padding=1) self.max_pool1 = paddle.nn.MaxPool2D(kernel_size=2, stride=2) self.conv2 = paddle.nn.Conv2D(in_channels=16, out_channels=16, kernel_size=3, st...
simple nn layers
LeNet1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LeNet1: """simple nn layers""" def __init__(self): """init""" <|body_0|> def forward(self, x): """forward""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(LeNet1, self).__init__() self.conv1 = paddle.nn.Conv2D(in_channels=1, out_cha...
stack_v2_sparse_classes_36k_train_022796
1,728
no_license
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "forward", "name": "forward", "signature": "def forward(self, x)" } ]
2
null
Implement the Python class `LeNet1` described below. Class description: simple nn layers Method signatures and docstrings: - def __init__(self): init - def forward(self, x): forward
Implement the Python class `LeNet1` described below. Class description: simple nn layers Method signatures and docstrings: - def __init__(self): init - def forward(self, x): forward <|skeleton|> class LeNet1: """simple nn layers""" def __init__(self): """init""" <|body_0|> def forward(s...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class LeNet1: """simple nn layers""" def __init__(self): """init""" <|body_0|> def forward(self, x): """forward""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LeNet1: """simple nn layers""" def __init__(self): """init""" super(LeNet1, self).__init__() self.conv1 = paddle.nn.Conv2D(in_channels=1, out_channels=16, kernel_size=3, stride=1, padding=1) self.max_pool1 = paddle.nn.MaxPool2D(kernel_size=2, stride=2) self.conv2 =...
the_stack_v2_python_sparse
framework/e2e/jit_legacy/scene/test_jit_script_in_forward.py
PaddlePaddle/PaddleTest
train
42
19a3fb49a3261e81ee80235a04f0ffb8c5232c29
[ "if all((e in elements_tl for e in comp)):\n return np.array([comp[e] if e in comp else 0 for e in elements_tl], np.float32)\nelse:\n return None", "if 'composition' in kwargs and datapoint is None:\n datapoint = kwargs.get('composition')\n raise DeprecationWarning('Composition is being phased out as ...
<|body_start_0|> if all((e in elements_tl for e in comp)): return np.array([comp[e] if e in comp else 0 for e in elements_tl], np.float32) else: return None <|end_body_0|> <|body_start_1|> if 'composition' in kwargs and datapoint is None: datapoint = kwargs.g...
Fixed size vector of length 86 containing raw fractional elemental compositions in the compound. The 86 chosen elements are based on the original implementation at https://github.com/NU-CUCIS/ElemNet. Returns a vector containing fractional compositions of each element in the compound. References ---------- .. [1] Jha, ...
ElemNetFeaturizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElemNetFeaturizer: """Fixed size vector of length 86 containing raw fractional elemental compositions in the compound. The 86 chosen elements are based on the original implementation at https://github.com/NU-CUCIS/ElemNet. Returns a vector containing fractional compositions of each element in the...
stack_v2_sparse_classes_36k_train_022797
3,232
permissive
[ { "docstring": "Converts a dictionary containing element names and corresponding compositional fractions into a vector of fractions. Parameters ---------- comp: collections.defaultdict object Dictionary mapping element names to fractional compositions. Returns ------- fractions: np.ndarray Vector of fractional ...
2
stack_v2_sparse_classes_30k_train_002533
Implement the Python class `ElemNetFeaturizer` described below. Class description: Fixed size vector of length 86 containing raw fractional elemental compositions in the compound. The 86 chosen elements are based on the original implementation at https://github.com/NU-CUCIS/ElemNet. Returns a vector containing fractio...
Implement the Python class `ElemNetFeaturizer` described below. Class description: Fixed size vector of length 86 containing raw fractional elemental compositions in the compound. The 86 chosen elements are based on the original implementation at https://github.com/NU-CUCIS/ElemNet. Returns a vector containing fractio...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class ElemNetFeaturizer: """Fixed size vector of length 86 containing raw fractional elemental compositions in the compound. The 86 chosen elements are based on the original implementation at https://github.com/NU-CUCIS/ElemNet. Returns a vector containing fractional compositions of each element in the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElemNetFeaturizer: """Fixed size vector of length 86 containing raw fractional elemental compositions in the compound. The 86 chosen elements are based on the original implementation at https://github.com/NU-CUCIS/ElemNet. Returns a vector containing fractional compositions of each element in the compound. Re...
the_stack_v2_python_sparse
deepchem/feat/material_featurizers/elemnet_featurizer.py
deepchem/deepchem
train
4,876
79c893f627e0d13b1f25f704bfb18d46ec378a3c
[ "super(ArcBiaffine, self).__init__()\nself.U = nn.Parameter(torch.Tensor(hidden_size, hidden_size), requires_grad=True)\nself.has_bias = bias\nif self.has_bias:\n self.bias = nn.Parameter(torch.Tensor(hidden_size), requires_grad=True)\nelse:\n self.register_parameter('bias', None)\ninitial_parameter(self)", ...
<|body_start_0|> super(ArcBiaffine, self).__init__() self.U = nn.Parameter(torch.Tensor(hidden_size, hidden_size), requires_grad=True) self.has_bias = bias if self.has_bias: self.bias = nn.Parameter(torch.Tensor(hidden_size), requires_grad=True) else: self...
Biaffine Dependency Parser 的子模块, 用于构建预测边的图
ArcBiaffine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArcBiaffine: """Biaffine Dependency Parser 的子模块, 用于构建预测边的图""" def __init__(self, hidden_size, bias=True): """:param hidden_size: 输入的特征维度 :param bias: 是否使用bias. Default: ``True``""" <|body_0|> def forward(self, head, dep): """:param head: arc-head tensor [batch, l...
stack_v2_sparse_classes_36k_train_022798
22,013
permissive
[ { "docstring": ":param hidden_size: 输入的特征维度 :param bias: 是否使用bias. Default: ``True``", "name": "__init__", "signature": "def __init__(self, hidden_size, bias=True)" }, { "docstring": ":param head: arc-head tensor [batch, length, hidden] :param dep: arc-dependent tensor [batch, length, hidden] :r...
2
null
Implement the Python class `ArcBiaffine` described below. Class description: Biaffine Dependency Parser 的子模块, 用于构建预测边的图 Method signatures and docstrings: - def __init__(self, hidden_size, bias=True): :param hidden_size: 输入的特征维度 :param bias: 是否使用bias. Default: ``True`` - def forward(self, head, dep): :param head: arc-...
Implement the Python class `ArcBiaffine` described below. Class description: Biaffine Dependency Parser 的子模块, 用于构建预测边的图 Method signatures and docstrings: - def __init__(self, hidden_size, bias=True): :param hidden_size: 输入的特征维度 :param bias: 是否使用bias. Default: ``True`` - def forward(self, head, dep): :param head: arc-...
dffc7a06cdbff2671a3ca73d2398159d91a4a7db
<|skeleton|> class ArcBiaffine: """Biaffine Dependency Parser 的子模块, 用于构建预测边的图""" def __init__(self, hidden_size, bias=True): """:param hidden_size: 输入的特征维度 :param bias: 是否使用bias. Default: ``True``""" <|body_0|> def forward(self, head, dep): """:param head: arc-head tensor [batch, l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArcBiaffine: """Biaffine Dependency Parser 的子模块, 用于构建预测边的图""" def __init__(self, hidden_size, bias=True): """:param hidden_size: 输入的特征维度 :param bias: 是否使用bias. Default: ``True``""" super(ArcBiaffine, self).__init__() self.U = nn.Parameter(torch.Tensor(hidden_size, hidden_size), re...
the_stack_v2_python_sparse
phenobert/utils/fastNLP/models/biaffine_parser.py
TianlabTech/PhenoBERT
train
2
1a1285cdf97102f4eb1974aa61e0ee258ecd3193
[ "super(Transformer, self).__init__()\nself.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)\nself.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)\nself.linear = tf.keras.layers.Dense(target_vocab)", "enc_output = self.encoder(inputs, training, encoder_mask)\n...
<|body_start_0|> super(Transformer, self).__init__() self.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate) self.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate) self.linear = tf.keras.layers.Dense(target_vocab) <|end_body_0|> <|body_...
Transformer class
Transformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transformer: """Transformer class""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """Class constructor :param N: number of blocks in the encoder :param dm: dimensionality of the model :param h: number of heads :param h...
stack_v2_sparse_classes_36k_train_022799
2,460
no_license
[ { "docstring": "Class constructor :param N: number of blocks in the encoder :param dm: dimensionality of the model :param h: number of heads :param hidden: number of hidden units in the fully connected layers :param input_vocab: size of the input vocabulary :param target_vocab: size of the target vocabulary :pa...
2
stack_v2_sparse_classes_30k_train_021273
Implement the Python class `Transformer` described below. Class description: Transformer class Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Class constructor :param N: number of blocks in the encoder :param dm: dimen...
Implement the Python class `Transformer` described below. Class description: Transformer class Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Class constructor :param N: number of blocks in the encoder :param dm: dimen...
f83a60babb1d2a510a4a0e0f58aa3880fd9f93a7
<|skeleton|> class Transformer: """Transformer class""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """Class constructor :param N: number of blocks in the encoder :param dm: dimensionality of the model :param h: number of heads :param h...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transformer: """Transformer class""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """Class constructor :param N: number of blocks in the encoder :param dm: dimensionality of the model :param h: number of heads :param hidden: number...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/11-transformer.py
jalondono/holbertonschool-machine_learning
train
2