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
9f616a40590feb6fb45b6f3378064fa83c7f0934
[ "if not isinstance(gate, Gate):\n raise TypeError('Expected gate object, got %s' % type(gate))\nself.gate = gate\nself.name = 'Dagger(%s)' % gate.get_name()\nself.num_params = gate.get_num_params()\nself.size = gate.get_size()\nself.radixes = gate.get_radixes()\nif self.num_params == 0:\n self.utry = gate.get...
<|body_start_0|> if not isinstance(gate, Gate): raise TypeError('Expected gate object, got %s' % type(gate)) self.gate = gate self.name = 'Dagger(%s)' % gate.get_name() self.num_params = gate.get_num_params() self.size = gate.get_size() self.radixes = gate.get...
The DaggerGate Class.
DaggerGate
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DaggerGate: """The DaggerGate Class.""" def __init__(self, gate: Gate) -> None: """Create a gate which is the conjugate transpose of another. Args: gate (Gate): The Gate to conjugate transpose.""" <|body_0|> def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMat...
stack_v2_sparse_classes_36k_train_018500
2,568
permissive
[ { "docstring": "Create a gate which is the conjugate transpose of another. Args: gate (Gate): The Gate to conjugate transpose.", "name": "__init__", "signature": "def __init__(self, gate: Gate) -> None" }, { "docstring": "Returns the unitary for this gate, see Unitary for more info.", "name"...
4
stack_v2_sparse_classes_30k_train_008049
Implement the Python class `DaggerGate` described below. Class description: The DaggerGate Class. Method signatures and docstrings: - def __init__(self, gate: Gate) -> None: Create a gate which is the conjugate transpose of another. Args: gate (Gate): The Gate to conjugate transpose. - def get_unitary(self, params: S...
Implement the Python class `DaggerGate` described below. Class description: The DaggerGate Class. Method signatures and docstrings: - def __init__(self, gate: Gate) -> None: Create a gate which is the conjugate transpose of another. Args: gate (Gate): The Gate to conjugate transpose. - def get_unitary(self, params: S...
3083218c2f4e3c3ce4ba027d12caa30c384d7665
<|skeleton|> class DaggerGate: """The DaggerGate Class.""" def __init__(self, gate: Gate) -> None: """Create a gate which is the conjugate transpose of another. Args: gate (Gate): The Gate to conjugate transpose.""" <|body_0|> def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DaggerGate: """The DaggerGate Class.""" def __init__(self, gate: Gate) -> None: """Create a gate which is the conjugate transpose of another. Args: gate (Gate): The Gate to conjugate transpose.""" if not isinstance(gate, Gate): raise TypeError('Expected gate object, got %s' % ...
the_stack_v2_python_sparse
bqskit/ir/gates/composed/daggergate.py
mtreinish/bqskit
train
0
14289ae036844bc863dacd0dbd8a4ccd260347b0
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserExperienceAnalyticsWorkFromAnywhereModelPerformance()", "from .entity import Entity\nfrom .user_experience_analytics_health_state import UserExperienceAnalyticsHealthState\nfrom .entity import Entity\nfrom .user_experience_analytic...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserExperienceAnalyticsWorkFromAnywhereModelPerformance() <|end_body_0|> <|body_start_1|> from .entity import Entity from .user_experience_analytics_health_state import UserExperienceAna...
The user experience analytics work from anywhere model performance.
UserExperienceAnalyticsWorkFromAnywhereModelPerformance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserExperienceAnalyticsWorkFromAnywhereModelPerformance: """The user experience analytics work from anywhere model performance.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsWorkFromAnywhereModelPerformance: """Creates a new in...
stack_v2_sparse_classes_36k_train_018501
5,738
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: UserExperienceAnalyticsWorkFromAnywhereModelPerformance", "name": "create_from_discriminator_value", "signat...
3
stack_v2_sparse_classes_30k_train_006121
Implement the Python class `UserExperienceAnalyticsWorkFromAnywhereModelPerformance` described below. Class description: The user experience analytics work from anywhere model performance. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAn...
Implement the Python class `UserExperienceAnalyticsWorkFromAnywhereModelPerformance` described below. Class description: The user experience analytics work from anywhere model performance. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAn...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserExperienceAnalyticsWorkFromAnywhereModelPerformance: """The user experience analytics work from anywhere model performance.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsWorkFromAnywhereModelPerformance: """Creates a new in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserExperienceAnalyticsWorkFromAnywhereModelPerformance: """The user experience analytics work from anywhere model performance.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsWorkFromAnywhereModelPerformance: """Creates a new instance of the...
the_stack_v2_python_sparse
msgraph/generated/models/user_experience_analytics_work_from_anywhere_model_performance.py
microsoftgraph/msgraph-sdk-python
train
135
8d79abd33cd77205b1924d5ba56eeb01e8906a16
[ "data = {}\nfiltered_data = {key: value for key, value in self.__dict__.items() if key not in self.READ_ONLY}\nfor key, value in filtered_data.items():\n data[key] = self._convert_value(value)\nreturn data", "if isinstance(value, DataObject):\n value = value.to_dict()\nelif isinstance(value, dict):\n val...
<|body_start_0|> data = {} filtered_data = {key: value for key, value in self.__dict__.items() if key not in self.READ_ONLY} for key, value in filtered_data.items(): data[key] = self._convert_value(value) return data <|end_body_0|> <|body_start_1|> if isinstance(valu...
Data object representation handling recursive transformation from object to dict
DataObject
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataObject: """Data object representation handling recursive transformation from object to dict""" def to_dict(self) -> Dict: """Represent object as dictionary Returns: Dict""" <|body_0|> def _convert_value(self, value: Any) -> Any: """Convert value based on its ...
stack_v2_sparse_classes_36k_train_018502
3,830
permissive
[ { "docstring": "Represent object as dictionary Returns: Dict", "name": "to_dict", "signature": "def to_dict(self) -> Dict" }, { "docstring": "Convert value based on its type Args: value: variable to convert Returns: Converted object", "name": "_convert_value", "signature": "def _convert_...
4
null
Implement the Python class `DataObject` described below. Class description: Data object representation handling recursive transformation from object to dict Method signatures and docstrings: - def to_dict(self) -> Dict: Represent object as dictionary Returns: Dict - def _convert_value(self, value: Any) -> Any: Conver...
Implement the Python class `DataObject` described below. Class description: Data object representation handling recursive transformation from object to dict Method signatures and docstrings: - def to_dict(self) -> Dict: Represent object as dictionary Returns: Dict - def _convert_value(self, value: Any) -> Any: Conver...
a5388a45f71a949639b35cc5b990bd130d2d8164
<|skeleton|> class DataObject: """Data object representation handling recursive transformation from object to dict""" def to_dict(self) -> Dict: """Represent object as dictionary Returns: Dict""" <|body_0|> def _convert_value(self, value: Any) -> Any: """Convert value based on its ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataObject: """Data object representation handling recursive transformation from object to dict""" def to_dict(self) -> Dict: """Represent object as dictionary Returns: Dict""" data = {} filtered_data = {key: value for key, value in self.__dict__.items() if key not in self.READ_ON...
the_stack_v2_python_sparse
TensorFlow2/Recommendation/WideAndDeep/triton/runner/core.py
NVIDIA/DeepLearningExamples
train
11,838
6a3a666b24d670f02713c86e1d51973ca7a4def9
[ "super(QNetwork, self).__init__()\nif norm_in:\n self.in_fn = nn.BatchNorm1d(state_size)\n self.in_fn.weight.data.fill_(1)\n self.in_fn.bias.data.fill_(0)\nelse:\n self.in_fn = lambda x: x\nself.fc1 = nn.Linear(state_size, hidden_dim)\nself.fc2 = nn.Linear(hidden_dim, hidden_dim)\nself.fc3 = nn.Linear(h...
<|body_start_0|> super(QNetwork, self).__init__() if norm_in: self.in_fn = nn.BatchNorm1d(state_size) self.in_fn.weight.data.fill_(1) self.in_fn.bias.data.fill_(0) else: self.in_fn = lambda x: x self.fc1 = nn.Linear(state_size, hidden_dim) ...
Deep Q-Network
QNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QNetwork: """Deep Q-Network""" def __init__(self, state_size, action_size, hidden_dim, dropout_p=0.0, nonlin=F.relu, norm_in=True): """Initialize parameters and build model. :param state_size: Dimension of each state :param action_size: Dimension of each action :param hidden_dim: dim...
stack_v2_sparse_classes_36k_train_018503
1,565
no_license
[ { "docstring": "Initialize parameters and build model. :param state_size: Dimension of each state :param action_size: Dimension of each action :param hidden_dim: dimension of hidden layers :param dropout_p: dropout probability :param nonlin: nonlinearity to use :param norm_in: normalise input first", "name"...
2
stack_v2_sparse_classes_30k_train_019971
Implement the Python class `QNetwork` described below. Class description: Deep Q-Network Method signatures and docstrings: - def __init__(self, state_size, action_size, hidden_dim, dropout_p=0.0, nonlin=F.relu, norm_in=True): Initialize parameters and build model. :param state_size: Dimension of each state :param act...
Implement the Python class `QNetwork` described below. Class description: Deep Q-Network Method signatures and docstrings: - def __init__(self, state_size, action_size, hidden_dim, dropout_p=0.0, nonlin=F.relu, norm_in=True): Initialize parameters and build model. :param state_size: Dimension of each state :param act...
2afa0a9d83bd66a151c1a19242c5ef22cf4eb1f6
<|skeleton|> class QNetwork: """Deep Q-Network""" def __init__(self, state_size, action_size, hidden_dim, dropout_p=0.0, nonlin=F.relu, norm_in=True): """Initialize parameters and build model. :param state_size: Dimension of each state :param action_size: Dimension of each action :param hidden_dim: dim...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QNetwork: """Deep Q-Network""" def __init__(self, state_size, action_size, hidden_dim, dropout_p=0.0, nonlin=F.relu, norm_in=True): """Initialize parameters and build model. :param state_size: Dimension of each state :param action_size: Dimension of each action :param hidden_dim: dimension of hid...
the_stack_v2_python_sparse
marl_algorithms/iql/model.py
Jarvis-K/MSc_Curiosity_MARL
train
0
e9ff5459df5adb326802b73e7a2c6cde500e1ac0
[ "super().__init__()\nself._subset = subset\nself._shuffle_data = shuffle_data\nself._data_dir = data_dir or DATA_ROOT\nself._dataset = None\nallowed_versions = ('tokens', 'raw')\nif version not in allowed_versions:\n raise ValueError(f'Version must be one of {allowed_versions}.')\nself._version = version", "if...
<|body_start_0|> super().__init__() self._subset = subset self._shuffle_data = shuffle_data self._data_dir = data_dir or DATA_ROOT self._dataset = None allowed_versions = ('tokens', 'raw') if version not in allowed_versions: raise ValueError(f'Version ...
Raw text dataset for wikitext-103.
RawDataset
[ "Apache-2.0", "CC-BY-SA-4.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RawDataset: """Raw text dataset for wikitext-103.""" def __init__(self, subset: str='train', shuffle_data: bool=False, data_dir: str=None, version: str='tokens'): """Constructor. Args: subset: which subset to load, one of {"train", "valid", "test"}. shuffle_data: if set to True the d...
stack_v2_sparse_classes_36k_train_018504
7,525
permissive
[ { "docstring": "Constructor. Args: subset: which subset to load, one of {\"train\", \"valid\", \"test\"}. shuffle_data: if set to True the data will be randomly shuffled. data_dir: if provided will be used instead of the default `DATA_ROOT` as the directory that contains the data. version: one of {'tokens', 'ra...
2
null
Implement the Python class `RawDataset` described below. Class description: Raw text dataset for wikitext-103. Method signatures and docstrings: - def __init__(self, subset: str='train', shuffle_data: bool=False, data_dir: str=None, version: str='tokens'): Constructor. Args: subset: which subset to load, one of {"tra...
Implement the Python class `RawDataset` described below. Class description: Raw text dataset for wikitext-103. Method signatures and docstrings: - def __init__(self, subset: str='train', shuffle_data: bool=False, data_dir: str=None, version: str='tokens'): Constructor. Args: subset: which subset to load, one of {"tra...
a6ef8053380d6aa19aaae14b93f013ae9762d057
<|skeleton|> class RawDataset: """Raw text dataset for wikitext-103.""" def __init__(self, subset: str='train', shuffle_data: bool=False, data_dir: str=None, version: str='tokens'): """Constructor. Args: subset: which subset to load, one of {"train", "valid", "test"}. shuffle_data: if set to True the d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RawDataset: """Raw text dataset for wikitext-103.""" def __init__(self, subset: str='train', shuffle_data: bool=False, data_dir: str=None, version: str='tokens'): """Constructor. Args: subset: which subset to load, one of {"train", "valid", "test"}. shuffle_data: if set to True the data will be r...
the_stack_v2_python_sparse
wikigraphs/wikigraphs/data/wikitext.py
sethuramanio/deepmind-research
train
1
b82ca52e89e3c128090ee089970b7f4510e744a9
[ "self.frame = frame\nself.max_width = max_width\nself.max_height = max_height\nheight = float(self.frame.shape[0])\nwidth = float(self.frame.shape[1])\nif height <= self.max_height and width <= self.max_width:\n self.scale_factor = 1.0\nelif height >= width:\n self.scale_factor = self.max_height / height\nels...
<|body_start_0|> self.frame = frame self.max_width = max_width self.max_height = max_height height = float(self.frame.shape[0]) width = float(self.frame.shape[1]) if height <= self.max_height and width <= self.max_width: self.scale_factor = 1.0 elif he...
Scales down a frame if its size is over a given amount, preserving the original aspect ratio. It can then scale up any detections that have been run on the smaller frame to fit the original frame size. If the frame is under the given amount, nothing is done and the frame is kept the same. Usage Example: >>> clamp = Cla...
Clamp
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Clamp: """Scales down a frame if its size is over a given amount, preserving the original aspect ratio. It can then scale up any detections that have been run on the smaller frame to fit the original frame size. If the frame is under the given amount, nothing is done and the frame is kept the sam...
stack_v2_sparse_classes_36k_train_018505
14,406
permissive
[ { "docstring": ":param frame: The frame to scale :param max_width: The maximum allowed width of the frame :param max_height: The maximum allowed height of the frame", "name": "__init__", "signature": "def __init__(self, frame, max_width, max_height)" }, { "docstring": ":return: A clamped version...
3
stack_v2_sparse_classes_30k_train_012089
Implement the Python class `Clamp` described below. Class description: Scales down a frame if its size is over a given amount, preserving the original aspect ratio. It can then scale up any detections that have been run on the smaller frame to fit the original frame size. If the frame is under the given amount, nothin...
Implement the Python class `Clamp` described below. Class description: Scales down a frame if its size is over a given amount, preserving the original aspect ratio. It can then scale up any detections that have been run on the smaller frame to fit the original frame size. If the frame is under the given amount, nothin...
7412902fed8f91c9c82bd42b0180e07673c38bf1
<|skeleton|> class Clamp: """Scales down a frame if its size is over a given amount, preserving the original aspect ratio. It can then scale up any detections that have been run on the smaller frame to fit the original frame size. If the frame is under the given amount, nothing is done and the frame is kept the sam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Clamp: """Scales down a frame if its size is over a given amount, preserving the original aspect ratio. It can then scale up any detections that have been run on the smaller frame to fit the original frame size. If the frame is under the given amount, nothing is done and the frame is kept the same. Usage Exam...
the_stack_v2_python_sparse
vcap/vcap/modifiers.py
opencv/open_vision_capsules
train
124
69f45143dbae2ae8b136f12cadcb38a488639527
[ "allowed_users = []\nfor user in self.targets:\n if not user.is_active:\n continue\n allows_emails = InvenTree.helpers.str2bool(self.usersetting(user))\n if allows_emails:\n allowed_users.append(user)\nreturn EmailAddress.objects.filter(user__in=allowed_users)", "html_message = render_to_st...
<|body_start_0|> allowed_users = [] for user in self.targets: if not user.is_active: continue allows_emails = InvenTree.helpers.str2bool(self.usersetting(user)) if allows_emails: allowed_users.append(user) return EmailAddress.ob...
Notificationmethod for delivery via Email.
EmailNotification
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailNotification: """Notificationmethod for delivery via Email.""" def get_targets(self): """Return a list of target email addresses, only for users which allow email notifications.""" <|body_0|> def send_bulk(self): """Send the notifications out via email.""" ...
stack_v2_sparse_classes_36k_train_018506
6,053
permissive
[ { "docstring": "Return a list of target email addresses, only for users which allow email notifications.", "name": "get_targets", "signature": "def get_targets(self)" }, { "docstring": "Send the notifications out via email.", "name": "send_bulk", "signature": "def send_bulk(self)" } ]
2
stack_v2_sparse_classes_30k_train_018135
Implement the Python class `EmailNotification` described below. Class description: Notificationmethod for delivery via Email. Method signatures and docstrings: - def get_targets(self): Return a list of target email addresses, only for users which allow email notifications. - def send_bulk(self): Send the notification...
Implement the Python class `EmailNotification` described below. Class description: Notificationmethod for delivery via Email. Method signatures and docstrings: - def get_targets(self): Return a list of target email addresses, only for users which allow email notifications. - def send_bulk(self): Send the notification...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class EmailNotification: """Notificationmethod for delivery via Email.""" def get_targets(self): """Return a list of target email addresses, only for users which allow email notifications.""" <|body_0|> def send_bulk(self): """Send the notifications out via email.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailNotification: """Notificationmethod for delivery via Email.""" def get_targets(self): """Return a list of target email addresses, only for users which allow email notifications.""" allowed_users = [] for user in self.targets: if not user.is_active: ...
the_stack_v2_python_sparse
InvenTree/plugin/builtin/integration/core_notifications.py
inventree/InvenTree
train
3,077
ae4c923a26bf1f8cd1bd8039078c957125ca73ae
[ "super(AITank, self).__init__(tank_id)\nself.state = 'patrolling'\nself.ai_moving = {'prev_angle': self.moving['angle'], 'prev_center': self.tank.rect.center, 'desired_angle': 0, 'back': 0}\nself.max_state_change_frame = 10\nself.state_change_frame = 0\nself.target = self.tank", "bullet = Bullet(vector, self.tank...
<|body_start_0|> super(AITank, self).__init__(tank_id) self.state = 'patrolling' self.ai_moving = {'prev_angle': self.moving['angle'], 'prev_center': self.tank.rect.center, 'desired_angle': 0, 'back': 0} self.max_state_change_frame = 10 self.state_change_frame = 0 self.ta...
Tank controlled by AI
AITank
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AITank: """Tank controlled by AI""" def __init__(self, tank_id): """:param tank_id: tank graphic id""" <|body_0|> def laser_target(self, tank, vector): """:param tank: tank to be targeted :param vector: vector for targeting :return: True if there are no obstacles...
stack_v2_sparse_classes_36k_train_018507
21,421
no_license
[ { "docstring": ":param tank_id: tank graphic id", "name": "__init__", "signature": "def __init__(self, tank_id)" }, { "docstring": ":param tank: tank to be targeted :param vector: vector for targeting :return: True if there are no obstacles, False otherwise", "name": "laser_target", "sig...
6
stack_v2_sparse_classes_30k_train_015156
Implement the Python class `AITank` described below. Class description: Tank controlled by AI Method signatures and docstrings: - def __init__(self, tank_id): :param tank_id: tank graphic id - def laser_target(self, tank, vector): :param tank: tank to be targeted :param vector: vector for targeting :return: True if t...
Implement the Python class `AITank` described below. Class description: Tank controlled by AI Method signatures and docstrings: - def __init__(self, tank_id): :param tank_id: tank graphic id - def laser_target(self, tank, vector): :param tank: tank to be targeted :param vector: vector for targeting :return: True if t...
51a2f2ecc09a05672a2c3deb00ab8c273d3b756b
<|skeleton|> class AITank: """Tank controlled by AI""" def __init__(self, tank_id): """:param tank_id: tank graphic id""" <|body_0|> def laser_target(self, tank, vector): """:param tank: tank to be targeted :param vector: vector for targeting :return: True if there are no obstacles...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AITank: """Tank controlled by AI""" def __init__(self, tank_id): """:param tank_id: tank graphic id""" super(AITank, self).__init__(tank_id) self.state = 'patrolling' self.ai_moving = {'prev_angle': self.moving['angle'], 'prev_center': self.tank.rect.center, 'desired_angle...
the_stack_v2_python_sparse
game_core/game_data.py
asmodeii/tanki
train
0
8d314dcbe006af415ca333f1a610ebd51cf507cd
[ "sessions = request.session.get('sessions', {})\nif environment_id in sessions:\n id = sessions[environment_id]\nelse:\n id = create_session(request, environment_id)\nreturn id", "sessions = request.session.get('sessions', {})\nclient = api.muranoclient(request)\nif environment_id in sessions:\n id = ses...
<|body_start_0|> sessions = request.session.get('sessions', {}) if environment_id in sessions: id = sessions[environment_id] else: id = create_session(request, environment_id) return id <|end_body_0|> <|body_start_1|> sessions = request.session.get('sessi...
Session
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Session: def get_or_create(request, environment_id): """Get an open session id Gets id from already opened session for specified environment, otherwise opens new session and returns its id :param request: :param environment_id: :return: Session Id""" <|body_0|> def get_or_cr...
stack_v2_sparse_classes_36k_train_018508
17,347
permissive
[ { "docstring": "Get an open session id Gets id from already opened session for specified environment, otherwise opens new session and returns its id :param request: :param environment_id: :return: Session Id", "name": "get_or_create", "signature": "def get_or_create(request, environment_id)" }, { ...
5
stack_v2_sparse_classes_30k_train_004067
Implement the Python class `Session` described below. Class description: Implement the Session class. Method signatures and docstrings: - def get_or_create(request, environment_id): Get an open session id Gets id from already opened session for specified environment, otherwise opens new session and returns its id :pa...
Implement the Python class `Session` described below. Class description: Implement the Session class. Method signatures and docstrings: - def get_or_create(request, environment_id): Get an open session id Gets id from already opened session for specified environment, otherwise opens new session and returns its id :pa...
54e2ea8a71385b1c7624b3d2c8056bd8a2c2e2f7
<|skeleton|> class Session: def get_or_create(request, environment_id): """Get an open session id Gets id from already opened session for specified environment, otherwise opens new session and returns its id :param request: :param environment_id: :return: Session Id""" <|body_0|> def get_or_cr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Session: def get_or_create(request, environment_id): """Get an open session id Gets id from already opened session for specified environment, otherwise opens new session and returns its id :param request: :param environment_id: :return: Session Id""" sessions = request.session.get('sessions', ...
the_stack_v2_python_sparse
muranodashboard/environments/api.py
openstack/murano-dashboard
train
38
c3a38c921925b5fe392567fc06a3419bdc8ee4d0
[ "try:\n obj_kwargs = kwargs.copy()\n obj_kwargs[self.uri_object_key] = object_id\n review_request = resources.review_request.get_object(request, *args, **obj_kwargs)\n user = resources.user.get_object(request, *args, **kwargs)\nexcept (ReviewRequest.DoesNotExist, User.DoesNotExist):\n return DOES_NOT...
<|body_start_0|> try: obj_kwargs = kwargs.copy() obj_kwargs[self.uri_object_key] = object_id review_request = resources.review_request.get_object(request, *args, **obj_kwargs) user = resources.user.get_object(request, *args, **kwargs) except (ReviewRequest...
A base resource for objects archived or muted by a user.
BaseArchivedObjectResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseArchivedObjectResource: """A base resource for objects archived or muted by a user.""" def create(self, request, object_id, *args, **kwargs): """Handle HTTP POST operations.""" <|body_0|> def delete(self, request, review_request_id, *args, **kwargs): """Handl...
stack_v2_sparse_classes_36k_train_018509
3,181
permissive
[ { "docstring": "Handle HTTP POST operations.", "name": "create", "signature": "def create(self, request, object_id, *args, **kwargs)" }, { "docstring": "Handle HTTP DELETE operations.", "name": "delete", "signature": "def delete(self, request, review_request_id, *args, **kwargs)" } ]
2
null
Implement the Python class `BaseArchivedObjectResource` described below. Class description: A base resource for objects archived or muted by a user. Method signatures and docstrings: - def create(self, request, object_id, *args, **kwargs): Handle HTTP POST operations. - def delete(self, request, review_request_id, *a...
Implement the Python class `BaseArchivedObjectResource` described below. Class description: A base resource for objects archived or muted by a user. Method signatures and docstrings: - def create(self, request, object_id, *args, **kwargs): Handle HTTP POST operations. - def delete(self, request, review_request_id, *a...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class BaseArchivedObjectResource: """A base resource for objects archived or muted by a user.""" def create(self, request, object_id, *args, **kwargs): """Handle HTTP POST operations.""" <|body_0|> def delete(self, request, review_request_id, *args, **kwargs): """Handl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseArchivedObjectResource: """A base resource for objects archived or muted by a user.""" def create(self, request, object_id, *args, **kwargs): """Handle HTTP POST operations.""" try: obj_kwargs = kwargs.copy() obj_kwargs[self.uri_object_key] = object_id ...
the_stack_v2_python_sparse
reviewboard/webapi/resources/base_archived_object.py
reviewboard/reviewboard
train
1,141
e84be0586edee80e04b2403c807a77b2ec25fede
[ "if request.user.is_staff:\n return True\nreturn super().has_permission(request, view)", "if request.user.is_staff or obj.user == request.user:\n return True\nhas_permission = super().has_permission(request, view)\nif has_permission and request.method in permissions.SAFE_METHODS:\n try:\n org_id =...
<|body_start_0|> if request.user.is_staff: return True return super().has_permission(request, view) <|end_body_0|> <|body_start_1|> if request.user.is_staff or obj.user == request.user: return True has_permission = super().has_permission(request, view) if...
extends DjanoModelPermissions and adds object level perms
IsAdminOwnerOrShared
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsAdminOwnerOrShared: """extends DjanoModelPermissions and adds object level perms""" def has_permission(self, request, view): """has permission called before has_object_permission check for is_staff, then check model permissions if all true, then has_object permission called""" ...
stack_v2_sparse_classes_36k_train_018510
5,524
permissive
[ { "docstring": "has permission called before has_object_permission check for is_staff, then check model permissions if all true, then has_object permission called", "name": "has_permission", "signature": "def has_permission(self, request, view)" }, { "docstring": "Create not called by this metho...
2
stack_v2_sparse_classes_30k_val_000867
Implement the Python class `IsAdminOwnerOrShared` described below. Class description: extends DjanoModelPermissions and adds object level perms Method signatures and docstrings: - def has_permission(self, request, view): has permission called before has_object_permission check for is_staff, then check model permissio...
Implement the Python class `IsAdminOwnerOrShared` described below. Class description: extends DjanoModelPermissions and adds object level perms Method signatures and docstrings: - def has_permission(self, request, view): has permission called before has_object_permission check for is_staff, then check model permissio...
40d9608295daefc5e1cd83afd84ecb5b0518cc3d
<|skeleton|> class IsAdminOwnerOrShared: """extends DjanoModelPermissions and adds object level perms""" def has_permission(self, request, view): """has permission called before has_object_permission check for is_staff, then check model permissions if all true, then has_object permission called""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IsAdminOwnerOrShared: """extends DjanoModelPermissions and adds object level perms""" def has_permission(self, request, view): """has permission called before has_object_permission check for is_staff, then check model permissions if all true, then has_object permission called""" if reques...
the_stack_v2_python_sparse
app/squac/permissions.py
pnsn/squacapi
train
7
399094d90aed7a1109c9de4ae18e367dd0711324
[ "self.forms = []\ninstances = instances or []\nfor i, obj in enumerate(instances):\n if isinstance(obj, db.Key):\n obj = db.get(obj)\n form_kwargs = {'instance': obj, 'prefix': '%i' % i}\n if data:\n form_kwargs.update(dict(data=data))\n base_form = self.base_form(**form_kwargs)\n self....
<|body_start_0|> self.forms = [] instances = instances or [] for i, obj in enumerate(instances): if isinstance(obj, db.Key): obj = db.get(obj) form_kwargs = {'instance': obj, 'prefix': '%i' % i} if data: form_kwargs.update(dict(...
BaseFormSet
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseFormSet: def __init__(self, data=None, instances=None, extra_forms=2): """Testing Concerns: - deleting an item - adding an item - altering the key - altering the value""" <|body_0|> def is_valid(self): """App engine doesn't support the empty_permitted flag to mod...
stack_v2_sparse_classes_36k_train_018511
1,921
permissive
[ { "docstring": "Testing Concerns: - deleting an item - adding an item - altering the key - altering the value", "name": "__init__", "signature": "def __init__(self, data=None, instances=None, extra_forms=2)" }, { "docstring": "App engine doesn't support the empty_permitted flag to model forms, s...
2
stack_v2_sparse_classes_30k_train_008816
Implement the Python class `BaseFormSet` described below. Class description: Implement the BaseFormSet class. Method signatures and docstrings: - def __init__(self, data=None, instances=None, extra_forms=2): Testing Concerns: - deleting an item - adding an item - altering the key - altering the value - def is_valid(s...
Implement the Python class `BaseFormSet` described below. Class description: Implement the BaseFormSet class. Method signatures and docstrings: - def __init__(self, data=None, instances=None, extra_forms=2): Testing Concerns: - deleting an item - adding an item - altering the key - altering the value - def is_valid(s...
afdc352436f9ce623cfb108caf36cd8bc2590f06
<|skeleton|> class BaseFormSet: def __init__(self, data=None, instances=None, extra_forms=2): """Testing Concerns: - deleting an item - adding an item - altering the key - altering the value""" <|body_0|> def is_valid(self): """App engine doesn't support the empty_permitted flag to mod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseFormSet: def __init__(self, data=None, instances=None, extra_forms=2): """Testing Concerns: - deleting an item - adding an item - altering the key - altering the value""" self.forms = [] instances = instances or [] for i, obj in enumerate(instances): if isinstan...
the_stack_v2_python_sparse
permachart/charter/form_utils.py
justinabrahms/permachart
train
1
86c9d57842f9431b86c70b00d1e9355d793f805c
[ "super(GetSchedulerScalingPolicy, self).setUp()\nself.at_value = self.autoscale_behaviors.get_time_in_utc(600)\nself.cron_value = '0 */10 * * *'\nself.at_style_policy = self.autoscale_behaviors.create_schedule_policy_given(group_id=self.group.id, sp_name='hahaha', sp_change=self.sp_change, schedule_at=self.at_value...
<|body_start_0|> super(GetSchedulerScalingPolicy, self).setUp() self.at_value = self.autoscale_behaviors.get_time_in_utc(600) self.cron_value = '0 */10 * * *' self.at_style_policy = self.autoscale_behaviors.create_schedule_policy_given(group_id=self.group.id, sp_name='hahaha', sp_change=...
Verify get scheduler policies.
GetSchedulerScalingPolicy
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetSchedulerScalingPolicy: """Verify get scheduler policies.""" def setUp(self): """Create 2 scheduler policies, one at-style and another cron-style on the scaling group with 0 minentities""" <|body_0|> def test_get_at_style_scaling_policy(self): """Verify get at...
stack_v2_sparse_classes_36k_train_018512
5,980
permissive
[ { "docstring": "Create 2 scheduler policies, one at-style and another cron-style on the scaling group with 0 minentities", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Verify get at style schedule policy's response code 200, headers and data.", "name": "test_get_at_styl...
5
null
Implement the Python class `GetSchedulerScalingPolicy` described below. Class description: Verify get scheduler policies. Method signatures and docstrings: - def setUp(self): Create 2 scheduler policies, one at-style and another cron-style on the scaling group with 0 minentities - def test_get_at_style_scaling_policy...
Implement the Python class `GetSchedulerScalingPolicy` described below. Class description: Verify get scheduler policies. Method signatures and docstrings: - def setUp(self): Create 2 scheduler policies, one at-style and another cron-style on the scaling group with 0 minentities - def test_get_at_style_scaling_policy...
7199cdd67255fe116dbcbedea660c13453671134
<|skeleton|> class GetSchedulerScalingPolicy: """Verify get scheduler policies.""" def setUp(self): """Create 2 scheduler policies, one at-style and another cron-style on the scaling group with 0 minentities""" <|body_0|> def test_get_at_style_scaling_policy(self): """Verify get at...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetSchedulerScalingPolicy: """Verify get scheduler policies.""" def setUp(self): """Create 2 scheduler policies, one at-style and another cron-style on the scaling group with 0 minentities""" super(GetSchedulerScalingPolicy, self).setUp() self.at_value = self.autoscale_behaviors.g...
the_stack_v2_python_sparse
autoscale_cloudroast/test_repo/autoscale/functional/scheduler/test_get_scheduler_policies.py
rackerlabs/otter
train
20
8a35cc0467f05bc6c013748ef70aa4c80b707008
[ "if head.next is None or head.next is None:\n return head\nnew_head = self.reverseList(head.next)\nhead.next.next = head\nhead.next = None\nreturn new_head", "if head is None:\n return head\npre = None\ncur = head\nwhile cur is not None:\n next_node = cur.next\n cur.next = pre\n pre = cur\n cur ...
<|body_start_0|> if head.next is None or head.next is None: return head new_head = self.reverseList(head.next) head.next.next = head head.next = None return new_head <|end_body_0|> <|body_start_1|> if head is None: return head pre = None ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head: ListNode) -> ListNode: """递归""" <|body_0|> def reverseList1(self, head: ListNode) -> ListNode: """迭代""" <|body_1|> <|end_skeleton|> <|body_start_0|> if head.next is None or head.next is None: return ...
stack_v2_sparse_classes_36k_train_018513
941
no_license
[ { "docstring": "递归", "name": "reverseList", "signature": "def reverseList(self, head: ListNode) -> ListNode" }, { "docstring": "迭代", "name": "reverseList1", "signature": "def reverseList1(self, head: ListNode) -> ListNode" } ]
2
stack_v2_sparse_classes_30k_train_002207
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head: ListNode) -> ListNode: 递归 - def reverseList1(self, head: ListNode) -> ListNode: 迭代
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head: ListNode) -> ListNode: 递归 - def reverseList1(self, head: ListNode) -> ListNode: 迭代 <|skeleton|> class Solution: def reverseList(self, head: List...
3fa96c81f92595cf076ad675ba332e2b0eb0e071
<|skeleton|> class Solution: def reverseList(self, head: ListNode) -> ListNode: """递归""" <|body_0|> def reverseList1(self, head: ListNode) -> ListNode: """迭代""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head: ListNode) -> ListNode: """递归""" if head.next is None or head.next is None: return head new_head = self.reverseList(head.next) head.next.next = head head.next = None return new_head def reverseList1(self, hea...
the_stack_v2_python_sparse
2020-03/3月每日一题复习/206反转链表.py
Annihilation7/Leetcode-Love
train
0
b03090fd9840a23d7d9588afba135c37ffe75293
[ "r = urllib.request.urlopen(self.url)\njdata = json.loads(r.read().decode(r.info().get_param('charset') or 'utf-8'))\nself.alldata = jdata['items']\nself.target_list = [list(item.keys())[0] for item in self.alldata]\nprint(f'Loaded {len(self.target_list)} targets')", "try:\n ti = self.target_list.index(target)...
<|body_start_0|> r = urllib.request.urlopen(self.url) jdata = json.loads(r.read().decode(r.info().get_param('charset') or 'utf-8')) self.alldata = jdata['items'] self.target_list = [list(item.keys())[0] for item in self.alldata] print(f'Loaded {len(self.target_list)} targets') <|...
ExoplanetWatch
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExoplanetWatch: def __init__(self) -> None: """An interface to the Exoplanet Watch Results Database Parameters ---------- Returns ------- None""" <|body_0|> def get(self, target): """Returns a dictionary of the result for the given target Parameters ---------- target...
stack_v2_sparse_classes_36k_train_018514
5,589
permissive
[ { "docstring": "An interface to the Exoplanet Watch Results Database Parameters ---------- Returns ------- None", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Returns a dictionary of the result for the given target Parameters ---------- target : str The target...
2
stack_v2_sparse_classes_30k_train_020333
Implement the Python class `ExoplanetWatch` described below. Class description: Implement the ExoplanetWatch class. Method signatures and docstrings: - def __init__(self) -> None: An interface to the Exoplanet Watch Results Database Parameters ---------- Returns ------- None - def get(self, target): Returns a diction...
Implement the Python class `ExoplanetWatch` described below. Class description: Implement the ExoplanetWatch class. Method signatures and docstrings: - def __init__(self) -> None: An interface to the Exoplanet Watch Results Database Parameters ---------- Returns ------- None - def get(self, target): Returns a diction...
2a5b09c01a5f19289d1947b09a0789f11e5ed7b2
<|skeleton|> class ExoplanetWatch: def __init__(self) -> None: """An interface to the Exoplanet Watch Results Database Parameters ---------- Returns ------- None""" <|body_0|> def get(self, target): """Returns a dictionary of the result for the given target Parameters ---------- target...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExoplanetWatch: def __init__(self) -> None: """An interface to the Exoplanet Watch Results Database Parameters ---------- Returns ------- None""" r = urllib.request.urlopen(self.url) jdata = json.loads(r.read().decode(r.info().get_param('charset') or 'utf-8')) self.alldata = jd...
the_stack_v2_python_sparse
exotic/api/ew.py
rzellem/EXOTIC
train
65
c83d84d1e8e31802f6efa6f2076fc844984adcc6
[ "if spec.deprecated == fullname:\n warnings.warn(f'Module {fullname} is deprecated since rally-openstack {spec.release}. Use {spec.get_new_name(fullname)} instead.', stacklevel=3)\nreturn importlib.machinery.ModuleSpec(fullname, ModuleLoader(spec))", "for spec in _MOVES:\n if spec.deprecated in fullname:\n ...
<|body_start_0|> if spec.deprecated == fullname: warnings.warn(f'Module {fullname} is deprecated since rally-openstack {spec.release}. Use {spec.get_new_name(fullname)} instead.', stacklevel=3) return importlib.machinery.ModuleSpec(fullname, ModuleLoader(spec)) <|end_body_0|> <|body_start_1...
ModulesMovementsHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModulesMovementsHandler: def _process_spec(cls, fullname, spec): """Make module spec and print warning message if needed.""" <|body_0|> def find_spec(cls, fullname, path=None, target=None): """This functions is what gets executed by the loader.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_018515
6,151
permissive
[ { "docstring": "Make module spec and print warning message if needed.", "name": "_process_spec", "signature": "def _process_spec(cls, fullname, spec)" }, { "docstring": "This functions is what gets executed by the loader.", "name": "find_spec", "signature": "def find_spec(cls, fullname, ...
2
stack_v2_sparse_classes_30k_train_006402
Implement the Python class `ModulesMovementsHandler` described below. Class description: Implement the ModulesMovementsHandler class. Method signatures and docstrings: - def _process_spec(cls, fullname, spec): Make module spec and print warning message if needed. - def find_spec(cls, fullname, path=None, target=None)...
Implement the Python class `ModulesMovementsHandler` described below. Class description: Implement the ModulesMovementsHandler class. Method signatures and docstrings: - def _process_spec(cls, fullname, spec): Make module spec and print warning message if needed. - def find_spec(cls, fullname, path=None, target=None)...
9ff67887bf848c5966bb4a2f37018500d30dbe45
<|skeleton|> class ModulesMovementsHandler: def _process_spec(cls, fullname, spec): """Make module spec and print warning message if needed.""" <|body_0|> def find_spec(cls, fullname, path=None, target=None): """This functions is what gets executed by the loader.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModulesMovementsHandler: def _process_spec(cls, fullname, spec): """Make module spec and print warning message if needed.""" if spec.deprecated == fullname: warnings.warn(f'Module {fullname} is deprecated since rally-openstack {spec.release}. Use {spec.get_new_name(fullname)} inste...
the_stack_v2_python_sparse
rally_openstack/_compat.py
openstack/rally-openstack
train
41
17fc7b66b537c554121d16ef3a73c3f43f49a50d
[ "mocker = Mocker()\nnumber = mocker.mock()\ncorpus_file = mocker.mock()\ncorpus_dir = mocker.mock()\ntext = mocker.mock()\ncorpus_file = 'script.rst'\nmocker.replay()\nscript = update_corpus_xml_info.Update_Corpus_XML_Info(number, corpus_file, corpus_dir, text)\nmocker.restore()\nmocker.verify()\nself.assertEqual(s...
<|body_start_0|> mocker = Mocker() number = mocker.mock() corpus_file = mocker.mock() corpus_dir = mocker.mock() text = mocker.mock() corpus_file = 'script.rst' mocker.replay() script = update_corpus_xml_info.Update_Corpus_XML_Info(number, corpus_file, cor...
test_UCXI_snippet_pair_count
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_UCXI_snippet_pair_count: def test_snippet_pair_count_without_xml(self): """Probando el método snippet_pair_count cuando no está el fichero. Para ello se utiliza un nombre de fichero no existente en esta ruta 'script.rst'. .. Nota:: se acerca bastante al nombre del fichero que aparec...
stack_v2_sparse_classes_36k_train_018516
2,468
no_license
[ { "docstring": "Probando el método snippet_pair_count cuando no está el fichero. Para ello se utiliza un nombre de fichero no existente en esta ruta 'script.rst'. .. Nota:: se acerca bastante al nombre del fichero que aparece allí que es scripts.rst, es intencional la selección de este nombre para que parezca q...
2
stack_v2_sparse_classes_30k_train_000563
Implement the Python class `test_UCXI_snippet_pair_count` described below. Class description: Implement the test_UCXI_snippet_pair_count class. Method signatures and docstrings: - def test_snippet_pair_count_without_xml(self): Probando el método snippet_pair_count cuando no está el fichero. Para ello se utiliza un no...
Implement the Python class `test_UCXI_snippet_pair_count` described below. Class description: Implement the test_UCXI_snippet_pair_count class. Method signatures and docstrings: - def test_snippet_pair_count_without_xml(self): Probando el método snippet_pair_count cuando no está el fichero. Para ello se utiliza un no...
91bb65e6ce014257dec9c3e071a6c43796916005
<|skeleton|> class test_UCXI_snippet_pair_count: def test_snippet_pair_count_without_xml(self): """Probando el método snippet_pair_count cuando no está el fichero. Para ello se utiliza un nombre de fichero no existente en esta ruta 'script.rst'. .. Nota:: se acerca bastante al nombre del fichero que aparec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test_UCXI_snippet_pair_count: def test_snippet_pair_count_without_xml(self): """Probando el método snippet_pair_count cuando no está el fichero. Para ello se utiliza un nombre de fichero no existente en esta ruta 'script.rst'. .. Nota:: se acerca bastante al nombre del fichero que aparece allí que es ...
the_stack_v2_python_sparse
scripts/test_update_xml_info.py
sorice/QtNLP-Linguist
train
0
d9f63b1a4634f19267f5e865b78daf1d9ceefc15
[ "self.protected_count = protected_count\nself.protected_size = protected_size\nself.unprotected_count = unprotected_count\nself.unprotected_size = unprotected_size", "if dictionary is None:\n return None\nprotected_count = dictionary.get('protectedCount')\nprotected_size = dictionary.get('protectedSize')\nunpr...
<|body_start_0|> self.protected_count = protected_count self.protected_size = protected_size self.unprotected_count = unprotected_count self.unprotected_size = unprotected_size <|end_body_0|> <|body_start_1|> if dictionary is None: return None protected_count...
Implementation of the 'ProtectionSummary' model. Specifies the number of protected and unprotected objects, and their sizes information of the given entity. Attributes: protected_count (long|int): Specifies the number of objects that are protected under the given entity. protected_size (long|int): Specifies the total s...
ProtectionSummary
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectionSummary: """Implementation of the 'ProtectionSummary' model. Specifies the number of protected and unprotected objects, and their sizes information of the given entity. Attributes: protected_count (long|int): Specifies the number of objects that are protected under the given entity. pro...
stack_v2_sparse_classes_36k_train_018517
2,551
permissive
[ { "docstring": "Constructor for the ProtectionSummary class", "name": "__init__", "signature": "def __init__(self, protected_count=None, protected_size=None, unprotected_count=None, unprotected_size=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (d...
2
stack_v2_sparse_classes_30k_train_007741
Implement the Python class `ProtectionSummary` described below. Class description: Implementation of the 'ProtectionSummary' model. Specifies the number of protected and unprotected objects, and their sizes information of the given entity. Attributes: protected_count (long|int): Specifies the number of objects that ar...
Implement the Python class `ProtectionSummary` described below. Class description: Implementation of the 'ProtectionSummary' model. Specifies the number of protected and unprotected objects, and their sizes information of the given entity. Attributes: protected_count (long|int): Specifies the number of objects that ar...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ProtectionSummary: """Implementation of the 'ProtectionSummary' model. Specifies the number of protected and unprotected objects, and their sizes information of the given entity. Attributes: protected_count (long|int): Specifies the number of objects that are protected under the given entity. pro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProtectionSummary: """Implementation of the 'ProtectionSummary' model. Specifies the number of protected and unprotected objects, and their sizes information of the given entity. Attributes: protected_count (long|int): Specifies the number of objects that are protected under the given entity. protected_size (...
the_stack_v2_python_sparse
cohesity_management_sdk/models/protection_summary.py
cohesity/management-sdk-python
train
24
76fa1c3a03857c79ece5b4b5c73d9c7d3584fa16
[ "if isinstance(class_names, str):\n class_names = [class_names]\nself.class_names = list() if class_names is None else class_names\nself.exact_match = exact_match\nself.return_types = return_types", "if not self.class_names:\n return True\nclass_name = edict.get_class_name()\nfor check_name in self.class_na...
<|body_start_0|> if isinstance(class_names, str): class_names = [class_names] self.class_names = list() if class_names is None else class_names self.exact_match = exact_match self.return_types = return_types <|end_body_0|> <|body_start_1|> if not self.class_names: ...
Entity iterate class.
EntityIter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntityIter: """Entity iterate class.""" def __init__(self, class_names=None, exact_match=True, return_types='index'): """Store the base attributes for the generator.""" <|body_0|> def _is_valid(self, edict): """Verify that the edict needs yielded.""" <|bo...
stack_v2_sparse_classes_36k_train_018518
4,153
no_license
[ { "docstring": "Store the base attributes for the generator.", "name": "__init__", "signature": "def __init__(self, class_names=None, exact_match=True, return_types='index')" }, { "docstring": "Verify that the edict needs yielded.", "name": "_is_valid", "signature": "def _is_valid(self, ...
2
stack_v2_sparse_classes_30k_train_005502
Implement the Python class `EntityIter` described below. Class description: Entity iterate class. Method signatures and docstrings: - def __init__(self, class_names=None, exact_match=True, return_types='index'): Store the base attributes for the generator. - def _is_valid(self, edict): Verify that the edict needs yie...
Implement the Python class `EntityIter` described below. Class description: Entity iterate class. Method signatures and docstrings: - def __init__(self, class_names=None, exact_match=True, return_types='index'): Store the base attributes for the generator. - def _is_valid(self, edict): Verify that the edict needs yie...
2d6fc3d0e0534e6eb2046fb11e40706ca42a2a59
<|skeleton|> class EntityIter: """Entity iterate class.""" def __init__(self, class_names=None, exact_match=True, return_types='index'): """Store the base attributes for the generator.""" <|body_0|> def _is_valid(self, edict): """Verify that the edict needs yielded.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntityIter: """Entity iterate class.""" def __init__(self, class_names=None, exact_match=True, return_types='index'): """Store the base attributes for the generator.""" if isinstance(class_names, str): class_names = [class_names] self.class_names = list() if class_name...
the_stack_v2_python_sparse
addons/source-python/packages/source-python/filters/entities.py
Doldol/Source.Python
train
0
68dfc0f950ba4cc07bbbcb9aec5ed9e8631ede51
[ "CtrlDev.__init__(self, parent)\nself._name = u'Memória'\nself._category = 'Sistema'\nself._diag = DiagMemory(self)\nself._compat = CompatMemory(self)\nself._guiClass = GUIMemory", "self._callInfo()\nself._callCompat()\nself._callDiag()" ]
<|body_start_0|> CtrlDev.__init__(self, parent) self._name = u'Memória' self._category = 'Sistema' self._diag = DiagMemory(self) self._compat = CompatMemory(self) self._guiClass = GUIMemory <|end_body_0|> <|body_start_1|> self._callInfo() self._callCompat...
Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade, diagnóstico e cria a tela de exibição.
CtrlMemory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CtrlMemory: """Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade, diagnóstico e cria a tela de exibição.""" def __init__(self, parent): """Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe ba...
stack_v2_sparse_classes_36k_train_018519
1,202
no_license
[ { "docstring": "Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe base 'CtrlDev'.", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "Executa o info, compat, diag e cria as telas de exibição.", "name": "execute_lib", ...
2
stack_v2_sparse_classes_30k_train_018675
Implement the Python class `CtrlMemory` described below. Class description: Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade, diagnóstico e cria a tela de exibição. Method signatures and docstrings: - def __init__(self, parent): Construtor que inicializa os atributo...
Implement the Python class `CtrlMemory` described below. Class description: Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade, diagnóstico e cria a tela de exibição. Method signatures and docstrings: - def __init__(self, parent): Construtor que inicializa os atributo...
bda0c2c8977dd1246339f1f0f4718d29e8795f21
<|skeleton|> class CtrlMemory: """Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade, diagnóstico e cria a tela de exibição.""" def __init__(self, parent): """Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe ba...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CtrlMemory: """Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade, diagnóstico e cria a tela de exibição.""" def __init__(self, parent): """Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe base 'CtrlDev'....
the_stack_v2_python_sparse
src/libs/memory/ctrl_memory.py
adrianomelo/ldc-desktop
train
1
5bc2379fcc2e2765582d5ab63ca3fdf8e4b541b5
[ "if not root:\n return ''\nstack, all_nodes = ([], [])\nstack.append(root)\nall_nodes.append(str(root.val))\nwhile stack:\n temp = []\n for node in stack:\n if node.left:\n all_nodes.append(str(node.left.val))\n temp.append(node.left)\n else:\n all_nodes.appen...
<|body_start_0|> if not root: return '' stack, all_nodes = ([], []) stack.append(root) all_nodes.append(str(root.val)) while stack: temp = [] for node in stack: if node.left: all_nodes.append(str(node.left.va...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. Space: O(2^h); h == height of the tree :type data: str :rtype: TreeNode""" ...
stack_v2_sparse_classes_36k_train_018520
2,372
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. Space: O(2^h); h == height of the tree :type data: str :rtype: TreeNode", "name": "deseria...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. Space: O(2^h); h == hei...
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. Space: O(2^h); h == hei...
1a3c1f4d6e9d3444039f087763b93241f4ba7892
<|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. Space: O(2^h); h == height of the tree :type data: str :rtype: TreeNode""" ...
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 '' stack, all_nodes = ([], []) stack.append(root) all_nodes.append(str(root.val)) while stack: temp = [] ...
the_stack_v2_python_sparse
Algorithm/297_Tree_Serialize_Deserialize.py
Gi1ia/TechNoteBook
train
7
e27ed907252aa88bebc472207016219620ba87bb
[ "self.json_data = json_data\nself.status_code = status_code\nself.exception = exception", "if self.exception:\n raise self.exception\nreturn self.json_data" ]
<|body_start_0|> self.json_data = json_data self.status_code = status_code self.exception = exception <|end_body_0|> <|body_start_1|> if self.exception: raise self.exception return self.json_data <|end_body_1|>
Mock response object for testing.
MockResponse
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MockResponse: """Mock response object for testing.""" def __init__(self, json_data, status_code, exception=None): """Create object.""" <|body_0|> def json(self): """Return json data.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.json_data...
stack_v2_sparse_classes_36k_train_018521
17,261
permissive
[ { "docstring": "Create object.", "name": "__init__", "signature": "def __init__(self, json_data, status_code, exception=None)" }, { "docstring": "Return json data.", "name": "json", "signature": "def json(self)" } ]
2
null
Implement the Python class `MockResponse` described below. Class description: Mock response object for testing. Method signatures and docstrings: - def __init__(self, json_data, status_code, exception=None): Create object. - def json(self): Return json data.
Implement the Python class `MockResponse` described below. Class description: Mock response object for testing. Method signatures and docstrings: - def __init__(self, json_data, status_code, exception=None): Create object. - def json(self): Return json data. <|skeleton|> class MockResponse: """Mock response obje...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class MockResponse: """Mock response object for testing.""" def __init__(self, json_data, status_code, exception=None): """Create object.""" <|body_0|> def json(self): """Return json data.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MockResponse: """Mock response object for testing.""" def __init__(self, json_data, status_code, exception=None): """Create object.""" self.json_data = json_data self.status_code = status_code self.exception = exception def json(self): """Return json data.""" ...
the_stack_v2_python_sparse
koku/koku/test_rbac.py
project-koku/koku
train
225
2e9b9afdbb8a65dfe58a6193fd22cd699bef7116
[ "if self.letter is not None:\n valid = message.startswith(self.letter)\n remaining = message[1:]\n return (valid, remaining)\nremaining = message\nfor rule_num in self.ruleset1:\n rule = rulebook[rule_num]\n valid, remaining = rule.is_valid(remaining, rulebook)\n if not valid:\n break\nif v...
<|body_start_0|> if self.letter is not None: valid = message.startswith(self.letter) remaining = message[1:] return (valid, remaining) remaining = message for rule_num in self.ruleset1: rule = rulebook[rule_num] valid, remaining = rule....
Holds a rule.
Rule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rule: """Holds a rule.""" def is_valid(self, message: str, rulebook: Dict[int, object]) -> Tuple[bool, str]: """Check whether rule applies. If so return remaining message.""" <|body_0|> def get_valid_messages(self, prefix: str, rulebook: Dict[int, object], ruleset: List[...
stack_v2_sparse_classes_36k_train_018522
5,517
no_license
[ { "docstring": "Check whether rule applies. If so return remaining message.", "name": "is_valid", "signature": "def is_valid(self, message: str, rulebook: Dict[int, object]) -> Tuple[bool, str]" }, { "docstring": "Return all valid messages following on from prefix.", "name": "get_valid_messa...
2
null
Implement the Python class `Rule` described below. Class description: Holds a rule. Method signatures and docstrings: - def is_valid(self, message: str, rulebook: Dict[int, object]) -> Tuple[bool, str]: Check whether rule applies. If so return remaining message. - def get_valid_messages(self, prefix: str, rulebook: D...
Implement the Python class `Rule` described below. Class description: Holds a rule. Method signatures and docstrings: - def is_valid(self, message: str, rulebook: Dict[int, object]) -> Tuple[bool, str]: Check whether rule applies. If so return remaining message. - def get_valid_messages(self, prefix: str, rulebook: D...
568effb090668f6eefc483ae9573612e1cef215c
<|skeleton|> class Rule: """Holds a rule.""" def is_valid(self, message: str, rulebook: Dict[int, object]) -> Tuple[bool, str]: """Check whether rule applies. If so return remaining message.""" <|body_0|> def get_valid_messages(self, prefix: str, rulebook: Dict[int, object], ruleset: List[...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Rule: """Holds a rule.""" def is_valid(self, message: str, rulebook: Dict[int, object]) -> Tuple[bool, str]: """Check whether rule applies. If so return remaining message.""" if self.letter is not None: valid = message.startswith(self.letter) remaining = message[1:...
the_stack_v2_python_sparse
2020/day-19.py
valeonte/advent-of-code-python
train
0
e4791412da0cc3439476c78f0b8df7db19e05957
[ "data['program'] = get_object_or_404(Program, pk=data['program_id'])\nif not data['program'].financial_aid_availability:\n raise ValidationError('Financial aid not available for this program.')\nif not ProgramEnrollment.objects.filter(program=data['program'], user=self.context['request'].user).exists():\n rai...
<|body_start_0|> data['program'] = get_object_or_404(Program, pk=data['program_id']) if not data['program'].financial_aid_availability: raise ValidationError('Financial aid not available for this program.') if not ProgramEnrollment.objects.filter(program=data['program'], user=self.co...
Serializer for financial aid requests
FinancialAidRequestSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FinancialAidRequestSerializer: """Serializer for financial aid requests""" def validate(self, data): """Validators for this serializer""" <|body_0|> def save(self): """Override save method""" <|body_1|> <|end_skeleton|> <|body_start_0|> data['pr...
stack_v2_sparse_classes_36k_train_018523
6,670
no_license
[ { "docstring": "Validators for this serializer", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": "Override save method", "name": "save", "signature": "def save(self)" } ]
2
stack_v2_sparse_classes_30k_train_005765
Implement the Python class `FinancialAidRequestSerializer` described below. Class description: Serializer for financial aid requests Method signatures and docstrings: - def validate(self, data): Validators for this serializer - def save(self): Override save method
Implement the Python class `FinancialAidRequestSerializer` described below. Class description: Serializer for financial aid requests Method signatures and docstrings: - def validate(self, data): Validators for this serializer - def save(self): Override save method <|skeleton|> class FinancialAidRequestSerializer: ...
3c166bc52dfe8d7aa04f922134f4f6deeff49eb6
<|skeleton|> class FinancialAidRequestSerializer: """Serializer for financial aid requests""" def validate(self, data): """Validators for this serializer""" <|body_0|> def save(self): """Override save method""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FinancialAidRequestSerializer: """Serializer for financial aid requests""" def validate(self, data): """Validators for this serializer""" data['program'] = get_object_or_404(Program, pk=data['program_id']) if not data['program'].financial_aid_availability: raise Valida...
the_stack_v2_python_sparse
financialaid/serializers.py
avontd2868/micromasters
train
0
1f00e10485a6e620e2f5e880a4c18027fac5162d
[ "def helper(node, level, result):\n if not node:\n return\n if len(result) == level:\n result.append([])\n result[level].append(node.val)\n if node.left:\n helper(node.left, level + 1, result)\n if node.right:\n helper(node.right, level + 1, result)\nif not root:\n retu...
<|body_start_0|> def helper(node, level, result): if not node: return if len(result) == level: result.append([]) result[level].append(node.val) if node.left: helper(node.left, level + 1, result) if node.r...
BFS.
Solution
[ "WTFPL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """BFS.""" def levelOrder_1(self, root: TreeNode) -> List[List[int]]: """Solve recursively.""" <|body_0|> def levelOrder_2(self, root: TreeNode) -> List[List[int]]: """Solve iteratively by using queue.""" <|body_1|> def levelOrder_3(self, r...
stack_v2_sparse_classes_36k_train_018524
2,036
permissive
[ { "docstring": "Solve recursively.", "name": "levelOrder_1", "signature": "def levelOrder_1(self, root: TreeNode) -> List[List[int]]" }, { "docstring": "Solve iteratively by using queue.", "name": "levelOrder_2", "signature": "def levelOrder_2(self, root: TreeNode) -> List[List[int]]" ...
3
stack_v2_sparse_classes_30k_test_000205
Implement the Python class `Solution` described below. Class description: BFS. Method signatures and docstrings: - def levelOrder_1(self, root: TreeNode) -> List[List[int]]: Solve recursively. - def levelOrder_2(self, root: TreeNode) -> List[List[int]]: Solve iteratively by using queue. - def levelOrder_3(self, root:...
Implement the Python class `Solution` described below. Class description: BFS. Method signatures and docstrings: - def levelOrder_1(self, root: TreeNode) -> List[List[int]]: Solve recursively. - def levelOrder_2(self, root: TreeNode) -> List[List[int]]: Solve iteratively by using queue. - def levelOrder_3(self, root:...
5e5e7098d2310c972314c9c9895aafd048047fe6
<|skeleton|> class Solution: """BFS.""" def levelOrder_1(self, root: TreeNode) -> List[List[int]]: """Solve recursively.""" <|body_0|> def levelOrder_2(self, root: TreeNode) -> List[List[int]]: """Solve iteratively by using queue.""" <|body_1|> def levelOrder_3(self, r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """BFS.""" def levelOrder_1(self, root: TreeNode) -> List[List[int]]: """Solve recursively.""" def helper(node, level, result): if not node: return if len(result) == level: result.append([]) result[level].append...
the_stack_v2_python_sparse
0102_Binary_Tree_Level_Order_Traversal.py
imguozr/LC-Solutions
train
0
334839b5ccb98cd07b5b6540cb19f92b130228f6
[ "def insert(target):\n left, right = (0, len(res) - 1)\n while left <= right:\n mid = left + (right - left) / 2\n if res[mid] < target:\n left = mid + 1\n else:\n right = mid - 1\n if left == len(res):\n res.append(target)\n else:\n res[left] = ta...
<|body_start_0|> def insert(target): left, right = (0, len(res) - 1) while left <= right: mid = left + (right - left) / 2 if res[mid] < target: left = mid + 1 else: right = mid - 1 if left...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_0|> def maxEnvelopes2(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def insert...
stack_v2_sparse_classes_36k_train_018525
3,342
no_license
[ { "docstring": ":type envelopes: List[List[int]] :rtype: int", "name": "maxEnvelopes", "signature": "def maxEnvelopes(self, envelopes)" }, { "docstring": ":type envelopes: List[List[int]] :rtype: int", "name": "maxEnvelopes2", "signature": "def maxEnvelopes2(self, envelopes)" } ]
2
stack_v2_sparse_classes_30k_train_003023
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int - def maxEnvelopes2(self, envelopes): :type envelopes: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int - def maxEnvelopes2(self, envelopes): :type envelopes: List[List[int]] :rtype: int <|skeleton|> c...
340ae58fb65b97aa6c6ab2daa8cbd82d1093deae
<|skeleton|> class Solution: def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_0|> def maxEnvelopes2(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" def insert(target): left, right = (0, len(res) - 1) while left <= right: mid = left + (right - left) / 2 if res[mid] < target: ...
the_stack_v2_python_sparse
learnpythonthehardway/russian-doll-envelopes-354.py
dgpllc/leetcode-python
train
0
e4ee08938bd9106e6c0f1d1ca0d18a06a202bbbd
[ "idxs = []\nfor ii in range(len(unsorted_loglikelihoods)):\n idx = np.where(np.all(sorted_samples[ii] == unsorted_samples, axis=1))[0]\n if len(idx) > 1:\n logger.warning('Multiple likelihood matches found between sorted and unsorted samples. Taking the first match.')\n idxs.append(idx[0])\nreturn u...
<|body_start_0|> idxs = [] for ii in range(len(unsorted_loglikelihoods)): idx = np.where(np.all(sorted_samples[ii] == unsorted_samples, axis=1))[0] if len(idx) > 1: logger.warning('Multiple likelihood matches found between sorted and unsorted samples. Taking the f...
NestedSampler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NestedSampler: def reorder_loglikelihoods(unsorted_loglikelihoods, unsorted_samples, sorted_samples): """Reorders the stored log-likelihood after they have been reweighted This creates a sorting index by matching the reweights `result.samples` against the raw samples, then uses this inde...
stack_v2_sparse_classes_36k_train_018526
36,082
permissive
[ { "docstring": "Reorders the stored log-likelihood after they have been reweighted This creates a sorting index by matching the reweights `result.samples` against the raw samples, then uses this index to sort the loglikelihoods Parameters ========== sorted_samples, unsorted_samples: array-like Sorted and unsort...
2
stack_v2_sparse_classes_30k_val_000456
Implement the Python class `NestedSampler` described below. Class description: Implement the NestedSampler class. Method signatures and docstrings: - def reorder_loglikelihoods(unsorted_loglikelihoods, unsorted_samples, sorted_samples): Reorders the stored log-likelihood after they have been reweighted This creates a...
Implement the Python class `NestedSampler` described below. Class description: Implement the NestedSampler class. Method signatures and docstrings: - def reorder_loglikelihoods(unsorted_loglikelihoods, unsorted_samples, sorted_samples): Reorders the stored log-likelihood after they have been reweighted This creates a...
9c1dda6cc1510692ce4ac75c608de5fae53e971c
<|skeleton|> class NestedSampler: def reorder_loglikelihoods(unsorted_loglikelihoods, unsorted_samples, sorted_samples): """Reorders the stored log-likelihood after they have been reweighted This creates a sorting index by matching the reweights `result.samples` against the raw samples, then uses this inde...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NestedSampler: def reorder_loglikelihoods(unsorted_loglikelihoods, unsorted_samples, sorted_samples): """Reorders the stored log-likelihood after they have been reweighted This creates a sorting index by matching the reweights `result.samples` against the raw samples, then uses this index to sort the ...
the_stack_v2_python_sparse
bilby/core/sampler/base_sampler.py
khunsang/bilby
train
0
1280ed338b62c620ba48ae107498ae1cf4f1b7f4
[ "workflow_collection_subscription = get_object_or_404(WorkflowCollectionSubscription, id=id, user=request.user.id)\nserializer = WorkflowCollectionSubscriptionSummarySerializer(workflow_collection_subscription, context={'request': request})\nreturn Response(data=serializer.data)", "workflow_collection_subscriptio...
<|body_start_0|> workflow_collection_subscription = get_object_or_404(WorkflowCollectionSubscription, id=id, user=request.user.id) serializer = WorkflowCollectionSubscriptionSummarySerializer(workflow_collection_subscription, context={'request': request}) return Response(data=serializer.data) <|...
**Supported HTTP Methods** * Get: Retrieve a summary representation of a particular WorkflowCollectionSubscription resource belonging to the requesting user. * Put: Update a particular WorkflowCollectionSubscription resource belonging to the requesting user.
WorkflowCollectionSubscriptionView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowCollectionSubscriptionView: """**Supported HTTP Methods** * Get: Retrieve a summary representation of a particular WorkflowCollectionSubscription resource belonging to the requesting user. * Put: Update a particular WorkflowCollectionSubscription resource belonging to the requesting user....
stack_v2_sparse_classes_36k_train_018527
12,221
permissive
[ { "docstring": "Retrieve a WorkflowCollectionSubscription representation. Path Parameters: id (str): The UUID of the workflow collection subscription to retrieve. Returns: A HTTP response containing a dict-like JSON representation of the workflow collection subscription with a 200 status code. { \"detail\": \"h...
2
stack_v2_sparse_classes_30k_train_002188
Implement the Python class `WorkflowCollectionSubscriptionView` described below. Class description: **Supported HTTP Methods** * Get: Retrieve a summary representation of a particular WorkflowCollectionSubscription resource belonging to the requesting user. * Put: Update a particular WorkflowCollectionSubscription res...
Implement the Python class `WorkflowCollectionSubscriptionView` described below. Class description: **Supported HTTP Methods** * Get: Retrieve a summary representation of a particular WorkflowCollectionSubscription resource belonging to the requesting user. * Put: Update a particular WorkflowCollectionSubscription res...
dc0e8807263266713d3d7fa46e240e8d72db28d1
<|skeleton|> class WorkflowCollectionSubscriptionView: """**Supported HTTP Methods** * Get: Retrieve a summary representation of a particular WorkflowCollectionSubscription resource belonging to the requesting user. * Put: Update a particular WorkflowCollectionSubscription resource belonging to the requesting user....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkflowCollectionSubscriptionView: """**Supported HTTP Methods** * Get: Retrieve a summary representation of a particular WorkflowCollectionSubscription resource belonging to the requesting user. * Put: Update a particular WorkflowCollectionSubscription resource belonging to the requesting user.""" def ...
the_stack_v2_python_sparse
django_workflow_system/api/views/user/workflows/subscription.py
kwang1971/django-workflow-system
train
0
13eb71c8cffc308faeb91bdbfb76aae8d47301b7
[ "if not valid(j1, j2, j3, m1, m2, m3):\n raise ValueError(\"j1, j2, j3 must be integers or half integers the mi's must be so that mi is one of -ji, -ji+1, ..., 0, ..., ji-1, ji where i is 1, 2 or 3.\")\nif trivial_zero(j1, j2, j3, m1, m2, m3):\n return 0.0\nrrfcalc = os.path.abspath(os...
<|body_start_0|> if not valid(j1, j2, j3, m1, m2, m3): raise ValueError("j1, j2, j3 must be integers or half integers the mi's must be so that mi is one of -ji, -ji+1, ..., 0, ..., ji-1, ji where i is 1, 2 or 3.") if trivial_zero(j1, j2, j3, m1, m2, m3): r...
Provides python access to Anthony Stone's RRF code (v 3.2), via the program rrfcalc, allowing computation of w3j symbols. The program rrfcalc must be installed for this class to work. For some reason wrapping his fortran code directly with f2py ends with errors that are difficult to diagnose.
W3jStone
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class W3jStone: """Provides python access to Anthony Stone's RRF code (v 3.2), via the program rrfcalc, allowing computation of w3j symbols. The program rrfcalc must be installed for this class to work. For some reason wrapping his fortran code directly with f2py ends with errors that are difficult to ...
stack_v2_sparse_classes_36k_train_018528
25,178
no_license
[ { "docstring": "Returns the double precision value of the exact calculation of the 3j symbol: (j1 j2 j3) (m1 m2 m3) Parameters ---------- j1 : float A float representation of an integer or half-integer. j2 : float A float representation of an integer or half-integer. j3 : float A float representation of an inte...
2
stack_v2_sparse_classes_30k_train_017056
Implement the Python class `W3jStone` described below. Class description: Provides python access to Anthony Stone's RRF code (v 3.2), via the program rrfcalc, allowing computation of w3j symbols. The program rrfcalc must be installed for this class to work. For some reason wrapping his fortran code directly with f2py ...
Implement the Python class `W3jStone` described below. Class description: Provides python access to Anthony Stone's RRF code (v 3.2), via the program rrfcalc, allowing computation of w3j symbols. The program rrfcalc must be installed for this class to work. For some reason wrapping his fortran code directly with f2py ...
2ce16d776448553e2ae5c45f3cf973c8271aefbf
<|skeleton|> class W3jStone: """Provides python access to Anthony Stone's RRF code (v 3.2), via the program rrfcalc, allowing computation of w3j symbols. The program rrfcalc must be installed for this class to work. For some reason wrapping his fortran code directly with f2py ends with errors that are difficult to ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class W3jStone: """Provides python access to Anthony Stone's RRF code (v 3.2), via the program rrfcalc, allowing computation of w3j symbols. The program rrfcalc must be installed for this class to work. For some reason wrapping his fortran code directly with f2py ends with errors that are difficult to diagnose.""" ...
the_stack_v2_python_sparse
Code/packages/coffee/swsh/w3j/w3j.py
mfuphi/SOFTX_2019_93
train
0
c8cdaa16bef0dcbdf1f733ca5682b7d0d6649120
[ "self.modules = []\nfor fname in mod_list:\n self.modules.append([fname, os.path.splitext(fname)[0], None])", "tileset_data = self.modules[mod_index]\nfilename, modulename, tile_obj = tileset_data\nif not tile_obj:\n obj = __import__('pyslip', globals(), locals(), [modulename])\n tileset = getattr(obj, m...
<|body_start_0|> self.modules = [] for fname in mod_list: self.modules.append([fname, os.path.splitext(fname)[0], None]) <|end_body_0|> <|body_start_1|> tileset_data = self.modules[mod_index] filename, modulename, tile_obj = tileset_data if not tile_obj: ...
A class to manage multiple tileset objects. ts = TilesetManager(source_list) # 'source_list' is list of tileset source modules ts.get_tile_source(index) # 'index' into 'source_list' of source to use Features 'lazy' importing, only imports when the tileset is used the first time.
TilesetManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TilesetManager: """A class to manage multiple tileset objects. ts = TilesetManager(source_list) # 'source_list' is list of tileset source modules ts.get_tile_source(index) # 'index' into 'source_list' of source to use Features 'lazy' importing, only imports when the tileset is used the first time...
stack_v2_sparse_classes_36k_train_018529
4,444
no_license
[ { "docstring": "Create a set of tile sources. mod_list list of module filenames to manage The list is something like: ['open_street_map.py', 'gmt_local.py'] We can access tilesets using the index of the module in the 'mod_list'.", "name": "__init__", "signature": "def __init__(self, mod_list)" }, { ...
2
stack_v2_sparse_classes_30k_test_000810
Implement the Python class `TilesetManager` described below. Class description: A class to manage multiple tileset objects. ts = TilesetManager(source_list) # 'source_list' is list of tileset source modules ts.get_tile_source(index) # 'index' into 'source_list' of source to use Features 'lazy' importing, only imports ...
Implement the Python class `TilesetManager` described below. Class description: A class to manage multiple tileset objects. ts = TilesetManager(source_list) # 'source_list' is list of tileset source modules ts.get_tile_source(index) # 'index' into 'source_list' of source to use Features 'lazy' importing, only imports ...
9c641e35f82e304b83576ad9bb5788eee6cb6d2b
<|skeleton|> class TilesetManager: """A class to manage multiple tileset objects. ts = TilesetManager(source_list) # 'source_list' is list of tileset source modules ts.get_tile_source(index) # 'index' into 'source_list' of source to use Features 'lazy' importing, only imports when the tileset is used the first time...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TilesetManager: """A class to manage multiple tileset objects. ts = TilesetManager(source_list) # 'source_list' is list of tileset source modules ts.get_tile_source(index) # 'index' into 'source_list' of source to use Features 'lazy' importing, only imports when the tileset is used the first time.""" def...
the_stack_v2_python_sparse
ui/map.py
ahenshaw/rusty_venture
train
0
4064ed106fadaa742a34723a1c84a69e82620870
[ "global task_tree\n\ndef simulation():\n return None\nself.suspended_tree = task_tree\nself.world_state, self.objects2attached = BulletWorld.current_bullet_world.save_state()\nself.simulated_root = TaskTreeNode(code=Code(simulation))\ntask_tree = self.simulated_root\npybullet.addUserDebugText('Simulating...', [0...
<|body_start_0|> global task_tree def simulation(): return None self.suspended_tree = task_tree self.world_state, self.objects2attached = BulletWorld.current_bullet_world.save_state() self.simulated_root = TaskTreeNode(code=Code(simulation)) task_tree = self....
TaskTree for execution in a 'new' simulation.
SimulatedTaskTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulatedTaskTree: """TaskTree for execution in a 'new' simulation.""" def __enter__(self): """At the beginning of a with statement the current task tree and bullet world will be suspended and remembered. Fresh structures are then available inside the with statement.""" <|bod...
stack_v2_sparse_classes_36k_train_018530
11,387
no_license
[ { "docstring": "At the beginning of a with statement the current task tree and bullet world will be suspended and remembered. Fresh structures are then available inside the with statement.", "name": "__enter__", "signature": "def __enter__(self)" }, { "docstring": "Restore the old state at the e...
2
stack_v2_sparse_classes_30k_train_020594
Implement the Python class `SimulatedTaskTree` described below. Class description: TaskTree for execution in a 'new' simulation. Method signatures and docstrings: - def __enter__(self): At the beginning of a with statement the current task tree and bullet world will be suspended and remembered. Fresh structures are t...
Implement the Python class `SimulatedTaskTree` described below. Class description: TaskTree for execution in a 'new' simulation. Method signatures and docstrings: - def __enter__(self): At the beginning of a with statement the current task tree and bullet world will be suspended and remembered. Fresh structures are t...
f9ef666d6d4685660c9517652f2c568ed2c9367c
<|skeleton|> class SimulatedTaskTree: """TaskTree for execution in a 'new' simulation.""" def __enter__(self): """At the beginning of a with statement the current task tree and bullet world will be suspended and remembered. Fresh structures are then available inside the with statement.""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimulatedTaskTree: """TaskTree for execution in a 'new' simulation.""" def __enter__(self): """At the beginning of a with statement the current task tree and bullet world will be suspended and remembered. Fresh structures are then available inside the with statement.""" global task_tree ...
the_stack_v2_python_sparse
src/pycram/task.py
cram2/pycram
train
12
3e45d8b67b719e6eac7a123f4b769a6ff260a959
[ "n = len(matrix[0])\nfor i in range(math.ceil(n / 2)):\n for j in range(i, n - i - 1):\n matrix[i][j], matrix[j][n - 1 - i], matrix[n - 1 - i][n - 1 - j], matrix[n - 1 - j][i] = (matrix[n - 1 - j][i], matrix[i][j], matrix[j][n - 1 - i], matrix[n - 1 - i][n - 1 - j])", "length = len(matrix)\nfor i in ran...
<|body_start_0|> n = len(matrix[0]) for i in range(math.ceil(n / 2)): for j in range(i, n - i - 1): matrix[i][j], matrix[j][n - 1 - i], matrix[n - 1 - i][n - 1 - j], matrix[n - 1 - j][i] = (matrix[n - 1 - j][i], matrix[i][j], matrix[j][n - 1 - i], matrix[n - 1 - i][n - 1 - j]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate_(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate(self, matrix) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_1|>...
stack_v2_sparse_classes_36k_train_018531
1,236
no_license
[ { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.", "name": "rotate_", "signature": "def rotate_(self, matrix)" }, { "docstring": "Do not return anything, modify matrix in-place instead.", "name": "rotate", "signature": "de...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate_(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate(self, matrix) -> None: Do not return an...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate_(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate(self, matrix) -> None: Do not return an...
238995bd23c8a6c40c6035890e94baa2473d4bbc
<|skeleton|> class Solution: def rotate_(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate(self, matrix) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate_(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" n = len(matrix[0]) for i in range(math.ceil(n / 2)): for j in range(i, n - i - 1): matrix[i][j], matrix[j][n - 1 - i...
the_stack_v2_python_sparse
problems/RotateImage.py
wan-catherine/Leetcode
train
5
e29b1886a005525a5b7cb606b498f9dd03946b3e
[ "BaseJaffleCommand.parse_command_line(self, argv)\nif not self.extra_args:\n print('No kernel specified.', file=sys.stderr)\n self.exit(1)\nself.session_id = self.extra_args[0]\ntry:\n status = JaffleStatus.load(self.status_file_path)\n print('status', status)\nexcept FileNotFoundError:\n print('Jaff...
<|body_start_0|> BaseJaffleCommand.parse_command_line(self, argv) if not self.extra_args: print('No kernel specified.', file=sys.stderr) self.exit(1) self.session_id = self.extra_args[0] try: status = JaffleStatus.load(self.status_file_path) ...
Console for a jaffle kernel.
JaffleConsoleCommand
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JaffleConsoleCommand: """Console for a jaffle kernel.""" def parse_command_line(self, argv): """Parses comnand line. Parameters ---------- argv : list[str] Command line strings.""" <|body_0|> def init_shell(self): """Initializes the interactive shell and set sign...
stack_v2_sparse_classes_36k_train_018532
2,398
permissive
[ { "docstring": "Parses comnand line. Parameters ---------- argv : list[str] Command line strings.", "name": "parse_command_line", "signature": "def parse_command_line(self, argv)" }, { "docstring": "Initializes the interactive shell and set signal handlers.", "name": "init_shell", "signa...
2
null
Implement the Python class `JaffleConsoleCommand` described below. Class description: Console for a jaffle kernel. Method signatures and docstrings: - def parse_command_line(self, argv): Parses comnand line. Parameters ---------- argv : list[str] Command line strings. - def init_shell(self): Initializes the interacti...
Implement the Python class `JaffleConsoleCommand` described below. Class description: Console for a jaffle kernel. Method signatures and docstrings: - def parse_command_line(self, argv): Parses comnand line. Parameters ---------- argv : list[str] Command line strings. - def init_shell(self): Initializes the interacti...
ab8352716c973eef9c224ff80d0dd66b95c606a3
<|skeleton|> class JaffleConsoleCommand: """Console for a jaffle kernel.""" def parse_command_line(self, argv): """Parses comnand line. Parameters ---------- argv : list[str] Command line strings.""" <|body_0|> def init_shell(self): """Initializes the interactive shell and set sign...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JaffleConsoleCommand: """Console for a jaffle kernel.""" def parse_command_line(self, argv): """Parses comnand line. Parameters ---------- argv : list[str] Command line strings.""" BaseJaffleCommand.parse_command_line(self, argv) if not self.extra_args: print('No kerne...
the_stack_v2_python_sparse
jaffle/command/console/command.py
daniel-covelli/jaffle
train
0
4eb6d2bb4cb8366e248851b40f809caa48b10f4e
[ "operation_settings_objs = OperationSettings.objects.filter(owner=request.manager)\nif operation_settings_objs.count() == 0:\n operation_settings = OperationSettings.objects.create(owner=request.manager)\nelse:\n operation_settings = operation_settings_objs[0]\nc = RequestContext(request, {'first_nav_name': F...
<|body_start_0|> operation_settings_objs = OperationSettings.objects.filter(owner=request.manager) if operation_settings_objs.count() == 0: operation_settings = OperationSettings.objects.create(owner=request.manager) else: operation_settings = operation_settings_objs[0] ...
DirectFollow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DirectFollow: def get(request): """快速关注页面""" <|body_0|> def api_post(request): """更新快速关注信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> operation_settings_objs = OperationSettings.objects.filter(owner=request.manager) if operation_setting...
stack_v2_sparse_classes_36k_train_018533
1,715
no_license
[ { "docstring": "快速关注页面", "name": "get", "signature": "def get(request)" }, { "docstring": "更新快速关注信息", "name": "api_post", "signature": "def api_post(request)" } ]
2
null
Implement the Python class `DirectFollow` described below. Class description: Implement the DirectFollow class. Method signatures and docstrings: - def get(request): 快速关注页面 - def api_post(request): 更新快速关注信息
Implement the Python class `DirectFollow` described below. Class description: Implement the DirectFollow class. Method signatures and docstrings: - def get(request): 快速关注页面 - def api_post(request): 更新快速关注信息 <|skeleton|> class DirectFollow: def get(request): """快速关注页面""" <|body_0|> def api_p...
8b2f7befe92841bcc35e0e60cac5958ef3f3af54
<|skeleton|> class DirectFollow: def get(request): """快速关注页面""" <|body_0|> def api_post(request): """更新快速关注信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DirectFollow: def get(request): """快速关注页面""" operation_settings_objs = OperationSettings.objects.filter(owner=request.manager) if operation_settings_objs.count() == 0: operation_settings = OperationSettings.objects.create(owner=request.manager) else: ope...
the_stack_v2_python_sparse
weapp/weixin2/mp_user/direct_follow.py
chengdg/weizoom
train
1
0582fe1d0c3100afd8d4baa29f0fbca1dbf47097
[ "super(LikelihoodEstimator, self).__init__()\nself.mean_block = tf.keras.Sequential([layers.Dense(output_dim), layers.BatchNormalization(), layers.ELU(), layers.Dense(output_dim)])\nself.logvar_block = tf.keras.Sequential([layers.Dense(output_dim), layers.BatchNormalization(), layers.ELU(), layers.Dense(output_dim,...
<|body_start_0|> super(LikelihoodEstimator, self).__init__() self.mean_block = tf.keras.Sequential([layers.Dense(output_dim), layers.BatchNormalization(), layers.ELU(), layers.Dense(output_dim)]) self.logvar_block = tf.keras.Sequential([layers.Dense(output_dim), layers.BatchNormalization(), laye...
Network to estimate the log-likelihood.
LikelihoodEstimator
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LikelihoodEstimator: """Network to estimate the log-likelihood.""" def __init__(self, output_dim): """Initializer. Args: output_dim: An integer for the dimension of the output.""" <|body_0|> def call(self, inputs, training=False): """Computes a forward pass. Args...
stack_v2_sparse_classes_36k_train_018534
30,548
permissive
[ { "docstring": "Initializer. Args: output_dim: An integer for the dimension of the output.", "name": "__init__", "signature": "def __init__(self, output_dim)" }, { "docstring": "Computes a forward pass. Args: inputs: An input tensor. training: A boolean indicating whether the call is for trainin...
2
null
Implement the Python class `LikelihoodEstimator` described below. Class description: Network to estimate the log-likelihood. Method signatures and docstrings: - def __init__(self, output_dim): Initializer. Args: output_dim: An integer for the dimension of the output. - def call(self, inputs, training=False): Computes...
Implement the Python class `LikelihoodEstimator` described below. Class description: Network to estimate the log-likelihood. Method signatures and docstrings: - def __init__(self, output_dim): Initializer. Args: output_dim: An integer for the dimension of the output. - def call(self, inputs, training=False): Computes...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class LikelihoodEstimator: """Network to estimate the log-likelihood.""" def __init__(self, output_dim): """Initializer. Args: output_dim: An integer for the dimension of the output.""" <|body_0|> def call(self, inputs, training=False): """Computes a forward pass. Args...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LikelihoodEstimator: """Network to estimate the log-likelihood.""" def __init__(self, output_dim): """Initializer. Args: output_dim: An integer for the dimension of the output.""" super(LikelihoodEstimator, self).__init__() self.mean_block = tf.keras.Sequential([layers.Dense(outpu...
the_stack_v2_python_sparse
poem/cv_mim/models.py
Jimmy-INL/google-research
train
1
78972ff408306570ac5e4a6af7fa578c5d420361
[ "x = _generate_products(100000)\nwith self.session() as sess:\n x_ph = tf.placeholder(x.dtype, len(x))\n angle_ph = losses.safe_acosd(x_ph)\n angle, d_angle = sess.run((angle_ph, tf.gradients(tf.reduce_sum(angle_ph), x_ph)), feed_dict={x_ph: x})\n for v in [angle, d_angle]:\n self.assertTrue(np.a...
<|body_start_0|> x = _generate_products(100000) with self.session() as sess: x_ph = tf.placeholder(x.dtype, len(x)) angle_ph = losses.safe_acosd(x_ph) angle, d_angle = sess.run((angle_ph, tf.gradients(tf.reduce_sum(angle_ph), x_ph)), feed_dict={x_ph: x}) f...
Tests losses.safe_acosd().
SafeArcCosDTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SafeArcCosDTest: """Tests losses.safe_acosd().""" def testFiniteAngleAndGradient(self): """Test that the angle and the gradient are finite for all x in [-1, 1].""" <|body_0|> def testAccurateAngle(self): """Test that the angle is very accurate.""" <|body_...
stack_v2_sparse_classes_36k_train_018535
17,094
permissive
[ { "docstring": "Test that the angle and the gradient are finite for all x in [-1, 1].", "name": "testFiniteAngleAndGradient", "signature": "def testFiniteAngleAndGradient(self)" }, { "docstring": "Test that the angle is very accurate.", "name": "testAccurateAngle", "signature": "def test...
3
stack_v2_sparse_classes_30k_train_014283
Implement the Python class `SafeArcCosDTest` described below. Class description: Tests losses.safe_acosd(). Method signatures and docstrings: - def testFiniteAngleAndGradient(self): Test that the angle and the gradient are finite for all x in [-1, 1]. - def testAccurateAngle(self): Test that the angle is very accurat...
Implement the Python class `SafeArcCosDTest` described below. Class description: Tests losses.safe_acosd(). Method signatures and docstrings: - def testFiniteAngleAndGradient(self): Test that the angle and the gradient are finite for all x in [-1, 1]. - def testAccurateAngle(self): Test that the angle is very accurat...
c52b225082327ea34bed80357dbff004fc9926ba
<|skeleton|> class SafeArcCosDTest: """Tests losses.safe_acosd().""" def testFiniteAngleAndGradient(self): """Test that the angle and the gradient are finite for all x in [-1, 1].""" <|body_0|> def testAccurateAngle(self): """Test that the angle is very accurate.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SafeArcCosDTest: """Tests losses.safe_acosd().""" def testFiniteAngleAndGradient(self): """Test that the angle and the gradient are finite for all x in [-1, 1].""" x = _generate_products(100000) with self.session() as sess: x_ph = tf.placeholder(x.dtype, len(x)) ...
the_stack_v2_python_sparse
python/losses_test.py
mahmoudnafifi/ffcc
train
1
bde5734a5b56400bfe2e61540ec4c1636e1c23c6
[ "self._subsystems = subsystems\nself._x_dims = [sys._x_dim for sys in subsystems]\nx_dim = sum(self._x_dims)\nu_dims = [sys._u_dim for sys in subsystems]\nsuper(ProductMultiPlayerDynamicalSystem, self).__init__(x_dim, u_dims, T)", "subsystem_xs = np.split(x, np.cumsum(self._x_dims[:-1]), axis=0)\nx_dot_list = [sy...
<|body_start_0|> self._subsystems = subsystems self._x_dims = [sys._x_dim for sys in subsystems] x_dim = sum(self._x_dims) u_dims = [sys._u_dim for sys in subsystems] super(ProductMultiPlayerDynamicalSystem, self).__init__(x_dim, u_dims, T) <|end_body_0|> <|body_start_1|> ...
ProductMultiPlayerDynamicalSystem
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductMultiPlayerDynamicalSystem: def __init__(self, subsystems, T=0.1): """Initialize with a list of dynamical systems. :param subsystems: list of component (single-player) dynamical systems :type subsystems: [DynamicalSystem] :param T: time interval :type T: float""" <|body_0|...
stack_v2_sparse_classes_36k_train_018536
5,130
permissive
[ { "docstring": "Initialize with a list of dynamical systems. :param subsystems: list of component (single-player) dynamical systems :type subsystems: [DynamicalSystem] :param T: time interval :type T: float", "name": "__init__", "signature": "def __init__(self, subsystems, T=0.1)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_test_000741
Implement the Python class `ProductMultiPlayerDynamicalSystem` described below. Class description: Implement the ProductMultiPlayerDynamicalSystem class. Method signatures and docstrings: - def __init__(self, subsystems, T=0.1): Initialize with a list of dynamical systems. :param subsystems: list of component (single...
Implement the Python class `ProductMultiPlayerDynamicalSystem` described below. Class description: Implement the ProductMultiPlayerDynamicalSystem class. Method signatures and docstrings: - def __init__(self, subsystems, T=0.1): Initialize with a list of dynamical systems. :param subsystems: list of component (single...
fbe9501a51e33498e0b916e2a870dada7c61df57
<|skeleton|> class ProductMultiPlayerDynamicalSystem: def __init__(self, subsystems, T=0.1): """Initialize with a list of dynamical systems. :param subsystems: list of component (single-player) dynamical systems :type subsystems: [DynamicalSystem] :param T: time interval :type T: float""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductMultiPlayerDynamicalSystem: def __init__(self, subsystems, T=0.1): """Initialize with a list of dynamical systems. :param subsystems: list of component (single-player) dynamical systems :type subsystems: [DynamicalSystem] :param T: time interval :type T: float""" self._subsystems = subs...
the_stack_v2_python_sparse
python/product_multiplayer_dynamical_system.py
HJReachability/ilqgames
train
89
6de6495f5d64be3fd6c6c388574d69e1ab0249da
[ "super(LMEvaluator, self).__init__(val_iter, reporter, device=-1)\nself.model = eval_model\nself.device = device", "val_iter = self.get_iterator('main')\nloss = 0\nnll = 0\ncount = 0\nself.model.eval()\nwith torch.no_grad():\n for batch in copy.copy(val_iter):\n x, t = concat_examples(batch, device=self...
<|body_start_0|> super(LMEvaluator, self).__init__(val_iter, reporter, device=-1) self.model = eval_model self.device = device <|end_body_0|> <|body_start_1|> val_iter = self.get_iterator('main') loss = 0 nll = 0 count = 0 self.model.eval() with t...
A custom evaluator for a pytorch LM.
LMEvaluator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LMEvaluator: """A custom evaluator for a pytorch LM.""" def __init__(self, val_iter, eval_model, reporter, device): """Initialize class. :param chainer.dataset.Iterator val_iter : The validation iterator :param LMInterface eval_model : The model to evaluate :param chainer.Reporter re...
stack_v2_sparse_classes_36k_train_018537
14,856
permissive
[ { "docstring": "Initialize class. :param chainer.dataset.Iterator val_iter : The validation iterator :param LMInterface eval_model : The model to evaluate :param chainer.Reporter reporter : The observations reporter :param int device : The device id to use", "name": "__init__", "signature": "def __init_...
2
null
Implement the Python class `LMEvaluator` described below. Class description: A custom evaluator for a pytorch LM. Method signatures and docstrings: - def __init__(self, val_iter, eval_model, reporter, device): Initialize class. :param chainer.dataset.Iterator val_iter : The validation iterator :param LMInterface eval...
Implement the Python class `LMEvaluator` described below. Class description: A custom evaluator for a pytorch LM. Method signatures and docstrings: - def __init__(self, val_iter, eval_model, reporter, device): Initialize class. :param chainer.dataset.Iterator val_iter : The validation iterator :param LMInterface eval...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class LMEvaluator: """A custom evaluator for a pytorch LM.""" def __init__(self, val_iter, eval_model, reporter, device): """Initialize class. :param chainer.dataset.Iterator val_iter : The validation iterator :param LMInterface eval_model : The model to evaluate :param chainer.Reporter re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LMEvaluator: """A custom evaluator for a pytorch LM.""" def __init__(self, val_iter, eval_model, reporter, device): """Initialize class. :param chainer.dataset.Iterator val_iter : The validation iterator :param LMInterface eval_model : The model to evaluate :param chainer.Reporter reporter : The ...
the_stack_v2_python_sparse
espnet/lm/pytorch_backend/lm.py
espnet/espnet
train
7,242
5dc93c67927189ac1133e832d97a6a5813073590
[ "self._setup(field_mapping={'properties': FieldMapping(SimulationProperties.parse, SimulationProperties.toJSONObject), 'sources': ListFieldMapping(SimulationSource.parse, SimulationSource.toJSONObject, [])})\nif properties is not None:\n self.properties = properties\nelif simulation_name is not None:\n self.p...
<|body_start_0|> self._setup(field_mapping={'properties': FieldMapping(SimulationProperties.parse, SimulationProperties.toJSONObject), 'sources': ListFieldMapping(SimulationSource.parse, SimulationSource.toJSONObject, [])}) if properties is not None: self.properties = properties elif...
FeedSimulationConfiguration API Object which could be passed to WSO2 SP Event Simulator via EventSimulatorClient.
FeedSimulationConfiguration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeedSimulationConfiguration: """FeedSimulationConfiguration API Object which could be passed to WSO2 SP Event Simulator via EventSimulatorClient.""" def __init__(self, simulation_name=None, properties=None): """Instantiates FeedSimulationConfiguration. :param simulation_name: name of...
stack_v2_sparse_classes_36k_train_018538
2,279
permissive
[ { "docstring": "Instantiates FeedSimulationConfiguration. :param simulation_name: name of simulation :param properties: SimulationProperties", "name": "__init__", "signature": "def __init__(self, simulation_name=None, properties=None)" }, { "docstring": "Converts a Python Class Object (from JSON...
2
stack_v2_sparse_classes_30k_train_004883
Implement the Python class `FeedSimulationConfiguration` described below. Class description: FeedSimulationConfiguration API Object which could be passed to WSO2 SP Event Simulator via EventSimulatorClient. Method signatures and docstrings: - def __init__(self, simulation_name=None, properties=None): Instantiates Fee...
Implement the Python class `FeedSimulationConfiguration` described below. Class description: FeedSimulationConfiguration API Object which could be passed to WSO2 SP Event Simulator via EventSimulatorClient. Method signatures and docstrings: - def __init__(self, simulation_name=None, properties=None): Instantiates Fee...
343db17ca1331d0a53335478d01bba69338cf24b
<|skeleton|> class FeedSimulationConfiguration: """FeedSimulationConfiguration API Object which could be passed to WSO2 SP Event Simulator via EventSimulatorClient.""" def __init__(self, simulation_name=None, properties=None): """Instantiates FeedSimulationConfiguration. :param simulation_name: name of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeedSimulationConfiguration: """FeedSimulationConfiguration API Object which could be passed to WSO2 SP Event Simulator via EventSimulatorClient.""" def __init__(self, simulation_name=None, properties=None): """Instantiates FeedSimulationConfiguration. :param simulation_name: name of simulation :...
the_stack_v2_python_sparse
PySiddhi/sp/EventSimulator/FeedSimulationConfiguration.py
whummer/PySiddhi
train
0
5412e603a0a085ed5f007afab4a32fdc4bbaae54
[ "super(ResConfigSettings, self).set_values()\nParam = self.env['ir.config_parameter'].sudo()\nParam.set_param('stock.group_stock_production_lot', self.group_stock_production_lot)", "res = super(ResConfigSettings, self).get_values()\nparams = self.env['ir.config_parameter'].sudo()\nres.update(group_stock_productio...
<|body_start_0|> super(ResConfigSettings, self).set_values() Param = self.env['ir.config_parameter'].sudo() Param.set_param('stock.group_stock_production_lot', self.group_stock_production_lot) <|end_body_0|> <|body_start_1|> res = super(ResConfigSettings, self).get_values() para...
ResConfigSettings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResConfigSettings: def set_values(self): """Set values for configuration""" <|body_0|> def get_values(self): """Get values for configuration""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(ResConfigSettings, self).set_values() Param = ...
stack_v2_sparse_classes_36k_train_018539
826
no_license
[ { "docstring": "Set values for configuration", "name": "set_values", "signature": "def set_values(self)" }, { "docstring": "Get values for configuration", "name": "get_values", "signature": "def get_values(self)" } ]
2
null
Implement the Python class `ResConfigSettings` described below. Class description: Implement the ResConfigSettings class. Method signatures and docstrings: - def set_values(self): Set values for configuration - def get_values(self): Get values for configuration
Implement the Python class `ResConfigSettings` described below. Class description: Implement the ResConfigSettings class. Method signatures and docstrings: - def set_values(self): Set values for configuration - def get_values(self): Get values for configuration <|skeleton|> class ResConfigSettings: def set_valu...
6e3117aa3bf0d1bed101b2cedd89f5d26911277e
<|skeleton|> class ResConfigSettings: def set_values(self): """Set values for configuration""" <|body_0|> def get_values(self): """Get values for configuration""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResConfigSettings: def set_values(self): """Set values for configuration""" super(ResConfigSettings, self).set_values() Param = self.env['ir.config_parameter'].sudo() Param.set_param('stock.group_stock_production_lot', self.group_stock_production_lot) def get_values(self):...
the_stack_v2_python_sparse
silent_inventory_adjustment/models/res_config_settings.py
AkshayKvenu/advanced_parallel
train
1
331f7416945d6b97a1324bb0ba1a0fd076c18677
[ "lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field\nlookup = self.kwargs.get(lookup_url_kwarg, None)\nif lookup is not None:\n return VideoUsers.objects.filter(video__hash_key=lookup).select_related('user', 'video').order_by('created_at')\nreturn VideoUsers.objects.none()", "if self.request.method ...
<|body_start_0|> lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field lookup = self.kwargs.get(lookup_url_kwarg, None) if lookup is not None: return VideoUsers.objects.filter(video__hash_key=lookup).select_related('user', 'video').order_by('created_at') return VideoU...
List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a list of VideoUser objects Name | Description | Type ----------------- | ---------...
VideoUserList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoUserList: """List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a list of VideoUser objects Name | Descrip...
stack_v2_sparse_classes_36k_train_018540
40,640
no_license
[ { "docstring": "This view should return a list of all associated users of a video as determined by the lookup parameters of the view.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "a POST request implies video user creation so return the serializer for video u...
2
stack_v2_sparse_classes_30k_train_008360
Implement the Python class `VideoUserList` described below. Class description: List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a l...
Implement the Python class `VideoUserList` described below. Class description: List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a l...
1f4b4cd74c9b4280437f73bdfef4491536194eeb
<|skeleton|> class VideoUserList: """List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a list of VideoUser objects Name | Descrip...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VideoUserList: """List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a list of VideoUser objects Name | Description | Type -...
the_stack_v2_python_sparse
gravvy/apps/video/views.py
nceruchalu/gravvy-server
train
1
5ca3da2a310e40bc7513d5b487fd72ee0ea7e586
[ "if not root:\n return True\nreturn self.subroutine(root.left, root.right)", "if not left and (not right):\n return True\nif not left and right or (left and (not right)):\n return False\nif left.val != right.val:\n return False\nelse:\n out_pair = self.subroutine(left.left, right.right)\n in_pai...
<|body_start_0|> if not root: return True return self.subroutine(root.left, root.right) <|end_body_0|> <|body_start_1|> if not left and (not right): return True if not left and right or (left and (not right)): return False if left.val != right...
Leet101
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Leet101: def is_symmetric(self, root): """Find if tree is symmetric. Args: root -- TreeNode Returns: True if tree is symmetric. False otherwise.""" <|body_0|> def subroutine(self, left, right): """Subroutine to check if left and right subtrees are symmetric. Args: le...
stack_v2_sparse_classes_36k_train_018541
1,323
no_license
[ { "docstring": "Find if tree is symmetric. Args: root -- TreeNode Returns: True if tree is symmetric. False otherwise.", "name": "is_symmetric", "signature": "def is_symmetric(self, root)" }, { "docstring": "Subroutine to check if left and right subtrees are symmetric. Args: left -- TreeNode rig...
2
null
Implement the Python class `Leet101` described below. Class description: Implement the Leet101 class. Method signatures and docstrings: - def is_symmetric(self, root): Find if tree is symmetric. Args: root -- TreeNode Returns: True if tree is symmetric. False otherwise. - def subroutine(self, left, right): Subroutine...
Implement the Python class `Leet101` described below. Class description: Implement the Leet101 class. Method signatures and docstrings: - def is_symmetric(self, root): Find if tree is symmetric. Args: root -- TreeNode Returns: True if tree is symmetric. False otherwise. - def subroutine(self, left, right): Subroutine...
b0cfcfa1eff0101cf8e0e3fb9db55fb83f566f6f
<|skeleton|> class Leet101: def is_symmetric(self, root): """Find if tree is symmetric. Args: root -- TreeNode Returns: True if tree is symmetric. False otherwise.""" <|body_0|> def subroutine(self, left, right): """Subroutine to check if left and right subtrees are symmetric. Args: le...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Leet101: def is_symmetric(self, root): """Find if tree is symmetric. Args: root -- TreeNode Returns: True if tree is symmetric. False otherwise.""" if not root: return True return self.subroutine(root.left, root.right) def subroutine(self, left, right): """Subr...
the_stack_v2_python_sparse
archive/algorithms-leetcode/leet101.py
riehseun/software-engineering
train
0
375710431123c81b4a5cb981bcca1f4ecbc9bf97
[ "address = quote_plus(address, safe=',')\nmaps_address = 'http://maps.apple.com/?address=' + address\nprocess = Popen(['open', '-a', 'Maps', maps_address], stdout=PIPE, stderr=PIPE)\nstdout, stderr = process.communicate()", "name = kwargs.get('name', 'Selected Location')\nmaps_address = 'http://maps.apple.com/?ll...
<|body_start_0|> address = quote_plus(address, safe=',') maps_address = 'http://maps.apple.com/?address=' + address process = Popen(['open', '-a', 'Maps', maps_address], stdout=PIPE, stderr=PIPE) stdout, stderr = process.communicate() <|end_body_0|> <|body_start_1|> name = kwarg...
Implementation of MacOS Maps API.
MacOSMaps
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MacOSMaps: """Implementation of MacOS Maps API.""" def _open_by_address(self, address, **kwargs): """:param address: An address string that geolocation can understand.""" <|body_0|> def _open_by_lat_long(self, latitude, longitude, **kwargs): """Open a coordinate ...
stack_v2_sparse_classes_36k_train_018542
2,777
permissive
[ { "docstring": ":param address: An address string that geolocation can understand.", "name": "_open_by_address", "signature": "def _open_by_address(self, address, **kwargs)" }, { "docstring": "Open a coordinate span denoting a latitudinal delta and a longitudinal delta (similar to MKCoordinateSp...
4
stack_v2_sparse_classes_30k_train_021608
Implement the Python class `MacOSMaps` described below. Class description: Implementation of MacOS Maps API. Method signatures and docstrings: - def _open_by_address(self, address, **kwargs): :param address: An address string that geolocation can understand. - def _open_by_lat_long(self, latitude, longitude, **kwargs...
Implement the Python class `MacOSMaps` described below. Class description: Implementation of MacOS Maps API. Method signatures and docstrings: - def _open_by_address(self, address, **kwargs): :param address: An address string that geolocation can understand. - def _open_by_lat_long(self, latitude, longitude, **kwargs...
d8a2b3d16b12fc54667744a092a453ad007c9448
<|skeleton|> class MacOSMaps: """Implementation of MacOS Maps API.""" def _open_by_address(self, address, **kwargs): """:param address: An address string that geolocation can understand.""" <|body_0|> def _open_by_lat_long(self, latitude, longitude, **kwargs): """Open a coordinate ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MacOSMaps: """Implementation of MacOS Maps API.""" def _open_by_address(self, address, **kwargs): """:param address: An address string that geolocation can understand.""" address = quote_plus(address, safe=',') maps_address = 'http://maps.apple.com/?address=' + address pro...
the_stack_v2_python_sparse
plyer/platforms/macosx/maps.py
kivy/plyer
train
1,516
9faf7adc6a822906ed35f15e43078d10d771428c
[ "env.switch[1].ui.create_mirror_session(1, 2, 'IngressAndEgress')\nsessions = env.switch[1].ui.get_mirroring_sessions()\nsession = {'sourcePortId': 1, 'destinationPortId': 2, 'mirroringMode': 'IngressAndEgress'}\nassert session in sessions, 'Mirroring session has not been created'\nenv.switch[1].ui.delete_mirroring...
<|body_start_0|> env.switch[1].ui.create_mirror_session(1, 2, 'IngressAndEgress') sessions = env.switch[1].ui.get_mirroring_sessions() session = {'sourcePortId': 1, 'destinationPortId': 2, 'mirroringMode': 'IngressAndEgress'} assert session in sessions, 'Mirroring session has not been cr...
@description Suite for Mirroring testing
TestMirroringSamples
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMirroringSamples: """@description Suite for Mirroring testing""" def test_configure_mirroring_session(self, env): """@brief Verify that simple Mirroring session can be created and deleted @steps -# Create simple mirroring session. -# Verify session has been created. -# Delete mir...
stack_v2_sparse_classes_36k_train_018543
5,725
permissive
[ { "docstring": "@brief Verify that simple Mirroring session can be created and deleted @steps -# Create simple mirroring session. -# Verify session has been created. -# Delete mirroring session. -# Verify session has been deleted. @endsteps", "name": "test_configure_mirroring_session", "signature": "def...
2
stack_v2_sparse_classes_30k_train_008204
Implement the Python class `TestMirroringSamples` described below. Class description: @description Suite for Mirroring testing Method signatures and docstrings: - def test_configure_mirroring_session(self, env): @brief Verify that simple Mirroring session can be created and deleted @steps -# Create simple mirroring s...
Implement the Python class `TestMirroringSamples` described below. Class description: @description Suite for Mirroring testing Method signatures and docstrings: - def test_configure_mirroring_session(self, env): @brief Verify that simple Mirroring session can be created and deleted @steps -# Create simple mirroring s...
18c532fcea7b98cbeadd68e82bdad78ebaaecf4e
<|skeleton|> class TestMirroringSamples: """@description Suite for Mirroring testing""" def test_configure_mirroring_session(self, env): """@brief Verify that simple Mirroring session can be created and deleted @steps -# Create simple mirroring session. -# Verify session has been created. -# Delete mir...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestMirroringSamples: """@description Suite for Mirroring testing""" def test_configure_mirroring_session(self, env): """@brief Verify that simple Mirroring session can be created and deleted @steps -# Create simple mirroring session. -# Verify session has been created. -# Delete mirroring sessio...
the_stack_v2_python_sparse
l2/mirroring/test_mirroring_samples.py
ravigupta1989/testcases
train
0
b6d99b70a6402a13a61176e2c8b02b49c4202b00
[ "resource = f'/inspection/api/v1/formInstances/{formInstanceId}/document'\nresponse = item_fixture.request('GET', resource)\nreturn response", "resource = f'/inspection/api/v1/formInstances/{formInstanceId}/attachments'\nresponse = item_fixture.request('GET', resource)\nreturn response" ]
<|body_start_0|> resource = f'/inspection/api/v1/formInstances/{formInstanceId}/document' response = item_fixture.request('GET', resource) return response <|end_body_0|> <|body_start_1|> resource = f'/inspection/api/v1/formInstances/{formInstanceId}/attachments' response = item_...
FormAttachments
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormAttachments: def formInstancesGET(self, item_fixture, formInstanceId=None): """查询表单文件 :param item_fixture: item fixture,""" <|body_0|> def formInstancesGET(self, item_fixture, formInstanceId=None): """查询表单附件 :param item_fixture: item fixture,""" <|body_1|...
stack_v2_sparse_classes_36k_train_018544
898
no_license
[ { "docstring": "查询表单文件 :param item_fixture: item fixture,", "name": "formInstancesGET", "signature": "def formInstancesGET(self, item_fixture, formInstanceId=None)" }, { "docstring": "查询表单附件 :param item_fixture: item fixture,", "name": "formInstancesGET", "signature": "def formInstancesG...
2
stack_v2_sparse_classes_30k_train_021673
Implement the Python class `FormAttachments` described below. Class description: Implement the FormAttachments class. Method signatures and docstrings: - def formInstancesGET(self, item_fixture, formInstanceId=None): 查询表单文件 :param item_fixture: item fixture, - def formInstancesGET(self, item_fixture, formInstanceId=N...
Implement the Python class `FormAttachments` described below. Class description: Implement the FormAttachments class. Method signatures and docstrings: - def formInstancesGET(self, item_fixture, formInstanceId=None): 查询表单文件 :param item_fixture: item fixture, - def formInstancesGET(self, item_fixture, formInstanceId=N...
f875de62f7f505c596ea5567e1fc2c8a64010f87
<|skeleton|> class FormAttachments: def formInstancesGET(self, item_fixture, formInstanceId=None): """查询表单文件 :param item_fixture: item fixture,""" <|body_0|> def formInstancesGET(self, item_fixture, formInstanceId=None): """查询表单附件 :param item_fixture: item fixture,""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FormAttachments: def formInstancesGET(self, item_fixture, formInstanceId=None): """查询表单文件 :param item_fixture: item fixture,""" resource = f'/inspection/api/v1/formInstances/{formInstanceId}/document' response = item_fixture.request('GET', resource) return response def for...
the_stack_v2_python_sparse
swagger/api/inspection/form_attachments.py
zhangjingwen198817/pytest-api-allure
train
1
4be8f87febad39fee52b02451e812a66999f2cf9
[ "maxSoFar = 0\nu = set(nums)\nwhile len(u) > 0:\n item = u.pop()\n cur = item\n count = 1\n cur += 1\n while cur in u:\n u.remove(cur)\n cur += 1\n count += 1\n cur = item - 1\n while cur in u:\n u.remove(cur)\n cur -= 1\n count += 1\n maxSoFar = max...
<|body_start_0|> maxSoFar = 0 u = set(nums) while len(u) > 0: item = u.pop() cur = item count = 1 cur += 1 while cur in u: u.remove(cur) cur += 1 count += 1 cur = item - 1 ...
https://leetcode.com/problems/longest-consecutive-sequence/description/
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """https://leetcode.com/problems/longest-consecutive-sequence/description/""" def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def longestConsecutive2(self, nums): """:type nums: List[int] :rtype: int""" <|b...
stack_v2_sparse_classes_36k_train_018545
1,284
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "longestConsecutive", "signature": "def longestConsecutive(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "longestConsecutive2", "signature": "def longestConsecutive2(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/longest-consecutive-sequence/description/ Method signatures and docstrings: - def longestConsecutive(self, nums): :type nums: List[int] :rtype: int - def longestConsecutive2(self, nums): :type nums: List[int] :rtyp...
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/longest-consecutive-sequence/description/ Method signatures and docstrings: - def longestConsecutive(self, nums): :type nums: List[int] :rtype: int - def longestConsecutive2(self, nums): :type nums: List[int] :rtyp...
54d3d9530b25272d4a2e5dc33e7035c44f506dc5
<|skeleton|> class Solution: """https://leetcode.com/problems/longest-consecutive-sequence/description/""" def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def longestConsecutive2(self, nums): """:type nums: List[int] :rtype: int""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """https://leetcode.com/problems/longest-consecutive-sequence/description/""" def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int""" maxSoFar = 0 u = set(nums) while len(u) > 0: item = u.pop() cur = item co...
the_stack_v2_python_sparse
old/Session002/TopInterviewQuestions/LongestConsecutiveSequence.py
MaxIakovliev/algorithms
train
0
751de327e538fea7fa1cfccc26afea28c0c0180e
[ "self._symbols = list()\nself._ngram = 1\nself.set_symbols(symbols)\nself.set_ngram(n)", "if len(symbols) == 0:\n raise EmptyError\nself._symbols = symbols", "n = int(n)\nif 0 < n <= MAX_NGRAM:\n self._ngram = n\nelse:\n raise InsideIntervalError(n, 1, MAX_NGRAM)", "if len(self._symbols) == 0:\n r...
<|body_start_0|> self._symbols = list() self._ngram = 1 self.set_symbols(symbols) self.set_ngram(n) <|end_body_0|> <|body_start_1|> if len(symbols) == 0: raise EmptyError self._symbols = symbols <|end_body_1|> <|body_start_2|> n = int(n) if 0...
Entropy estimation. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Entropy is a measure of unpredictability of information content. Entropy is one of several ways to measure dive...
sppasEntropy
[ "GFDL-1.1-or-later", "GPL-3.0-only", "GPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sppasEntropy: """Entropy estimation. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Entropy is a measure of unpredictability of information content. Entrop...
stack_v2_sparse_classes_36k_train_018546
4,263
permissive
[ { "docstring": "Create a sppasEntropy instance with a list of symbols. :param symbols: (list) a vector of symbols of any type. :param n: (int) n value for n-gram estimation. n ranges 1..MAX_NGRAM", "name": "__init__", "signature": "def __init__(self, symbols, n=1)" }, { "docstring": "Set the lis...
4
stack_v2_sparse_classes_30k_train_003027
Implement the Python class `sppasEntropy` described below. Class description: Entropy estimation. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Entropy is a measure of unpredic...
Implement the Python class `sppasEntropy` described below. Class description: Entropy estimation. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Entropy is a measure of unpredic...
3167b65f576abcc27a8767d24c274a04712bd948
<|skeleton|> class sppasEntropy: """Entropy estimation. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Entropy is a measure of unpredictability of information content. Entrop...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class sppasEntropy: """Entropy estimation. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Entropy is a measure of unpredictability of information content. Entropy is one of s...
the_stack_v2_python_sparse
sppas/sppas/src/calculus/infotheory/entropy.py
mirfan899/MTTS
train
0
f4d885a7a4a80f073c3be731125a5cfbba927285
[ "if digits[-1] < 9:\n digits[-1] += 1\n return digits\ndigits[-1] = 0\nfor j in range(1, len(digits)):\n i = len(digits) - 1 - j\n if digits[i] < 9:\n digits[i] += 1\n return digits\n else:\n digits[i] = 0\nif digits[0] == 0:\n digits.insert(0, 1)\nreturn digits", "for i in ...
<|body_start_0|> if digits[-1] < 9: digits[-1] += 1 return digits digits[-1] = 0 for j in range(1, len(digits)): i = len(digits) - 1 - j if digits[i] < 9: digits[i] += 1 return digits else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def plusOne(self, digits): """从数组末尾判断是否需要进位 执行用时 : 52 ms, 在Plus One的Python3提交中击败了86.46% 的用户 内存消耗 : 13.1 MB, 在Plus One的Python3提交中击败了82.41% 的用户""" <|body_0|> def plusOne1(self, digits): """从数组末尾判断是否需要进位 改进版 执行用时 : 36 ms, 在Plus One的Python3提交中击败了99.97% 的用户 内存消耗...
stack_v2_sparse_classes_36k_train_018547
2,447
no_license
[ { "docstring": "从数组末尾判断是否需要进位 执行用时 : 52 ms, 在Plus One的Python3提交中击败了86.46% 的用户 内存消耗 : 13.1 MB, 在Plus One的Python3提交中击败了82.41% 的用户", "name": "plusOne", "signature": "def plusOne(self, digits)" }, { "docstring": "从数组末尾判断是否需要进位 改进版 执行用时 : 36 ms, 在Plus One的Python3提交中击败了99.97% 的用户 内存消耗 : 13.1 MB, 在Plus...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, digits): 从数组末尾判断是否需要进位 执行用时 : 52 ms, 在Plus One的Python3提交中击败了86.46% 的用户 内存消耗 : 13.1 MB, 在Plus One的Python3提交中击败了82.41% 的用户 - def plusOne1(self, digits): 从数组末尾判断是否...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, digits): 从数组末尾判断是否需要进位 执行用时 : 52 ms, 在Plus One的Python3提交中击败了86.46% 的用户 内存消耗 : 13.1 MB, 在Plus One的Python3提交中击败了82.41% 的用户 - def plusOne1(self, digits): 从数组末尾判断是否...
7bca9dc8ec211be15c12f89bffbb680d639f87bf
<|skeleton|> class Solution: def plusOne(self, digits): """从数组末尾判断是否需要进位 执行用时 : 52 ms, 在Plus One的Python3提交中击败了86.46% 的用户 内存消耗 : 13.1 MB, 在Plus One的Python3提交中击败了82.41% 的用户""" <|body_0|> def plusOne1(self, digits): """从数组末尾判断是否需要进位 改进版 执行用时 : 36 ms, 在Plus One的Python3提交中击败了99.97% 的用户 内存消耗...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def plusOne(self, digits): """从数组末尾判断是否需要进位 执行用时 : 52 ms, 在Plus One的Python3提交中击败了86.46% 的用户 内存消耗 : 13.1 MB, 在Plus One的Python3提交中击败了82.41% 的用户""" if digits[-1] < 9: digits[-1] += 1 return digits digits[-1] = 0 for j in range(1, len(digits)): ...
the_stack_v2_python_sparse
python/leetcode/66-plus-one.py
wxnacy/study
train
18
b289e1fb8cb63905a33774a47eabdd4b8ad2a4f5
[ "goals = super().published()\ngoals = goals.filter(categories__state='published', categories__packaged_content=False)\nreturn goals.distinct()", "published = kwargs.pop('published', True)\nqs = super().get_queryset()\nif published:\n qs = qs.filter(categories__packaged_content=True, state='published')\nelse:\n...
<|body_start_0|> goals = super().published() goals = goals.filter(categories__state='published', categories__packaged_content=False) return goals.distinct() <|end_body_0|> <|body_start_1|> published = kwargs.pop('published', True) qs = super().get_queryset() if published...
GoalManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoalManager: def published(self, *args, **kwargs): """Returns Goals that are published and are contained within non-packaged categories (that are also published).""" <|body_0|> def packages(self, *args, **kwargs): """Return only Categories that have been marked as pa...
stack_v2_sparse_classes_36k_train_018548
21,796
permissive
[ { "docstring": "Returns Goals that are published and are contained within non-packaged categories (that are also published).", "name": "published", "signature": "def published(self, *args, **kwargs)" }, { "docstring": "Return only Categories that have been marked as packages. By default this ret...
2
null
Implement the Python class `GoalManager` described below. Class description: Implement the GoalManager class. Method signatures and docstrings: - def published(self, *args, **kwargs): Returns Goals that are published and are contained within non-packaged categories (that are also published). - def packages(self, *arg...
Implement the Python class `GoalManager` described below. Class description: Implement the GoalManager class. Method signatures and docstrings: - def published(self, *args, **kwargs): Returns Goals that are published and are contained within non-packaged categories (that are also published). - def packages(self, *arg...
3d22179c581ab3da18900483930d5ecc0a5fca73
<|skeleton|> class GoalManager: def published(self, *args, **kwargs): """Returns Goals that are published and are contained within non-packaged categories (that are also published).""" <|body_0|> def packages(self, *args, **kwargs): """Return only Categories that have been marked as pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GoalManager: def published(self, *args, **kwargs): """Returns Goals that are published and are contained within non-packaged categories (that are also published).""" goals = super().published() goals = goals.filter(categories__state='published', categories__packaged_content=False) ...
the_stack_v2_python_sparse
tndata_backend/goals/managers.py
tndatacommons/tndata_backend
train
1
8a2c625dc5abf745fd4f36636544e1834c8c2ff8
[ "create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW)\ncreate_listener_flow.add(lifecycle_tasks.ListenersToErrorOnRevertTask(requires=constants.LISTENERS))\ncreate_listener_flow.add(amphora_driver_tasks.ListenersUpdate(requires=constants.LOADBALANCER_ID))\ncreate_listener_flow.add(network_tasks.U...
<|body_start_0|> create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW) create_listener_flow.add(lifecycle_tasks.ListenersToErrorOnRevertTask(requires=constants.LISTENERS)) create_listener_flow.add(amphora_driver_tasks.ListenersUpdate(requires=constants.LOADBALANCER_ID)) ...
ListenerFlows
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListenerFlows: def get_create_listener_flow(self): """Create a flow to create a listener :returns: The flow for creating a listener""" <|body_0|> def get_create_all_listeners_flow(self): """Create a flow to create all listeners :returns: The flow for creating all lis...
stack_v2_sparse_classes_36k_train_018549
5,910
permissive
[ { "docstring": "Create a flow to create a listener :returns: The flow for creating a listener", "name": "get_create_listener_flow", "signature": "def get_create_listener_flow(self)" }, { "docstring": "Create a flow to create all listeners :returns: The flow for creating all listeners", "name...
5
stack_v2_sparse_classes_30k_train_007490
Implement the Python class `ListenerFlows` described below. Class description: Implement the ListenerFlows class. Method signatures and docstrings: - def get_create_listener_flow(self): Create a flow to create a listener :returns: The flow for creating a listener - def get_create_all_listeners_flow(self): Create a fl...
Implement the Python class `ListenerFlows` described below. Class description: Implement the ListenerFlows class. Method signatures and docstrings: - def get_create_listener_flow(self): Create a flow to create a listener :returns: The flow for creating a listener - def get_create_all_listeners_flow(self): Create a fl...
0426285a41464a5015494584f109eed35a0d44db
<|skeleton|> class ListenerFlows: def get_create_listener_flow(self): """Create a flow to create a listener :returns: The flow for creating a listener""" <|body_0|> def get_create_all_listeners_flow(self): """Create a flow to create all listeners :returns: The flow for creating all lis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListenerFlows: def get_create_listener_flow(self): """Create a flow to create a listener :returns: The flow for creating a listener""" create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW) create_listener_flow.add(lifecycle_tasks.ListenersToErrorOnRevertTask(requires=...
the_stack_v2_python_sparse
octavia/controller/worker/v2/flows/listener_flows.py
openstack/octavia
train
147
45c43060945b3d39b479f22e89c3d6f57f3f51e4
[ "self.L = L\nself.N = 2 * L + 1\nself.alpha = alpha\nself.kappa = kappa\nself.beta = beta", "L = self.L\nN = self.N\nassert mu.shape == (L,)\nassert var.shape == (L, L)\nalpha = self.alpha\nkappa = self.kappa\nbeta = self.beta\nsigmaMat = np.zeros((N, L))\nLambda = alpha ** 2 * (L + kappa) - L\nsigmaMat[0, :] = m...
<|body_start_0|> self.L = L self.N = 2 * L + 1 self.alpha = alpha self.kappa = kappa self.beta = beta <|end_body_0|> <|body_start_1|> L = self.L N = self.N assert mu.shape == (L,) assert var.shape == (L, L) alpha = self.alpha kappa...
UGP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UGP: def __init__(self, L, alpha=0.001, kappa=0.0, beta=2.0): """Initialize the unscented transform parameters :param L: dim of the input a practical value set for the remaining params: :param alpha: 1. :param kappa: 2. :param beta: 0.""" <|body_0|> def get_sigma_points(self...
stack_v2_sparse_classes_36k_train_018550
36,021
no_license
[ { "docstring": "Initialize the unscented transform parameters :param L: dim of the input a practical value set for the remaining params: :param alpha: 1. :param kappa: 2. :param beta: 0.", "name": "__init__", "signature": "def __init__(self, L, alpha=0.001, kappa=0.0, beta=2.0)" }, { "docstring"...
4
null
Implement the Python class `UGP` described below. Class description: Implement the UGP class. Method signatures and docstrings: - def __init__(self, L, alpha=0.001, kappa=0.0, beta=2.0): Initialize the unscented transform parameters :param L: dim of the input a practical value set for the remaining params: :param alp...
Implement the Python class `UGP` described below. Class description: Implement the UGP class. Method signatures and docstrings: - def __init__(self, L, alpha=0.001, kappa=0.0, beta=2.0): Initialize the unscented transform parameters :param L: dim of the input a practical value set for the remaining params: :param alp...
5e3823e534714c008e146eecda82a5b21c43db39
<|skeleton|> class UGP: def __init__(self, L, alpha=0.001, kappa=0.0, beta=2.0): """Initialize the unscented transform parameters :param L: dim of the input a practical value set for the remaining params: :param alpha: 1. :param kappa: 2. :param beta: 0.""" <|body_0|> def get_sigma_points(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UGP: def __init__(self, L, alpha=0.001, kappa=0.0, beta=2.0): """Initialize the unscented transform parameters :param L: dim of the input a practical value set for the remaining params: :param alpha: 1. :param kappa: 2. :param beta: 0.""" self.L = L self.N = 2 * L + 1 self.alph...
the_stack_v2_python_sparse
model_leraning_utils.py
shbz80/model_learning
train
1
331f7416945d6b97a1324bb0ba1a0fd076c18677
[ "lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field\nlookup = self.kwargs.get(lookup_url_kwarg, None)\nif lookup is not None:\n return Clip.objects.filter(video__hash_key=lookup).select_related('owner', 'video')\nreturn Clip.objects.none()", "lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_f...
<|body_start_0|> lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field lookup = self.kwargs.get(lookup_url_kwarg, None) if lookup is not None: return Clip.objects.filter(video__hash_key=lookup).select_related('owner', 'video') return Clip.objects.none() <|end_body_0|>...
List all clips of a video and create new clips. ## Reading ### Permissions * Anyone can read this endpoint. ### Fields Reading this endpoint returns a list of [Clip objects](0/) ## Publishing ### Permissions * Only authenticated users can create using this endpoint. * Only associated users of a video can write to this ...
VideoClipList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoClipList: """List all clips of a video and create new clips. ## Reading ### Permissions * Anyone can read this endpoint. ### Fields Reading this endpoint returns a list of [Clip objects](0/) ## Publishing ### Permissions * Only authenticated users can create using this endpoint. * Only assoc...
stack_v2_sparse_classes_36k_train_018551
40,640
no_license
[ { "docstring": "This view should return a list of all clips for the video as determined by the lookup parameters of the view.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Create a new clip", "name": "perform_create", "signature": "def perform_create(...
2
stack_v2_sparse_classes_30k_train_011946
Implement the Python class `VideoClipList` described below. Class description: List all clips of a video and create new clips. ## Reading ### Permissions * Anyone can read this endpoint. ### Fields Reading this endpoint returns a list of [Clip objects](0/) ## Publishing ### Permissions * Only authenticated users can c...
Implement the Python class `VideoClipList` described below. Class description: List all clips of a video and create new clips. ## Reading ### Permissions * Anyone can read this endpoint. ### Fields Reading this endpoint returns a list of [Clip objects](0/) ## Publishing ### Permissions * Only authenticated users can c...
1f4b4cd74c9b4280437f73bdfef4491536194eeb
<|skeleton|> class VideoClipList: """List all clips of a video and create new clips. ## Reading ### Permissions * Anyone can read this endpoint. ### Fields Reading this endpoint returns a list of [Clip objects](0/) ## Publishing ### Permissions * Only authenticated users can create using this endpoint. * Only assoc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VideoClipList: """List all clips of a video and create new clips. ## Reading ### Permissions * Anyone can read this endpoint. ### Fields Reading this endpoint returns a list of [Clip objects](0/) ## Publishing ### Permissions * Only authenticated users can create using this endpoint. * Only associated users o...
the_stack_v2_python_sparse
gravvy/apps/video/views.py
nceruchalu/gravvy-server
train
1
e16ec123bc45a9ae8519ce2ccfc8316ac2b32b0a
[ "self._hasnext = None\ni, _num = (0, '')\nself.stack_alpha, self.stack_digit = ([], [])\nif compressedString:\n while i < len(compressedString):\n if compressedString[i].isalpha():\n if self.stack_alpha:\n self.stack_alpha.append(compressedString[i])\n self.stack_d...
<|body_start_0|> self._hasnext = None i, _num = (0, '') self.stack_alpha, self.stack_digit = ([], []) if compressedString: while i < len(compressedString): if compressedString[i].isalpha(): if self.stack_alpha: self....
StringIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_36k_train_018552
3,161
no_license
[ { "docstring": ":type compressedString: str", "name": "__init__", "signature": "def __init__(self, compressedString)" }, { "docstring": ":rtype: str", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext", "signature": "def hasN...
3
null
Implement the Python class `StringIterator` described below. Class description: Implement the StringIterator class. Method signatures and docstrings: - def __init__(self, compressedString): :type compressedString: str - def next(self): :rtype: str - def hasNext(self): :rtype: bool
Implement the Python class `StringIterator` described below. Class description: Implement the StringIterator class. Method signatures and docstrings: - def __init__(self, compressedString): :type compressedString: str - def next(self): :rtype: str - def hasNext(self): :rtype: bool <|skeleton|> class StringIterator: ...
546cbce06fcd4bc34e16d42b5d5eb68fb25e16a9
<|skeleton|> class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" self._hasnext = None i, _num = (0, '') self.stack_alpha, self.stack_digit = ([], []) if compressedString: while i < len(compressedString): if compressedSt...
the_stack_v2_python_sparse
leetcode/solution_604.py
eselyavka/python
train
0
09afa85effbf5260991f534ab2711b812b5069c7
[ "timestamp = str(time.time())\npvt_key, pub_key = Signature.get_key_pair()\nsignature = bytes.hex(Signature.sign(pvt_key, transaction.__dict__.__str__()))\nmsg_id = Signature.gen_id_by_sig(signature)\nreturn Message(msg_id=msg_id, msg_type=msg_type, transaction=transaction.__dict__, timestamp=timestamp, pub_key=byt...
<|body_start_0|> timestamp = str(time.time()) pvt_key, pub_key = Signature.get_key_pair() signature = bytes.hex(Signature.sign(pvt_key, transaction.__dict__.__str__())) msg_id = Signature.gen_id_by_sig(signature) return Message(msg_id=msg_id, msg_type=msg_type, transaction=transa...
MessageService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageService: def gen_msg(msg_type, transaction): """根据 msg type 和 transaction 生成一个 Message 类对象 :param msg_type: :param transaction: Transaction对象 :return:""" <|body_0|> def verify_msg(msg): """判断 msg 的签名是否正确 :param msg: Message 对象 :return:""" <|body_1|> <...
stack_v2_sparse_classes_36k_train_018553
1,605
permissive
[ { "docstring": "根据 msg type 和 transaction 生成一个 Message 类对象 :param msg_type: :param transaction: Transaction对象 :return:", "name": "gen_msg", "signature": "def gen_msg(msg_type, transaction)" }, { "docstring": "判断 msg 的签名是否正确 :param msg: Message 对象 :return:", "name": "verify_msg", "signatu...
2
stack_v2_sparse_classes_30k_train_001189
Implement the Python class `MessageService` described below. Class description: Implement the MessageService class. Method signatures and docstrings: - def gen_msg(msg_type, transaction): 根据 msg type 和 transaction 生成一个 Message 类对象 :param msg_type: :param transaction: Transaction对象 :return: - def verify_msg(msg): 判断 m...
Implement the Python class `MessageService` described below. Class description: Implement the MessageService class. Method signatures and docstrings: - def gen_msg(msg_type, transaction): 根据 msg type 和 transaction 生成一个 Message 类对象 :param msg_type: :param transaction: Transaction对象 :return: - def verify_msg(msg): 判断 m...
84dfa1461e6d3de40bf78f8ad9079badef095f9e
<|skeleton|> class MessageService: def gen_msg(msg_type, transaction): """根据 msg type 和 transaction 生成一个 Message 类对象 :param msg_type: :param transaction: Transaction对象 :return:""" <|body_0|> def verify_msg(msg): """判断 msg 的签名是否正确 :param msg: Message 对象 :return:""" <|body_1|> <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MessageService: def gen_msg(msg_type, transaction): """根据 msg type 和 transaction 生成一个 Message 类对象 :param msg_type: :param transaction: Transaction对象 :return:""" timestamp = str(time.time()) pvt_key, pub_key = Signature.get_key_pair() signature = bytes.hex(Signature.sign(pvt_key...
the_stack_v2_python_sparse
BlockchainDjango/service/message_service.py
just2husky/BlockchainDjango
train
0
bfbdc3f68fc97b7f9ae7b3cbb105447b5624b213
[ "super(IndexBatchIterator, self).__init__(*args, **kwargs)\nself.source = source\nif source is not None:\n x = source.data\n input_shape = [len(x) + (SAMPLE_SIZE - 1), N_ELECTRODES]\n self.augmented = np.zeros(input_shape, dtype=np.float32)\n self.augmented[SAMPLE_SIZE - 1:] = x\n self.augmented[:SAM...
<|body_start_0|> super(IndexBatchIterator, self).__init__(*args, **kwargs) self.source = source if source is not None: x = source.data input_shape = [len(x) + (SAMPLE_SIZE - 1), N_ELECTRODES] self.augmented = np.zeros(input_shape, dtype=np.float32) ...
Generate BatchData from indices. Rather than passing the data into the fit function, instead we just pass in indices to the data. The actual data is then grabbed from a Source object that is passed in at the creation of the IndexBatchIterator. Passing in a '-1' grabs a random value from the Source. As a result, an "epo...
IndexBatchIterator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndexBatchIterator: """Generate BatchData from indices. Rather than passing the data into the fit function, instead we just pass in indices to the data. The actual data is then grabbed from a Source object that is passed in at the creation of the IndexBatchIterator. Passing in a '-1' grabs a rand...
stack_v2_sparse_classes_36k_train_018554
12,952
permissive
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, source, *args, **kwargs)" }, { "docstring": "Transform.", "name": "transform", "signature": "def transform(self, X_indices, y_indices)" } ]
2
null
Implement the Python class `IndexBatchIterator` described below. Class description: Generate BatchData from indices. Rather than passing the data into the fit function, instead we just pass in indices to the data. The actual data is then grabbed from a Source object that is passed in at the creation of the IndexBatchI...
Implement the Python class `IndexBatchIterator` described below. Class description: Generate BatchData from indices. Rather than passing the data into the fit function, instead we just pass in indices to the data. The actual data is then grabbed from a Source object that is passed in at the creation of the IndexBatchI...
87de739aba2399fd31072ee81b391f9b7a63f540
<|skeleton|> class IndexBatchIterator: """Generate BatchData from indices. Rather than passing the data into the fit function, instead we just pass in indices to the data. The actual data is then grabbed from a Source object that is passed in at the creation of the IndexBatchIterator. Passing in a '-1' grabs a rand...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IndexBatchIterator: """Generate BatchData from indices. Rather than passing the data into the fit function, instead we just pass in indices to the data. The actual data is then grabbed from a Source object that is passed in at the creation of the IndexBatchIterator. Passing in a '-1' grabs a random value from...
the_stack_v2_python_sparse
data/external/repositories_2to3/197978/Grasp-and-lift-EEG-challenge-master/lvl1/genPreds_CNN_Tim.py
Keesiu/meta-kaggle
train
0
3d0d5f807470962327068d15dd5ab318f3676ba3
[ "self.r = radius\nself.x = x_center\nself.y = y_center", "f = True\nwhile f:\n a = random.uniform(self.x - self.r, self.x + self.r)\n b = random.uniform(self.y - self.r, self.y + self.r)\n if (a - self.x) ** 2 + (b - self.y) ** 2 <= self.r ** 2:\n f = False\n r0 = a\n r1 = b\nreturn ...
<|body_start_0|> self.r = radius self.x = x_center self.y = y_center <|end_body_0|> <|body_start_1|> f = True while f: a = random.uniform(self.x - self.r, self.x + self.r) b = random.uniform(self.y - self.r, self.y + self.r) if (a - self.x) **...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.r = radius ...
stack_v2_sparse_classes_36k_train_018555
846
no_license
[ { "docstring": ":type radius: float :type x_center: float :type y_center: float", "name": "__init__", "signature": "def __init__(self, radius, x_center, y_center)" }, { "docstring": ":rtype: List[float]", "name": "randPoint", "signature": "def randPoint(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float] <|skeleton|> class Sol...
20623defecf65cbc35b194d8b60d8b211816ee4f
<|skeleton|> class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" self.r = radius self.x = x_center self.y = y_center def randPoint(self): """:rtype: List[float]""" f = True while f: ...
the_stack_v2_python_sparse
in_Python/0478 Generate Random Point in a Circle.py
YangLiyli131/Leetcode2020
train
0
11c3af7dc218e166c9efe6faca2a1760519b80b4
[ "if not s.isdigit():\n return False\nif int(s) <= 255 and str(int(s)) == s:\n return True\nreturn False", "s_len = len(s)\nif s_len < i + 1:\n return\nif k == 1:\n s1 = s[:i + 1]\n if self.isValidNum(s1):\n dict_kinds[i, k] = [s1]\nelse:\n l2 = []\n for j in range(1, 4):\n l1 = ...
<|body_start_0|> if not s.isdigit(): return False if int(s) <= 255 and str(int(s)) == s: return True return False <|end_body_0|> <|body_start_1|> s_len = len(s) if s_len < i + 1: return if k == 1: s1 = s[:i + 1] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidNum(self, s): """用来计算ip地址中间的某一个字符串是否合法""" <|body_0|> def getIndexValues(self, s, i, k, dict_kinds): """计算第i索引为结尾的字符串分成k个满足条件的数字的个数,并且加入到dict_kinds中""" <|body_1|> def restoreIpAddresses(self, s): """:type s: str :rtype: List[s...
stack_v2_sparse_classes_36k_train_018556
2,305
no_license
[ { "docstring": "用来计算ip地址中间的某一个字符串是否合法", "name": "isValidNum", "signature": "def isValidNum(self, s)" }, { "docstring": "计算第i索引为结尾的字符串分成k个满足条件的数字的个数,并且加入到dict_kinds中", "name": "getIndexValues", "signature": "def getIndexValues(self, s, i, k, dict_kinds)" }, { "docstring": ":type s...
3
stack_v2_sparse_classes_30k_train_016946
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidNum(self, s): 用来计算ip地址中间的某一个字符串是否合法 - def getIndexValues(self, s, i, k, dict_kinds): 计算第i索引为结尾的字符串分成k个满足条件的数字的个数,并且加入到dict_kinds中 - def restoreIpAddresses(self, s): :t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidNum(self, s): 用来计算ip地址中间的某一个字符串是否合法 - def getIndexValues(self, s, i, k, dict_kinds): 计算第i索引为结尾的字符串分成k个满足条件的数字的个数,并且加入到dict_kinds中 - def restoreIpAddresses(self, s): :t...
313ea5583d423ec89d66d5f0c5f2dcc87cc3e68a
<|skeleton|> class Solution: def isValidNum(self, s): """用来计算ip地址中间的某一个字符串是否合法""" <|body_0|> def getIndexValues(self, s, i, k, dict_kinds): """计算第i索引为结尾的字符串分成k个满足条件的数字的个数,并且加入到dict_kinds中""" <|body_1|> def restoreIpAddresses(self, s): """:type s: str :rtype: List[s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValidNum(self, s): """用来计算ip地址中间的某一个字符串是否合法""" if not s.isdigit(): return False if int(s) <= 255 and str(int(s)) == s: return True return False def getIndexValues(self, s, i, k, dict_kinds): """计算第i索引为结尾的字符串分成k个满足条件的数字的个数,并且加...
the_stack_v2_python_sparse
0093_RestoreIPAddresses.py
cheungrui/leetcode
train
0
68947c9ca630bdad67c88ccd610cce695ed0ce28
[ "self.channel_owner_vec = channel_owner_vec\nself.channel_type = channel_type\nself.create_new_channel = create_new_channel\nself.id = id\nself.name = name", "if dictionary is None:\n return None\nchannel_owner_vec = None\nif dictionary.get('channelOwnerVec') != None:\n channel_owner_vec = list()\n for s...
<|body_start_0|> self.channel_owner_vec = channel_owner_vec self.channel_type = channel_type self.create_new_channel = create_new_channel self.id = id self.name = name <|end_body_0|> <|body_start_1|> if dictionary is None: return None channel_owner_ve...
Implementation of the 'RestoreO365TeamsParams_TargetChannel' model. Target channel for teams granular restore to alternate loc. At least one of id or name must be specified. name must be specified if create_new_channel is true. Attributes: channel_owner_vec (list of EntityProto): Owners for the private channel. This is...
RestoreO365TeamsParams_TargetChannel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreO365TeamsParams_TargetChannel: """Implementation of the 'RestoreO365TeamsParams_TargetChannel' model. Target channel for teams granular restore to alternate loc. At least one of id or name must be specified. name must be specified if create_new_channel is true. Attributes: channel_owner_ve...
stack_v2_sparse_classes_36k_train_018557
2,919
permissive
[ { "docstring": "Constructor for the RestoreO365TeamsParams_TargetChannel class", "name": "__init__", "signature": "def __init__(self, channel_owner_vec=None, channel_type=None, create_new_channel=None, id=None, name=None)" }, { "docstring": "Creates an instance of this model from a dictionary Ar...
2
stack_v2_sparse_classes_30k_train_007180
Implement the Python class `RestoreO365TeamsParams_TargetChannel` described below. Class description: Implementation of the 'RestoreO365TeamsParams_TargetChannel' model. Target channel for teams granular restore to alternate loc. At least one of id or name must be specified. name must be specified if create_new_channe...
Implement the Python class `RestoreO365TeamsParams_TargetChannel` described below. Class description: Implementation of the 'RestoreO365TeamsParams_TargetChannel' model. Target channel for teams granular restore to alternate loc. At least one of id or name must be specified. name must be specified if create_new_channe...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreO365TeamsParams_TargetChannel: """Implementation of the 'RestoreO365TeamsParams_TargetChannel' model. Target channel for teams granular restore to alternate loc. At least one of id or name must be specified. name must be specified if create_new_channel is true. Attributes: channel_owner_ve...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestoreO365TeamsParams_TargetChannel: """Implementation of the 'RestoreO365TeamsParams_TargetChannel' model. Target channel for teams granular restore to alternate loc. At least one of id or name must be specified. name must be specified if create_new_channel is true. Attributes: channel_owner_vec (list of En...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_o_365_teams_params_target_channel.py
cohesity/management-sdk-python
train
24
51d2390497f97399be477bdffcf83eacae9c3257
[ "res = []\nfor s in [S, T]:\n tmp = []\n for i in s:\n if i is not '#':\n tmp.append(i)\n elif i is '#' and tmp != []:\n tmp.pop()\n res.append(tmp)\nreturn res[0] == res[1]", "def F(S):\n skip = 0\n for x in reversed(S):\n if x == '#':\n skip +...
<|body_start_0|> res = [] for s in [S, T]: tmp = [] for i in s: if i is not '#': tmp.append(i) elif i is '#' and tmp != []: tmp.pop() res.append(tmp) return res[0] == res[1] <|end_body_0|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def backspaceCompare(self, S, T): """:type S: str :type T: str :rtype: bool""" <|body_0|> def backspaceCompare2(self, S, T): """:type S: str :type T: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] for s i...
stack_v2_sparse_classes_36k_train_018558
2,087
no_license
[ { "docstring": ":type S: str :type T: str :rtype: bool", "name": "backspaceCompare", "signature": "def backspaceCompare(self, S, T)" }, { "docstring": ":type S: str :type T: str :rtype: bool", "name": "backspaceCompare2", "signature": "def backspaceCompare2(self, S, T)" } ]
2
stack_v2_sparse_classes_30k_train_020413
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def backspaceCompare(self, S, T): :type S: str :type T: str :rtype: bool - def backspaceCompare2(self, S, T): :type S: str :type T: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def backspaceCompare(self, S, T): :type S: str :type T: str :rtype: bool - def backspaceCompare2(self, S, T): :type S: str :type T: str :rtype: bool <|skeleton|> class Solution:...
416fed6e441612e1ad82467d07ee1b5570386a94
<|skeleton|> class Solution: def backspaceCompare(self, S, T): """:type S: str :type T: str :rtype: bool""" <|body_0|> def backspaceCompare2(self, S, T): """:type S: str :type T: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def backspaceCompare(self, S, T): """:type S: str :type T: str :rtype: bool""" res = [] for s in [S, T]: tmp = [] for i in s: if i is not '#': tmp.append(i) elif i is '#' and tmp != []: ...
the_stack_v2_python_sparse
src/python/backspace_string_compare.py
liadbiz/Leetcode-Solutions
train
1
8e415d927798cd6f6b11d587872033f02df75d74
[ "super(GlobalBestPSO, self).__init__(n_particles, dimensions, options, bounds, velocity_clamp)\nself.logger = logging.getLogger(__name__)\nself.assertions()\nself.reset()", "for i in xrange(iters):\n current_cost = objective_func(self.pos)\n pbest_cost = objective_func(self.personal_best_pos)\n m = curre...
<|body_start_0|> super(GlobalBestPSO, self).__init__(n_particles, dimensions, options, bounds, velocity_clamp) self.logger = logging.getLogger(__name__) self.assertions() self.reset() <|end_body_0|> <|body_start_1|> for i in xrange(iters): current_cost = objective_fu...
GlobalBestPSO
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlobalBestPSO: def __init__(self, n_particles, dimensions, options, bounds=None, velocity_clamp=None): """Initializes the swarm. Attributes ---------- n_particles : int number of particles in the swarm. dimensions : int number of dimensions in the space. options : dict with keys :code:`{...
stack_v2_sparse_classes_36k_train_018559
8,709
permissive
[ { "docstring": "Initializes the swarm. Attributes ---------- n_particles : int number of particles in the swarm. dimensions : int number of dimensions in the space. options : dict with keys :code:`{'c1', 'c2', 'w'}` a dictionary containing the parameters for the specific optimization technique * c1 : float cogn...
4
stack_v2_sparse_classes_30k_train_005180
Implement the Python class `GlobalBestPSO` described below. Class description: Implement the GlobalBestPSO class. Method signatures and docstrings: - def __init__(self, n_particles, dimensions, options, bounds=None, velocity_clamp=None): Initializes the swarm. Attributes ---------- n_particles : int number of particl...
Implement the Python class `GlobalBestPSO` described below. Class description: Implement the GlobalBestPSO class. Method signatures and docstrings: - def __init__(self, n_particles, dimensions, options, bounds=None, velocity_clamp=None): Initializes the swarm. Attributes ---------- n_particles : int number of particl...
353f92f7657a6f676a271d8d7f00d7c20e39d234
<|skeleton|> class GlobalBestPSO: def __init__(self, n_particles, dimensions, options, bounds=None, velocity_clamp=None): """Initializes the swarm. Attributes ---------- n_particles : int number of particles in the swarm. dimensions : int number of dimensions in the space. options : dict with keys :code:`{...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GlobalBestPSO: def __init__(self, n_particles, dimensions, options, bounds=None, velocity_clamp=None): """Initializes the swarm. Attributes ---------- n_particles : int number of particles in the swarm. dimensions : int number of dimensions in the space. options : dict with keys :code:`{'c1', 'c2', 'w...
the_stack_v2_python_sparse
pso_doc/pyswarms-master/pyswarms/single/global_best.py
smart1004/learn_src
train
3
71e1e1077b3efbd4d4171f92b6f98250f65a2cf9
[ "pygame.init()\nself.surface = pygame.display.set_mode((800, 600))\nnr_molecules = 50\nself.molecules = Molecules(nr_molecules, self.surface.get_size())", "clock = pygame.time.Clock()\nrunning = True\nwhile running:\n self.surface.fill((0, 0, 0))\n for event in pygame.event.get():\n if event.type == ...
<|body_start_0|> pygame.init() self.surface = pygame.display.set_mode((800, 600)) nr_molecules = 50 self.molecules = Molecules(nr_molecules, self.surface.get_size()) <|end_body_0|> <|body_start_1|> clock = pygame.time.Clock() running = True while running: ...
Gas_Simulation that simulates molecules moving and colliding
Gas_Simulation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Gas_Simulation: """Gas_Simulation that simulates molecules moving and colliding""" def __init__(self): """Initalizes the Simulation""" <|body_0|> def run(self): """Runs the simulation until the program ends""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_018560
5,895
no_license
[ { "docstring": "Initalizes the Simulation", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Runs the simulation until the program ends", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_015680
Implement the Python class `Gas_Simulation` described below. Class description: Gas_Simulation that simulates molecules moving and colliding Method signatures and docstrings: - def __init__(self): Initalizes the Simulation - def run(self): Runs the simulation until the program ends
Implement the Python class `Gas_Simulation` described below. Class description: Gas_Simulation that simulates molecules moving and colliding Method signatures and docstrings: - def __init__(self): Initalizes the Simulation - def run(self): Runs the simulation until the program ends <|skeleton|> class Gas_Simulation:...
dd8fec6f71b18aaa4a78e26a4afefc8c70327093
<|skeleton|> class Gas_Simulation: """Gas_Simulation that simulates molecules moving and colliding""" def __init__(self): """Initalizes the Simulation""" <|body_0|> def run(self): """Runs the simulation until the program ends""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Gas_Simulation: """Gas_Simulation that simulates molecules moving and colliding""" def __init__(self): """Initalizes the Simulation""" pygame.init() self.surface = pygame.display.set_mode((800, 600)) nr_molecules = 50 self.molecules = Molecules(nr_molecules, self.s...
the_stack_v2_python_sparse
Gas_Simulation.py
bterwijn/python
train
0
4532e4e194201d10952dd091737e026abf57c20a
[ "super().__init__(**kwargs)\nself.has_monthly_pass = monthly_pass\nself.contact_details = ContactDetails(name=name, email=email)", "if self.card_id[:1] == 'T' and self.card_id[1:].isdigit() and (int(self._balance) >= 0):\n return True\nreturn False", "fields = super().get_fields()\nfields['name'] = 'Contact ...
<|body_start_0|> super().__init__(**kwargs) self.has_monthly_pass = monthly_pass self.contact_details = ContactDetails(name=name, email=email) <|end_body_0|> <|body_start_1|> if self.card_id[:1] == 'T' and self.card_id[1:].isdigit() and (int(self._balance) >= 0): return True...
Represent a card used for transit system. TransitCard holds a balance, a boolean variable to tell whether it is a monthly pass or not, and some contact information. TransitCard must have a balance of 0 or more and the card ID must start with a "T" followed by digits in order to be validated. This class implements and i...
TransitCard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransitCard: """Represent a card used for transit system. TransitCard holds a balance, a boolean variable to tell whether it is a monthly pass or not, and some contact information. TransitCard must have a balance of 0 or more and the card ID must start with a "T" followed by digits in order to be...
stack_v2_sparse_classes_36k_train_018561
13,320
no_license
[ { "docstring": "Initialize the transit card object :param name: name of the contact as a String :param email: email of the contact as a String :param monthly_pass: Bool that checks if it is a monthly pass :param kwargs: a dictionary of named arguments and values. This is to provide support in the event of multi...
4
stack_v2_sparse_classes_30k_train_008515
Implement the Python class `TransitCard` described below. Class description: Represent a card used for transit system. TransitCard holds a balance, a boolean variable to tell whether it is a monthly pass or not, and some contact information. TransitCard must have a balance of 0 or more and the card ID must start with ...
Implement the Python class `TransitCard` described below. Class description: Represent a card used for transit system. TransitCard holds a balance, a boolean variable to tell whether it is a monthly pass or not, and some contact information. TransitCard must have a balance of 0 or more and the card ID must start with ...
e4953c9a4f574a6d92cbd0815e5150dd1523c31d
<|skeleton|> class TransitCard: """Represent a card used for transit system. TransitCard holds a balance, a boolean variable to tell whether it is a monthly pass or not, and some contact information. TransitCard must have a balance of 0 or more and the card ID must start with a "T" followed by digits in order to be...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransitCard: """Represent a card used for transit system. TransitCard holds a balance, a boolean variable to tell whether it is a monthly pass or not, and some contact information. TransitCard must have a balance of 0 or more and the card ID must start with a "T" followed by digits in order to be validated. T...
the_stack_v2_python_sparse
Labs/Lab6/cards.py
kchung90/Python-Labs-Assignments
train
0
01a0f10255d2035845b96106d604f5734edf98d7
[ "settings.addListsToRepository('skeinforge_tools.analyze_plugins.vectorwrite.html', '', self)\nself.activateVectorwrite = settings.BooleanSetting().getFromValue('Activate Vectorwrite', self, False)\nself.fileNameInput = settings.FileNameInput().getFromFileName([('Gcode text files', '*.gcode')], 'Open File to Write ...
<|body_start_0|> settings.addListsToRepository('skeinforge_tools.analyze_plugins.vectorwrite.html', '', self) self.activateVectorwrite = settings.BooleanSetting().getFromValue('Activate Vectorwrite', self, False) self.fileNameInput = settings.FileNameInput().getFromFileName([('Gcode text files',...
A class to handle the vectorwrite settings.
VectorwriteRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VectorwriteRepository: """A class to handle the vectorwrite settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Write button has been clicked.""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_36k_train_018562
12,022
no_license
[ { "docstring": "Set the default settings, execute title & settings fileName.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Write button has been clicked.", "name": "execute", "signature": "def execute(self)" } ]
2
stack_v2_sparse_classes_30k_train_012012
Implement the Python class `VectorwriteRepository` described below. Class description: A class to handle the vectorwrite settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Write button has been clicked.
Implement the Python class `VectorwriteRepository` described below. Class description: A class to handle the vectorwrite settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Write button has been clicked. <|skeleton|> clas...
fd69d8e856780c826386dc973ceabcc03623f3e8
<|skeleton|> class VectorwriteRepository: """A class to handle the vectorwrite settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Write button has been clicked.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VectorwriteRepository: """A class to handle the vectorwrite settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" settings.addListsToRepository('skeinforge_tools.analyze_plugins.vectorwrite.html', '', self) self.activateVectorwrite = s...
the_stack_v2_python_sparse
skeinforge_tools/analyze_plugins/vectorwrite.py
bmander/skeinforge
train
34
105572cacce8cd3c9884e1c37d137915ff8d0be2
[ "self.p0 = p0\nself.p1 = p1\nself.p2 = p2\nself.rowid = rowid", "volume = self.p0.x * (self.p1.z * self.p2.y - self.p1.y * self.p2.z)\nvolume += self.p0.y * (self.p1.x * self.p2.z - self.p1.z * self.p2.x)\nvolume += self.p0.z * (self.p1.y * self.p2.x - self.p1.x * self.p2.y)\nreturn volume / 6", "D0 = [[centroi...
<|body_start_0|> self.p0 = p0 self.p1 = p1 self.p2 = p2 self.rowid = rowid <|end_body_0|> <|body_start_1|> volume = self.p0.x * (self.p1.z * self.p2.y - self.p1.y * self.p2.z) volume += self.p0.y * (self.p1.x * self.p2.z - self.p1.z * self.p2.x) volume += self.p0...
Tetrahedron3d
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tetrahedron3d: def __init__(self, p0, p1, p2, rowid=-1): """@param p0: instancia de Point3d @param p1: instancia de Point3d @param p2: instancia de Point3d""" <|body_0|> def tetrahedronVolume(self): """Funcion que obtiene el volumen del tetraedro formado entre el tri...
stack_v2_sparse_classes_36k_train_018563
2,652
no_license
[ { "docstring": "@param p0: instancia de Point3d @param p1: instancia de Point3d @param p2: instancia de Point3d", "name": "__init__", "signature": "def __init__(self, p0, p1, p2, rowid=-1)" }, { "docstring": "Funcion que obtiene el volumen del tetraedro formado entre el triangulo exterior y el c...
3
stack_v2_sparse_classes_30k_train_020314
Implement the Python class `Tetrahedron3d` described below. Class description: Implement the Tetrahedron3d class. Method signatures and docstrings: - def __init__(self, p0, p1, p2, rowid=-1): @param p0: instancia de Point3d @param p1: instancia de Point3d @param p2: instancia de Point3d - def tetrahedronVolume(self):...
Implement the Python class `Tetrahedron3d` described below. Class description: Implement the Tetrahedron3d class. Method signatures and docstrings: - def __init__(self, p0, p1, p2, rowid=-1): @param p0: instancia de Point3d @param p1: instancia de Point3d @param p2: instancia de Point3d - def tetrahedronVolume(self):...
a93de278ea92ad8d57d66fcb76744d394400bd11
<|skeleton|> class Tetrahedron3d: def __init__(self, p0, p1, p2, rowid=-1): """@param p0: instancia de Point3d @param p1: instancia de Point3d @param p2: instancia de Point3d""" <|body_0|> def tetrahedronVolume(self): """Funcion que obtiene el volumen del tetraedro formado entre el tri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tetrahedron3d: def __init__(self, p0, p1, p2, rowid=-1): """@param p0: instancia de Point3d @param p1: instancia de Point3d @param p2: instancia de Point3d""" self.p0 = p0 self.p1 = p1 self.p2 = p2 self.rowid = rowid def tetrahedronVolume(self): """Funcion ...
the_stack_v2_python_sparse
geometry/controller/geometry_3d/tetrahedron_3d.py
nvergarayi/Cubicador
train
0
18cd624a6d1ab97fff2a8d7966a3e7e2efa0590a
[ "super(CharCNN, self).__init__()\nself.device = device\nself.char_len = char_len\nself.word_emb_dim = word_emb_dim\nself.kernel_sizes = kernel_sizes\nself.embedding = nn.Embedding(vocab_size, char_emb_dim)\nself.kernels = nn.ModuleList([nn.Conv1d(in_channels=char_emb_dim, out_channels=num_features, kernel_size=kern...
<|body_start_0|> super(CharCNN, self).__init__() self.device = device self.char_len = char_len self.word_emb_dim = word_emb_dim self.kernel_sizes = kernel_sizes self.embedding = nn.Embedding(vocab_size, char_emb_dim) self.kernels = nn.ModuleList([nn.Conv1d(in_chan...
An implementation of 'Character-Aware Neural Language Models' of Kim et al. (2015).
CharCNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CharCNN: """An implementation of 'Character-Aware Neural Language Models' of Kim et al. (2015).""" def __init__(self, vocab_size: int, char_emb_dim: int, word_emb_dim: int, kernel_sizes: List[List[int]], char_len: int, device: str): """Parameters: vocab_size: `int`. Vocabulary size o...
stack_v2_sparse_classes_36k_train_018564
4,912
no_license
[ { "docstring": "Parameters: vocab_size: `int`. Vocabulary size of chracters used in the model emb_dim: `int`. Embedding size kernel_sizes: A `list` of `list`s of `int`s. The nested list indicates feature maps for the convolutions in the paper (i.e. [(kernel_size, # kernels), ...]) char_len: 'int'. Character len...
2
stack_v2_sparse_classes_30k_train_007489
Implement the Python class `CharCNN` described below. Class description: An implementation of 'Character-Aware Neural Language Models' of Kim et al. (2015). Method signatures and docstrings: - def __init__(self, vocab_size: int, char_emb_dim: int, word_emb_dim: int, kernel_sizes: List[List[int]], char_len: int, devic...
Implement the Python class `CharCNN` described below. Class description: An implementation of 'Character-Aware Neural Language Models' of Kim et al. (2015). Method signatures and docstrings: - def __init__(self, vocab_size: int, char_emb_dim: int, word_emb_dim: int, kernel_sizes: List[List[int]], char_len: int, devic...
ca033284850147b334d3771df8235a1135eba76c
<|skeleton|> class CharCNN: """An implementation of 'Character-Aware Neural Language Models' of Kim et al. (2015).""" def __init__(self, vocab_size: int, char_emb_dim: int, word_emb_dim: int, kernel_sizes: List[List[int]], char_len: int, device: str): """Parameters: vocab_size: `int`. Vocabulary size o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CharCNN: """An implementation of 'Character-Aware Neural Language Models' of Kim et al. (2015).""" def __init__(self, vocab_size: int, char_emb_dim: int, word_emb_dim: int, kernel_sizes: List[List[int]], char_len: int, device: str): """Parameters: vocab_size: `int`. Vocabulary size of chracters u...
the_stack_v2_python_sparse
papers/4.ELMo/char_cnn.py
euhkim/NLP
train
0
34aa7b91b0f5d2cbaf2df9c3986ace0ec5603b41
[ "self.fs_type = fs_type\nself.read_only = read_only\nself.secret_ref = secret_ref\nself.volume_name = volume_name\nself.volume_namespace = volume_namespace", "if dictionary is None:\n return None\nfs_type = dictionary.get('fsType')\nread_only = dictionary.get('readOnly')\nsecret_ref = cohesity_management_sdk.m...
<|body_start_0|> self.fs_type = fs_type self.read_only = read_only self.secret_ref = secret_ref self.volume_name = volume_name self.volume_namespace = volume_namespace <|end_body_0|> <|body_start_1|> if dictionary is None: return None fs_type = dictio...
Implementation of the 'PodInfo_PodSpec_VolumeInfo_StorageOS' model. TODO: type description here. Attributes: fs_type (string): TODO: Type description here. read_only (bool): TODO: Type description here. secret_ref (ObjectReference): TODO: Type description here. volume_name (string): TODO: Type description here. volume_...
PodInfo_PodSpec_VolumeInfo_StorageOS
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PodInfo_PodSpec_VolumeInfo_StorageOS: """Implementation of the 'PodInfo_PodSpec_VolumeInfo_StorageOS' model. TODO: type description here. Attributes: fs_type (string): TODO: Type description here. read_only (bool): TODO: Type description here. secret_ref (ObjectReference): TODO: Type description ...
stack_v2_sparse_classes_36k_train_018565
2,532
permissive
[ { "docstring": "Constructor for the PodInfo_PodSpec_VolumeInfo_StorageOS class", "name": "__init__", "signature": "def __init__(self, fs_type=None, read_only=None, secret_ref=None, volume_name=None, volume_namespace=None)" }, { "docstring": "Creates an instance of this model from a dictionary Ar...
2
null
Implement the Python class `PodInfo_PodSpec_VolumeInfo_StorageOS` described below. Class description: Implementation of the 'PodInfo_PodSpec_VolumeInfo_StorageOS' model. TODO: type description here. Attributes: fs_type (string): TODO: Type description here. read_only (bool): TODO: Type description here. secret_ref (Ob...
Implement the Python class `PodInfo_PodSpec_VolumeInfo_StorageOS` described below. Class description: Implementation of the 'PodInfo_PodSpec_VolumeInfo_StorageOS' model. TODO: type description here. Attributes: fs_type (string): TODO: Type description here. read_only (bool): TODO: Type description here. secret_ref (Ob...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class PodInfo_PodSpec_VolumeInfo_StorageOS: """Implementation of the 'PodInfo_PodSpec_VolumeInfo_StorageOS' model. TODO: type description here. Attributes: fs_type (string): TODO: Type description here. read_only (bool): TODO: Type description here. secret_ref (ObjectReference): TODO: Type description ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PodInfo_PodSpec_VolumeInfo_StorageOS: """Implementation of the 'PodInfo_PodSpec_VolumeInfo_StorageOS' model. TODO: type description here. Attributes: fs_type (string): TODO: Type description here. read_only (bool): TODO: Type description here. secret_ref (ObjectReference): TODO: Type description here. volume_...
the_stack_v2_python_sparse
cohesity_management_sdk/models/pod_info_pod_spec_volume_info_storage_os.py
cohesity/management-sdk-python
train
24
d0c44c99119ac2e02260ff2f0b0d23a3c6d45be4
[ "super().__init__()\nself.weights = torch.nn.Parameter(torch.zeros(feature_number, feature_number))\ntorch.nn.init.xavier_uniform_(self.weights)", "attention = torch.nn.functional.normalize(self.weights, dim=-1)\nleft_representations = torch.nn.functional.normalize(left_representations, dim=-1)\nright_representat...
<|body_start_0|> super().__init__() self.weights = torch.nn.Parameter(torch.zeros(feature_number, feature_number)) torch.nn.init.xavier_uniform_(self.weights) <|end_body_0|> <|body_start_1|> attention = torch.nn.functional.normalize(self.weights, dim=-1) left_representations = t...
Attention layer.
EmbeddingLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmbeddingLayer: """Attention layer.""" def __init__(self, feature_number: int): """Initialize the relational embedding layer. :param feature_number: Number of features.""" <|body_0|> def forward(self, left_representations: torch.FloatTensor, right_representations: torch....
stack_v2_sparse_classes_36k_train_018566
25,672
no_license
[ { "docstring": "Initialize the relational embedding layer. :param feature_number: Number of features.", "name": "__init__", "signature": "def __init__(self, feature_number: int)" }, { "docstring": "Make a forward pass with the drug representations. :param left_representations: Left side drug rep...
2
stack_v2_sparse_classes_30k_train_008353
Implement the Python class `EmbeddingLayer` described below. Class description: Attention layer. Method signatures and docstrings: - def __init__(self, feature_number: int): Initialize the relational embedding layer. :param feature_number: Number of features. - def forward(self, left_representations: torch.FloatTenso...
Implement the Python class `EmbeddingLayer` described below. Class description: Attention layer. Method signatures and docstrings: - def __init__(self, feature_number: int): Initialize the relational embedding layer. :param feature_number: Number of features. - def forward(self, left_representations: torch.FloatTenso...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class EmbeddingLayer: """Attention layer.""" def __init__(self, feature_number: int): """Initialize the relational embedding layer. :param feature_number: Number of features.""" <|body_0|> def forward(self, left_representations: torch.FloatTensor, right_representations: torch....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmbeddingLayer: """Attention layer.""" def __init__(self, feature_number: int): """Initialize the relational embedding layer. :param feature_number: Number of features.""" super().__init__() self.weights = torch.nn.Parameter(torch.zeros(feature_number, feature_number)) tor...
the_stack_v2_python_sparse
generated/test_AstraZeneca_chemicalx.py
jansel/pytorch-jit-paritybench
train
35
1d060ca1719316864ea9d464e9612fef4139dda4
[ "self._cpu = CPU()\nself._memory = Memory()\nself._hard_drive = HardDrive()", "self._cpu.freeze()\nself._memory.load_data(self._hard_drive.read_data(self._BOOT_SECTOR, self._SECTOR_SIZE), self._BOOT_ADDRESS)\nself._cpu.jump(self._BOOT_ADDRESS)\nself._cpu.execute()" ]
<|body_start_0|> self._cpu = CPU() self._memory = Memory() self._hard_drive = HardDrive() <|end_body_0|> <|body_start_1|> self._cpu.freeze() self._memory.load_data(self._hard_drive.read_data(self._BOOT_SECTOR, self._SECTOR_SIZE), self._BOOT_ADDRESS) self._cpu.jump(self._...
Facade class for computer that serves as a front-facing interface masking more complex sub-components to simplify the usage for client and minimize the dependencies between the client and the sub-components.
ComputerFacade
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComputerFacade: """Facade class for computer that serves as a front-facing interface masking more complex sub-components to simplify the usage for client and minimize the dependencies between the client and the sub-components.""" def __init__(self): """Default constructor.""" ...
stack_v2_sparse_classes_36k_train_018567
2,600
permissive
[ { "docstring": "Default constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Starts this computer. :return: None", "name": "start", "signature": "def start(self) -> None" } ]
2
null
Implement the Python class `ComputerFacade` described below. Class description: Facade class for computer that serves as a front-facing interface masking more complex sub-components to simplify the usage for client and minimize the dependencies between the client and the sub-components. Method signatures and docstrin...
Implement the Python class `ComputerFacade` described below. Class description: Facade class for computer that serves as a front-facing interface masking more complex sub-components to simplify the usage for client and minimize the dependencies between the client and the sub-components. Method signatures and docstrin...
7a8167a85456b481aba15d5eee5a64b116b00adc
<|skeleton|> class ComputerFacade: """Facade class for computer that serves as a front-facing interface masking more complex sub-components to simplify the usage for client and minimize the dependencies between the client and the sub-components.""" def __init__(self): """Default constructor.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComputerFacade: """Facade class for computer that serves as a front-facing interface masking more complex sub-components to simplify the usage for client and minimize the dependencies between the client and the sub-components.""" def __init__(self): """Default constructor.""" self._cpu = ...
the_stack_v2_python_sparse
3-Structural Patterns/7-Facade Pattern/Computer Example/Python/computer.py
Ziang-Lu/Design-Patterns
train
2
9b26d6fbd196081dc66411ec59b0eba1117f9344
[ "item = RequestBids.query.filter_by(id=request_bid_id).first()\nif not item:\n return abort(404, 'request_bid_id not found')\nreturn jsonify(item.to_json())", "item = RequestBids.query.filter_by(id=request_bid_id).first()\nif item and item.user_id == g.user.id:\n item.delete()\n return jsonify(dict(succe...
<|body_start_0|> item = RequestBids.query.filter_by(id=request_bid_id).first() if not item: return abort(404, 'request_bid_id not found') return jsonify(item.to_json()) <|end_body_0|> <|body_start_1|> item = RequestBids.query.filter_by(id=request_bid_id).first() if i...
RequestBidAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequestBidAPI: def get(self, request_bid_id): """get details request_bid_id""" <|body_0|> def delete(self, request_bid_id): """delete request_bid_id""" <|body_1|> def put(self, request_bid_id): """update request_bid_id""" <|body_2|> <|en...
stack_v2_sparse_classes_36k_train_018568
4,039
no_license
[ { "docstring": "get details request_bid_id", "name": "get", "signature": "def get(self, request_bid_id)" }, { "docstring": "delete request_bid_id", "name": "delete", "signature": "def delete(self, request_bid_id)" }, { "docstring": "update request_bid_id", "name": "put", ...
3
stack_v2_sparse_classes_30k_train_019319
Implement the Python class `RequestBidAPI` described below. Class description: Implement the RequestBidAPI class. Method signatures and docstrings: - def get(self, request_bid_id): get details request_bid_id - def delete(self, request_bid_id): delete request_bid_id - def put(self, request_bid_id): update request_bid_...
Implement the Python class `RequestBidAPI` described below. Class description: Implement the RequestBidAPI class. Method signatures and docstrings: - def get(self, request_bid_id): get details request_bid_id - def delete(self, request_bid_id): delete request_bid_id - def put(self, request_bid_id): update request_bid_...
1c7d812e214590e0f4759e6c5be411bd64f8e3c4
<|skeleton|> class RequestBidAPI: def get(self, request_bid_id): """get details request_bid_id""" <|body_0|> def delete(self, request_bid_id): """delete request_bid_id""" <|body_1|> def put(self, request_bid_id): """update request_bid_id""" <|body_2|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RequestBidAPI: def get(self, request_bid_id): """get details request_bid_id""" item = RequestBids.query.filter_by(id=request_bid_id).first() if not item: return abort(404, 'request_bid_id not found') return jsonify(item.to_json()) def delete(self, request_bid_i...
the_stack_v2_python_sparse
apis/bids.py
ajutor-app/backend
train
0
d3dfc731a62bcb7b8d1a35807286cdde242f7057
[ "Frame.__init__(self, master)\nself.grid()\nself.create_widgets()", "Label(self, text='Choose your favorite movie type').grid(row=0, column=0, sticky=W)\nLabel(self, text='Select all that apply:').grid(row=1, column=0, sticky=W)\nself.comedy = BooleanVar()\nCheckbutton(self, text='Comedy', variable=self.comedy, c...
<|body_start_0|> Frame.__init__(self, master) self.grid() self.create_widgets() <|end_body_0|> <|body_start_1|> Label(self, text='Choose your favorite movie type').grid(row=0, column=0, sticky=W) Label(self, text='Select all that apply:').grid(row=1, column=0, sticky=W) ...
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: def __init__(self, master): """initialize the Frame""" <|body_0|> def create_widgets(self): """create widgets for movie type choice""" <|body_1|> def update_text(self): """update text widget and display favorite movie types""" ...
stack_v2_sparse_classes_36k_train_018569
1,854
no_license
[ { "docstring": "initialize the Frame", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "create widgets for movie type choice", "name": "create_widgets", "signature": "def create_widgets(self)" }, { "docstring": "update text widget and display favor...
3
stack_v2_sparse_classes_30k_train_013898
Implement the Python class `Application` described below. Class description: Implement the Application class. Method signatures and docstrings: - def __init__(self, master): initialize the Frame - def create_widgets(self): create widgets for movie type choice - def update_text(self): update text widget and display fa...
Implement the Python class `Application` described below. Class description: Implement the Application class. Method signatures and docstrings: - def __init__(self, master): initialize the Frame - def create_widgets(self): create widgets for movie type choice - def update_text(self): update text widget and display fa...
728a8614fa50e3de0541efa87f71ec047326d66a
<|skeleton|> class Application: def __init__(self, master): """initialize the Frame""" <|body_0|> def create_widgets(self): """create widgets for movie type choice""" <|body_1|> def update_text(self): """update text widget and display favorite movie types""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Application: def __init__(self, master): """initialize the Frame""" Frame.__init__(self, master) self.grid() self.create_widgets() def create_widgets(self): """create widgets for movie type choice""" Label(self, text='Choose your favorite movie type').grid(...
the_stack_v2_python_sparse
src/Ex14/check_box.py
lil-val/she-codes
train
0
be61de41076fae63ad04c0beee3b101c50e2ae5e
[ "def dfs(node):\n if node is None:\n return\n l = node.left\n r = node.right\n while l:\n l.next = r\n l = l.right\n r = r.left\n if node.left:\n dfs(node.left)\n dfs(node.right)\ndfs(root)\nreturn root", "from collections import deque\nif root is None:\n ...
<|body_start_0|> def dfs(node): if node is None: return l = node.left r = node.right while l: l.next = r l = l.right r = r.left if node.left: dfs(node.left) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def connect(self, root: 'Node') -> 'Node': """Recursive1, Time: O(n), Space: O(logn) for recursive stack""" <|body_0|> def connect(self, root: 'Node') -> 'Node': """BFS, Time: O(n), Space: O(logn)""" <|body_1|> def connect(self, root: 'Node') -...
stack_v2_sparse_classes_36k_train_018570
2,251
no_license
[ { "docstring": "Recursive1, Time: O(n), Space: O(logn) for recursive stack", "name": "connect", "signature": "def connect(self, root: 'Node') -> 'Node'" }, { "docstring": "BFS, Time: O(n), Space: O(logn)", "name": "connect", "signature": "def connect(self, root: 'Node') -> 'Node'" }, ...
4
stack_v2_sparse_classes_30k_train_014592
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def connect(self, root: 'Node') -> 'Node': Recursive1, Time: O(n), Space: O(logn) for recursive stack - def connect(self, root: 'Node') -> 'Node': BFS, Time: O(n), Space: O(logn)...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def connect(self, root: 'Node') -> 'Node': Recursive1, Time: O(n), Space: O(logn) for recursive stack - def connect(self, root: 'Node') -> 'Node': BFS, Time: O(n), Space: O(logn)...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def connect(self, root: 'Node') -> 'Node': """Recursive1, Time: O(n), Space: O(logn) for recursive stack""" <|body_0|> def connect(self, root: 'Node') -> 'Node': """BFS, Time: O(n), Space: O(logn)""" <|body_1|> def connect(self, root: 'Node') -...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def connect(self, root: 'Node') -> 'Node': """Recursive1, Time: O(n), Space: O(logn) for recursive stack""" def dfs(node): if node is None: return l = node.left r = node.right while l: l.next = r ...
the_stack_v2_python_sparse
python/116-Populating Next Right Pointers in Each Node.py
cwza/leetcode
train
0
b2c6b168c014ce163b75ae9192dc9c59ecd46238
[ "cur, prev = (root, None)\nres = []\nwhile cur:\n if not cur.left:\n res.append(cur.val)\n cur = cur.right\n else:\n prev = cur.left\n while prev.right and prev.right != cur:\n prev = prev.right\n if not prev.right:\n res.append(cur.val)\n pr...
<|body_start_0|> cur, prev = (root, None) res = [] while cur: if not cur.left: res.append(cur.val) cur = cur.right else: prev = cur.left while prev.right and prev.right != cur: prev = prev...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def preorderTraversal_on(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> cur, prev = (root, N...
stack_v2_sparse_classes_36k_train_018571
1,475
permissive
[ { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "preorderTraversal", "signature": "def preorderTraversal(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "preorderTraversal_on", "signature": "def preorderTraversal_on(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def preorderTraversal_on(self, root): :type root: TreeNode :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def preorderTraversal_on(self, root): :type root: TreeNode :rtype: List[int] <|skeleton|> class Solut...
86f1cb98de801f58c39d9a48ce9de12df7303d20
<|skeleton|> class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def preorderTraversal_on(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" cur, prev = (root, None) res = [] while cur: if not cur.left: res.append(cur.val) cur = cur.right else: prev = cur.l...
the_stack_v2_python_sparse
144-Binary-Tree-Preorder-Traversal/solution.py
Tanych/CodeTracking
train
0
d9e557ec3e189281715e55d81fa18c5f3dcfe623
[ "super().__init__()\nif dim == 1:\n conv = nn.Conv1d\n bn = nn.BatchNorm1d\nelif dim == 2:\n conv = nn.Conv2d\n bn = nn.BatchNorm2d\nelse:\n raise ValueError\nif not isinstance(out_channels, (list, tuple)):\n out_channels = [out_channels]\nlayers = []\nfor oc in out_channels:\n layers.extend([c...
<|body_start_0|> super().__init__() if dim == 1: conv = nn.Conv1d bn = nn.BatchNorm1d elif dim == 2: conv = nn.Conv2d bn = nn.BatchNorm2d else: raise ValueError if not isinstance(out_channels, (list, tuple)): ...
SharedMLP Module, comprising Conv2d, BatchNorm and ReLU blocks.
SharedMLP
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SharedMLP: """SharedMLP Module, comprising Conv2d, BatchNorm and ReLU blocks.""" def __init__(self, in_channels, out_channels, dim=1): """Constructor for SharedMLP Block. Args: in_channels: Number of input channels. out_channels: Number of output channels. dim: Input dimension""" ...
stack_v2_sparse_classes_36k_train_018572
22,879
permissive
[ { "docstring": "Constructor for SharedMLP Block. Args: in_channels: Number of input channels. out_channels: Number of output channels. dim: Input dimension", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels, dim=1)" }, { "docstring": "Forward pass for SharedMLP Args...
2
stack_v2_sparse_classes_30k_train_019438
Implement the Python class `SharedMLP` described below. Class description: SharedMLP Module, comprising Conv2d, BatchNorm and ReLU blocks. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, dim=1): Constructor for SharedMLP Block. Args: in_channels: Number of input channels. out_channel...
Implement the Python class `SharedMLP` described below. Class description: SharedMLP Module, comprising Conv2d, BatchNorm and ReLU blocks. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, dim=1): Constructor for SharedMLP Block. Args: in_channels: Number of input channels. out_channel...
51482281dc180786e7563c73c12ac5df89289748
<|skeleton|> class SharedMLP: """SharedMLP Module, comprising Conv2d, BatchNorm and ReLU blocks.""" def __init__(self, in_channels, out_channels, dim=1): """Constructor for SharedMLP Block. Args: in_channels: Number of input channels. out_channels: Number of output channels. dim: Input dimension""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SharedMLP: """SharedMLP Module, comprising Conv2d, BatchNorm and ReLU blocks.""" def __init__(self, in_channels, out_channels, dim=1): """Constructor for SharedMLP Block. Args: in_channels: Number of input channels. out_channels: Number of output channels. dim: Input dimension""" super()....
the_stack_v2_python_sparse
ml3d/torch/models/pvcnn.py
CosmosHua/Open3D-ML
train
0
db5291bd94f5b45b7d05fbed6fdaac1a159b6e23
[ "w, h = (len(board), len(board[0]))\nboard_p = np.zeros((w + 2, h + 2))\nboard_p[1:w + 1, 1:h + 1] = board\nfor i in range(1, w + 1):\n for j in range(1, h + 1):\n value = self.conv2d(board_p, i, j)\n if value > 3 or value < 2:\n board[i - 1][j - 1] = 0\n elif value == 3:\n ...
<|body_start_0|> w, h = (len(board), len(board[0])) board_p = np.zeros((w + 2, h + 2)) board_p[1:w + 1, 1:h + 1] = board for i in range(1, w + 1): for j in range(1, h + 1): value = self.conv2d(board_p, i, j) if value > 3 or value < 2: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def gameOfLife(self, board) -> None: """Do not return anything, modify board in-place instead.""" <|body_0|> def conv2d(self, board_p, i, j): """convolution implemention :para board_p: board after 0 padding(np.array) i,j : loction :output value_convolution"...
stack_v2_sparse_classes_36k_train_018573
3,141
permissive
[ { "docstring": "Do not return anything, modify board in-place instead.", "name": "gameOfLife", "signature": "def gameOfLife(self, board) -> None" }, { "docstring": "convolution implemention :para board_p: board after 0 padding(np.array) i,j : loction :output value_convolution", "name": "conv...
2
stack_v2_sparse_classes_30k_train_000671
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def gameOfLife(self, board) -> None: Do not return anything, modify board in-place instead. - def conv2d(self, board_p, i, j): convolution implemention :para board_p: board after...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def gameOfLife(self, board) -> None: Do not return anything, modify board in-place instead. - def conv2d(self, board_p, i, j): convolution implemention :para board_p: board after...
91c8b09c278f5abb67e90f0096fc83bef975647b
<|skeleton|> class Solution: def gameOfLife(self, board) -> None: """Do not return anything, modify board in-place instead.""" <|body_0|> def conv2d(self, board_p, i, j): """convolution implemention :para board_p: board after 0 padding(np.array) i,j : loction :output value_convolution"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def gameOfLife(self, board) -> None: """Do not return anything, modify board in-place instead.""" w, h = (len(board), len(board[0])) board_p = np.zeros((w + 2, h + 2)) board_p[1:w + 1, 1:h + 1] = board for i in range(1, w + 1): for j in range(1, h ...
the_stack_v2_python_sparse
289LifeGame/GameOfLife.py
Easonyesheng/CodePractice
train
0
ea8121a54b5b2caa22f5d479eb911057149648e5
[ "self.possible_steps = step_list\nself.all_combinations = []\nself.slice_with_multiple_scales(range(n), self.possible_steps)\nreturn len(self.all_combinations)", "target_length = len(target)\nfor step in step_list:\n clone_pieces = current_pieces[:]\n slice_index = current_index + step\n piece = target[c...
<|body_start_0|> self.possible_steps = step_list self.all_combinations = [] self.slice_with_multiple_scales(range(n), self.possible_steps) return len(self.all_combinations) <|end_body_0|> <|body_start_1|> target_length = len(target) for step in step_list: clo...
目前此种方法failed了,超时, 在输入值为35的时候。此方法可以获得解,但算法复杂度太高。但是此种方法可以显示出所有的组合。
SolutionFailed1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolutionFailed1: """目前此种方法failed了,超时, 在输入值为35的时候。此方法可以获得解,但算法复杂度太高。但是此种方法可以显示出所有的组合。""" def climbStairs(self, n, step_list=[1, 2]): """:type n: int :rtype: int""" <|body_0|> def slice_with_multiple_scales(self, target, step_list, current_index=0, current_pieces=[]): ...
stack_v2_sparse_classes_36k_train_018574
4,780
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "climbStairs", "signature": "def climbStairs(self, n, step_list=[1, 2])" }, { "docstring": "一个任意长度的有序列表,可以按照参数列表里提供的n种尺度进行连续切分,返回最后可能的切分结果总数", "name": "slice_with_multiple_scales", "signature": "def slice_with_multiple_scales(self, targe...
2
null
Implement the Python class `SolutionFailed1` described below. Class description: 目前此种方法failed了,超时, 在输入值为35的时候。此方法可以获得解,但算法复杂度太高。但是此种方法可以显示出所有的组合。 Method signatures and docstrings: - def climbStairs(self, n, step_list=[1, 2]): :type n: int :rtype: int - def slice_with_multiple_scales(self, target, step_list, current_i...
Implement the Python class `SolutionFailed1` described below. Class description: 目前此种方法failed了,超时, 在输入值为35的时候。此方法可以获得解,但算法复杂度太高。但是此种方法可以显示出所有的组合。 Method signatures and docstrings: - def climbStairs(self, n, step_list=[1, 2]): :type n: int :rtype: int - def slice_with_multiple_scales(self, target, step_list, current_i...
2a7401c6e407db533877de6e20a2b523f7964fdb
<|skeleton|> class SolutionFailed1: """目前此种方法failed了,超时, 在输入值为35的时候。此方法可以获得解,但算法复杂度太高。但是此种方法可以显示出所有的组合。""" def climbStairs(self, n, step_list=[1, 2]): """:type n: int :rtype: int""" <|body_0|> def slice_with_multiple_scales(self, target, step_list, current_index=0, current_pieces=[]): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SolutionFailed1: """目前此种方法failed了,超时, 在输入值为35的时候。此方法可以获得解,但算法复杂度太高。但是此种方法可以显示出所有的组合。""" def climbStairs(self, n, step_list=[1, 2]): """:type n: int :rtype: int""" self.possible_steps = step_list self.all_combinations = [] self.slice_with_multiple_scales(range(n), self.poss...
the_stack_v2_python_sparse
THEORIES/algorithm/leetcode/Y70_Climbing_Stairs.py
bb2qqq/tech_notes
train
0
d0c44c99119ac2e02260ff2f0b0d23a3c6d45be4
[ "super().__init__()\nself.weight_query = torch.nn.Parameter(torch.zeros(feature_number, feature_number // 2))\nself.weight_key = torch.nn.Parameter(torch.zeros(feature_number, feature_number // 2))\nself.bias = torch.nn.Parameter(torch.zeros(feature_number // 2))\nself.attention = torch.nn.Parameter(torch.zeros(fea...
<|body_start_0|> super().__init__() self.weight_query = torch.nn.Parameter(torch.zeros(feature_number, feature_number // 2)) self.weight_key = torch.nn.Parameter(torch.zeros(feature_number, feature_number // 2)) self.bias = torch.nn.Parameter(torch.zeros(feature_number // 2)) sel...
Co-attention layer for drug pairs.
DrugDrugAttentionLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DrugDrugAttentionLayer: """Co-attention layer for drug pairs.""" def __init__(self, feature_number: int): """Initialize the co-attention layer. :param feature_number: Number of input features.""" <|body_0|> def forward(self, left_representations: torch.Tensor, right_repr...
stack_v2_sparse_classes_36k_train_018575
25,672
no_license
[ { "docstring": "Initialize the co-attention layer. :param feature_number: Number of input features.", "name": "__init__", "signature": "def __init__(self, feature_number: int)" }, { "docstring": "Make a forward pass with the co-attention calculation. :param left_representations: Matrix of left h...
2
stack_v2_sparse_classes_30k_train_011780
Implement the Python class `DrugDrugAttentionLayer` described below. Class description: Co-attention layer for drug pairs. Method signatures and docstrings: - def __init__(self, feature_number: int): Initialize the co-attention layer. :param feature_number: Number of input features. - def forward(self, left_represent...
Implement the Python class `DrugDrugAttentionLayer` described below. Class description: Co-attention layer for drug pairs. Method signatures and docstrings: - def __init__(self, feature_number: int): Initialize the co-attention layer. :param feature_number: Number of input features. - def forward(self, left_represent...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class DrugDrugAttentionLayer: """Co-attention layer for drug pairs.""" def __init__(self, feature_number: int): """Initialize the co-attention layer. :param feature_number: Number of input features.""" <|body_0|> def forward(self, left_representations: torch.Tensor, right_repr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DrugDrugAttentionLayer: """Co-attention layer for drug pairs.""" def __init__(self, feature_number: int): """Initialize the co-attention layer. :param feature_number: Number of input features.""" super().__init__() self.weight_query = torch.nn.Parameter(torch.zeros(feature_number,...
the_stack_v2_python_sparse
generated/test_AstraZeneca_chemicalx.py
jansel/pytorch-jit-paritybench
train
35
2724fd1e7bc09a955f1e5d13e87b1a834e4566ac
[ "super().__init__()\nself.norm = nn.InstanceNorm1D(in_channels, momentum=0.1, data_format='NCL', weight_attr=False, bias_attr=False)\nself.aux_conv = nn.Sequential(nn.Conv1D(aux_channels, in_channels, kernel_size, 1, bias_attr=bias, padding=(kernel_size - 1) // 2))\nself.gated_conv = nn.Sequential(nn.Conv1D(in_chan...
<|body_start_0|> super().__init__() self.norm = nn.InstanceNorm1D(in_channels, momentum=0.1, data_format='NCL', weight_attr=False, bias_attr=False) self.aux_conv = nn.Sequential(nn.Conv1D(aux_channels, in_channels, kernel_size, 1, bias_attr=bias, padding=(kernel_size - 1) // 2)) self.gat...
TADE Layer module.
TADELayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TADELayer: """TADE Layer module.""" def __init__(self, in_channels: int=64, aux_channels: int=80, kernel_size: int=9, bias: bool=True, upsample_factor: int=2, upsample_mode: str='nearest'): """Initilize TADE layer.""" <|body_0|> def forward(self, x, c): """Calcul...
stack_v2_sparse_classes_36k_train_018576
5,634
permissive
[ { "docstring": "Initilize TADE layer.", "name": "__init__", "signature": "def __init__(self, in_channels: int=64, aux_channels: int=80, kernel_size: int=9, bias: bool=True, upsample_factor: int=2, upsample_mode: str='nearest')" }, { "docstring": "Calculate forward propagation. Args: x (Tensor): ...
2
null
Implement the Python class `TADELayer` described below. Class description: TADE Layer module. Method signatures and docstrings: - def __init__(self, in_channels: int=64, aux_channels: int=80, kernel_size: int=9, bias: bool=True, upsample_factor: int=2, upsample_mode: str='nearest'): Initilize TADE layer. - def forwar...
Implement the Python class `TADELayer` described below. Class description: TADE Layer module. Method signatures and docstrings: - def __init__(self, in_channels: int=64, aux_channels: int=80, kernel_size: int=9, bias: bool=True, upsample_factor: int=2, upsample_mode: str='nearest'): Initilize TADE layer. - def forwar...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class TADELayer: """TADE Layer module.""" def __init__(self, in_channels: int=64, aux_channels: int=80, kernel_size: int=9, bias: bool=True, upsample_factor: int=2, upsample_mode: str='nearest'): """Initilize TADE layer.""" <|body_0|> def forward(self, x, c): """Calcul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TADELayer: """TADE Layer module.""" def __init__(self, in_channels: int=64, aux_channels: int=80, kernel_size: int=9, bias: bool=True, upsample_factor: int=2, upsample_mode: str='nearest'): """Initilize TADE layer.""" super().__init__() self.norm = nn.InstanceNorm1D(in_channels, m...
the_stack_v2_python_sparse
paddlespeech/t2s/modules/tade_res_block.py
anniyanvr/DeepSpeech-1
train
0
fdb0155429b27491aa1b76045027aab6c2ecd05e
[ "optimizer.Optimizer.__init__(self, **kwargs)\nself.stepKind = kwargs['step']\nself.optimalPoint = kwargs['x0']\nself.lineSearch = kwargs['line_search']\nself.state['new_parameters'] = self.optimalPoint\nself.state['new_value'] = self.function(self.optimalPoint)\nself.recordHistory(**self.state)", "self.state['ol...
<|body_start_0|> optimizer.Optimizer.__init__(self, **kwargs) self.stepKind = kwargs['step'] self.optimalPoint = kwargs['x0'] self.lineSearch = kwargs['line_search'] self.state['new_parameters'] = self.optimalPoint self.state['new_value'] = self.function(self.optimalPoint...
A standard optimizer, takes a step and finds the best candidate Must give in self.optimalPoint the optimal point after optimization
StandardOptimizer
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandardOptimizer: """A standard optimizer, takes a step and finds the best candidate Must give in self.optimalPoint the optimal point after optimization""" def __init__(self, **kwargs): """Needs to have : - an object function to optimize (function), alternatively a function ('fun'),...
stack_v2_sparse_classes_36k_train_018577
2,378
permissive
[ { "docstring": "Needs to have : - an object function to optimize (function), alternatively a function ('fun'), gradient ('gradient'), ... - a way to get a new point, that is a step (step) - a criterion to stop the optimization (criterion) - a starting point (x0) - a way to find the best point on a line (lineSea...
2
null
Implement the Python class `StandardOptimizer` described below. Class description: A standard optimizer, takes a step and finds the best candidate Must give in self.optimalPoint the optimal point after optimization Method signatures and docstrings: - def __init__(self, **kwargs): Needs to have : - an object function ...
Implement the Python class `StandardOptimizer` described below. Class description: A standard optimizer, takes a step and finds the best candidate Must give in self.optimalPoint the optimal point after optimization Method signatures and docstrings: - def __init__(self, **kwargs): Needs to have : - an object function ...
3d298e908ff55340cd3612078508be0c791f63a8
<|skeleton|> class StandardOptimizer: """A standard optimizer, takes a step and finds the best candidate Must give in self.optimalPoint the optimal point after optimization""" def __init__(self, **kwargs): """Needs to have : - an object function to optimize (function), alternatively a function ('fun'),...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StandardOptimizer: """A standard optimizer, takes a step and finds the best candidate Must give in self.optimalPoint the optimal point after optimization""" def __init__(self, **kwargs): """Needs to have : - an object function to optimize (function), alternatively a function ('fun'), gradient ('g...
the_stack_v2_python_sparse
PyDSTool/Toolbox/optimizers/optimizer/standard_optimizer.py
mdlama/pydstool
train
2
159437dc3d490b4982953cd6dbeccee803bf2e60
[ "self.auth_before_sign = auth_before_sign\nself.social_security_number = social_security_number\nself.signature_method_unique_id = signature_method_unique_id\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nauth_before_sign = dictionary.get('authBeforeSign')\nsocial_...
<|body_start_0|> self.auth_before_sign = auth_before_sign self.social_security_number = social_security_number self.signature_method_unique_id = signature_method_unique_id self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: ...
Implementation of the 'Authentication' model. TODO: type model description here. Attributes: auth_before_sign (bool): If this is set to true, you have to include the social security number or SignatureMethod unique id for the signer social_security_number (string): The signers social security number signature_method_un...
Authentication
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Authentication: """Implementation of the 'Authentication' model. TODO: type model description here. Attributes: auth_before_sign (bool): If this is set to true, you have to include the social security number or SignatureMethod unique id for the signer social_security_number (string): The signers ...
stack_v2_sparse_classes_36k_train_018578
2,927
permissive
[ { "docstring": "Constructor for the Authentication class", "name": "__init__", "signature": "def __init__(self, auth_before_sign=None, social_security_number=None, signature_method_unique_id=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary A...
2
null
Implement the Python class `Authentication` described below. Class description: Implementation of the 'Authentication' model. TODO: type model description here. Attributes: auth_before_sign (bool): If this is set to true, you have to include the social security number or SignatureMethod unique id for the signer social...
Implement the Python class `Authentication` described below. Class description: Implementation of the 'Authentication' model. TODO: type model description here. Attributes: auth_before_sign (bool): If this is set to true, you have to include the social security number or SignatureMethod unique id for the signer social...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class Authentication: """Implementation of the 'Authentication' model. TODO: type model description here. Attributes: auth_before_sign (bool): If this is set to true, you have to include the social security number or SignatureMethod unique id for the signer social_security_number (string): The signers ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Authentication: """Implementation of the 'Authentication' model. TODO: type model description here. Attributes: auth_before_sign (bool): If this is set to true, you have to include the social security number or SignatureMethod unique id for the signer social_security_number (string): The signers social securi...
the_stack_v2_python_sparse
idfy_rest_client/models/authentication.py
dealflowteam/Idfy
train
0
e15b9ea79199ae4e6e607eb7695a6c594e39e43e
[ "self.num_archival_runs = num_archival_runs\nself.num_backup_runs = num_backup_runs\nself.num_replication_runs = num_replication_runs", "if dictionary is None:\n return None\nnum_archival_runs = dictionary.get('numArchivalRuns')\nnum_backup_runs = dictionary.get('numBackupRuns')\nnum_replication_runs = diction...
<|body_start_0|> self.num_archival_runs = num_archival_runs self.num_backup_runs = num_backup_runs self.num_replication_runs = num_replication_runs <|end_body_0|> <|body_start_1|> if dictionary is None: return None num_archival_runs = dictionary.get('numArchivalRuns'...
Implementation of the 'ProtectionRunsStats' model. Specifies the Protection Runs statistics response. Attributes: num_archival_runs (long|int): Specifies the count of archival Runs. num_backup_runs (long|int): Specifies the count of backup Runs. num_replication_runs (long|int): Specifies the count of replication Runs.
ProtectionRunsStats
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectionRunsStats: """Implementation of the 'ProtectionRunsStats' model. Specifies the Protection Runs statistics response. Attributes: num_archival_runs (long|int): Specifies the count of archival Runs. num_backup_runs (long|int): Specifies the count of backup Runs. num_replication_runs (long|...
stack_v2_sparse_classes_36k_train_018579
2,056
permissive
[ { "docstring": "Constructor for the ProtectionRunsStats class", "name": "__init__", "signature": "def __init__(self, num_archival_runs=None, num_backup_runs=None, num_replication_runs=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A d...
2
null
Implement the Python class `ProtectionRunsStats` described below. Class description: Implementation of the 'ProtectionRunsStats' model. Specifies the Protection Runs statistics response. Attributes: num_archival_runs (long|int): Specifies the count of archival Runs. num_backup_runs (long|int): Specifies the count of b...
Implement the Python class `ProtectionRunsStats` described below. Class description: Implementation of the 'ProtectionRunsStats' model. Specifies the Protection Runs statistics response. Attributes: num_archival_runs (long|int): Specifies the count of archival Runs. num_backup_runs (long|int): Specifies the count of b...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ProtectionRunsStats: """Implementation of the 'ProtectionRunsStats' model. Specifies the Protection Runs statistics response. Attributes: num_archival_runs (long|int): Specifies the count of archival Runs. num_backup_runs (long|int): Specifies the count of backup Runs. num_replication_runs (long|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProtectionRunsStats: """Implementation of the 'ProtectionRunsStats' model. Specifies the Protection Runs statistics response. Attributes: num_archival_runs (long|int): Specifies the count of archival Runs. num_backup_runs (long|int): Specifies the count of backup Runs. num_replication_runs (long|int): Specifi...
the_stack_v2_python_sparse
cohesity_management_sdk/models/protection_runs_stats.py
cohesity/management-sdk-python
train
24
05d7b1ba0c012909c0d8a4077fbe12f389d82909
[ "self.size = 300\nself.counter = [0] * self.size\nself.next, self.cur_time = (1, 1)", "diff = timestamp - self.cur_time\nif diff >= self.size:\n self.counter = [0] * self.size\nelse:\n diff2 = self.size - self.next - diff\n if diff2 > 0:\n self.counter[self.next:self.next + diff] = [0] * diff\n ...
<|body_start_0|> self.size = 300 self.counter = [0] * self.size self.next, self.cur_time = (1, 1) <|end_body_0|> <|body_start_1|> diff = timestamp - self.cur_time if diff >= self.size: self.counter = [0] * self.size else: diff2 = self.size - self....
HitCounter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HitCounter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def hit(self, timestamp: int) -> None: """Record a hit. @param timestamp - The current timestamp (in seconds granularity).""" <|body_1|> def getHits(self, timestamp: in...
stack_v2_sparse_classes_36k_train_018580
6,469
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Record a hit. @param timestamp - The current timestamp (in seconds granularity).", "name": "hit", "signature": "def hit(self, timestamp: int) -> None" }, { ...
3
null
Implement the Python class `HitCounter` described below. Class description: Implement the HitCounter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def hit(self, timestamp: int) -> None: Record a hit. @param timestamp - The current timestamp (in seconds granulari...
Implement the Python class `HitCounter` described below. Class description: Implement the HitCounter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def hit(self, timestamp: int) -> None: Record a hit. @param timestamp - The current timestamp (in seconds granulari...
4a1747b6497305f3821612d9c358a6795b1690da
<|skeleton|> class HitCounter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def hit(self, timestamp: int) -> None: """Record a hit. @param timestamp - The current timestamp (in seconds granularity).""" <|body_1|> def getHits(self, timestamp: in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HitCounter: def __init__(self): """Initialize your data structure here.""" self.size = 300 self.counter = [0] * self.size self.next, self.cur_time = (1, 1) def hit(self, timestamp: int) -> None: """Record a hit. @param timestamp - The current timestamp (in seconds ...
the_stack_v2_python_sparse
HashTable/q362_design_hit_counter.py
sevenhe716/LeetCode
train
0
03dd5e4d617d1587d96287217541a2f14fb6f3f1
[ "account_data = validated_data.pop('account')\naccount = User(**account_data)\naccount.set_password(account.password)\naccount.save()\nuser_profile = UserProfileModel.objects.create(account=account, **validated_data)\nreturn user_profile", "instance.profile_photo = validated_data.get('profile_photo', instance.pro...
<|body_start_0|> account_data = validated_data.pop('account') account = User(**account_data) account.set_password(account.password) account.save() user_profile = UserProfileModel.objects.create(account=account, **validated_data) return user_profile <|end_body_0|> <|body_...
The serializer for the user profile model
UserProfileSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProfileSerializer: """The serializer for the user profile model""" def create(self, validated_data): """Creates a new user profile from the request's data""" <|body_0|> def update(self, instance, validated_data): """Updates a certain user profile from the req...
stack_v2_sparse_classes_36k_train_018581
3,283
permissive
[ { "docstring": "Creates a new user profile from the request's data", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Updates a certain user profile from the request's data", "name": "update", "signature": "def update(self, instance, validated_data)" ...
2
stack_v2_sparse_classes_30k_train_007997
Implement the Python class `UserProfileSerializer` described below. Class description: The serializer for the user profile model Method signatures and docstrings: - def create(self, validated_data): Creates a new user profile from the request's data - def update(self, instance, validated_data): Updates a certain user...
Implement the Python class `UserProfileSerializer` described below. Class description: The serializer for the user profile model Method signatures and docstrings: - def create(self, validated_data): Creates a new user profile from the request's data - def update(self, instance, validated_data): Updates a certain user...
7c361a31c5225c6ad649fcf92e323bdb10cc4c16
<|skeleton|> class UserProfileSerializer: """The serializer for the user profile model""" def create(self, validated_data): """Creates a new user profile from the request's data""" <|body_0|> def update(self, instance, validated_data): """Updates a certain user profile from the req...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserProfileSerializer: """The serializer for the user profile model""" def create(self, validated_data): """Creates a new user profile from the request's data""" account_data = validated_data.pop('account') account = User(**account_data) account.set_password(account.passwo...
the_stack_v2_python_sparse
users/serializers.py
ahmed-alllam/Koshkie-Server
train
0
e7b0ac669d8868f13a4af5696315ba0bee32b59a
[ "date = data.strftime('%A')\nservice_start = self.context['service'].service_start\nif service_start:\n if service_start < data:\n return data\n else:\n raise serializers.ValidationError('The time of service end must be great than service start')\nelse:\n raise serializers.ValidationError('Th...
<|body_start_0|> date = data.strftime('%A') service_start = self.context['service'].service_start if service_start: if service_start < data: return data else: raise serializers.ValidationError('The time of service end must be great than ser...
Start the service with the time of server.
EndServiceSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EndServiceSerializer: """Start the service with the time of server.""" def validate_service_end(self, data): """Validate if the service start in the date.""" <|body_0|> def validate_is_active(self, data): """Validate if the service is in this moment active.""" ...
stack_v2_sparse_classes_36k_train_018582
6,205
permissive
[ { "docstring": "Validate if the service start in the date.", "name": "validate_service_end", "signature": "def validate_service_end(self, data)" }, { "docstring": "Validate if the service is in this moment active.", "name": "validate_is_active", "signature": "def validate_is_active(self,...
2
stack_v2_sparse_classes_30k_val_000983
Implement the Python class `EndServiceSerializer` described below. Class description: Start the service with the time of server. Method signatures and docstrings: - def validate_service_end(self, data): Validate if the service start in the date. - def validate_is_active(self, data): Validate if the service is in this...
Implement the Python class `EndServiceSerializer` described below. Class description: Start the service with the time of server. Method signatures and docstrings: - def validate_service_end(self, data): Validate if the service start in the date. - def validate_is_active(self, data): Validate if the service is in this...
5c37c6876ca13b5794ac44e0342b810426acbc76
<|skeleton|> class EndServiceSerializer: """Start the service with the time of server.""" def validate_service_end(self, data): """Validate if the service start in the date.""" <|body_0|> def validate_is_active(self, data): """Validate if the service is in this moment active.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EndServiceSerializer: """Start the service with the time of server.""" def validate_service_end(self, data): """Validate if the service start in the date.""" date = data.strftime('%A') service_start = self.context['service'].service_start if service_start: if s...
the_stack_v2_python_sparse
hisitter/services/serializers/services.py
babysitter-finder/backend
train
1
126841737e9e2420e363ae8fa32669bbe08c6de6
[ "pg.sprite.Sprite.__init__(self)\nself.filename = filename\nself.hp = 100\nself.image = pg.image.load(os.path.join('Images', self.filename))\nself.coords = [int(self.image.get_rect()[0] + scr_size[0] / 2), int(self.image.get_rect()[1] + 4 * scr_size[1] / 7)]\nself.rect = self.coords\nself.mask = pg.mask.from_surfac...
<|body_start_0|> pg.sprite.Sprite.__init__(self) self.filename = filename self.hp = 100 self.image = pg.image.load(os.path.join('Images', self.filename)) self.coords = [int(self.image.get_rect()[0] + scr_size[0] / 2), int(self.image.get_rect()[1] + 4 * scr_size[1] / 7)] s...
Dantes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dantes: def __init__(self, scr, scr_size, filename): """Dantes object class Parametrs: **scr** - game screen. **scr_size** - game screen size. **filename** - Dantes image file name.""" <|body_0|> def check_dantes_hp(self, scr, screensize): """Function that checks Dan...
stack_v2_sparse_classes_36k_train_018583
2,771
no_license
[ { "docstring": "Dantes object class Parametrs: **scr** - game screen. **scr_size** - game screen size. **filename** - Dantes image file name.", "name": "__init__", "signature": "def __init__(self, scr, scr_size, filename)" }, { "docstring": "Function that checks Dantes health points and redraw h...
3
stack_v2_sparse_classes_30k_train_000795
Implement the Python class `Dantes` described below. Class description: Implement the Dantes class. Method signatures and docstrings: - def __init__(self, scr, scr_size, filename): Dantes object class Parametrs: **scr** - game screen. **scr_size** - game screen size. **filename** - Dantes image file name. - def check...
Implement the Python class `Dantes` described below. Class description: Implement the Dantes class. Method signatures and docstrings: - def __init__(self, scr, scr_size, filename): Dantes object class Parametrs: **scr** - game screen. **scr_size** - game screen size. **filename** - Dantes image file name. - def check...
9d813cfb7995f47953d653f9c450f7921dc26fe5
<|skeleton|> class Dantes: def __init__(self, scr, scr_size, filename): """Dantes object class Parametrs: **scr** - game screen. **scr_size** - game screen size. **filename** - Dantes image file name.""" <|body_0|> def check_dantes_hp(self, scr, screensize): """Function that checks Dan...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dantes: def __init__(self, scr, scr_size, filename): """Dantes object class Parametrs: **scr** - game screen. **scr_size** - game screen size. **filename** - Dantes image file name.""" pg.sprite.Sprite.__init__(self) self.filename = filename self.hp = 100 self.image = p...
the_stack_v2_python_sparse
duel_ily_zassal/modules/fighters.py
python-practice-b02-006/Power.Rangers
train
0
b82bdafd7a5ad6ee1cf69b3eb8d2c08d04369e79
[ "self.in_column = in_column\nself.strategy = ImputerMode(strategy)\nself.window = window\nself.fill_value: Optional[int] = None\nself.nan_timestamps = None", "self.nan_timestamps = df[df[self.in_column].isna()].index\nif self.strategy == ImputerMode.zero:\n self.fill_value = 0\nelif self.strategy == ImputerMod...
<|body_start_0|> self.in_column = in_column self.strategy = ImputerMode(strategy) self.window = window self.fill_value: Optional[int] = None self.nan_timestamps = None <|end_body_0|> <|body_start_1|> self.nan_timestamps = df[df[self.in_column].isna()].index if se...
Fills Nans in series of DataFrame with zeros, previous value, average or moving average.
_OneSegmentTimeSeriesImputerTransform
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _OneSegmentTimeSeriesImputerTransform: """Fills Nans in series of DataFrame with zeros, previous value, average or moving average.""" def __init__(self, in_column: str='target', strategy: str=ImputerMode.zero, window: int=-1): """Create instance of _OneSegmentTimeSeriesImputerTransfo...
stack_v2_sparse_classes_36k_train_018584
5,793
permissive
[ { "docstring": "Create instance of _OneSegmentTimeSeriesImputerTransform. Parameters ---------- in_column: name of processed column strategy: filling value in missed dates: - If \"zero\", then replace missing dates with zeros - If \"mean\", then replace missing dates using the mean in fit stage. - If \"running_...
5
null
Implement the Python class `_OneSegmentTimeSeriesImputerTransform` described below. Class description: Fills Nans in series of DataFrame with zeros, previous value, average or moving average. Method signatures and docstrings: - def __init__(self, in_column: str='target', strategy: str=ImputerMode.zero, window: int=-1...
Implement the Python class `_OneSegmentTimeSeriesImputerTransform` described below. Class description: Fills Nans in series of DataFrame with zeros, previous value, average or moving average. Method signatures and docstrings: - def __init__(self, in_column: str='target', strategy: str=ImputerMode.zero, window: int=-1...
b2453671b00affe2af23c4b10f556f6fb5d7d602
<|skeleton|> class _OneSegmentTimeSeriesImputerTransform: """Fills Nans in series of DataFrame with zeros, previous value, average or moving average.""" def __init__(self, in_column: str='target', strategy: str=ImputerMode.zero, window: int=-1): """Create instance of _OneSegmentTimeSeriesImputerTransfo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _OneSegmentTimeSeriesImputerTransform: """Fills Nans in series of DataFrame with zeros, previous value, average or moving average.""" def __init__(self, in_column: str='target', strategy: str=ImputerMode.zero, window: int=-1): """Create instance of _OneSegmentTimeSeriesImputerTransform. Parameter...
the_stack_v2_python_sparse
etna/transforms/imputation.py
jingmouren/etna-ts
train
0
a754919e854bb13f1e283e8e8fada59e9c1298c1
[ "self.r = 0\nself.c = 0\nself.l = vec2d", "re = self.l[self.r][self.c]\nself.c += 1\nreturn re", "while self.r < len(self.l):\n if self.c < len(self.l[self.r]):\n return True\n self.r += 1\n self.c = 0\nreturn False" ]
<|body_start_0|> self.r = 0 self.c = 0 self.l = vec2d <|end_body_0|> <|body_start_1|> re = self.l[self.r][self.c] self.c += 1 return re <|end_body_1|> <|body_start_2|> while self.r < len(self.l): if self.c < len(self.l[self.r]): retur...
Vector2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_018585
1,584
no_license
[ { "docstring": "Initialize your data structure here. :type vec2d: List[List[int]]", "name": "__init__", "signature": "def __init__(self, vec2d)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext",...
3
stack_v2_sparse_classes_30k_train_012433
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool <|skeleton|> class V...
fe79161211cc08c269cde9e1fdcfed27de11f2cb
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" self.r = 0 self.c = 0 self.l = vec2d def next(self): """:rtype: int""" re = self.l[self.r][self.c] self.c += 1 return re def ha...
the_stack_v2_python_sparse
MyLeetCode/python/Flatten 2D Vector.py
ihuei801/leetcode
train
0
4bd2466bd0b7dd2a9cda0f53e216372bf9503a0a
[ "try:\n team = TeamService.get_team_by_id(team_id)\n team_dto = UpdateTeamDTO(request.get_json())\n team_dto.team_id = team_id\n team_dto.validate()\n authenticated_user_id = token_auth.current_user()\n if not TeamService.is_user_team_manager(team_id, authenticated_user_id) and (not OrganisationSe...
<|body_start_0|> try: team = TeamService.get_team_by_id(team_id) team_dto = UpdateTeamDTO(request.get_json()) team_dto.team_id = team_id team_dto.validate() authenticated_user_id = token_auth.current_user() if not TeamService.is_user_team_m...
TeamsRestAPI
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeamsRestAPI: def patch(self, team_id): """Updates a team --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - name: team_id in: path descripti...
stack_v2_sparse_classes_36k_train_018586
12,780
permissive
[ { "docstring": "Updates a team --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - name: team_id in: path description: The unique team ID required: true type: integer...
3
stack_v2_sparse_classes_30k_val_001081
Implement the Python class `TeamsRestAPI` described below. Class description: Implement the TeamsRestAPI class. Method signatures and docstrings: - def patch(self, team_id): Updates a team --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session t...
Implement the Python class `TeamsRestAPI` described below. Class description: Implement the TeamsRestAPI class. Method signatures and docstrings: - def patch(self, team_id): Updates a team --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session t...
45bf3937c74902226096aee5b49e7abea62df524
<|skeleton|> class TeamsRestAPI: def patch(self, team_id): """Updates a team --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - name: team_id in: path descripti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TeamsRestAPI: def patch(self, team_id): """Updates a team --- tags: - teams produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - name: team_id in: path description: The unique...
the_stack_v2_python_sparse
backend/api/teams/resources.py
hotosm/tasking-manager
train
526
e79cdc1c4c07313e38b00117ed064a043b55c73b
[ "self._algorithm = algorithm\nif algorithm == 'kd_tree':\n self.tree = cKDTree(data, leafsize=leafsize)\nelse:\n raise ValueError('invalid algorithm')", "if self._algorithm == 'kd_tree':\n ind = self.tree.query_ball_point(q, r)\n if len(ind) == 0:\n return (ind, 0)\n dist = scipy.spatial.min...
<|body_start_0|> self._algorithm = algorithm if algorithm == 'kd_tree': self.tree = cKDTree(data, leafsize=leafsize) else: raise ValueError('invalid algorithm') <|end_body_0|> <|body_start_1|> if self._algorithm == 'kd_tree': ind = self.tree.query_bal...
Nearest neighbor locator. Class for finding the neighbors of a points within a given distance. Parameters ---------- data : array_like, (n_sample, n_dimensions) Locations of points to be indexed. Note that if data is a C-contiguous array of dtype float64 the data will not be copied. Othersize and internal copy will be ...
NNLocator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NNLocator: """Nearest neighbor locator. Class for finding the neighbors of a points within a given distance. Parameters ---------- data : array_like, (n_sample, n_dimensions) Locations of points to be indexed. Note that if data is a C-contiguous array of dtype float64 the data will not be copied....
stack_v2_sparse_classes_36k_train_018587
31,793
permissive
[ { "docstring": "initalize.", "name": "__init__", "signature": "def __init__(self, data, leafsize=10, algorithm='kd_tree')" }, { "docstring": "Find all neighbors and distances within a given distance. Parameters ---------- q : n_dimensional tuple Point to query r : float Distance within which nei...
2
null
Implement the Python class `NNLocator` described below. Class description: Nearest neighbor locator. Class for finding the neighbors of a points within a given distance. Parameters ---------- data : array_like, (n_sample, n_dimensions) Locations of points to be indexed. Note that if data is a C-contiguous array of dty...
Implement the Python class `NNLocator` described below. Class description: Nearest neighbor locator. Class for finding the neighbors of a points within a given distance. Parameters ---------- data : array_like, (n_sample, n_dimensions) Locations of points to be indexed. Note that if data is a C-contiguous array of dty...
172bbcf1cf3bcdb953c76ebae72c27c95dc2e606
<|skeleton|> class NNLocator: """Nearest neighbor locator. Class for finding the neighbors of a points within a given distance. Parameters ---------- data : array_like, (n_sample, n_dimensions) Locations of points to be indexed. Note that if data is a C-contiguous array of dtype float64 the data will not be copied....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NNLocator: """Nearest neighbor locator. Class for finding the neighbors of a points within a given distance. Parameters ---------- data : array_like, (n_sample, n_dimensions) Locations of points to be indexed. Note that if data is a C-contiguous array of dtype float64 the data will not be copied. Othersize an...
the_stack_v2_python_sparse
pyart/map/grid_mapper.py
ARM-DOE/pyart
train
455
1b7f7a781a846c0a13ccfe7431fbc1f0d264326f
[ "self._init_fn = jax.jit(init_fn, device=self._device)\nself._apply_fn = apply_fn\nself._sample_fn = jax.jit(self._sample, device=self._device)", "batch_size, sample_len = x.shape\n\ndef one_step(params, state, rng, i, x):\n step_sample = jax.lax.dynamic_slice(x, [0, i], [batch_size, 1])\n rng, rng_ = jax.r...
<|body_start_0|> self._init_fn = jax.jit(init_fn, device=self._device) self._apply_fn = apply_fn self._sample_fn = jax.jit(self._sample, device=self._device) <|end_body_0|> <|body_start_1|> batch_size, sample_len = x.shape def one_step(params, state, rng, i, x): ste...
Sampling from the TransformerXL model.
Bow2TextTransformerSampler
[ "CC-BY-SA-4.0", "CC-BY-4.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bow2TextTransformerSampler: """Sampling from the TransformerXL model.""" def _jit_model(self, init_fn, apply_fn): """Jit `init_fn` and `apply_fn`, the latter is used in `self._sample`.""" <|body_0|> def _sample(self, params: Mapping[str, Any], state: Mapping[str, Any], r...
stack_v2_sparse_classes_36k_train_018588
12,853
permissive
[ { "docstring": "Jit `init_fn` and `apply_fn`, the latter is used in `self._sample`.", "name": "_jit_model", "signature": "def _jit_model(self, init_fn, apply_fn)" }, { "docstring": "Generate samples conditioned on the bag-of-words of the graph. Args: params: parameters of the transformer. state:...
3
null
Implement the Python class `Bow2TextTransformerSampler` described below. Class description: Sampling from the TransformerXL model. Method signatures and docstrings: - def _jit_model(self, init_fn, apply_fn): Jit `init_fn` and `apply_fn`, the latter is used in `self._sample`. - def _sample(self, params: Mapping[str, A...
Implement the Python class `Bow2TextTransformerSampler` described below. Class description: Sampling from the TransformerXL model. Method signatures and docstrings: - def _jit_model(self, init_fn, apply_fn): Jit `init_fn` and `apply_fn`, the latter is used in `self._sample`. - def _sample(self, params: Mapping[str, A...
a6ef8053380d6aa19aaae14b93f013ae9762d057
<|skeleton|> class Bow2TextTransformerSampler: """Sampling from the TransformerXL model.""" def _jit_model(self, init_fn, apply_fn): """Jit `init_fn` and `apply_fn`, the latter is used in `self._sample`.""" <|body_0|> def _sample(self, params: Mapping[str, Any], state: Mapping[str, Any], r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bow2TextTransformerSampler: """Sampling from the TransformerXL model.""" def _jit_model(self, init_fn, apply_fn): """Jit `init_fn` and `apply_fn`, the latter is used in `self._sample`.""" self._init_fn = jax.jit(init_fn, device=self._device) self._apply_fn = apply_fn self....
the_stack_v2_python_sparse
wikigraphs/wikigraphs/model/sampler.py
sethuramanio/deepmind-research
train
1
a7a99f8b33a8c8b8e47e6bd2b48e38a94b444e18
[ "super(Location_Box_Loss, self).__init__()\nself.prior_w = prior_w\nself.prior_cx = prior_cx\nself.prior_cy = prior_cy\nself.size_variance = size_variance\nself.center_variance = center_variance", "ww_gt = gt_box[:, 2] - gt_box[:, 0]\nhh_gt = gt_box[:, 3] - gt_box[:, 1]\nxx_gt_tr = (gt_box[:, 2] + gt_box[:, 0]) /...
<|body_start_0|> super(Location_Box_Loss, self).__init__() self.prior_w = prior_w self.prior_cx = prior_cx self.prior_cy = prior_cy self.size_variance = size_variance self.center_variance = center_variance <|end_body_0|> <|body_start_1|> ww_gt = gt_box[:, 2] - gt...
Location_Box_Loss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Location_Box_Loss: def __init__(self, prior_w=0.5, prior_cx=0.5, prior_cy=0.5, size_variance=0.1, center_variance=0.1): """Implement Loss of box locolization smooth L1 regression loss.""" <|body_0|> def forward(self, gt_box, predicted_vec): """# predicted_vec x_cente...
stack_v2_sparse_classes_36k_train_018589
7,988
permissive
[ { "docstring": "Implement Loss of box locolization smooth L1 regression loss.", "name": "__init__", "signature": "def __init__(self, prior_w=0.5, prior_cx=0.5, prior_cy=0.5, size_variance=0.1, center_variance=0.1)" }, { "docstring": "# predicted_vec x_center(-1,1) /center_variance y_center(-1,1)...
2
null
Implement the Python class `Location_Box_Loss` described below. Class description: Implement the Location_Box_Loss class. Method signatures and docstrings: - def __init__(self, prior_w=0.5, prior_cx=0.5, prior_cy=0.5, size_variance=0.1, center_variance=0.1): Implement Loss of box locolization smooth L1 regression los...
Implement the Python class `Location_Box_Loss` described below. Class description: Implement the Location_Box_Loss class. Method signatures and docstrings: - def __init__(self, prior_w=0.5, prior_cx=0.5, prior_cy=0.5, size_variance=0.1, center_variance=0.1): Implement Loss of box locolization smooth L1 regression los...
e6c09414c49e695b0f4221a3c6245ae3929a1788
<|skeleton|> class Location_Box_Loss: def __init__(self, prior_w=0.5, prior_cx=0.5, prior_cy=0.5, size_variance=0.1, center_variance=0.1): """Implement Loss of box locolization smooth L1 regression loss.""" <|body_0|> def forward(self, gt_box, predicted_vec): """# predicted_vec x_cente...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Location_Box_Loss: def __init__(self, prior_w=0.5, prior_cx=0.5, prior_cy=0.5, size_variance=0.1, center_variance=0.1): """Implement Loss of box locolization smooth L1 regression loss.""" super(Location_Box_Loss, self).__init__() self.prior_w = prior_w self.prior_cx = prior_cx ...
the_stack_v2_python_sparse
modeling/location_box_loss.py
zyxwvu321/Classifer_SSL_Longtail
train
0
76f4445f69177a8bcd6e24c64d6af791aa61a891
[ "device_id = None\nif self.device():\n device_id = self.device().idx_uid()\nreturn device_id", "description = None\nif self.description:\n description = self.description\nreturn description" ]
<|body_start_0|> device_id = None if self.device(): device_id = self.device().idx_uid() return device_id <|end_body_0|> <|body_start_1|> description = None if self.description: description = self.description return description <|end_body_1|>
ComponentIndexable
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComponentIndexable: def idx_deviceId(self): """device the component belongs to""" <|body_0|> def idx_description(self): """description of the component""" <|body_1|> <|end_skeleton|> <|body_start_0|> device_id = None if self.device(): ...
stack_v2_sparse_classes_36k_train_018590
26,766
no_license
[ { "docstring": "device the component belongs to", "name": "idx_deviceId", "signature": "def idx_deviceId(self)" }, { "docstring": "description of the component", "name": "idx_description", "signature": "def idx_description(self)" } ]
2
null
Implement the Python class `ComponentIndexable` described below. Class description: Implement the ComponentIndexable class. Method signatures and docstrings: - def idx_deviceId(self): device the component belongs to - def idx_description(self): description of the component
Implement the Python class `ComponentIndexable` described below. Class description: Implement the ComponentIndexable class. Method signatures and docstrings: - def idx_deviceId(self): device the component belongs to - def idx_description(self): description of the component <|skeleton|> class ComponentIndexable: ...
1ea508c3d2b51742bc3b448c445cd0a3dba9e798
<|skeleton|> class ComponentIndexable: def idx_deviceId(self): """device the component belongs to""" <|body_0|> def idx_description(self): """description of the component""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComponentIndexable: def idx_deviceId(self): """device the component belongs to""" device_id = None if self.device(): device_id = self.device().idx_uid() return device_id def idx_description(self): """description of the component""" description =...
the_stack_v2_python_sparse
Products/Zuul/catalog/indexable.py
zenoss/zenoss-prodbin
train
27
1cc5847563b3606fc337946683b75fb15e332235
[ "self.id = id\nself.created_date = created_date\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nid = dictionary.get('id')\ncreated_date = dictionary.get('createdDate')\nfor key in cls._names.values():\n if key in dictionary:\n del dictionary[key]\nreturn c...
<|body_start_0|> self.id = id self.created_date = created_date self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None id = dictionary.get('id') created_date = dictionary.get('createdDate') ...
Implementation of the 'Create TxPush Test Transaction Response' model. Response for TxPush test transaction Attributes: id (long|int): The ID of the new transaction record created_date (long|int): A timestamp of when the transaction was added (see Handling Dates and Times)
CreateTxpushTestTransactionResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateTxpushTestTransactionResponse: """Implementation of the 'Create TxPush Test Transaction Response' model. Response for TxPush test transaction Attributes: id (long|int): The ID of the new transaction record created_date (long|int): A timestamp of when the transaction was added (see Handling ...
stack_v2_sparse_classes_36k_train_018591
2,019
permissive
[ { "docstring": "Constructor for the CreateTxpushTestTransactionResponse class", "name": "__init__", "signature": "def __init__(self, id=None, created_date=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dict...
2
stack_v2_sparse_classes_30k_train_011575
Implement the Python class `CreateTxpushTestTransactionResponse` described below. Class description: Implementation of the 'Create TxPush Test Transaction Response' model. Response for TxPush test transaction Attributes: id (long|int): The ID of the new transaction record created_date (long|int): A timestamp of when t...
Implement the Python class `CreateTxpushTestTransactionResponse` described below. Class description: Implementation of the 'Create TxPush Test Transaction Response' model. Response for TxPush test transaction Attributes: id (long|int): The ID of the new transaction record created_date (long|int): A timestamp of when t...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class CreateTxpushTestTransactionResponse: """Implementation of the 'Create TxPush Test Transaction Response' model. Response for TxPush test transaction Attributes: id (long|int): The ID of the new transaction record created_date (long|int): A timestamp of when the transaction was added (see Handling ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateTxpushTestTransactionResponse: """Implementation of the 'Create TxPush Test Transaction Response' model. Response for TxPush test transaction Attributes: id (long|int): The ID of the new transaction record created_date (long|int): A timestamp of when the transaction was added (see Handling Dates and Tim...
the_stack_v2_python_sparse
finicityapi/models/create_txpush_test_transaction_response.py
monarchmoney/finicity-python
train
0
9e7a32ae9f6da41d06b0a066bc8fd2ff2d931ced
[ "for testvalue, expected in self.knownvalues:\n p = project.Project()\n for d in self.directions:\n for s in self.seasons:\n for f in self.frames:\n for l in self.layers:\n result = p.image_path(d, s, f, l, testvalue, validate=True)\n self...
<|body_start_0|> for testvalue, expected in self.knownvalues: p = project.Project() for d in self.directions: for s in self.seasons: for f in self.frames: for l in self.layers: result = p.image_path(d...
Test image path validator and image path settings
image_path
[ "BSD-2-Clause", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class image_path: """Test image path validator and image path settings""" def test_knownvalues_validate(self): """Test that known values are validated correctly""" <|body_0|> def test_knownvalues_set(self): """Test that known values are set correctly""" <|body_...
stack_v2_sparse_classes_36k_train_018592
3,994
permissive
[ { "docstring": "Test that known values are validated correctly", "name": "test_knownvalues_validate", "signature": "def test_knownvalues_validate(self)" }, { "docstring": "Test that known values are set correctly", "name": "test_knownvalues_set", "signature": "def test_knownvalues_set(se...
3
stack_v2_sparse_classes_30k_val_000338
Implement the Python class `image_path` described below. Class description: Test image path validator and image path settings Method signatures and docstrings: - def test_knownvalues_validate(self): Test that known values are validated correctly - def test_knownvalues_set(self): Test that known values are set correct...
Implement the Python class `image_path` described below. Class description: Test image path validator and image path settings Method signatures and docstrings: - def test_knownvalues_validate(self): Test that known values are validated correctly - def test_knownvalues_set(self): Test that known values are set correct...
307a9de864566fece1a999888e19048aeef9734c
<|skeleton|> class image_path: """Test image path validator and image path settings""" def test_knownvalues_validate(self): """Test that known values are validated correctly""" <|body_0|> def test_knownvalues_set(self): """Test that known values are set correctly""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class image_path: """Test image path validator and image path settings""" def test_knownvalues_validate(self): """Test that known values are validated correctly""" for testvalue, expected in self.knownvalues: p = project.Project() for d in self.directions: ...
the_stack_v2_python_sparse
project_test.py
An-dz/tilecutter
train
4
a323697bcb1dd0fc10d482b2558083b79d61be76
[ "self.Ch2P2_19a = '010'\nself.Ch2P2_19b = '017'\nself.Ch2P2_19c = '006'\nself.Ch2P_20a = '014'\nself.Ch2P_20b = '008'\nself.Ch2P_20c = '013'\nself.Ch2P_20d = '004'\nself.Ch2P_22a = '00010001 11101010 00100010 00001110'\nself.Ch2P_22b = '00001110 00111000 11101010 00111000'\nself.Ch2P_22c = '01101110 00001110 001110...
<|body_start_0|> self.Ch2P2_19a = '010' self.Ch2P2_19b = '017' self.Ch2P2_19c = '006' self.Ch2P_20a = '014' self.Ch2P_20b = '008' self.Ch2P_20c = '013' self.Ch2P_20d = '004' self.Ch2P_22a = '00010001 11101010 00100010 00001110' self.Ch2P_22b = '000...
HW02
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HW02: def ch2(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。 #作業 2. 課本 Ch2. P2.19""" <|body_0|> def ch3(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch3P3_28a = "xxx" 意思是 ...
stack_v2_sparse_classes_36k_train_018593
2,288
no_license
[ { "docstring": "請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = \"xxx\" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 \"xxx\" : 你要填入你的答地方。 #作業 2. 課本 Ch2. P2.19", "name": "ch2", "signature": "def ch2(self)" }, { "docstring": "請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch3P3_28a = \"xxx\" 意思...
2
null
Implement the Python class `HW02` described below. Class description: Implement the HW02 class. Method signatures and docstrings: - def ch2(self): 請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。 #作業 2. 課本 Ch2. P2.19 - def ch3(s...
Implement the Python class `HW02` described below. Class description: Implement the HW02 class. Method signatures and docstrings: - def ch2(self): 請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。 #作業 2. 課本 Ch2. P2.19 - def ch3(s...
008575d161d48672f906bdaec130f0c5060cd36d
<|skeleton|> class HW02: def ch2(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。 #作業 2. 課本 Ch2. P2.19""" <|body_0|> def ch3(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch3P3_28a = "xxx" 意思是 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HW02: def ch2(self): """請將你計算出來的答案填入以下變數,助教會寫程式自動批改。 Ch2P2_19a = "xxx" 意思是 Ch2 : 第二章 P2_19a: 第二章結尾處的 PRACTICE SET 段落處的 Problems 第 P2-19 題的 a 小題 "xxx" : 你要填入你的答地方。 #作業 2. 課本 Ch2. P2.19""" self.Ch2P2_19a = '010' self.Ch2P2_19b = '017' self.Ch2P2_19c = '006' self.Ch2P_20a ...
the_stack_v2_python_sparse
homework02_B05505045.py
PeterWolf-tw/ESOE-CS101-2016
train
21
1e7618ebe6ba93d2b846688dd14547a1244c3281
[ "INT_MAX = 3001\n\ndef helper(arr, cur):\n if len(arr) == 1:\n return cur\n elif len(arr) < k:\n return -1\n n = len(arr)\n moves = INT_MAX\n cnt = 0\n for j in range(k - 1):\n cnt += arr[j]\n for i in range(n - k + 1):\n cnt += arr[i + k - 1]\n moves = min(mo...
<|body_start_0|> INT_MAX = 3001 def helper(arr, cur): if len(arr) == 1: return cur elif len(arr) < k: return -1 n = len(arr) moves = INT_MAX cnt = 0 for j in range(k - 1): cnt += arr[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeStones(self, stones, k): """:type stones: List[int] :type k: int :rtype: int""" <|body_0|> def mergeStones2(self, stones, k): """:type stones: List[int] :type k: int :rtype: int""" <|body_1|> def mergeStones3(self, stones, k): ...
stack_v2_sparse_classes_36k_train_018594
5,379
no_license
[ { "docstring": ":type stones: List[int] :type k: int :rtype: int", "name": "mergeStones", "signature": "def mergeStones(self, stones, k)" }, { "docstring": ":type stones: List[int] :type k: int :rtype: int", "name": "mergeStones2", "signature": "def mergeStones2(self, stones, k)" }, ...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeStones(self, stones, k): :type stones: List[int] :type k: int :rtype: int - def mergeStones2(self, stones, k): :type stones: List[int] :type k: int :rtype: int - def mer...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeStones(self, stones, k): :type stones: List[int] :type k: int :rtype: int - def mergeStones2(self, stones, k): :type stones: List[int] :type k: int :rtype: int - def mer...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def mergeStones(self, stones, k): """:type stones: List[int] :type k: int :rtype: int""" <|body_0|> def mergeStones2(self, stones, k): """:type stones: List[int] :type k: int :rtype: int""" <|body_1|> def mergeStones3(self, stones, k): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeStones(self, stones, k): """:type stones: List[int] :type k: int :rtype: int""" INT_MAX = 3001 def helper(arr, cur): if len(arr) == 1: return cur elif len(arr) < k: return -1 n = len(arr) ...
the_stack_v2_python_sparse
M/MinimumCosttoMergeStones.py
bssrdf/pyleet
train
2
1e875bddc2fc85562802f313571262e3b969a862
[ "if n == 0:\n return 1\ncount = 0\nfor i in xrange(10 ** n):\n if len(set(str(i))) == len(str(i)):\n count += 1\nreturn count", "if n == 0:\n return 1\nnums = 1\ntotal = 1\ndp = [9, 9, 8, 7, 6, 5, 4, 3, 2, 1]\nfor i in dp[:n]:\n nums *= i\n total += nums\nreturn total", "if n == 0:\n re...
<|body_start_0|> if n == 0: return 1 count = 0 for i in xrange(10 ** n): if len(set(str(i))) == len(str(i)): count += 1 return count <|end_body_0|> <|body_start_1|> if n == 0: return 1 nums = 1 total = 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countNumbersWithUniqueDigits_TLE(self, n): """:type n: int :rtype: int""" <|body_0|> def countNumbersWithUniqueDigits(self, n): """:type n: int :rtype: int""" <|body_1|> def countNumbersWithUniqueDigits2(self, n): """:type n: int :r...
stack_v2_sparse_classes_36k_train_018595
2,619
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "countNumbersWithUniqueDigits_TLE", "signature": "def countNumbersWithUniqueDigits_TLE(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "countNumbersWithUniqueDigits", "signature": "def countNumbersWithUniqueDigits(self, n...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countNumbersWithUniqueDigits_TLE(self, n): :type n: int :rtype: int - def countNumbersWithUniqueDigits(self, n): :type n: int :rtype: int - def countNumbersWithUniqueDigits2(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countNumbersWithUniqueDigits_TLE(self, n): :type n: int :rtype: int - def countNumbersWithUniqueDigits(self, n): :type n: int :rtype: int - def countNumbersWithUniqueDigits2(...
2d5fa4cd696d5035ea8859befeadc5cc436959c9
<|skeleton|> class Solution: def countNumbersWithUniqueDigits_TLE(self, n): """:type n: int :rtype: int""" <|body_0|> def countNumbersWithUniqueDigits(self, n): """:type n: int :rtype: int""" <|body_1|> def countNumbersWithUniqueDigits2(self, n): """:type n: int :r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countNumbersWithUniqueDigits_TLE(self, n): """:type n: int :rtype: int""" if n == 0: return 1 count = 0 for i in xrange(10 ** n): if len(set(str(i))) == len(str(i)): count += 1 return count def countNumbersWithU...
the_stack_v2_python_sparse
SourceCode/Python/Problem/00357.Count Numbers with Unique Digits.py
roger6blog/LeetCode
train
0
128ef5d80c9748b0e88f2b4bdd1bfcbfefcefd1f
[ "self.db = SqliteDB()\nself.code_list = []\nself.data = self.get_data()\nself.data_for_table = {}", "with self.db as cur:\n cur.execute('SELECT * FROM salaries')\nreturn cur.fetchall()", "for string in self.data:\n if string[1] not in self.code_list:\n self.code_list.append(string[1])\nfor i in sel...
<|body_start_0|> self.db = SqliteDB() self.code_list = [] self.data = self.get_data() self.data_for_table = {} <|end_body_0|> <|body_start_1|> with self.db as cur: cur.execute('SELECT * FROM salaries') return cur.fetchall() <|end_body_1|> <|body_start_2|> ...
Класс, рассчитывающий общую численность персонала по категориям
PersonelSummary
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersonelSummary: """Класс, рассчитывающий общую численность персонала по категориям""" def __init__(self) -> None: """Метод инициализации класса""" <|body_0|> def get_data(self) -> tuple: """Метод, получающий из БД данные о всех записях :return: self.cur.fetchall...
stack_v2_sparse_classes_36k_train_018596
3,002
no_license
[ { "docstring": "Метод инициализации класса", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Метод, получающий из БД данные о всех записях :return: self.cur.fetchall() - список с результами запроса", "name": "get_data", "signature": "def get_data(self) ->...
4
stack_v2_sparse_classes_30k_train_005517
Implement the Python class `PersonelSummary` described below. Class description: Класс, рассчитывающий общую численность персонала по категориям Method signatures and docstrings: - def __init__(self) -> None: Метод инициализации класса - def get_data(self) -> tuple: Метод, получающий из БД данные о всех записях :retu...
Implement the Python class `PersonelSummary` described below. Class description: Класс, рассчитывающий общую численность персонала по категориям Method signatures and docstrings: - def __init__(self) -> None: Метод инициализации класса - def get_data(self) -> tuple: Метод, получающий из БД данные о всех записях :retu...
f63d5db6780cc02cb064e70d2076eba94cb45785
<|skeleton|> class PersonelSummary: """Класс, рассчитывающий общую численность персонала по категориям""" def __init__(self) -> None: """Метод инициализации класса""" <|body_0|> def get_data(self) -> tuple: """Метод, получающий из БД данные о всех записях :return: self.cur.fetchall...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PersonelSummary: """Класс, рассчитывающий общую численность персонала по категориям""" def __init__(self) -> None: """Метод инициализации класса""" self.db = SqliteDB() self.code_list = [] self.data = self.get_data() self.data_for_table = {} def get_data(self)...
the_stack_v2_python_sparse
counting/personel_summary.py
Pheeneek/Salary
train
0
77838437d58b03a23534a0acff77a335ef016086
[ "if sent_tokenizer:\n self.sent_tokenizer = sent_tokenizer()\nelse:\n punkt_param = PunktParameters()\n self.sent_tokenizer = PunktSentenceTokenizer(punkt_param)", "sents = self.sent_tokenizer.tokenize(text)\ntokenizer = TreebankWordTokenizer()\nreturn [item for sublist in tokenizer.tokenize_sents(sents)...
<|body_start_0|> if sent_tokenizer: self.sent_tokenizer = sent_tokenizer() else: punkt_param = PunktParameters() self.sent_tokenizer = PunktSentenceTokenizer(punkt_param) <|end_body_0|> <|body_start_1|> sents = self.sent_tokenizer.tokenize(text) token...
Class for punkt word tokenization
PunktWordTokenizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PunktWordTokenizer: """Class for punkt word tokenization""" def __init__(self, sent_tokenizer: object=None): """:param language : language for sentences tokenization :type language: str""" <|body_0|> def tokenize(self, text: str): """:rtype: list :param text: tex...
stack_v2_sparse_classes_36k_train_018597
3,603
permissive
[ { "docstring": ":param language : language for sentences tokenization :type language: str", "name": "__init__", "signature": "def __init__(self, sent_tokenizer: object=None)" }, { "docstring": ":rtype: list :param text: text to be tokenized into sentences :type text: str", "name": "tokenize"...
2
null
Implement the Python class `PunktWordTokenizer` described below. Class description: Class for punkt word tokenization Method signatures and docstrings: - def __init__(self, sent_tokenizer: object=None): :param language : language for sentences tokenization :type language: str - def tokenize(self, text: str): :rtype: ...
Implement the Python class `PunktWordTokenizer` described below. Class description: Class for punkt word tokenization Method signatures and docstrings: - def __init__(self, sent_tokenizer: object=None): :param language : language for sentences tokenization :type language: str - def tokenize(self, text: str): :rtype: ...
8a122113d2509aef85bebba8e2c303471c107ff4
<|skeleton|> class PunktWordTokenizer: """Class for punkt word tokenization""" def __init__(self, sent_tokenizer: object=None): """:param language : language for sentences tokenization :type language: str""" <|body_0|> def tokenize(self, text: str): """:rtype: list :param text: tex...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PunktWordTokenizer: """Class for punkt word tokenization""" def __init__(self, sent_tokenizer: object=None): """:param language : language for sentences tokenization :type language: str""" if sent_tokenizer: self.sent_tokenizer = sent_tokenizer() else: punk...
the_stack_v2_python_sparse
src/cltk/tokenizers/word.py
cltk/cltk
train
847
a6dfa7eef2478d97fb1b4afa371bc0faf333833d
[ "self.original_patch_size = patch_size * 2\nkwargs['transforms'] = _Transform(K.CenterCrop(patch_size))\nsuper().__init__(ChesapeakeCVPR, batch_size, patch_size, length, num_workers, **kwargs)\nassert class_set in [5, 7]\nif use_prior_labels and class_set == 7:\n raise ValueError('The pre-generated prior labels ...
<|body_start_0|> self.original_patch_size = patch_size * 2 kwargs['transforms'] = _Transform(K.CenterCrop(patch_size)) super().__init__(ChesapeakeCVPR, batch_size, patch_size, length, num_workers, **kwargs) assert class_set in [5, 7] if use_prior_labels and class_set == 7: ...
LightningDataModule implementation for the Chesapeake CVPR Land Cover dataset. Uses the random splits defined per state to partition tiles into train, val, and test sets.
ChesapeakeCVPRDataModule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChesapeakeCVPRDataModule: """LightningDataModule implementation for the Chesapeake CVPR Land Cover dataset. Uses the random splits defined per state to partition tiles into train, val, and test sets.""" def __init__(self, train_splits: list[str], val_splits: list[str], test_splits: list[str]...
stack_v2_sparse_classes_36k_train_018598
6,692
permissive
[ { "docstring": "Initialize a new ChesapeakeCVPRDataModule instance. Args: train_splits: Splits used to train the model, e.g., [\"ny-train\"]. val_splits: Splits used to validate the model, e.g., [\"ny-val\"]. test_splits: Splits used to test the model, e.g., [\"ny-test\"]. batch_size: Size of each mini-batch. p...
3
stack_v2_sparse_classes_30k_train_002534
Implement the Python class `ChesapeakeCVPRDataModule` described below. Class description: LightningDataModule implementation for the Chesapeake CVPR Land Cover dataset. Uses the random splits defined per state to partition tiles into train, val, and test sets. Method signatures and docstrings: - def __init__(self, tr...
Implement the Python class `ChesapeakeCVPRDataModule` described below. Class description: LightningDataModule implementation for the Chesapeake CVPR Land Cover dataset. Uses the random splits defined per state to partition tiles into train, val, and test sets. Method signatures and docstrings: - def __init__(self, tr...
29985861614b3b93f9ef5389469ebb98570de7dd
<|skeleton|> class ChesapeakeCVPRDataModule: """LightningDataModule implementation for the Chesapeake CVPR Land Cover dataset. Uses the random splits defined per state to partition tiles into train, val, and test sets.""" def __init__(self, train_splits: list[str], val_splits: list[str], test_splits: list[str]...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChesapeakeCVPRDataModule: """LightningDataModule implementation for the Chesapeake CVPR Land Cover dataset. Uses the random splits defined per state to partition tiles into train, val, and test sets.""" def __init__(self, train_splits: list[str], val_splits: list[str], test_splits: list[str], batch_size:...
the_stack_v2_python_sparse
torchgeo/datamodules/chesapeake.py
microsoft/torchgeo
train
1,724
67191c9d2aa72935e6e6504f77821b3c72c70711
[ "if not len(viewports) > 0:\n raise Exception('Must provide at least one viewport for MegaViewport!')\nself.viewports = viewports\nself.arc_width = arc_width\nx_min = 16384\ny_min = 16384\nx_max = 0\ny_max = 0\nfor viewport in viewports:\n geometry = ManagedWindow.lookup_viewport_geometry(viewport)\n x_min...
<|body_start_0|> if not len(viewports) > 0: raise Exception('Must provide at least one viewport for MegaViewport!') self.viewports = viewports self.arc_width = arc_width x_min = 16384 y_min = 16384 x_max = 0 y_max = 0 for viewport in viewports:...
Helper for converting angular offsets to viewport coordinates across the span of all viewports. It is assumed that: * All given viewports have the same dimensions. * The pointing device is located roughly at the center of the cylinder.
MegaViewport
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MegaViewport: """Helper for converting angular offsets to viewport coordinates across the span of all viewports. It is assumed that: * All given viewports have the same dimensions. * The pointing device is located roughly at the center of the cylinder.""" def __init__(self, viewports, arc_wi...
stack_v2_sparse_classes_36k_train_018599
3,416
permissive
[ { "docstring": "Args: viewports (list[str]): List of viewports from left to right. arc_width (float): Physical arc width of all viewports in radians. Raises: Exception: No viewports provided.", "name": "__init__", "signature": "def __init__(self, viewports, arc_width)" }, { "docstring": "Convert...
3
stack_v2_sparse_classes_30k_train_004735
Implement the Python class `MegaViewport` described below. Class description: Helper for converting angular offsets to viewport coordinates across the span of all viewports. It is assumed that: * All given viewports have the same dimensions. * The pointing device is located roughly at the center of the cylinder. Meth...
Implement the Python class `MegaViewport` described below. Class description: Helper for converting angular offsets to viewport coordinates across the span of all viewports. It is assumed that: * All given viewports have the same dimensions. * The pointing device is located roughly at the center of the cylinder. Meth...
90233b939bb4873c00a72e84ab3f8d1a776edee8
<|skeleton|> class MegaViewport: """Helper for converting angular offsets to viewport coordinates across the span of all viewports. It is assumed that: * All given viewports have the same dimensions. * The pointing device is located roughly at the center of the cylinder.""" def __init__(self, viewports, arc_wi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MegaViewport: """Helper for converting angular offsets to viewport coordinates across the span of all viewports. It is assumed that: * All given viewports have the same dimensions. * The pointing device is located roughly at the center of the cylinder.""" def __init__(self, viewports, arc_width): ...
the_stack_v2_python_sparse
lg_pointer/src/lg_pointer/megaviewport.py
EndPointCorp/lg_ros_nodes
train
18