blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2f5431ff48b1ec9144b37c5220fc2ad296c24d58 | [
"super().__init__(with_jokers=with_jokers)\nif with_jokers:\n for _ in range(2):\n self._cards.append(Card(JOKER_RANK, JOKER_SUIT))\nfor suit in POSSIBLE_SUIT:\n for rank in POSSIBLE_RANK:\n self._cards.append(Card(rank, suit))",
"total_possible_cards = 2 * (13 * 4 + (2 if self._with_jokers el... | <|body_start_0|>
super().__init__(with_jokers=with_jokers)
if with_jokers:
for _ in range(2):
self._cards.append(Card(JOKER_RANK, JOKER_SUIT))
for suit in POSSIBLE_SUIT:
for rank in POSSIBLE_RANK:
self._cards.append(Card(rank, suit))
<|end_... | A DoubleDeck object A new double deck starts out ordered. If jokers are included, contains 2 * (2 + 4 * 13) :class:`deck_of_cards.card.Card` objects If no jokers are included, contains 2 * (4 * 13) :class:`deck_of_cards.card.Card` objects | DoubleDeck | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DoubleDeck:
"""A DoubleDeck object A new double deck starts out ordered. If jokers are included, contains 2 * (2 + 4 * 13) :class:`deck_of_cards.card.Card` objects If no jokers are included, contains 2 * (4 * 13) :class:`deck_of_cards.card.Card` objects"""
def __init__(self, with_jokers=True... | stack_v2_sparse_classes_75kplus_train_001700 | 2,704 | no_license | [
{
"docstring": ":param bool with_jokers: include jokers if True",
"name": "__init__",
"signature": "def __init__(self, with_jokers=True)"
},
{
"docstring": "Check to make sure all the cards are accounted :returns: True if all cards are accounted :rtype: bool",
"name": "check_deck",
"sign... | 2 | stack_v2_sparse_classes_30k_train_006634 | Implement the Python class `DoubleDeck` described below.
Class description:
A DoubleDeck object A new double deck starts out ordered. If jokers are included, contains 2 * (2 + 4 * 13) :class:`deck_of_cards.card.Card` objects If no jokers are included, contains 2 * (4 * 13) :class:`deck_of_cards.card.Card` objects
Met... | Implement the Python class `DoubleDeck` described below.
Class description:
A DoubleDeck object A new double deck starts out ordered. If jokers are included, contains 2 * (2 + 4 * 13) :class:`deck_of_cards.card.Card` objects If no jokers are included, contains 2 * (4 * 13) :class:`deck_of_cards.card.Card` objects
Met... | 3cf666cb7f88fb0e317401b0c017c30fa742aead | <|skeleton|>
class DoubleDeck:
"""A DoubleDeck object A new double deck starts out ordered. If jokers are included, contains 2 * (2 + 4 * 13) :class:`deck_of_cards.card.Card` objects If no jokers are included, contains 2 * (4 * 13) :class:`deck_of_cards.card.Card` objects"""
def __init__(self, with_jokers=True... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DoubleDeck:
"""A DoubleDeck object A new double deck starts out ordered. If jokers are included, contains 2 * (2 + 4 * 13) :class:`deck_of_cards.card.Card` objects If no jokers are included, contains 2 * (4 * 13) :class:`deck_of_cards.card.Card` objects"""
def __init__(self, with_jokers=True):
""... | the_stack_v2_python_sparse | base/cards/double_deck.py | MichielRuelens/Canasta | train | 0 |
afcae8b1ab8f18f8f5a7fd099267f0a9c9f25ebe | [
"encoder_name = config.model_config.encoder_name\nencoder_class = encoder_registry.get_registered_encoder(encoder_name)\nencoder_variables = encoder_class.load_weights(config)\nmodel_variables = {}\nfor group_key in encoder_variables:\n model_variables[group_key] = {'encoder': encoder_variables[group_key]}\nretu... | <|body_start_0|>
encoder_name = config.model_config.encoder_name
encoder_class = encoder_registry.get_registered_encoder(encoder_name)
encoder_variables = encoder_class.load_weights(config)
model_variables = {}
for group_key in encoder_variables:
model_variables[group... | Task with base methods for downstream evaluations for a mention encoder. | DownstreamEncoderTask | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DownstreamEncoderTask:
"""Task with base methods for downstream evaluations for a mention encoder."""
def load_weights(cls, config: ml_collections.ConfigDict) -> Dict[str, Any]:
"""Load model weights from file. We assume that `encoder_name` is specified in the config. We use correspo... | stack_v2_sparse_classes_75kplus_train_001701 | 3,633 | permissive | [
{
"docstring": "Load model weights from file. We assume that `encoder_name` is specified in the config. We use corresponding class to load encoder weights. Args: config: experiment config. Returns: Dictionary of model weights.",
"name": "load_weights",
"signature": "def load_weights(cls, config: ml_coll... | 3 | stack_v2_sparse_classes_30k_train_022986 | Implement the Python class `DownstreamEncoderTask` described below.
Class description:
Task with base methods for downstream evaluations for a mention encoder.
Method signatures and docstrings:
- def load_weights(cls, config: ml_collections.ConfigDict) -> Dict[str, Any]: Load model weights from file. We assume that `... | Implement the Python class `DownstreamEncoderTask` described below.
Class description:
Task with base methods for downstream evaluations for a mention encoder.
Method signatures and docstrings:
- def load_weights(cls, config: ml_collections.ConfigDict) -> Dict[str, Any]: Load model weights from file. We assume that `... | ac9447064195e06de48cc91ff642f7fffa28ffe8 | <|skeleton|>
class DownstreamEncoderTask:
"""Task with base methods for downstream evaluations for a mention encoder."""
def load_weights(cls, config: ml_collections.ConfigDict) -> Dict[str, Any]:
"""Load model weights from file. We assume that `encoder_name` is specified in the config. We use correspo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DownstreamEncoderTask:
"""Task with base methods for downstream evaluations for a mention encoder."""
def load_weights(cls, config: ml_collections.ConfigDict) -> Dict[str, Any]:
"""Load model weights from file. We assume that `encoder_name` is specified in the config. We use corresponding class t... | the_stack_v2_python_sparse | language/mentionmemory/tasks/downstream_encoder_task.py | google-research/language | train | 1,567 |
5811661e9227cd9bc2355abb8a729aa3e3db981e | [
"payload, user = self.get_payload(request)\nif not payload:\n return Response(status=status.HTTP_401_UNAUTHORIZED)\nif user.profile != 'admin':\n return Response(status=status.HTTP_403_FORBIDDEN)\nslot = ParkingSlot.objects.filter(pk=kwargs['id'], is_active=True).first()\nif not slot:\n return Response({'c... | <|body_start_0|>
payload, user = self.get_payload(request)
if not payload:
return Response(status=status.HTTP_401_UNAUTHORIZED)
if user.profile != 'admin':
return Response(status=status.HTTP_403_FORBIDDEN)
slot = ParkingSlot.objects.filter(pk=kwargs['id'], is_acti... | Defines the HTTP verbs to specific parking slot model management. | SpecificParkingSlotApi | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpecificParkingSlotApi:
"""Defines the HTTP verbs to specific parking slot model management."""
def get(self, request, *args, **kwargs):
"""Retrieve specific slot information. Parameters ---------- request (dict) Contains http transaction information. Returns ------- Response (JSON, ... | stack_v2_sparse_classes_75kplus_train_001702 | 7,435 | permissive | [
{
"docstring": "Retrieve specific slot information. Parameters ---------- request (dict) Contains http transaction information. Returns ------- Response (JSON, int) Body response and status code.",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Update an... | 3 | stack_v2_sparse_classes_30k_train_021757 | Implement the Python class `SpecificParkingSlotApi` described below.
Class description:
Defines the HTTP verbs to specific parking slot model management.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Retrieve specific slot information. Parameters ---------- request (dict) Contains http ... | Implement the Python class `SpecificParkingSlotApi` described below.
Class description:
Defines the HTTP verbs to specific parking slot model management.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Retrieve specific slot information. Parameters ---------- request (dict) Contains http ... | d56d365dd840ecd272ce933c26f2d408e01c44c7 | <|skeleton|>
class SpecificParkingSlotApi:
"""Defines the HTTP verbs to specific parking slot model management."""
def get(self, request, *args, **kwargs):
"""Retrieve specific slot information. Parameters ---------- request (dict) Contains http transaction information. Returns ------- Response (JSON, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SpecificParkingSlotApi:
"""Defines the HTTP verbs to specific parking slot model management."""
def get(self, request, *args, **kwargs):
"""Retrieve specific slot information. Parameters ---------- request (dict) Contains http transaction information. Returns ------- Response (JSON, int) Body res... | the_stack_v2_python_sparse | api/views/parking_slot.py | santiagoSSAA/ParkingLot_Back | train | 0 |
8f87339b6b9b5c589d023713951fd7b1f52a7e84 | [
"right_remove = 0\nleft_remove = 0\nleft_total = 0\nright_total = 0\nfor c in s:\n if c == '(':\n left_total += 1\n left_remove += 1\n elif c == ')':\n right_total += 1\n if left_remove == 0:\n right_remove += 1\n else:\n left_remove -= 1\nres = set()\n... | <|body_start_0|>
right_remove = 0
left_remove = 0
left_total = 0
right_total = 0
for c in s:
if c == '(':
left_total += 1
left_remove += 1
elif c == ')':
right_total += 1
if left_remove == 0:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeInvalidParentheses(self, s):
""":type s: str :rtype: List[str]"""
<|body_0|>
def dfs(self, s, i, res, path, leftcnt, rightcnt, left_remove, right_remove):
"""leftcnt: number of left parentheses to add left_remove: number of left parentheses to rem... | stack_v2_sparse_classes_75kplus_train_001703 | 2,477 | no_license | [
{
"docstring": ":type s: str :rtype: List[str]",
"name": "removeInvalidParentheses",
"signature": "def removeInvalidParentheses(self, s)"
},
{
"docstring": "leftcnt: number of left parentheses to add left_remove: number of left parentheses to remove",
"name": "dfs",
"signature": "def dfs... | 2 | stack_v2_sparse_classes_30k_train_010638 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeInvalidParentheses(self, s): :type s: str :rtype: List[str]
- def dfs(self, s, i, res, path, leftcnt, rightcnt, left_remove, right_remove): leftcnt: number of left pare... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeInvalidParentheses(self, s): :type s: str :rtype: List[str]
- def dfs(self, s, i, res, path, leftcnt, rightcnt, left_remove, right_remove): leftcnt: number of left pare... | 4fd63ced37732d2c3f14b87bd115b1cebc4d5fc4 | <|skeleton|>
class Solution:
def removeInvalidParentheses(self, s):
""":type s: str :rtype: List[str]"""
<|body_0|>
def dfs(self, s, i, res, path, leftcnt, rightcnt, left_remove, right_remove):
"""leftcnt: number of left parentheses to add left_remove: number of left parentheses to rem... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def removeInvalidParentheses(self, s):
""":type s: str :rtype: List[str]"""
right_remove = 0
left_remove = 0
left_total = 0
right_total = 0
for c in s:
if c == '(':
left_total += 1
left_remove += 1
... | the_stack_v2_python_sparse | 0301. Remove Invalid Parentheses.py | zannn3/LeetCode-Solutions-Python | train | 0 | |
34c2cc9bb81fed55aaf3ea113958290cfffe24b0 | [
"calibration_curve = list(((parse_unit(bin, 'uL'), point) for bin, point in args))\npoints = [point for _, point in calibration_curve]\ncalibration_types = (VolumeCalibrationBin, dict)\nif not all((isinstance(_, calibration_types) for _ in points)):\n raise TypeError(f'values {points} are not one of {calibration... | <|body_start_0|>
calibration_curve = list(((parse_unit(bin, 'uL'), point) for bin, point in args))
points = [point for _, point in calibration_curve]
calibration_types = (VolumeCalibrationBin, dict)
if not all((isinstance(_, calibration_types) for _ in points)):
raise TypeErr... | Wrapper for a volume-binned calibration curve A data structure that represents a calibration curve for either volumes or flowrates that are binned by upper bounded volume ranges. | VolumeCalibration | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VolumeCalibration:
"""Wrapper for a volume-binned calibration curve A data structure that represents a calibration curve for either volumes or flowrates that are binned by upper bounded volume ranges."""
def __init__(self, *args):
"""Parameters ---------- args : (Unit(volume), Volume... | stack_v2_sparse_classes_75kplus_train_001704 | 12,938 | permissive | [
{
"docstring": "Parameters ---------- args : (Unit(volume), VolumeCalibrationBin or dict) individual calibration bins Raises ------ TypeError Not all points on the calibration curve are of the correct type",
"name": "__init__",
"signature": "def __init__(self, *args)"
},
{
"docstring": "Gets the... | 2 | stack_v2_sparse_classes_30k_test_000437 | Implement the Python class `VolumeCalibration` described below.
Class description:
Wrapper for a volume-binned calibration curve A data structure that represents a calibration curve for either volumes or flowrates that are binned by upper bounded volume ranges.
Method signatures and docstrings:
- def __init__(self, *... | Implement the Python class `VolumeCalibration` described below.
Class description:
Wrapper for a volume-binned calibration curve A data structure that represents a calibration curve for either volumes or flowrates that are binned by upper bounded volume ranges.
Method signatures and docstrings:
- def __init__(self, *... | 84f6d3fced521849657d21ae4cb9681f5897b957 | <|skeleton|>
class VolumeCalibration:
"""Wrapper for a volume-binned calibration curve A data structure that represents a calibration curve for either volumes or flowrates that are binned by upper bounded volume ranges."""
def __init__(self, *args):
"""Parameters ---------- args : (Unit(volume), Volume... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VolumeCalibration:
"""Wrapper for a volume-binned calibration curve A data structure that represents a calibration curve for either volumes or flowrates that are binned by upper bounded volume ranges."""
def __init__(self, *args):
"""Parameters ---------- args : (Unit(volume), VolumeCalibrationBi... | the_stack_v2_python_sparse | venv/lib/python3.9/site-packages/autoprotocol/liquid_handle/liquid_class.py | ClassWizard/PodLockParser | train | 2 |
084560460657cc4c89e3c2c8dd2256cd84b3a55f | [
"self._name = kwargs.get('name')\nself._type = type\nsuper().__init__(**kwargs)",
"user_data = super().as_dict\ndel user_data['type']\ndata = {'data': user_data, 'type': self._type}\nif self._name:\n data['data']['name'] = self._name\nreturn data"
] | <|body_start_0|>
self._name = kwargs.get('name')
self._type = type
super().__init__(**kwargs)
<|end_body_0|>
<|body_start_1|>
user_data = super().as_dict
del user_data['type']
data = {'data': user_data, 'type': self._type}
if self._name:
data['data'][... | Assignee Object for Case Management. For User type the user_name or id fields is required and for the Group type the name or id is required. Args: first_name (str, kwargs): The first name of the User. id (id, kwargs): The id of the User. name (str, kwargs): The name of the Group. last_name (str, kwargs): The last name ... | Assignee | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Assignee:
"""Assignee Object for Case Management. For User type the user_name or id fields is required and for the Group type the name or id is required. Args: first_name (str, kwargs): The first name of the User. id (id, kwargs): The id of the User. name (str, kwargs): The name of the Group. las... | stack_v2_sparse_classes_75kplus_train_001705 | 6,536 | permissive | [
{
"docstring": "Initialize Class properties.",
"name": "__init__",
"signature": "def __init__(self, type='User', **kwargs)"
},
{
"docstring": "Return a dict representation of the Assignee class.",
"name": "as_dict",
"signature": "def as_dict(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016105 | Implement the Python class `Assignee` described below.
Class description:
Assignee Object for Case Management. For User type the user_name or id fields is required and for the Group type the name or id is required. Args: first_name (str, kwargs): The first name of the User. id (id, kwargs): The id of the User. name (s... | Implement the Python class `Assignee` described below.
Class description:
Assignee Object for Case Management. For User type the user_name or id fields is required and for the Group type the name or id is required. Args: first_name (str, kwargs): The first name of the User. id (id, kwargs): The id of the User. name (s... | 7cf04fec048fadc71ff851970045b8a587269ccf | <|skeleton|>
class Assignee:
"""Assignee Object for Case Management. For User type the user_name or id fields is required and for the Group type the name or id is required. Args: first_name (str, kwargs): The first name of the User. id (id, kwargs): The id of the User. name (str, kwargs): The name of the Group. las... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Assignee:
"""Assignee Object for Case Management. For User type the user_name or id fields is required and for the Group type the name or id is required. Args: first_name (str, kwargs): The first name of the User. id (id, kwargs): The id of the User. name (str, kwargs): The name of the Group. last_name (str, ... | the_stack_v2_python_sparse | tcex/case_management/assignee.py | TpyoKnig/tcex | train | 0 |
7f5fe0bae7e7993b2f15d7ffa59395353187b70a | [
"self.Wz = np.random.randn(i + h, h)\nself.bz = np.zeros((1, h))\nself.Wr = np.random.randn(i + h, h)\nself.br = np.zeros((1, h))\nself.Wh = np.random.randn(i + h, h)\nself.bh = np.zeros((1, h))\nself.Wy = np.random.randn(h, o)\nself.by = np.zeros((1, o))",
"concat = np.concatenate([h_prev, x_t], axis=1)\nr = sig... | <|body_start_0|>
self.Wz = np.random.randn(i + h, h)
self.bz = np.zeros((1, h))
self.Wr = np.random.randn(i + h, h)
self.br = np.zeros((1, h))
self.Wh = np.random.randn(i + h, h)
self.bh = np.zeros((1, h))
self.Wy = np.random.randn(h, o)
self.by = np.zeros... | This class represents a GRUCell | GRUCell | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GRUCell:
"""This class represents a GRUCell"""
def __init__(self, i, h, o):
"""All begins here i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs"""
<|body_0|>
def forward(self, h_prev, x_t):
"""... | stack_v2_sparse_classes_75kplus_train_001706 | 1,796 | permissive | [
{
"docstring": "All begins here i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs",
"name": "__init__",
"signature": "def __init__(self, i, h, o)"
},
{
"docstring": "This method calculates de forward prop for one time-step x_t ... | 2 | stack_v2_sparse_classes_30k_train_050322 | Implement the Python class `GRUCell` described below.
Class description:
This class represents a GRUCell
Method signatures and docstrings:
- def __init__(self, i, h, o): All begins here i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs
- def forward... | Implement the Python class `GRUCell` described below.
Class description:
This class represents a GRUCell
Method signatures and docstrings:
- def __init__(self, i, h, o): All begins here i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs
- def forward... | 58c367f3014919f95157426121093b9fe14d4035 | <|skeleton|>
class GRUCell:
"""This class represents a GRUCell"""
def __init__(self, i, h, o):
"""All begins here i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs"""
<|body_0|>
def forward(self, h_prev, x_t):
"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GRUCell:
"""This class represents a GRUCell"""
def __init__(self, i, h, o):
"""All begins here i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs"""
self.Wz = np.random.randn(i + h, h)
self.bz = np.zeros((1, h))
... | the_stack_v2_python_sparse | supervised_learning/0x0D-RNNs/2-gru_cell.py | linkem97/holbertonschool-machine_learning | train | 0 |
f8270a6ea14fb2678ece836387bf92c5d06348a8 | [
"SelectEntity.__init__(self)\nsuper().__init__(data_handler)\nself._home_id = home_id\nself._climate_state_class = f'{CLIMATE_STATE_CLASS_NAME}-{self._home_id}'\nself._climate_state: pyatmo.AsyncClimate = data_handler.data[self._climate_state_class]\nself._home = self._climate_state.homes[self._home_id]\nself._data... | <|body_start_0|>
SelectEntity.__init__(self)
super().__init__(data_handler)
self._home_id = home_id
self._climate_state_class = f'{CLIMATE_STATE_CLASS_NAME}-{self._home_id}'
self._climate_state: pyatmo.AsyncClimate = data_handler.data[self._climate_state_class]
self._home... | Representation a Netatmo thermostat schedule selector. | NetatmoScheduleSelect | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NetatmoScheduleSelect:
"""Representation a Netatmo thermostat schedule selector."""
def __init__(self, data_handler: NetatmoDataHandler, home_id: str, options: list) -> None:
"""Initialize the select entity."""
<|body_0|>
async def async_added_to_hass(self) -> None:
... | stack_v2_sparse_classes_75kplus_train_001707 | 5,649 | permissive | [
{
"docstring": "Initialize the select entity.",
"name": "__init__",
"signature": "def __init__(self, data_handler: NetatmoDataHandler, home_id: str, options: list) -> None"
},
{
"docstring": "Entity created.",
"name": "async_added_to_hass",
"signature": "async def async_added_to_hass(sel... | 5 | stack_v2_sparse_classes_30k_train_045778 | Implement the Python class `NetatmoScheduleSelect` described below.
Class description:
Representation a Netatmo thermostat schedule selector.
Method signatures and docstrings:
- def __init__(self, data_handler: NetatmoDataHandler, home_id: str, options: list) -> None: Initialize the select entity.
- async def async_a... | Implement the Python class `NetatmoScheduleSelect` described below.
Class description:
Representation a Netatmo thermostat schedule selector.
Method signatures and docstrings:
- def __init__(self, data_handler: NetatmoDataHandler, home_id: str, options: list) -> None: Initialize the select entity.
- async def async_a... | 8f4ec89be6c2505d8a59eee44de335abe308ac9f | <|skeleton|>
class NetatmoScheduleSelect:
"""Representation a Netatmo thermostat schedule selector."""
def __init__(self, data_handler: NetatmoDataHandler, home_id: str, options: list) -> None:
"""Initialize the select entity."""
<|body_0|>
async def async_added_to_hass(self) -> None:
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NetatmoScheduleSelect:
"""Representation a Netatmo thermostat schedule selector."""
def __init__(self, data_handler: NetatmoDataHandler, home_id: str, options: list) -> None:
"""Initialize the select entity."""
SelectEntity.__init__(self)
super().__init__(data_handler)
sel... | the_stack_v2_python_sparse | homeassistant/components/netatmo/select.py | JeffLIrion/home-assistant | train | 5 |
6f79b7cd4314eda133ae7c827d24981aa75f4639 | [
"super(RegistrationForm, self).__init__(*args, **kwargs)\nfor fieldname in ['username', 'password1', 'password2']:\n self.fields[fieldname].help_text = None\nself.fields['email'].label = 'E-Mail'\nself.fields['password1'].label = 'Passwort'\nself.fields['password2'].label = 'Passwort bestätigen'",
"email = sel... | <|body_start_0|>
super(RegistrationForm, self).__init__(*args, **kwargs)
for fieldname in ['username', 'password1', 'password2']:
self.fields[fieldname].help_text = None
self.fields['email'].label = 'E-Mail'
self.fields['password1'].label = 'Passwort'
self.fields['pas... | Klasse des Registrierungs Formulars. Hier werden die angezeigten Formularfelder, deren CSS Klassen und ihr Aussehen definiert. Um einen Account zu erstellen, müssen ein einzigartiger Nutzernamen, eine einzigartige Email und ein Passwort angegeben werden. | RegistrationForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegistrationForm:
"""Klasse des Registrierungs Formulars. Hier werden die angezeigten Formularfelder, deren CSS Klassen und ihr Aussehen definiert. Um einen Account zu erstellen, müssen ein einzigartiger Nutzernamen, eine einzigartige Email und ein Passwort angegeben werden."""
def __init__(... | stack_v2_sparse_classes_75kplus_train_001708 | 5,396 | no_license | [
{
"docstring": "Wird nur verwendet um die Labels der Felder zu ändern. Bei den Account Feldern geht das Ändern der Labels nur auf diese Art und Weise.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Hier wird geprüft ob die Email einzigartig ist und in... | 3 | stack_v2_sparse_classes_30k_train_025580 | Implement the Python class `RegistrationForm` described below.
Class description:
Klasse des Registrierungs Formulars. Hier werden die angezeigten Formularfelder, deren CSS Klassen und ihr Aussehen definiert. Um einen Account zu erstellen, müssen ein einzigartiger Nutzernamen, eine einzigartige Email und ein Passwort ... | Implement the Python class `RegistrationForm` described below.
Class description:
Klasse des Registrierungs Formulars. Hier werden die angezeigten Formularfelder, deren CSS Klassen und ihr Aussehen definiert. Um einen Account zu erstellen, müssen ein einzigartiger Nutzernamen, eine einzigartige Email und ein Passwort ... | 65465c5ceb6d95f9d333b3399ccd988034b475ba | <|skeleton|>
class RegistrationForm:
"""Klasse des Registrierungs Formulars. Hier werden die angezeigten Formularfelder, deren CSS Klassen und ihr Aussehen definiert. Um einen Account zu erstellen, müssen ein einzigartiger Nutzernamen, eine einzigartige Email und ein Passwort angegeben werden."""
def __init__(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RegistrationForm:
"""Klasse des Registrierungs Formulars. Hier werden die angezeigten Formularfelder, deren CSS Klassen und ihr Aussehen definiert. Um einen Account zu erstellen, müssen ein einzigartiger Nutzernamen, eine einzigartige Email und ein Passwort angegeben werden."""
def __init__(self, *args, ... | the_stack_v2_python_sparse | src/account/forms.py | RBHSMA/TechTrader | train | 0 |
0a571b6ce355b1736e1ebb965b0b17a309099852 | [
"self.Data = Section.create('Data')\nself.Data.eventDataCenter = 'IRIS'\nself.Data.stationDataCenter = 'IRIS'\nself.Waveforms = Section.create('Waveforms')\nself.Waveforms.downloadDir = user_download_path()\nself.Waveforms.cacheSize = '50'\nself.Waveforms.saveDir = user_save_path()\nself.Waveforms.timeWindowBefore ... | <|body_start_0|>
self.Data = Section.create('Data')
self.Data.eventDataCenter = 'IRIS'
self.Data.stationDataCenter = 'IRIS'
self.Waveforms = Section.create('Waveforms')
self.Waveforms.downloadDir = user_download_path()
self.Waveforms.cacheSize = '50'
self.Waveform... | Container for application preferences. | Preferences | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Preferences:
"""Container for application preferences."""
def __init__(self):
"""Initialization with default settings."""
<|body_0|>
def save(self):
"""Saves the user's preferences to config file"""
<|body_1|>
def load(self):
"""Loads the use... | stack_v2_sparse_classes_75kplus_train_001709 | 7,361 | no_license | [
{
"docstring": "Initialization with default settings.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Saves the user's preferences to config file",
"name": "save",
"signature": "def save(self)"
},
{
"docstring": "Loads the user's preferences from saved ... | 3 | stack_v2_sparse_classes_30k_train_003456 | Implement the Python class `Preferences` described below.
Class description:
Container for application preferences.
Method signatures and docstrings:
- def __init__(self): Initialization with default settings.
- def save(self): Saves the user's preferences to config file
- def load(self): Loads the user's preferences... | Implement the Python class `Preferences` described below.
Class description:
Container for application preferences.
Method signatures and docstrings:
- def __init__(self): Initialization with default settings.
- def save(self): Saves the user's preferences to config file
- def load(self): Loads the user's preferences... | 1a1faf5daabfc697172e72856e3fa089df038673 | <|skeleton|>
class Preferences:
"""Container for application preferences."""
def __init__(self):
"""Initialization with default settings."""
<|body_0|>
def save(self):
"""Saves the user's preferences to config file"""
<|body_1|>
def load(self):
"""Loads the use... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Preferences:
"""Container for application preferences."""
def __init__(self):
"""Initialization with default settings."""
self.Data = Section.create('Data')
self.Data.eventDataCenter = 'IRIS'
self.Data.stationDataCenter = 'IRIS'
self.Waveforms = Section.create('Wav... | the_stack_v2_python_sparse | venv/Lib/site-packages/pyweed/preferences.py | wenyali/Decoding_code | train | 0 |
b5a34b70c1ab85dbdafdea4e1399f646cf3beda7 | [
"step_counter = tf.Variable(0, trainable=False, dtype=tf.int32, name='step_counter')\nsteps = kwargs.get('steps', 100)\ndecay = kwargs.get('decay', 0.8)\nlearning_rate = tf.train.exponential_decay(learning_rate, step_counter, steps, decay)\nself.observations = tf.placeholder(tf.float32, shape=[1, 4], name='observat... | <|body_start_0|>
step_counter = tf.Variable(0, trainable=False, dtype=tf.int32, name='step_counter')
steps = kwargs.get('steps', 100)
decay = kwargs.get('decay', 0.8)
learning_rate = tf.train.exponential_decay(learning_rate, step_counter, steps, decay)
self.observations = tf.plac... | Class for a reinforcement learner. Attributes ---------- observations : tf.placeholder Input port for currently observed environment. Shape is (1, 4) gradients : list Negative gradients for the 4 trainable variables of the fully connected network grad_placeholders : list `tf.placeholder`s for each of the trainable vari... | Agent | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Agent:
"""Class for a reinforcement learner. Attributes ---------- observations : tf.placeholder Input port for currently observed environment. Shape is (1, 4) gradients : list Negative gradients for the 4 trainable variables of the fully connected network grad_placeholders : list `tf.placeholder... | stack_v2_sparse_classes_75kplus_train_001710 | 9,913 | no_license | [
{
"docstring": "Respected kwargs are Parameters ---------- steps : int Decay learning rate according to `exponential_decay` every `steps` steps decay : decay factor for `exponential_decay` learning_rate : base learning rate for `exponential_decay`",
"name": "__init__",
"signature": "def __init__(self, l... | 3 | stack_v2_sparse_classes_30k_train_030531 | Implement the Python class `Agent` described below.
Class description:
Class for a reinforcement learner. Attributes ---------- observations : tf.placeholder Input port for currently observed environment. Shape is (1, 4) gradients : list Negative gradients for the 4 trainable variables of the fully connected network g... | Implement the Python class `Agent` described below.
Class description:
Class for a reinforcement learner. Attributes ---------- observations : tf.placeholder Input port for currently observed environment. Shape is (1, 4) gradients : list Negative gradients for the 4 trainable variables of the fully connected network g... | 2d0d55713cbc3f5b87fbc8e7a3194e819f9ee2a1 | <|skeleton|>
class Agent:
"""Class for a reinforcement learner. Attributes ---------- observations : tf.placeholder Input port for currently observed environment. Shape is (1, 4) gradients : list Negative gradients for the 4 trainable variables of the fully connected network grad_placeholders : list `tf.placeholder... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Agent:
"""Class for a reinforcement learner. Attributes ---------- observations : tf.placeholder Input port for currently observed environment. Shape is (1, 4) gradients : list Negative gradients for the 4 trainable variables of the fully connected network grad_placeholders : list `tf.placeholder`s for each o... | the_stack_v2_python_sparse | ex07/ex07.py | BobMcFry/ann-tensorflow | train | 0 |
d05983623662d8d6065188dda19c26ec61ad0cd0 | [
"keyboard = ['qwertyuiopQWERTYUIOP', 'asdfghjklASDFGHJKL', 'zxcvbnmZXCVBNM']\nres = []\nfor word in words:\n pos = []\n for w in word:\n for index, key in enumerate(keyboard):\n if w in key:\n pos.append(index)\n break\n if len(set(pos)) == 1:\n res.ap... | <|body_start_0|>
keyboard = ['qwertyuiopQWERTYUIOP', 'asdfghjklASDFGHJKL', 'zxcvbnmZXCVBNM']
res = []
for word in words:
pos = []
for w in word:
for index, key in enumerate(keyboard):
if w in key:
pos.append(inde... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findWords(self, words):
""":type words: List[str] :rtype: List[str]"""
<|body_0|>
def _findWords(self, words):
""":type words: List[str] :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
keyboard = ['qwertyuiopQWERTYUIO... | stack_v2_sparse_classes_75kplus_train_001711 | 1,800 | permissive | [
{
"docstring": ":type words: List[str] :rtype: List[str]",
"name": "findWords",
"signature": "def findWords(self, words)"
},
{
"docstring": ":type words: List[str] :rtype: List[str]",
"name": "_findWords",
"signature": "def _findWords(self, words)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015465 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findWords(self, words): :type words: List[str] :rtype: List[str]
- def _findWords(self, words): :type words: List[str] :rtype: List[str] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findWords(self, words): :type words: List[str] :rtype: List[str]
- def _findWords(self, words): :type words: List[str] :rtype: List[str]
<|skeleton|>
class Solution:
de... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def findWords(self, words):
""":type words: List[str] :rtype: List[str]"""
<|body_0|>
def _findWords(self, words):
""":type words: List[str] :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findWords(self, words):
""":type words: List[str] :rtype: List[str]"""
keyboard = ['qwertyuiopQWERTYUIOP', 'asdfghjklASDFGHJKL', 'zxcvbnmZXCVBNM']
res = []
for word in words:
pos = []
for w in word:
for index, key in enumera... | the_stack_v2_python_sparse | 500.keyboard-row.py | windard/leeeeee | train | 0 | |
0b3aa0a8d7f69960b8ec6d4381fae9043feb9cba | [
"self.artificial_noise_ADV = artificial_noise_ADV\nself.artificial_noise_CR = artificial_noise_CR\nself.mch = multiclasshandler\nself.n_updates = 0\nself.subcampaignHandlers = []\nself.bids = np.linspace(0, max_bid, n_arms_advertising)\nself.prices = np.linspace(product_config['base_price'], product_config['max_pri... | <|body_start_0|>
self.artificial_noise_ADV = artificial_noise_ADV
self.artificial_noise_CR = artificial_noise_CR
self.mch = multiclasshandler
self.n_updates = 0
self.subcampaignHandlers = []
self.bids = np.linspace(0, max_bid, n_arms_advertising)
self.prices = np.... | FixedPriceBudgetAllocator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FixedPriceBudgetAllocator:
def __init__(self, artificial_noise_ADV, artificial_noise_CR, multiclasshandler):
"""@param artificial_noise_ADV: how much exploration on the advertising learners @param multiclasshandler: classes information"""
<|body_0|>
def pull_arm_price(self, ... | stack_v2_sparse_classes_75kplus_train_001712 | 6,069 | no_license | [
{
"docstring": "@param artificial_noise_ADV: how much exploration on the advertising learners @param multiclasshandler: classes information",
"name": "__init__",
"signature": "def __init__(self, artificial_noise_ADV, artificial_noise_CR, multiclasshandler)"
},
{
"docstring": "takes the daily num... | 6 | stack_v2_sparse_classes_30k_train_033699 | Implement the Python class `FixedPriceBudgetAllocator` described below.
Class description:
Implement the FixedPriceBudgetAllocator class.
Method signatures and docstrings:
- def __init__(self, artificial_noise_ADV, artificial_noise_CR, multiclasshandler): @param artificial_noise_ADV: how much exploration on the adver... | Implement the Python class `FixedPriceBudgetAllocator` described below.
Class description:
Implement the FixedPriceBudgetAllocator class.
Method signatures and docstrings:
- def __init__(self, artificial_noise_ADV, artificial_noise_CR, multiclasshandler): @param artificial_noise_ADV: how much exploration on the adver... | 125147257fb8d7bbbe0deef070b0c3c0bddeffe0 | <|skeleton|>
class FixedPriceBudgetAllocator:
def __init__(self, artificial_noise_ADV, artificial_noise_CR, multiclasshandler):
"""@param artificial_noise_ADV: how much exploration on the advertising learners @param multiclasshandler: classes information"""
<|body_0|>
def pull_arm_price(self, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FixedPriceBudgetAllocator:
def __init__(self, artificial_noise_ADV, artificial_noise_CR, multiclasshandler):
"""@param artificial_noise_ADV: how much exploration on the advertising learners @param multiclasshandler: classes information"""
self.artificial_noise_ADV = artificial_noise_ADV
... | the_stack_v2_python_sparse | project/part_7/FixedPriceBudgetAllocator.py | damiano1996/DataIntelligenceApplications | train | 0 | |
73309d260a18bc14d6796bcd33a22d92ceb748fe | [
"self.method = method\nself.bins = bins\nself.interpolation = interpolation\nself.variable_width = variable_width\nself.model = model",
"X = load_and_check(X)\ny = load_and_check(y)\ny = column_or_1d(y)\nlabel_encoder = LabelEncoder()\ny = label_encoder.fit_transform(y).astype(np.float)\nif len(label_encoder.clas... | <|body_start_0|>
self.method = method
self.bins = bins
self.interpolation = interpolation
self.variable_width = variable_width
self.model = model
<|end_body_0|>
<|body_start_1|>
X = load_and_check(X)
y = load_and_check(y)
y = column_or_1d(y)
label... | Probability calibration. | CalibratedClassifier | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CalibratedClassifier:
"""Probability calibration."""
def __init__(self, model, method='histogram', bins=100, interpolation=None, variable_width=False):
"""Constructor. Parameters ----------"""
<|body_0|>
def fit(self, X, y):
"""Fit the calibrated model. Parameter... | stack_v2_sparse_classes_75kplus_train_001713 | 5,898 | permissive | [
{
"docstring": "Constructor. Parameters ----------",
"name": "__init__",
"signature": "def __init__(self, model, method='histogram', bins=100, interpolation=None, variable_width=False)"
},
{
"docstring": "Fit the calibrated model. Parameters ---------- * `X` [array-like, shape=(n_samples, n_feat... | 4 | stack_v2_sparse_classes_30k_train_029593 | Implement the Python class `CalibratedClassifier` described below.
Class description:
Probability calibration.
Method signatures and docstrings:
- def __init__(self, model, method='histogram', bins=100, interpolation=None, variable_width=False): Constructor. Parameters ----------
- def fit(self, X, y): Fit the calibr... | Implement the Python class `CalibratedClassifier` described below.
Class description:
Probability calibration.
Method signatures and docstrings:
- def __init__(self, model, method='histogram', bins=100, interpolation=None, variable_width=False): Constructor. Parameters ----------
- def fit(self, X, y): Fit the calibr... | 383ef84c449d654d783b4e8bdbb847ee8cbf24b9 | <|skeleton|>
class CalibratedClassifier:
"""Probability calibration."""
def __init__(self, model, method='histogram', bins=100, interpolation=None, variable_width=False):
"""Constructor. Parameters ----------"""
<|body_0|>
def fit(self, X, y):
"""Fit the calibrated model. Parameter... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CalibratedClassifier:
"""Probability calibration."""
def __init__(self, model, method='histogram', bins=100, interpolation=None, variable_width=False):
"""Constructor. Parameters ----------"""
self.method = method
self.bins = bins
self.interpolation = interpolation
... | the_stack_v2_python_sparse | ml/calibration.py | leonoravesterbacka/carl-torch | train | 10 |
c7746f5fdc97129331ce8be711368b5a9bff62c1 | [
"env = EpisodeInfo(gym.make('CartPole-v1'))\n\ndef actor(ob):\n ac = torch.from_numpy(np.array(env.action_space.sample()))[None]\n return namedtuple('test', ['action', 'state_out'])(action=ac, state_out=None)\nstats = rl_evaluate(env, actor, 10, outfile='./out.pt', save_info=True)\nassert len(stats['episode_l... | <|body_start_0|>
env = EpisodeInfo(gym.make('CartPole-v1'))
def actor(ob):
ac = torch.from_numpy(np.array(env.action_space.sample()))[None]
return namedtuple('test', ['action', 'state_out'])(action=ac, state_out=None)
stats = rl_evaluate(env, actor, 10, outfile='./out.pt... | Test. | Test | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test:
"""Test."""
def test_eval(self):
"""Test."""
<|body_0|>
def test_record(self):
"""Test record."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
env = EpisodeInfo(gym.make('CartPole-v1'))
def actor(ob):
ac = torch.from_n... | stack_v2_sparse_classes_75kplus_train_001714 | 7,046 | no_license | [
{
"docstring": "Test.",
"name": "test_eval",
"signature": "def test_eval(self)"
},
{
"docstring": "Test record.",
"name": "test_record",
"signature": "def test_record(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_048758 | Implement the Python class `Test` described below.
Class description:
Test.
Method signatures and docstrings:
- def test_eval(self): Test.
- def test_record(self): Test record. | Implement the Python class `Test` described below.
Class description:
Test.
Method signatures and docstrings:
- def test_eval(self): Test.
- def test_record(self): Test record.
<|skeleton|>
class Test:
"""Test."""
def test_eval(self):
"""Test."""
<|body_0|>
def test_record(self):
... | e71c4b12955b01bfb907aa31c91ded6bcd8aaec8 | <|skeleton|>
class Test:
"""Test."""
def test_eval(self):
"""Test."""
<|body_0|>
def test_record(self):
"""Test record."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Test:
"""Test."""
def test_eval(self):
"""Test."""
env = EpisodeInfo(gym.make('CartPole-v1'))
def actor(ob):
ac = torch.from_numpy(np.array(env.action_space.sample()))[None]
return namedtuple('test', ['action', 'state_out'])(action=ac, state_out=None)
... | the_stack_v2_python_sparse | dl/rl/util/eval.py | cbschaff/dl | train | 1 |
59087b571033dc1da1a770c0396ae6bd5bbcb9b6 | [
"size = len(prices)\nif size <= 0:\n return 0\nmemo = [-1] * size\n\ndef dp(start):\n if start >= size:\n return 0\n if memo[start] != -1:\n return memo[start]\n minIdx = start\n maxPro = 0\n for i in range(start + 1, size):\n if prices[i] < prices[minIdx]:\n minIdx... | <|body_start_0|>
size = len(prices)
if size <= 0:
return 0
memo = [-1] * size
def dp(start):
if start >= size:
return 0
if memo[start] != -1:
return memo[start]
minIdx = start
maxPro = 0
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, prices: List[int], fee: int) -> int:
"""暴力优化2:消除一层循环+备忘录,超时,区分题122,含手续费 - fee"""
<|body_0|>
def maxProfit_dp(self, prices: List[int], fee: int) -> int:
"""动态规划:三个操作状态buy, sell, rest。 通用状态转移方程:s[0,1]两种(有无股票)状态的两种情况,昨天的股票持有状态和今天的操作影响今天的收益情... | stack_v2_sparse_classes_75kplus_train_001715 | 4,570 | permissive | [
{
"docstring": "暴力优化2:消除一层循环+备忘录,超时,区分题122,含手续费 - fee",
"name": "maxProfit",
"signature": "def maxProfit(self, prices: List[int], fee: int) -> int"
},
{
"docstring": "动态规划:三个操作状态buy, sell, rest。 通用状态转移方程:s[0,1]两种(有无股票)状态的两种情况,昨天的股票持有状态和今天的操作影响今天的收益情况 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][... | 3 | stack_v2_sparse_classes_30k_train_009956 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices: List[int], fee: int) -> int: 暴力优化2:消除一层循环+备忘录,超时,区分题122,含手续费 - fee
- def maxProfit_dp(self, prices: List[int], fee: int) -> int: 动态规划:三个操作状态buy, sell,... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices: List[int], fee: int) -> int: 暴力优化2:消除一层循环+备忘录,超时,区分题122,含手续费 - fee
- def maxProfit_dp(self, prices: List[int], fee: int) -> int: 动态规划:三个操作状态buy, sell,... | e8a1c6cae6547cbcb6e8494be6df685f3e7c837c | <|skeleton|>
class Solution:
def maxProfit(self, prices: List[int], fee: int) -> int:
"""暴力优化2:消除一层循环+备忘录,超时,区分题122,含手续费 - fee"""
<|body_0|>
def maxProfit_dp(self, prices: List[int], fee: int) -> int:
"""动态规划:三个操作状态buy, sell, rest。 通用状态转移方程:s[0,1]两种(有无股票)状态的两种情况,昨天的股票持有状态和今天的操作影响今天的收益情... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxProfit(self, prices: List[int], fee: int) -> int:
"""暴力优化2:消除一层循环+备忘录,超时,区分题122,含手续费 - fee"""
size = len(prices)
if size <= 0:
return 0
memo = [-1] * size
def dp(start):
if start >= size:
return 0
if ... | the_stack_v2_python_sparse | 714-best-time-to-buy-and-sell-stock-with-transaction-fee.py | yuenliou/leetcode | train | 0 | |
9f66a29b51c9a3ff4895581fd03cdeb5e6075cf4 | [
"result = []\nsynsets = wn.synsets(word)\nfor synset in synsets:\n hypernyms = synset.hypernyms()\n for hyp in hypernyms:\n result.append(hyp.lemmas()[0].name())\nreturn set(result)",
"results = []\nfor word in words:\n hypernyms = self.get_hypernyms_for_single_word(word)\n for hypernym in hype... | <|body_start_0|>
result = []
synsets = wn.synsets(word)
for synset in synsets:
hypernyms = synset.hypernyms()
for hyp in hypernyms:
result.append(hyp.lemmas()[0].name())
return set(result)
<|end_body_0|>
<|body_start_1|>
results = []
... | Generate labels for the topic models with wordnet. | ExtrensicTopicLabeler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExtrensicTopicLabeler:
"""Generate labels for the topic models with wordnet."""
def get_hypernyms_for_single_word(self, word):
"""Get all the hypernyms for the synsets of a given word of a certain topic :param word: a word from a topic :type string :return: set of hypernyms for the g... | stack_v2_sparse_classes_75kplus_train_001716 | 3,555 | no_license | [
{
"docstring": "Get all the hypernyms for the synsets of a given word of a certain topic :param word: a word from a topic :type string :return: set of hypernyms for the given word",
"name": "get_hypernyms_for_single_word",
"signature": "def get_hypernyms_for_single_word(self, word)"
},
{
"docstr... | 4 | stack_v2_sparse_classes_30k_train_003996 | Implement the Python class `ExtrensicTopicLabeler` described below.
Class description:
Generate labels for the topic models with wordnet.
Method signatures and docstrings:
- def get_hypernyms_for_single_word(self, word): Get all the hypernyms for the synsets of a given word of a certain topic :param word: a word from... | Implement the Python class `ExtrensicTopicLabeler` described below.
Class description:
Generate labels for the topic models with wordnet.
Method signatures and docstrings:
- def get_hypernyms_for_single_word(self, word): Get all the hypernyms for the synsets of a given word of a certain topic :param word: a word from... | 34cdff618595bdb495d0cd7b23e543e089ea0c41 | <|skeleton|>
class ExtrensicTopicLabeler:
"""Generate labels for the topic models with wordnet."""
def get_hypernyms_for_single_word(self, word):
"""Get all the hypernyms for the synsets of a given word of a certain topic :param word: a word from a topic :type string :return: set of hypernyms for the g... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExtrensicTopicLabeler:
"""Generate labels for the topic models with wordnet."""
def get_hypernyms_for_single_word(self, word):
"""Get all the hypernyms for the synsets of a given word of a certain topic :param word: a word from a topic :type string :return: set of hypernyms for the given word"""
... | the_stack_v2_python_sparse | src/Automati_Topic_Labeling_Wordnet/extrinsic_topic_labler.py | ga65duy/Topic-Modeling | train | 0 |
eb3cb8e00f6f81170a5cf0b69b1e48f4681665d0 | [
"super().__init__()\nself.setText('Aff. Indices')\nself.setStyleSheet(self.style.controls_button + self.style.controls_button_smaller)",
"if self.enabled:\n self.enabled = False\n self.setStyleSheet(self.style.controls_button + self.style.controls_button_smaller)\nelse:\n self.enabled = True\n self.se... | <|body_start_0|>
super().__init__()
self.setText('Aff. Indices')
self.setStyleSheet(self.style.controls_button + self.style.controls_button_smaller)
<|end_body_0|>
<|body_start_1|>
if self.enabled:
self.enabled = False
self.setStyleSheet(self.style.controls_butto... | Togglable button. Enable: display hints Disabled : display value | ButtonHints | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ButtonHints:
"""Togglable button. Enable: display hints Disabled : display value"""
def __init__(self):
"""Initialize styling and text"""
<|body_0|>
def toggleClicked(self):
"""Enable or disable the button depending of the button's status"""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus_train_001717 | 918 | no_license | [
{
"docstring": "Initialize styling and text",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Enable or disable the button depending of the button's status",
"name": "toggleClicked",
"signature": "def toggleClicked(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_023574 | Implement the Python class `ButtonHints` described below.
Class description:
Togglable button. Enable: display hints Disabled : display value
Method signatures and docstrings:
- def __init__(self): Initialize styling and text
- def toggleClicked(self): Enable or disable the button depending of the button's status | Implement the Python class `ButtonHints` described below.
Class description:
Togglable button. Enable: display hints Disabled : display value
Method signatures and docstrings:
- def __init__(self): Initialize styling and text
- def toggleClicked(self): Enable or disable the button depending of the button's status
<|... | e5cae229bb411620cf23c9bd31f19fe359d7a021 | <|skeleton|>
class ButtonHints:
"""Togglable button. Enable: display hints Disabled : display value"""
def __init__(self):
"""Initialize styling and text"""
<|body_0|>
def toggleClicked(self):
"""Enable or disable the button depending of the button's status"""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ButtonHints:
"""Togglable button. Enable: display hints Disabled : display value"""
def __init__(self):
"""Initialize styling and text"""
super().__init__()
self.setText('Aff. Indices')
self.setStyleSheet(self.style.controls_button + self.style.controls_button_smaller)
... | the_stack_v2_python_sparse | interface/controls_components/ButtonHints.py | antoine2116/Sudoku | train | 0 |
d58c3d0ba58abc3161954ae2dd6df303f0f3b343 | [
"for i, matr in enumerate(self.transition_matrices):\n print(matrix_name + '_' + str(i), ':', file=file)\n matr_print(matr, file=file)\nprint('Average intensity:', self.avg_intensity, file=file)\nprint('Variation coefficient:', self.c_var, file=file)\nprint('Correlation coefficient:', self.c_cor, file=file)\n... | <|body_start_0|>
for i, matr in enumerate(self.transition_matrices):
print(matrix_name + '_' + str(i), ':', file=file)
matr_print(matr, file=file)
print('Average intensity:', self.avg_intensity, file=file)
print('Variation coefficient:', self.c_var, file=file)
pri... | MAP stream class. Contains two transition matrices, stream intensity, sum of transition matrices, variation coefficient and correlation coefficient. | MAPStream | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MAPStream:
"""MAP stream class. Contains two transition matrices, stream intensity, sum of transition matrices, variation coefficient and correlation coefficient."""
def print_characteristics(self, matrix_name, file=sys.stdout):
"""Prints characteristics of MAP stream: Average intens... | stack_v2_sparse_classes_75kplus_train_001718 | 15,627 | no_license | [
{
"docstring": "Prints characteristics of MAP stream: Average intensity Variation coefficient Correlation coefficient :return: None",
"name": "print_characteristics",
"signature": "def print_characteristics(self, matrix_name, file=sys.stdout)"
},
{
"docstring": "Constructor for MAPStream. :param... | 2 | stack_v2_sparse_classes_30k_train_048747 | Implement the Python class `MAPStream` described below.
Class description:
MAP stream class. Contains two transition matrices, stream intensity, sum of transition matrices, variation coefficient and correlation coefficient.
Method signatures and docstrings:
- def print_characteristics(self, matrix_name, file=sys.stdo... | Implement the Python class `MAPStream` described below.
Class description:
MAP stream class. Contains two transition matrices, stream intensity, sum of transition matrices, variation coefficient and correlation coefficient.
Method signatures and docstrings:
- def print_characteristics(self, matrix_name, file=sys.stdo... | 6173e0d279893f0da4f8ad09b824cd5897c4e5e7 | <|skeleton|>
class MAPStream:
"""MAP stream class. Contains two transition matrices, stream intensity, sum of transition matrices, variation coefficient and correlation coefficient."""
def print_characteristics(self, matrix_name, file=sys.stdout):
"""Prints characteristics of MAP stream: Average intens... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MAPStream:
"""MAP stream class. Contains two transition matrices, stream intensity, sum of transition matrices, variation coefficient and correlation coefficient."""
def print_characteristics(self, matrix_name, file=sys.stdout):
"""Prints characteristics of MAP stream: Average intensity Variation... | the_stack_v2_python_sparse | streams.py | pishchynski/magister_work | train | 0 |
8458ac009a0fc2f2d90b872862269518b29615b6 | [
"self._stream = stream\nself.coloured = coloured\nself.newline = newline",
"output = ''\nfor idx, (key, value) in enumerate(metrics.items()):\n color = None\n if self.coloured:\n color = 'cyan'\n if 'iteration' in key:\n color = 'magenta'\n if isinstance(value, float):\n v... | <|body_start_0|>
self._stream = stream
self.coloured = coloured
self.newline = newline
<|end_body_0|>
<|body_start_1|>
output = ''
for idx, (key, value) in enumerate(metrics.items()):
color = None
if self.coloured:
color = 'cyan'
... | Class that logs metrics to a file in JSON lines format. | StreamLogger | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StreamLogger:
"""Class that logs metrics to a file in JSON lines format."""
def __init__(self, stream: io.IOBase=sys.stdout, coloured: bool=True, newline: bool=True) -> None:
"""Initialise a `StreamLogger` instance."""
<|body_0|>
def __call__(self, metrics: Dict[str, Any... | stack_v2_sparse_classes_75kplus_train_001719 | 1,211 | no_license | [
{
"docstring": "Initialise a `StreamLogger` instance.",
"name": "__init__",
"signature": "def __init__(self, stream: io.IOBase=sys.stdout, coloured: bool=True, newline: bool=True) -> None"
},
{
"docstring": "Log a set of key-value pairs.",
"name": "__call__",
"signature": "def __call__(s... | 2 | null | Implement the Python class `StreamLogger` described below.
Class description:
Class that logs metrics to a file in JSON lines format.
Method signatures and docstrings:
- def __init__(self, stream: io.IOBase=sys.stdout, coloured: bool=True, newline: bool=True) -> None: Initialise a `StreamLogger` instance.
- def __cal... | Implement the Python class `StreamLogger` described below.
Class description:
Class that logs metrics to a file in JSON lines format.
Method signatures and docstrings:
- def __init__(self, stream: io.IOBase=sys.stdout, coloured: bool=True, newline: bool=True) -> None: Initialise a `StreamLogger` instance.
- def __cal... | 3b6d90bf16eb184753ec550cccad57ec9b12f8aa | <|skeleton|>
class StreamLogger:
"""Class that logs metrics to a file in JSON lines format."""
def __init__(self, stream: io.IOBase=sys.stdout, coloured: bool=True, newline: bool=True) -> None:
"""Initialise a `StreamLogger` instance."""
<|body_0|>
def __call__(self, metrics: Dict[str, Any... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StreamLogger:
"""Class that logs metrics to a file in JSON lines format."""
def __init__(self, stream: io.IOBase=sys.stdout, coloured: bool=True, newline: bool=True) -> None:
"""Initialise a `StreamLogger` instance."""
self._stream = stream
self.coloured = coloured
self.ne... | the_stack_v2_python_sparse | code/algorithm/loggers/stream.py | alexmirrington/class-conditional-label-noise | train | 0 |
01297687b3cf15b7a1d67f56eaa3c54eb30710d0 | [
"self._scheduler = BackgroundScheduler(**{'jobstores': {'default': DjangoJobStore()}, 'executors': {'default': ThreadPoolExecutor(max_workers=20), 'process': ProcessPoolExecutor(max_workers=20)}, 'job_defaults': {'misfire_grace_time': 60, 'coalesce': True, 'max_instances': 1}, 'logger': None, 'time_zone': settings.... | <|body_start_0|>
self._scheduler = BackgroundScheduler(**{'jobstores': {'default': DjangoJobStore()}, 'executors': {'default': ThreadPoolExecutor(max_workers=20), 'process': ProcessPoolExecutor(max_workers=20)}, 'job_defaults': {'misfire_grace_time': 60, 'coalesce': True, 'max_instances': 1}, 'logger': None, 't... | 事件调度器 | SchedulerServer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SchedulerServer:
"""事件调度器"""
def __init__(self) -> None:
"""初始化,配置并启动调度器"""
<|body_0|>
def add_immediate_job(self, job_cls: str, *args, **kwargs) -> dict:
"""添加一次性任务 :param job_cls: 作业类 :param args: 作业初始化位置参数 :param kwargs: 作业初始化关键字参数 :return: 任务名字对应 id 的字段"""
... | stack_v2_sparse_classes_75kplus_train_001720 | 3,824 | no_license | [
{
"docstring": "初始化,配置并启动调度器",
"name": "__init__",
"signature": "def __init__(self) -> None"
},
{
"docstring": "添加一次性任务 :param job_cls: 作业类 :param args: 作业初始化位置参数 :param kwargs: 作业初始化关键字参数 :return: 任务名字对应 id 的字段",
"name": "add_immediate_job",
"signature": "def add_immediate_job(self, job... | 3 | null | Implement the Python class `SchedulerServer` described below.
Class description:
事件调度器
Method signatures and docstrings:
- def __init__(self) -> None: 初始化,配置并启动调度器
- def add_immediate_job(self, job_cls: str, *args, **kwargs) -> dict: 添加一次性任务 :param job_cls: 作业类 :param args: 作业初始化位置参数 :param kwargs: 作业初始化关键字参数 :return... | Implement the Python class `SchedulerServer` described below.
Class description:
事件调度器
Method signatures and docstrings:
- def __init__(self) -> None: 初始化,配置并启动调度器
- def add_immediate_job(self, job_cls: str, *args, **kwargs) -> dict: 添加一次性任务 :param job_cls: 作业类 :param args: 作业初始化位置参数 :param kwargs: 作业初始化关键字参数 :return... | cd66e00a235fedf361ae2b80c0f6eaf2fcf56f37 | <|skeleton|>
class SchedulerServer:
"""事件调度器"""
def __init__(self) -> None:
"""初始化,配置并启动调度器"""
<|body_0|>
def add_immediate_job(self, job_cls: str, *args, **kwargs) -> dict:
"""添加一次性任务 :param job_cls: 作业类 :param args: 作业初始化位置参数 :param kwargs: 作业初始化关键字参数 :return: 任务名字对应 id 的字段"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SchedulerServer:
"""事件调度器"""
def __init__(self) -> None:
"""初始化,配置并启动调度器"""
self._scheduler = BackgroundScheduler(**{'jobstores': {'default': DjangoJobStore()}, 'executors': {'default': ThreadPoolExecutor(max_workers=20), 'process': ProcessPoolExecutor(max_workers=20)}, 'job_defaults': {'... | the_stack_v2_python_sparse | event/scheduler.py | Near-Zhang/flex_cmdb | train | 1 |
166b78268cec4aad608fba7d162aa2195954cf8a | [
"if not matrix:\n return 0\n\n@lru_cache(None)\ndef dfs(row: int, column: int) -> int:\n best = 1\n for dx, dy in Solution.DIRS:\n newRow, newColumn = (row + dx, column + dy)\n if 0 <= newRow < rows and 0 <= newColumn < columns and (matrix[newRow][newColumn] > matrix[row][column]):\n ... | <|body_start_0|>
if not matrix:
return 0
@lru_cache(None)
def dfs(row: int, column: int) -> int:
best = 1
for dx, dy in Solution.DIRS:
newRow, newColumn = (row + dx, column + dy)
if 0 <= newRow < rows and 0 <= newColumn < colum... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestIncreaseingPath(self, matrix):
"""方法一:dfs+备忘录+python lru_cache decorator"""
<|body_0|>
def longestIncreaseingPath(self, matrix):
"""方法一:dfs+备忘录"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not matrix:
return 0
... | stack_v2_sparse_classes_75kplus_train_001721 | 1,963 | no_license | [
{
"docstring": "方法一:dfs+备忘录+python lru_cache decorator",
"name": "longestIncreaseingPath",
"signature": "def longestIncreaseingPath(self, matrix)"
},
{
"docstring": "方法一:dfs+备忘录",
"name": "longestIncreaseingPath",
"signature": "def longestIncreaseingPath(self, matrix)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013549 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestIncreaseingPath(self, matrix): 方法一:dfs+备忘录+python lru_cache decorator
- def longestIncreaseingPath(self, matrix): 方法一:dfs+备忘录 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestIncreaseingPath(self, matrix): 方法一:dfs+备忘录+python lru_cache decorator
- def longestIncreaseingPath(self, matrix): 方法一:dfs+备忘录
<|skeleton|>
class Solution:
def lo... | 57f303aa6e76f7c5292fa60bffdfddcb4ff9ddfb | <|skeleton|>
class Solution:
def longestIncreaseingPath(self, matrix):
"""方法一:dfs+备忘录+python lru_cache decorator"""
<|body_0|>
def longestIncreaseingPath(self, matrix):
"""方法一:dfs+备忘录"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def longestIncreaseingPath(self, matrix):
"""方法一:dfs+备忘录+python lru_cache decorator"""
if not matrix:
return 0
@lru_cache(None)
def dfs(row: int, column: int) -> int:
best = 1
for dx, dy in Solution.DIRS:
newRow, ne... | the_stack_v2_python_sparse | 4_LEETCODE/6_DFSorBFS/329_矩阵中最长的递增路径.py | fzingithub/SwordRefers2Offer | train | 1 | |
09b2cc64b876f149e10e7fbef582ea1331c4431c | [
"if prev_buffer is None:\n self.states = []\n self.actions = []\n self.rewards = []\n self.dones = []\n self.exits = []\n self.next_states = []\n self.position = 0\n self.capacity = float(capacity)\nelse:\n fill = min(capacity, prev_buffer.capacity)\n self.states = prev_buffer.states[-... | <|body_start_0|>
if prev_buffer is None:
self.states = []
self.actions = []
self.rewards = []
self.dones = []
self.exits = []
self.next_states = []
self.position = 0
self.capacity = float(capacity)
else:
... | ReplayBuffer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReplayBuffer:
def __init__(self, capacity, prev_buffer=None):
"""This class implements a replay buffer where the relevant information of past experiences is stored and can be sampled from. :param capacity: (int) The desired capacity of the buffer. No more than this number of replay data ... | stack_v2_sparse_classes_75kplus_train_001722 | 5,651 | no_license | [
{
"docstring": "This class implements a replay buffer where the relevant information of past experiences is stored and can be sampled from. :param capacity: (int) The desired capacity of the buffer. No more than this number of replay data will be stored. :param prev_buffer: (ReplayBuffer) A previously collected... | 3 | stack_v2_sparse_classes_30k_train_039192 | Implement the Python class `ReplayBuffer` described below.
Class description:
Implement the ReplayBuffer class.
Method signatures and docstrings:
- def __init__(self, capacity, prev_buffer=None): This class implements a replay buffer where the relevant information of past experiences is stored and can be sampled from... | Implement the Python class `ReplayBuffer` described below.
Class description:
Implement the ReplayBuffer class.
Method signatures and docstrings:
- def __init__(self, capacity, prev_buffer=None): This class implements a replay buffer where the relevant information of past experiences is stored and can be sampled from... | 517a355f174346e0c99320a01bf597095a632341 | <|skeleton|>
class ReplayBuffer:
def __init__(self, capacity, prev_buffer=None):
"""This class implements a replay buffer where the relevant information of past experiences is stored and can be sampled from. :param capacity: (int) The desired capacity of the buffer. No more than this number of replay data ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReplayBuffer:
def __init__(self, capacity, prev_buffer=None):
"""This class implements a replay buffer where the relevant information of past experiences is stored and can be sampled from. :param capacity: (int) The desired capacity of the buffer. No more than this number of replay data will be stored... | the_stack_v2_python_sparse | utils/replay_buffer.py | nphamilton/rl_library | train | 2 | |
bbc4c3171b7227ed776a83ecdc7d0fb5732a4779 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | cameraService.CameraService 主摄像头视频流与图片的获取 | CameraServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CameraServiceServicer:
"""cameraService.CameraService 主摄像头视频流与图片的获取"""
def LiveH264Stream(self, request, context):
"""LiveH264Stream 获取主摄像头视频流数据 输出数据为H264裸流,无音频,分辨率为960*720 网关不包含当前方法,WebSocket用户请使用独立接口 ws://10.10.10.2(:81)/api/v2/camera/ws/h264/live(?token=) web应用中需调整数据类型: ws.binaryT... | stack_v2_sparse_classes_75kplus_train_001723 | 4,407 | permissive | [
{
"docstring": "LiveH264Stream 获取主摄像头视频流数据 输出数据为H264裸流,无音频,分辨率为960*720 网关不包含当前方法,WebSocket用户请使用独立接口 ws://10.10.10.2(:81)/api/v2/camera/ws/h264/live(?token=) web应用中需调整数据类型: ws.binaryType = 'arraybuffer'; 开发管理平台功能参考: http://10.10.10.2/camera/live/ws",
"name": "LiveH264Stream",
"signature": "def LiveH264St... | 2 | stack_v2_sparse_classes_30k_train_022948 | Implement the Python class `CameraServiceServicer` described below.
Class description:
cameraService.CameraService 主摄像头视频流与图片的获取
Method signatures and docstrings:
- def LiveH264Stream(self, request, context): LiveH264Stream 获取主摄像头视频流数据 输出数据为H264裸流,无音频,分辨率为960*720 网关不包含当前方法,WebSocket用户请使用独立接口 ws://10.10.10.2(:81)/api/... | Implement the Python class `CameraServiceServicer` described below.
Class description:
cameraService.CameraService 主摄像头视频流与图片的获取
Method signatures and docstrings:
- def LiveH264Stream(self, request, context): LiveH264Stream 获取主摄像头视频流数据 输出数据为H264裸流,无音频,分辨率为960*720 网关不包含当前方法,WebSocket用户请使用独立接口 ws://10.10.10.2(:81)/api/... | 4a0cb57aa5f318a3099fbfe6198620555b3a45af | <|skeleton|>
class CameraServiceServicer:
"""cameraService.CameraService 主摄像头视频流与图片的获取"""
def LiveH264Stream(self, request, context):
"""LiveH264Stream 获取主摄像头视频流数据 输出数据为H264裸流,无音频,分辨率为960*720 网关不包含当前方法,WebSocket用户请使用独立接口 ws://10.10.10.2(:81)/api/v2/camera/ws/h264/live(?token=) web应用中需调整数据类型: ws.binaryT... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CameraServiceServicer:
"""cameraService.CameraService 主摄像头视频流与图片的获取"""
def LiveH264Stream(self, request, context):
"""LiveH264Stream 获取主摄像头视频流数据 输出数据为H264裸流,无音频,分辨率为960*720 网关不包含当前方法,WebSocket用户请使用独立接口 ws://10.10.10.2(:81)/api/v2/camera/ws/h264/live(?token=) web应用中需调整数据类型: ws.binaryType = 'arrayb... | the_stack_v2_python_sparse | pythonsdk/camera/camera_pb2_grpc.py | jjrobotcn/andy4 | train | 0 |
b9556f1c7ec46a5653cc26117a4caf253ffc3909 | [
"pre, cur = (None, head)\nwhile cur:\n tmp = cur.next\n cur.next = pre\n pre = cur\n cur = tmp\nreturn pre",
"if not head or not head.next:\n return head\ncur = self.reverse_list_2(head.next)\nhead.next.next = head\nhead.next = None\nreturn cur"
] | <|body_start_0|>
pre, cur = (None, head)
while cur:
tmp = cur.next
cur.next = pre
pre = cur
cur = tmp
return pre
<|end_body_0|>
<|body_start_1|>
if not head or not head.next:
return head
cur = self.reverse_list_2(head.n... | OfficialSolution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OfficialSolution:
def reverse_list(self, head: ListNode) -> ListNode:
"""双指针。 设指针 pre 指向 None,指针 cur 指向 head, 然后遍历 cur,每次将 cur.next 指向 pre, 然后将 pre 和 cur 沿着链表移动一位。 直到 cur 遍历完链表,此时 pre 指向链表最后一个元素。"""
<|body_0|>
def reverse_list_2(self, head: ListNode) -> ListNode:
"""... | stack_v2_sparse_classes_75kplus_train_001724 | 2,713 | no_license | [
{
"docstring": "双指针。 设指针 pre 指向 None,指针 cur 指向 head, 然后遍历 cur,每次将 cur.next 指向 pre, 然后将 pre 和 cur 沿着链表移动一位。 直到 cur 遍历完链表,此时 pre 指向链表最后一个元素。",
"name": "reverse_list",
"signature": "def reverse_list(self, head: ListNode) -> ListNode"
},
{
"docstring": "递归。",
"name": "reverse_list_2",
"signa... | 2 | null | Implement the Python class `OfficialSolution` described below.
Class description:
Implement the OfficialSolution class.
Method signatures and docstrings:
- def reverse_list(self, head: ListNode) -> ListNode: 双指针。 设指针 pre 指向 None,指针 cur 指向 head, 然后遍历 cur,每次将 cur.next 指向 pre, 然后将 pre 和 cur 沿着链表移动一位。 直到 cur 遍历完链表,此时 pre... | Implement the Python class `OfficialSolution` described below.
Class description:
Implement the OfficialSolution class.
Method signatures and docstrings:
- def reverse_list(self, head: ListNode) -> ListNode: 双指针。 设指针 pre 指向 None,指针 cur 指向 head, 然后遍历 cur,每次将 cur.next 指向 pre, 然后将 pre 和 cur 沿着链表移动一位。 直到 cur 遍历完链表,此时 pre... | 6932d69353b94ec824dd0ddc86a92453f6673232 | <|skeleton|>
class OfficialSolution:
def reverse_list(self, head: ListNode) -> ListNode:
"""双指针。 设指针 pre 指向 None,指针 cur 指向 head, 然后遍历 cur,每次将 cur.next 指向 pre, 然后将 pre 和 cur 沿着链表移动一位。 直到 cur 遍历完链表,此时 pre 指向链表最后一个元素。"""
<|body_0|>
def reverse_list_2(self, head: ListNode) -> ListNode:
"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OfficialSolution:
def reverse_list(self, head: ListNode) -> ListNode:
"""双指针。 设指针 pre 指向 None,指针 cur 指向 head, 然后遍历 cur,每次将 cur.next 指向 pre, 然后将 pre 和 cur 沿着链表移动一位。 直到 cur 遍历完链表,此时 pre 指向链表最后一个元素。"""
pre, cur = (None, head)
while cur:
tmp = cur.next
cur.next = pr... | the_stack_v2_python_sparse | 0206_reverse-linked-list.py | Nigirimeshi/leetcode | train | 0 | |
3706685ff292a667e42555d735c91a257dd76415 | [
"all_data = []\nfor filepath in self.filepaths:\n with filepath.open() as f:\n data = re.split('(\\\\n){1}(?=(\\\\s{1}={1}\\\\s{1})[^=]+(\\\\s{1}={1}\\\\s{1}\\\\n))', f.read())[1:][3::4]\n all_data.extend(data)\n print('Loaded {} articles'.format(len(data)))\nreturn all_data",
"articles_it... | <|body_start_0|>
all_data = []
for filepath in self.filepaths:
with filepath.open() as f:
data = re.split('(\\n){1}(?=(\\s{1}={1}\\s{1})[^=]+(\\s{1}={1}\\s{1}\\n))', f.read())[1:][3::4]
all_data.extend(data)
print('Loaded {} articles'.format(le... | Loads, and tokenizes the wikitext dataset | WikiTextTokenizer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WikiTextTokenizer:
"""Loads, and tokenizes the wikitext dataset"""
def read_articles(self):
"""Returns a list of articles"""
<|body_0|>
def tokenize(self):
"""Articles will be processed in parallel"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_001725 | 2,399 | no_license | [
{
"docstring": "Returns a list of articles",
"name": "read_articles",
"signature": "def read_articles(self)"
},
{
"docstring": "Articles will be processed in parallel",
"name": "tokenize",
"signature": "def tokenize(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000606 | Implement the Python class `WikiTextTokenizer` described below.
Class description:
Loads, and tokenizes the wikitext dataset
Method signatures and docstrings:
- def read_articles(self): Returns a list of articles
- def tokenize(self): Articles will be processed in parallel | Implement the Python class `WikiTextTokenizer` described below.
Class description:
Loads, and tokenizes the wikitext dataset
Method signatures and docstrings:
- def read_articles(self): Returns a list of articles
- def tokenize(self): Articles will be processed in parallel
<|skeleton|>
class WikiTextTokenizer:
"... | cb79fe23b573977f57a41b4b2cba67b6aec10d2f | <|skeleton|>
class WikiTextTokenizer:
"""Loads, and tokenizes the wikitext dataset"""
def read_articles(self):
"""Returns a list of articles"""
<|body_0|>
def tokenize(self):
"""Articles will be processed in parallel"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WikiTextTokenizer:
"""Loads, and tokenizes the wikitext dataset"""
def read_articles(self):
"""Returns a list of articles"""
all_data = []
for filepath in self.filepaths:
with filepath.open() as f:
data = re.split('(\\n){1}(?=(\\s{1}={1}\\s{1})[^=]+(\\s... | the_stack_v2_python_sparse | natural_language_processing/language_model/lm/preprocess/wikitext.py | gabrieltseng/datascience-projects | train | 45 |
1d166b8f0b7b1709415b76919b7253f405756438 | [
"self.create_and_verify_stack('single/basic_layer')\nlayer_logical_id_1 = self.get_logical_id_by_type('AWS::Lambda::LayerVersion')\nself.set_template_resource_property('MyLayerVersion', 'Description', 'A basic layer')\nself.update_stack()\nlayer_logical_id_2 = self.get_logical_id_by_type('AWS::Lambda::LayerVersion'... | <|body_start_0|>
self.create_and_verify_stack('single/basic_layer')
layer_logical_id_1 = self.get_logical_id_by_type('AWS::Lambda::LayerVersion')
self.set_template_resource_property('MyLayerVersion', 'Description', 'A basic layer')
self.update_stack()
layer_logical_id_2 = self.ge... | Basic AWS::Lambda::LayerVersion tests | TestBasicLayerVersion | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestBasicLayerVersion:
"""Basic AWS::Lambda::LayerVersion tests"""
def test_basic_layer_version(self):
"""Creates a basic lambda layer version"""
<|body_0|>
def test_basic_layer_with_parameters(self):
"""Creates a basic lambda layer version with parameters"""
... | stack_v2_sparse_classes_75kplus_train_001726 | 2,605 | permissive | [
{
"docstring": "Creates a basic lambda layer version",
"name": "test_basic_layer_version",
"signature": "def test_basic_layer_version(self)"
},
{
"docstring": "Creates a basic lambda layer version with parameters",
"name": "test_basic_layer_with_parameters",
"signature": "def test_basic_... | 3 | stack_v2_sparse_classes_30k_train_045752 | Implement the Python class `TestBasicLayerVersion` described below.
Class description:
Basic AWS::Lambda::LayerVersion tests
Method signatures and docstrings:
- def test_basic_layer_version(self): Creates a basic lambda layer version
- def test_basic_layer_with_parameters(self): Creates a basic lambda layer version w... | Implement the Python class `TestBasicLayerVersion` described below.
Class description:
Basic AWS::Lambda::LayerVersion tests
Method signatures and docstrings:
- def test_basic_layer_version(self): Creates a basic lambda layer version
- def test_basic_layer_with_parameters(self): Creates a basic lambda layer version w... | 0bb862ea715a4aafbb7984b407a81856b3ae19c4 | <|skeleton|>
class TestBasicLayerVersion:
"""Basic AWS::Lambda::LayerVersion tests"""
def test_basic_layer_version(self):
"""Creates a basic lambda layer version"""
<|body_0|>
def test_basic_layer_with_parameters(self):
"""Creates a basic lambda layer version with parameters"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestBasicLayerVersion:
"""Basic AWS::Lambda::LayerVersion tests"""
def test_basic_layer_version(self):
"""Creates a basic lambda layer version"""
self.create_and_verify_stack('single/basic_layer')
layer_logical_id_1 = self.get_logical_id_by_type('AWS::Lambda::LayerVersion')
... | the_stack_v2_python_sparse | integration/single/test_basic_layer_version.py | aws/serverless-application-model | train | 2,055 |
d17973ed51d6284a547e2ef8a77a27b5774985ef | [
"for key in inservers:\n if not key.startswith('server '):\n raise KeyError('Unrecognized object type: %s' % key)\n srv = key[7:]\n inobj = inservers[key]\n self[wrapper.name, srv] = serv = ForeignServer.from_map(srv, wrapper.name, inobj)\n if 'user mappings' in inobj:\n newdb.usermaps.... | <|body_start_0|>
for key in inservers:
if not key.startswith('server '):
raise KeyError('Unrecognized object type: %s' % key)
srv = key[7:]
inobj = inservers[key]
self[wrapper.name, srv] = serv = ForeignServer.from_map(srv, wrapper.name, inobj)
... | The collection of foreign servers in a database | ForeignServerDict | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ForeignServerDict:
"""The collection of foreign servers in a database"""
def from_map(self, wrapper, inservers, newdb):
"""Initialize the dictionary of servers by examining the input map :param wrapper: associated foreign data wrapper :param inservers: input YAML map defining the for... | stack_v2_sparse_classes_75kplus_train_001727 | 24,509 | permissive | [
{
"docstring": "Initialize the dictionary of servers by examining the input map :param wrapper: associated foreign data wrapper :param inservers: input YAML map defining the foreign servers :param newdb: collection of dictionaries defining the database",
"name": "from_map",
"signature": "def from_map(se... | 3 | stack_v2_sparse_classes_30k_val_000176 | Implement the Python class `ForeignServerDict` described below.
Class description:
The collection of foreign servers in a database
Method signatures and docstrings:
- def from_map(self, wrapper, inservers, newdb): Initialize the dictionary of servers by examining the input map :param wrapper: associated foreign data ... | Implement the Python class `ForeignServerDict` described below.
Class description:
The collection of foreign servers in a database
Method signatures and docstrings:
- def from_map(self, wrapper, inservers, newdb): Initialize the dictionary of servers by examining the input map :param wrapper: associated foreign data ... | ec682513d5256e383647f38f7fba29530cfb9fbe | <|skeleton|>
class ForeignServerDict:
"""The collection of foreign servers in a database"""
def from_map(self, wrapper, inservers, newdb):
"""Initialize the dictionary of servers by examining the input map :param wrapper: associated foreign data wrapper :param inservers: input YAML map defining the for... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ForeignServerDict:
"""The collection of foreign servers in a database"""
def from_map(self, wrapper, inservers, newdb):
"""Initialize the dictionary of servers by examining the input map :param wrapper: associated foreign data wrapper :param inservers: input YAML map defining the foreign servers ... | the_stack_v2_python_sparse | pyrseas/dbobject/foreign.py | perseas/Pyrseas | train | 323 |
6c0abc2e2f0cbefc9e52a42b3ee4fcdd8625ddf0 | [
"if request.user.is_superuser:\n department_queryset = Department.objects.filter(has_waiting_list=True).order_by('zipcode')\nelse:\n department_queryset = Department.objects.filter(has_waiting_list=True, adminuserinformation__user=request.user).order_by('zipcode')\ndepartments = [('any', 'Alle opskrevne samle... | <|body_start_0|>
if request.user.is_superuser:
department_queryset = Department.objects.filter(has_waiting_list=True).order_by('zipcode')
else:
department_queryset = Department.objects.filter(has_waiting_list=True, adminuserinformation__user=request.user).order_by('zipcode')
... | PersonWaitinglistListFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PersonWaitinglistListFilter:
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the rig... | stack_v2_sparse_classes_75kplus_train_001728 | 45,186 | no_license | [
{
"docstring": "Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.",
"name": "lookups",
"signature": "def lookups(self, request,... | 2 | stack_v2_sparse_classes_30k_test_000892 | Implement the Python class `PersonWaitinglistListFilter` described below.
Class description:
Implement the PersonWaitinglistListFilter class.
Method signatures and docstrings:
- def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for the option that wi... | Implement the Python class `PersonWaitinglistListFilter` described below.
Class description:
Implement the PersonWaitinglistListFilter class.
Method signatures and docstrings:
- def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for the option that wi... | 69dfbb0f2d947418112a1af631275ee598743fff | <|skeleton|>
class PersonWaitinglistListFilter:
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the rig... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PersonWaitinglistListFilter:
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar."""... | the_stack_v2_python_sparse | members/admin.py | sunenilausen/forenings_medlemmer | train | 0 | |
2961fdc7a2391ad590457dfa8068c0f763d96bec | [
"if gain_factor != 1 and gain_factor != 2:\n raise ValueError('DAC __init__: Invalid gain factor. Must be 1 or 2')\nelse:\n self.gain = gain_factor\n self.maxdacvoltage = self.__dacMaxOutput__[self.gain]",
"if channel > 2 or channel < 1:\n raise ValueError('read_adc_voltage... | <|body_start_0|>
if gain_factor != 1 and gain_factor != 2:
raise ValueError('DAC __init__: Invalid gain factor. Must be 1 or 2')
else:
self.gain = gain_factor
self.maxdacvoltage = self.__dacMaxOutput__[self.gain]
<|end_body_0|>
<|body_star... | Based on the Microchip MCP3202 and MCP4822 | ADCDACPi | [
"Apache-2.0",
"GPL-2.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ADCDACPi:
"""Based on the Microchip MCP3202 and MCP4822"""
def __init__(self, gain_factor=1):
"""Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G ... | stack_v2_sparse_classes_75kplus_train_001729 | 5,074 | permissive | [
{
"docstring": "Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G is gain factor, Vref (for this chip) is 2.048 and D is the 12-bit digital value",
"name": "__init__",
... | 6 | stack_v2_sparse_classes_30k_test_002697 | Implement the Python class `ADCDACPi` described below.
Class description:
Based on the Microchip MCP3202 and MCP4822
Method signatures and docstrings:
- def __init__(self, gain_factor=1): Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output vo... | Implement the Python class `ADCDACPi` described below.
Class description:
Based on the Microchip MCP3202 and MCP4822
Method signatures and docstrings:
- def __init__(self, gain_factor=1): Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output vo... | 2529ca149d7f584ede780de1cb695a2f55b7031f | <|skeleton|>
class ADCDACPi:
"""Based on the Microchip MCP3202 and MCP4822"""
def __init__(self, gain_factor=1):
"""Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ADCDACPi:
"""Based on the Microchip MCP3202 and MCP4822"""
def __init__(self, gain_factor=1):
"""Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G is gain facto... | the_stack_v2_python_sparse | reinvent-2020/RhythmCloud/lib/ABElectronics_Python_Libraries/ADCDACPi/ADCDACPi.py | aws-samples/aws-builders-fair-projects | train | 89 |
0ef718cab0c87bf9d4545a1ebc463adfbe150f04 | [
"page = request.args.get('page', 1)\nif tab == 'all':\n orders = Order.commodities(is_paid=True, status__nin=['ABNORMAL', 'CANCELLED', 'REFUNDED'], is_test=False)\nelif tab == 'test':\n orders = Order.commodities(is_paid=True, status__nin=['ABNORMAL', 'CANCELLED', 'REFUNDED'], is_test=True)\nelif tab == 'tran... | <|body_start_0|>
page = request.args.get('page', 1)
if tab == 'all':
orders = Order.commodities(is_paid=True, status__nin=['ABNORMAL', 'CANCELLED', 'REFUNDED'], is_test=False)
elif tab == 'test':
orders = Order.commodities(is_paid=True, status__nin=['ABNORMAL', 'CANCELLED... | OrderView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrderView:
def index(self, tab='all'):
"""展示首页 :param tab: :return:"""
<|body_0|>
def search(self, page=1):
"""搜索 :param page: :return:"""
<|body_1|>
def cancel_order(self, order_id):
"""取消订单 :param order_id: :return:"""
<|body_2|>
d... | stack_v2_sparse_classes_75kplus_train_001730 | 3,603 | no_license | [
{
"docstring": "展示首页 :param tab: :return:",
"name": "index",
"signature": "def index(self, tab='all')"
},
{
"docstring": "搜索 :param page: :return:",
"name": "search",
"signature": "def search(self, page=1)"
},
{
"docstring": "取消订单 :param order_id: :return:",
"name": "cancel_o... | 4 | stack_v2_sparse_classes_30k_train_050306 | Implement the Python class `OrderView` described below.
Class description:
Implement the OrderView class.
Method signatures and docstrings:
- def index(self, tab='all'): 展示首页 :param tab: :return:
- def search(self, page=1): 搜索 :param page: :return:
- def cancel_order(self, order_id): 取消订单 :param order_id: :return:
- ... | Implement the Python class `OrderView` described below.
Class description:
Implement the OrderView class.
Method signatures and docstrings:
- def index(self, tab='all'): 展示首页 :param tab: :return:
- def search(self, page=1): 搜索 :param page: :return:
- def cancel_order(self, order_id): 取消订单 :param order_id: :return:
- ... | 867de34eea10ea4219eec9130b7b14412cbbd8a0 | <|skeleton|>
class OrderView:
def index(self, tab='all'):
"""展示首页 :param tab: :return:"""
<|body_0|>
def search(self, page=1):
"""搜索 :param page: :return:"""
<|body_1|>
def cancel_order(self, order_id):
"""取消订单 :param order_id: :return:"""
<|body_2|>
d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OrderView:
def index(self, tab='all'):
"""展示首页 :param tab: :return:"""
page = request.args.get('page', 1)
if tab == 'all':
orders = Order.commodities(is_paid=True, status__nin=['ABNORMAL', 'CANCELLED', 'REFUNDED'], is_test=False)
elif tab == 'test':
orde... | the_stack_v2_python_sparse | app/views/admin/order/order.py | FreeGodCode/e-commerce | train | 0 | |
a3830ea84b2f2acd43c933bccce2e185c92006cf | [
"it = iter(test_inputs.split('\\n')) if test_inputs else None\n\ndef uinput():\n return next(it) if it else sys.stdin.readline().rstrip()\n[self.n] = map(int, uinput().split())\n[self.m] = map(int, uinput().split())\nself.nums = [int(uinput()) for i in range(self.n)]\nself.numss = list(reversed(sorted(self.nums)... | <|body_start_0|>
it = iter(test_inputs.split('\n')) if test_inputs else None
def uinput():
return next(it) if it else sys.stdin.readline().rstrip()
[self.n] = map(int, uinput().split())
[self.m] = map(int, uinput().split())
self.nums = [int(uinput()) for i in range(s... | First representation | First | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class First:
"""First representation"""
def __init__(self, test_inputs=None):
"""Default constructor"""
<|body_0|>
def calculate(self):
"""Main calcualtion function of the class"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
it = iter(test_inputs.spl... | stack_v2_sparse_classes_75kplus_train_001731 | 3,138 | permissive | [
{
"docstring": "Default constructor",
"name": "__init__",
"signature": "def __init__(self, test_inputs=None)"
},
{
"docstring": "Main calcualtion function of the class",
"name": "calculate",
"signature": "def calculate(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_001178 | Implement the Python class `First` described below.
Class description:
First representation
Method signatures and docstrings:
- def __init__(self, test_inputs=None): Default constructor
- def calculate(self): Main calcualtion function of the class | Implement the Python class `First` described below.
Class description:
First representation
Method signatures and docstrings:
- def __init__(self, test_inputs=None): Default constructor
- def calculate(self): Main calcualtion function of the class
<|skeleton|>
class First:
"""First representation"""
def __i... | ae02ea872ca91ef98630cc172a844b82cc56f621 | <|skeleton|>
class First:
"""First representation"""
def __init__(self, test_inputs=None):
"""Default constructor"""
<|body_0|>
def calculate(self):
"""Main calcualtion function of the class"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class First:
"""First representation"""
def __init__(self, test_inputs=None):
"""Default constructor"""
it = iter(test_inputs.split('\n')) if test_inputs else None
def uinput():
return next(it) if it else sys.stdin.readline().rstrip()
[self.n] = map(int, uinput().sp... | the_stack_v2_python_sparse | codeforces/609A_first.py | snsokolov/contests | train | 1 |
61e95c8d3c795d77c8f9986245a7054fa073dd63 | [
"if metadata_columns is None:\n metadata_columns = ['note_id']\nif json_columns is None:\n json_columns = ['text']\nif parquet_columns is None:\n parquet_columns = ['NoteText', 'NoteID']\nself._parquet_columns = parquet_columns\nself._json_columns = json_columns\nself._metadata_columns = metadata_columns",... | <|body_start_0|>
if metadata_columns is None:
metadata_columns = ['note_id']
if json_columns is None:
json_columns = ['text']
if parquet_columns is None:
parquet_columns = ['NoteText', 'NoteID']
self._parquet_columns = parquet_columns
self._jso... | Convert parquet file to jsonl file. While some of the columns in the parquet file will be directly used as keys in the json object, some of the columns will be stored as metadata. The parquet_columns columns specify the columns from the parquet file that will be stored in the json object. The json_columns specify which... | DataLoader | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataLoader:
"""Convert parquet file to jsonl file. While some of the columns in the parquet file will be directly used as keys in the json object, some of the columns will be stored as metadata. The parquet_columns columns specify the columns from the parquet file that will be stored in the json ... | stack_v2_sparse_classes_75kplus_train_001732 | 7,272 | permissive | [
{
"docstring": "Initialize the parquet column names and json object key names Args: parquet_columns (Optional[Sequence[str]]): Columns to extract from parquet file. If not given - will assign ['NoteText', 'NoteID'] json_columns (Optional[Sequence[str]]): Fields that will be stored directly in json object. If no... | 2 | null | Implement the Python class `DataLoader` described below.
Class description:
Convert parquet file to jsonl file. While some of the columns in the parquet file will be directly used as keys in the json object, some of the columns will be stored as metadata. The parquet_columns columns specify the columns from the parque... | Implement the Python class `DataLoader` described below.
Class description:
Convert parquet file to jsonl file. While some of the columns in the parquet file will be directly used as keys in the json object, some of the columns will be stored as metadata. The parquet_columns columns specify the columns from the parque... | 88751ab1f95d23d54ded39385adb8a27f57a6f72 | <|skeleton|>
class DataLoader:
"""Convert parquet file to jsonl file. While some of the columns in the parquet file will be directly used as keys in the json object, some of the columns will be stored as metadata. The parquet_columns columns specify the columns from the parquet file that will be stored in the json ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DataLoader:
"""Convert parquet file to jsonl file. While some of the columns in the parquet file will be directly used as keys in the json object, some of the columns will be stored as metadata. The parquet_columns columns specify the columns from the parquet file that will be stored in the json object. The j... | the_stack_v2_python_sparse | src/robust_deid/data_processing/data_loader.py | obi-ml-public/ehr_deidentification | train | 28 |
ee0874a5aa84cef25423fd58ca2d2fa1fc91c8b9 | [
"try:\n if not params:\n params = dict()\n params['lastlogintime'] = 0\n params['_'] = int(time.time() * 1000)\n params['sceneval'] = 2\n params['g_login_type'] = 1\n params['g_ty'] = 'ls'\n params['callback'] = 'json'\n url = f'https://wq.jd.com/{path}?' + urlencode(params)\n if m... | <|body_start_0|>
try:
if not params:
params = dict()
params['lastlogintime'] = 0
params['_'] = int(time.time() * 1000)
params['sceneval'] = 2
params['g_login_type'] = 1
params['g_ty'] = 'ls'
params['callback'] = ... | JdUnsubscribe | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JdUnsubscribe:
async def request(self, session, path, params=None, method='GET'):
"""请求服务器数据 :param method: :param session: :param path: :param params: :return:"""
<|body_0|>
async def unsubscribe_goods(self, session):
"""取关商品 :param session: :return:"""
<|bo... | stack_v2_sparse_classes_75kplus_train_001733 | 4,959 | no_license | [
{
"docstring": "请求服务器数据 :param method: :param session: :param path: :param params: :return:",
"name": "request",
"signature": "async def request(self, session, path, params=None, method='GET')"
},
{
"docstring": "取关商品 :param session: :return:",
"name": "unsubscribe_goods",
"signature": "... | 4 | null | Implement the Python class `JdUnsubscribe` described below.
Class description:
Implement the JdUnsubscribe class.
Method signatures and docstrings:
- async def request(self, session, path, params=None, method='GET'): 请求服务器数据 :param method: :param session: :param path: :param params: :return:
- async def unsubscribe_g... | Implement the Python class `JdUnsubscribe` described below.
Class description:
Implement the JdUnsubscribe class.
Method signatures and docstrings:
- async def request(self, session, path, params=None, method='GET'): 请求服务器数据 :param method: :param session: :param path: :param params: :return:
- async def unsubscribe_g... | 183bac139df86c6aaad45c27fe072b8529a690b8 | <|skeleton|>
class JdUnsubscribe:
async def request(self, session, path, params=None, method='GET'):
"""请求服务器数据 :param method: :param session: :param path: :param params: :return:"""
<|body_0|>
async def unsubscribe_goods(self, session):
"""取关商品 :param session: :return:"""
<|bo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class JdUnsubscribe:
async def request(self, session, path, params=None, method='GET'):
"""请求服务器数据 :param method: :param session: :param path: :param params: :return:"""
try:
if not params:
params = dict()
params['lastlogintime'] = 0
params['_'] = ... | the_stack_v2_python_sparse | jd_unsubscribe.py | daidaojianke/jd_py-3 | train | 0 | |
82b7a1472da221a53d8a2485753057f9610a160d | [
"self.name = _name\nself.region_code_list = []\nself.status = 'enabled'\nself.memberships = {}\nself.vCPUs = 0\nself.original_vCPUs = 0\nself.avail_vCPUs = 0\nself.mem_cap = 0\nself.original_mem_cap = 0\nself.avail_mem_cap = 0\nself.local_disk_cap = 0\nself.original_local_disk_cap = 0\nself.avail_local_disk_cap = 0... | <|body_start_0|>
self.name = _name
self.region_code_list = []
self.status = 'enabled'
self.memberships = {}
self.vCPUs = 0
self.original_vCPUs = 0
self.avail_vCPUs = 0
self.mem_cap = 0
self.original_mem_cap = 0
self.avail_mem_cap = 0
... | Datacenter Class. This object represents a datacenter. It contains all memberships or logical groups in the datacenter, all resources available, placed vms, and more throughout the datacenter. | Datacenter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Datacenter:
"""Datacenter Class. This object represents a datacenter. It contains all memberships or logical groups in the datacenter, all resources available, placed vms, and more throughout the datacenter."""
def __init__(self, _name):
"""Init Datacenter object."""
<|body_0... | stack_v2_sparse_classes_75kplus_train_001734 | 21,975 | permissive | [
{
"docstring": "Init Datacenter object.",
"name": "__init__",
"signature": "def __init__(self, _name)"
},
{
"docstring": "Init datacenter resources to 0.",
"name": "init_resources",
"signature": "def init_resources(self)"
},
{
"docstring": "Return JSON info for datacenter object.... | 3 | stack_v2_sparse_classes_30k_train_009547 | Implement the Python class `Datacenter` described below.
Class description:
Datacenter Class. This object represents a datacenter. It contains all memberships or logical groups in the datacenter, all resources available, placed vms, and more throughout the datacenter.
Method signatures and docstrings:
- def __init__(... | Implement the Python class `Datacenter` described below.
Class description:
Datacenter Class. This object represents a datacenter. It contains all memberships or logical groups in the datacenter, all resources available, placed vms, and more throughout the datacenter.
Method signatures and docstrings:
- def __init__(... | ea89fbfbbb488938ac322e2a9bb7f8f448a7cd76 | <|skeleton|>
class Datacenter:
"""Datacenter Class. This object represents a datacenter. It contains all memberships or logical groups in the datacenter, all resources available, placed vms, and more throughout the datacenter."""
def __init__(self, _name):
"""Init Datacenter object."""
<|body_0... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Datacenter:
"""Datacenter Class. This object represents a datacenter. It contains all memberships or logical groups in the datacenter, all resources available, placed vms, and more throughout the datacenter."""
def __init__(self, _name):
"""Init Datacenter object."""
self.name = _name
... | the_stack_v2_python_sparse | valet/engine/resource_manager/resource_base.py | att-comdev/valet | train | 5 |
255f571c4530efdbc9813bb6fb6ef9da1a9c2e83 | [
"coleccion_objeto = Coleccion()\nimage_objeto = Image()\nimage_objeto.image_File = SimpleUploadedFile(name='black.png', content=open('../../black.png', 'rb').read(), content_type='image/png')\nimage_objeto.fk_Coleccion = coleccion_objeto\nself.assertEqual(image_objeto.load_image_function().format, 'PNG')",
"colec... | <|body_start_0|>
coleccion_objeto = Coleccion()
image_objeto = Image()
image_objeto.image_File = SimpleUploadedFile(name='black.png', content=open('../../black.png', 'rb').read(), content_type='image/png')
image_objeto.fk_Coleccion = coleccion_objeto
self.assertEqual(image_objeto... | TestImagenes | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestImagenes:
def test_format(self):
"""Función que evalua si el formato de una imagen se conserva @return: resultado de prueba comparando si la imagen es formato png"""
<|body_0|>
def test_add_photo(self):
"""Función que evalua si la base de datos guarda satisfactor... | stack_v2_sparse_classes_75kplus_train_001735 | 3,082 | no_license | [
{
"docstring": "Función que evalua si el formato de una imagen se conserva @return: resultado de prueba comparando si la imagen es formato png",
"name": "test_format",
"signature": "def test_format(self)"
},
{
"docstring": "Función que evalua si la base de datos guarda satisfactoriamente la imag... | 5 | stack_v2_sparse_classes_30k_train_016306 | Implement the Python class `TestImagenes` described below.
Class description:
Implement the TestImagenes class.
Method signatures and docstrings:
- def test_format(self): Función que evalua si el formato de una imagen se conserva @return: resultado de prueba comparando si la imagen es formato png
- def test_add_photo... | Implement the Python class `TestImagenes` described below.
Class description:
Implement the TestImagenes class.
Method signatures and docstrings:
- def test_format(self): Función que evalua si el formato de una imagen se conserva @return: resultado de prueba comparando si la imagen es formato png
- def test_add_photo... | 586fe5d322581fc5a01a31504d76c4966f0207c2 | <|skeleton|>
class TestImagenes:
def test_format(self):
"""Función que evalua si el formato de una imagen se conserva @return: resultado de prueba comparando si la imagen es formato png"""
<|body_0|>
def test_add_photo(self):
"""Función que evalua si la base de datos guarda satisfactor... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestImagenes:
def test_format(self):
"""Función que evalua si el formato de una imagen se conserva @return: resultado de prueba comparando si la imagen es formato png"""
coleccion_objeto = Coleccion()
image_objeto = Image()
image_objeto.image_File = SimpleUploadedFile(name='bla... | the_stack_v2_python_sparse | WebProject/CellSegmentation/ImageApp/test.py | joseant12/CellSegmentationProject | train | 0 | |
79642d78bdfc4b8895089edb0cd6edcda84ff165 | [
"key = a2b_p('2b7e151628aed2a6abf7158809cf4f3c')\npt = 'This is a test case'\nalg1 = CBC(Rijndael(key, blockSize=32))\nalg2 = CBC(Rijndael(key, blockSize=32))\nct1 = alg1.encrypt(pt)\nct2 = alg2.encrypt(pt)\nself.assertNotEqual(ct1, ct2)",
"key = a2b_p('2b7e151628aed2a6abf7158809cf4f3c')\npt = 'This is yet anothe... | <|body_start_0|>
key = a2b_p('2b7e151628aed2a6abf7158809cf4f3c')
pt = 'This is a test case'
alg1 = CBC(Rijndael(key, blockSize=32))
alg2 = CBC(Rijndael(key, blockSize=32))
ct1 = alg1.encrypt(pt)
ct2 = alg2.encrypt(pt)
self.assertNotEqual(ct1, ct2)
<|end_body_0|>
... | CBC IV tests | CBC_Auto_IV_Test | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CBC_Auto_IV_Test:
"""CBC IV tests"""
def testIVuniqueness(self):
"""Test that two different instances have different IVs"""
<|body_0|>
def testIVmultencryptUnique(self):
"""Test that two different encrypts have different IVs"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_75kplus_train_001736 | 5,430 | permissive | [
{
"docstring": "Test that two different instances have different IVs",
"name": "testIVuniqueness",
"signature": "def testIVuniqueness(self)"
},
{
"docstring": "Test that two different encrypts have different IVs",
"name": "testIVmultencryptUnique",
"signature": "def testIVmultencryptUniq... | 2 | stack_v2_sparse_classes_30k_train_023541 | Implement the Python class `CBC_Auto_IV_Test` described below.
Class description:
CBC IV tests
Method signatures and docstrings:
- def testIVuniqueness(self): Test that two different instances have different IVs
- def testIVmultencryptUnique(self): Test that two different encrypts have different IVs | Implement the Python class `CBC_Auto_IV_Test` described below.
Class description:
CBC IV tests
Method signatures and docstrings:
- def testIVuniqueness(self): Test that two different instances have different IVs
- def testIVmultencryptUnique(self): Test that two different encrypts have different IVs
<|skeleton|>
cla... | ed4d80d1e6f09634c12c0c3096e39667c6642b95 | <|skeleton|>
class CBC_Auto_IV_Test:
"""CBC IV tests"""
def testIVuniqueness(self):
"""Test that two different instances have different IVs"""
<|body_0|>
def testIVmultencryptUnique(self):
"""Test that two different encrypts have different IVs"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CBC_Auto_IV_Test:
"""CBC IV tests"""
def testIVuniqueness(self):
"""Test that two different instances have different IVs"""
key = a2b_p('2b7e151628aed2a6abf7158809cf4f3c')
pt = 'This is a test case'
alg1 = CBC(Rijndael(key, blockSize=32))
alg2 = CBC(Rijndael(key, b... | the_stack_v2_python_sparse | script.module.cryptolib/lib/cryptopy/cipher/cbc_test.py | gacj22/WizardGacj22 | train | 4 |
92b9ccbcaabb711107ca5e2f24b766791607611f | [
"self.board = board\nself.board_cell_lst = board.cell_list()\nself.__target_location = board.target_location()",
"user_input = input('please write down the color of the car you wish to move, and the direction: ')\nif len(user_input) != 3 or user_input[1] != ',':\n print('Bad input length or no \",\" between ca... | <|body_start_0|>
self.board = board
self.board_cell_lst = board.cell_list()
self.__target_location = board.target_location()
<|end_body_0|>
<|body_start_1|>
user_input = input('please write down the color of the car you wish to move, and the direction: ')
if len(user_input) != 3... | a class that runs the rush hour game, using the classes Car and Board, the game finishes when a car arrive to the target location according to the board. | Game | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Game:
"""a class that runs the rush hour game, using the classes Car and Board, the game finishes when a car arrive to the target location according to the board."""
def __init__(self, board):
"""Initialize a new Game object. :param board: An object of type board :param dict_of_cars:... | stack_v2_sparse_classes_75kplus_train_001737 | 6,085 | no_license | [
{
"docstring": "Initialize a new Game object. :param board: An object of type board :param dict_of_cars: dict of cars on the given board, with a car type and his name.",
"name": "__init__",
"signature": "def __init__(self, board)"
},
{
"docstring": "a function that checks if the user's input is ... | 4 | stack_v2_sparse_classes_30k_train_046097 | Implement the Python class `Game` described below.
Class description:
a class that runs the rush hour game, using the classes Car and Board, the game finishes when a car arrive to the target location according to the board.
Method signatures and docstrings:
- def __init__(self, board): Initialize a new Game object. :... | Implement the Python class `Game` described below.
Class description:
a class that runs the rush hour game, using the classes Car and Board, the game finishes when a car arrive to the target location according to the board.
Method signatures and docstrings:
- def __init__(self, board): Initialize a new Game object. :... | f691dff94e1014cde6a8596c853b42184f2295fb | <|skeleton|>
class Game:
"""a class that runs the rush hour game, using the classes Car and Board, the game finishes when a car arrive to the target location according to the board."""
def __init__(self, board):
"""Initialize a new Game object. :param board: An object of type board :param dict_of_cars:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Game:
"""a class that runs the rush hour game, using the classes Car and Board, the game finishes when a car arrive to the target location according to the board."""
def __init__(self, board):
"""Initialize a new Game object. :param board: An object of type board :param dict_of_cars: dict of cars... | the_stack_v2_python_sparse | ex9/game.py | alonShevach/introduction-to-CS | train | 0 |
e4ff882ac432ed2ee43f9e7487b700100fccbea4 | [
"super(Slic, self).__init__(paramlist)\nself.params['algorithm'] = 'Slic'\nself.params['n_segments'] = 5\nself.params['beta1'] = 2\nself.params['max_iter'] = 10\nself.params['alpha1'] = 0.5\nself.paramindexes = ['n_segments', 'alpha1', 'beta1', 'max_iter']\nself.slico = False\nself.set_params(paramlist)",
"compac... | <|body_start_0|>
super(Slic, self).__init__(paramlist)
self.params['algorithm'] = 'Slic'
self.params['n_segments'] = 5
self.params['beta1'] = 2
self.params['max_iter'] = 10
self.params['alpha1'] = 0.5
self.paramindexes = ['n_segments', 'alpha1', 'beta1', 'max_iter... | Perform the Slic segmentation algorithm. Segments k-means clustering in Color space (x, y, z). Returns a 2D or 3D array of labels. Parameters: image -- ndarray, input image n_segments -- int, approximate number of labels in segmented output image compactness -- float, Balances color proximity and space proximity. Highe... | Slic | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Slic:
"""Perform the Slic segmentation algorithm. Segments k-means clustering in Color space (x, y, z). Returns a 2D or 3D array of labels. Parameters: image -- ndarray, input image n_segments -- int, approximate number of labels in segmented output image compactness -- float, Balances color prox... | stack_v2_sparse_classes_75kplus_train_001738 | 29,598 | permissive | [
{
"docstring": "Get parameters from parameter list that are used in segmentation algorithm. Assign default values to these parameters.",
"name": "__init__",
"signature": "def __init__(self, paramlist=None)"
},
{
"docstring": "Evaluate segmentation algorithm on training image. Keyword arguments: ... | 2 | stack_v2_sparse_classes_30k_train_006351 | Implement the Python class `Slic` described below.
Class description:
Perform the Slic segmentation algorithm. Segments k-means clustering in Color space (x, y, z). Returns a 2D or 3D array of labels. Parameters: image -- ndarray, input image n_segments -- int, approximate number of labels in segmented output image co... | Implement the Python class `Slic` described below.
Class description:
Perform the Slic segmentation algorithm. Segments k-means clustering in Color space (x, y, z). Returns a 2D or 3D array of labels. Parameters: image -- ndarray, input image n_segments -- int, approximate number of labels in segmented output image co... | 9246b8b20510d4c89357a6764ed96b919eb92d5a | <|skeleton|>
class Slic:
"""Perform the Slic segmentation algorithm. Segments k-means clustering in Color space (x, y, z). Returns a 2D or 3D array of labels. Parameters: image -- ndarray, input image n_segments -- int, approximate number of labels in segmented output image compactness -- float, Balances color prox... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Slic:
"""Perform the Slic segmentation algorithm. Segments k-means clustering in Color space (x, y, z). Returns a 2D or 3D array of labels. Parameters: image -- ndarray, input image n_segments -- int, approximate number of labels in segmented output image compactness -- float, Balances color proximity and spa... | the_stack_v2_python_sparse | see/Segmentors.py | Deepak768/see-segment | train | 0 |
c29a3259713476cba09611ddac3c2b929dad54b7 | [
"if configs.use_noisy_net:\n linear_layer = NoisyLinearConstructor(configs.std_init)\n init_fn: Callable = identity\nelse:\n linear_layer = nn.Linear\n init_fn = init_layer_uniform\nsuper(IQNMLP, self).__init__(configs=configs, hidden_activation=hidden_activation, linear_layer=linear_layer, init_fn=init... | <|body_start_0|>
if configs.use_noisy_net:
linear_layer = NoisyLinearConstructor(configs.std_init)
init_fn: Callable = identity
else:
linear_layer = nn.Linear
init_fn = init_layer_uniform
super(IQNMLP, self).__init__(configs=configs, hidden_activat... | Multilayered perceptron for IQN with dueling construction. Reference: https://github.com/google/dopamine | IQNMLP | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IQNMLP:
"""Multilayered perceptron for IQN with dueling construction. Reference: https://github.com/google/dopamine"""
def __init__(self, configs: ConfigDict, hidden_activation: Callable=F.relu):
"""Initialize."""
<|body_0|>
def forward_(self, state: torch.Tensor, n_tau_... | stack_v2_sparse_classes_75kplus_train_001739 | 7,754 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, configs: ConfigDict, hidden_activation: Callable=F.relu)"
},
{
"docstring": "Get quantile values and quantiles.",
"name": "forward_",
"signature": "def forward_(self, state: torch.Tensor, n_tau_samples: in... | 3 | null | Implement the Python class `IQNMLP` described below.
Class description:
Multilayered perceptron for IQN with dueling construction. Reference: https://github.com/google/dopamine
Method signatures and docstrings:
- def __init__(self, configs: ConfigDict, hidden_activation: Callable=F.relu): Initialize.
- def forward_(s... | Implement the Python class `IQNMLP` described below.
Class description:
Multilayered perceptron for IQN with dueling construction. Reference: https://github.com/google/dopamine
Method signatures and docstrings:
- def __init__(self, configs: ConfigDict, hidden_activation: Callable=F.relu): Initialize.
- def forward_(s... | fdfac4e7056ee5a9d5b48b7b9653ce844a03ca22 | <|skeleton|>
class IQNMLP:
"""Multilayered perceptron for IQN with dueling construction. Reference: https://github.com/google/dopamine"""
def __init__(self, configs: ConfigDict, hidden_activation: Callable=F.relu):
"""Initialize."""
<|body_0|>
def forward_(self, state: torch.Tensor, n_tau_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IQNMLP:
"""Multilayered perceptron for IQN with dueling construction. Reference: https://github.com/google/dopamine"""
def __init__(self, configs: ConfigDict, hidden_activation: Callable=F.relu):
"""Initialize."""
if configs.use_noisy_net:
linear_layer = NoisyLinearConstructor... | the_stack_v2_python_sparse | rl_algorithms/dqn/networks.py | medipixel/rl_algorithms | train | 525 |
b7cb478d53c56b1c83410727ad572d4df8bdc6c7 | [
"super(BaseToolchangerHands, self).__init__(parent)\nif not parent:\n return\nself._parent = parent\nself.handlight_l_command = HandlightCommand(self, self.HAND_L)\nself.handlight_r_command = HandlightCommand(self, self.HAND_R)\nself.toolchanger_l_command = ToolchangerCommand(self, self.HAND_L)\nself.toolchanger... | <|body_start_0|>
super(BaseToolchangerHands, self).__init__(parent)
if not parent:
return
self._parent = parent
self.handlight_l_command = HandlightCommand(self, self.HAND_L)
self.handlight_r_command = HandlightCommand(self, self.HAND_R)
self.toolchanger_l_com... | This class holds methods that are specific to the hands of NEXTAGE OPEN, accompanied with toolchanger. @deprecated: Since version 0.5.1, the functionality in this class is moved to other BaseHands subclasses (e.g. Iros13Hands). | BaseToolchangerHands | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseToolchangerHands:
"""This class holds methods that are specific to the hands of NEXTAGE OPEN, accompanied with toolchanger. @deprecated: Since version 0.5.1, the functionality in this class is moved to other BaseHands subclasses (e.g. Iros13Hands)."""
def __init__(self, parent):
... | stack_v2_sparse_classes_75kplus_train_001740 | 2,200 | permissive | [
{
"docstring": "Since this class operates requires an access to hrpsys.hrpsys_config.HrpsysConfigurator, valid 'parent' is a must. Otherwise __init__ returns without doing anything. @type parent: hrpsys.hrpsys_config.HrpsysConfigurator @param parent: derived class of HrpsysConfigurator.",
"name": "__init__"... | 2 | stack_v2_sparse_classes_30k_train_001454 | Implement the Python class `BaseToolchangerHands` described below.
Class description:
This class holds methods that are specific to the hands of NEXTAGE OPEN, accompanied with toolchanger. @deprecated: Since version 0.5.1, the functionality in this class is moved to other BaseHands subclasses (e.g. Iros13Hands).
Meth... | Implement the Python class `BaseToolchangerHands` described below.
Class description:
This class holds methods that are specific to the hands of NEXTAGE OPEN, accompanied with toolchanger. @deprecated: Since version 0.5.1, the functionality in this class is moved to other BaseHands subclasses (e.g. Iros13Hands).
Meth... | 03c9e59779a30e2f6dedf2732ad8a46e6ac3c9f0 | <|skeleton|>
class BaseToolchangerHands:
"""This class holds methods that are specific to the hands of NEXTAGE OPEN, accompanied with toolchanger. @deprecated: Since version 0.5.1, the functionality in this class is moved to other BaseHands subclasses (e.g. Iros13Hands)."""
def __init__(self, parent):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BaseToolchangerHands:
"""This class holds methods that are specific to the hands of NEXTAGE OPEN, accompanied with toolchanger. @deprecated: Since version 0.5.1, the functionality in this class is moved to other BaseHands subclasses (e.g. Iros13Hands)."""
def __init__(self, parent):
"""Since this... | the_stack_v2_python_sparse | robot_con/nxt/nxtlib/base_toolchanger_hands.py | kazuki0824/wrs | train | 1 |
fbbb0d6a9f0ee144b78aecc0f1a0cd0bad3c45ad | [
"data = self._current_data\nkwargs = super(ClusterSerializer, self).data_info()\nif kwargs and self._detail:\n pass\nreturn kwargs",
"data = self._current_data\nhosts = data.host\nbest_host = None\nbest_perform = 0\nfor host in hosts:\n host_serializer = HostSystemSerializer(host).data\n free_mem_mb = ho... | <|body_start_0|>
data = self._current_data
kwargs = super(ClusterSerializer, self).data_info()
if kwargs and self._detail:
pass
return kwargs
<|end_body_0|>
<|body_start_1|>
data = self._current_data
hosts = data.host
best_host = None
best_per... | 集群数据处理 | ClusterSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClusterSerializer:
"""集群数据处理"""
def data_info(self):
"""* 返回字段 ** moid ** name"""
<|body_0|>
def best_host_of_mb(self):
"""内存最优主机"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
data = self._current_data
kwargs = super(ClusterSerializer,... | stack_v2_sparse_classes_75kplus_train_001741 | 12,928 | no_license | [
{
"docstring": "* 返回字段 ** moid ** name",
"name": "data_info",
"signature": "def data_info(self)"
},
{
"docstring": "内存最优主机",
"name": "best_host_of_mb",
"signature": "def best_host_of_mb(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005727 | Implement the Python class `ClusterSerializer` described below.
Class description:
集群数据处理
Method signatures and docstrings:
- def data_info(self): * 返回字段 ** moid ** name
- def best_host_of_mb(self): 内存最优主机 | Implement the Python class `ClusterSerializer` described below.
Class description:
集群数据处理
Method signatures and docstrings:
- def data_info(self): * 返回字段 ** moid ** name
- def best_host_of_mb(self): 内存最优主机
<|skeleton|>
class ClusterSerializer:
"""集群数据处理"""
def data_info(self):
"""* 返回字段 ** moid ** n... | 639f11a91ee6e8b72883300cbf297ef4c0494d52 | <|skeleton|>
class ClusterSerializer:
"""集群数据处理"""
def data_info(self):
"""* 返回字段 ** moid ** name"""
<|body_0|>
def best_host_of_mb(self):
"""内存最优主机"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClusterSerializer:
"""集群数据处理"""
def data_info(self):
"""* 返回字段 ** moid ** name"""
data = self._current_data
kwargs = super(ClusterSerializer, self).data_info()
if kwargs and self._detail:
pass
return kwargs
def best_host_of_mb(self):
"""内存最... | the_stack_v2_python_sparse | ivmware/serializers.py | caijb007/itmsp | train | 0 |
636fd53ed3cd4e8b949e594860a86c62c631a9bf | [
"ret = {}\nfor name in dir(self):\n if not name.startswith('_') and name.lower() != 'metadata':\n ret[name] = getattr(self, name)\nreturn ret",
"try:\n db_session.add(self)\n if refresh:\n db_session.flush()\n db_session.refresh(self)\n db_session.commit()\nexcept Exception as ex:... | <|body_start_0|>
ret = {}
for name in dir(self):
if not name.startswith('_') and name.lower() != 'metadata':
ret[name] = getattr(self, name)
return ret
<|end_body_0|>
<|body_start_1|>
try:
db_session.add(self)
if refresh:
... | 抽象基类, 用于封装常用工具. | BasicBase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicBase:
"""抽象基类, 用于封装常用工具."""
def __to_dict__(self):
"""类实例对象转为dict."""
<|body_0|>
def __save(self, db_session, refresh=True):
"""自保存, 暂不可用. :parameter db_session :parameter refresh"""
<|body_1|>
def __batch_save(db_session, entities_list):
... | stack_v2_sparse_classes_75kplus_train_001742 | 1,745 | no_license | [
{
"docstring": "类实例对象转为dict.",
"name": "__to_dict__",
"signature": "def __to_dict__(self)"
},
{
"docstring": "自保存, 暂不可用. :parameter db_session :parameter refresh",
"name": "__save",
"signature": "def __save(self, db_session, refresh=True)"
},
{
"docstring": "批量保存, 暂不可用. :paramete... | 3 | stack_v2_sparse_classes_30k_train_036029 | Implement the Python class `BasicBase` described below.
Class description:
抽象基类, 用于封装常用工具.
Method signatures and docstrings:
- def __to_dict__(self): 类实例对象转为dict.
- def __save(self, db_session, refresh=True): 自保存, 暂不可用. :parameter db_session :parameter refresh
- def __batch_save(db_session, entities_list): 批量保存, 暂不可用... | Implement the Python class `BasicBase` described below.
Class description:
抽象基类, 用于封装常用工具.
Method signatures and docstrings:
- def __to_dict__(self): 类实例对象转为dict.
- def __save(self, db_session, refresh=True): 自保存, 暂不可用. :parameter db_session :parameter refresh
- def __batch_save(db_session, entities_list): 批量保存, 暂不可用... | 40faf78b2365137b9da0cc67f511248b390b4c13 | <|skeleton|>
class BasicBase:
"""抽象基类, 用于封装常用工具."""
def __to_dict__(self):
"""类实例对象转为dict."""
<|body_0|>
def __save(self, db_session, refresh=True):
"""自保存, 暂不可用. :parameter db_session :parameter refresh"""
<|body_1|>
def __batch_save(db_session, entities_list):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BasicBase:
"""抽象基类, 用于封装常用工具."""
def __to_dict__(self):
"""类实例对象转为dict."""
ret = {}
for name in dir(self):
if not name.startswith('_') and name.lower() != 'metadata':
ret[name] = getattr(self, name)
return ret
def __save(self, db_session, r... | the_stack_v2_python_sparse | discuzx_tools/libs/models/base.py | BabyMelvin/discuzx-tools | train | 0 |
102c0c9462d00620fa1a76adfa584906e581862c | [
"self.t_value = t_value\nself.features = features\nself.attributes = attributes\nself.size = size\nself.forest = []",
"counter = 1\ntoolbar_width = 100\nfactor = int(self.t_value / toolbar_width)\nfactor = max(factor, 1)\nif print_status_bar:\n print('Building Bagging Trees')\n sys.stdout.write('Progress: [... | <|body_start_0|>
self.t_value = t_value
self.features = features
self.attributes = attributes
self.size = size
self.forest = []
<|end_body_0|>
<|body_start_1|>
counter = 1
toolbar_width = 100
factor = int(self.t_value / toolbar_width)
factor = max... | RandomForests class for binary labeled features (-1, 1) | RandomForests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomForests:
"""RandomForests class for binary labeled features (-1, 1)"""
def __init__(self, features, attributes, t_value, size):
"""RandomForests constructor :param features: ordered features from dataset :type features: python list containing Feature objects :param attributes: ... | stack_v2_sparse_classes_75kplus_train_001743 | 2,913 | no_license | [
{
"docstring": "RandomForests constructor :param features: ordered features from dataset :type features: python list containing Feature objects :param attributes: attributes for current fit iteration :type attributes: python tuple containing Attribute objects :param t_value: number of decision trees in forest :... | 3 | stack_v2_sparse_classes_30k_train_032649 | Implement the Python class `RandomForests` described below.
Class description:
RandomForests class for binary labeled features (-1, 1)
Method signatures and docstrings:
- def __init__(self, features, attributes, t_value, size): RandomForests constructor :param features: ordered features from dataset :type features: p... | Implement the Python class `RandomForests` described below.
Class description:
RandomForests class for binary labeled features (-1, 1)
Method signatures and docstrings:
- def __init__(self, features, attributes, t_value, size): RandomForests constructor :param features: ordered features from dataset :type features: p... | 782cfaaac95f666e8e3272dbcd42701a7d84200c | <|skeleton|>
class RandomForests:
"""RandomForests class for binary labeled features (-1, 1)"""
def __init__(self, features, attributes, t_value, size):
"""RandomForests constructor :param features: ordered features from dataset :type features: python list containing Feature objects :param attributes: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandomForests:
"""RandomForests class for binary labeled features (-1, 1)"""
def __init__(self, features, attributes, t_value, size):
"""RandomForests constructor :param features: ordered features from dataset :type features: python list containing Feature objects :param attributes: attributes fo... | the_stack_v2_python_sparse | EnsembleLearning/RandomForests.py | morsgiathatch/machine_learning | train | 0 |
854492905371223508416d9c9029fa45013490ee | [
"seen = set()\nwhile head not in seen:\n if head is None:\n return head\n seen.add(head)\n head = head.next\nreturn head",
"slow = fast = head\nwhile fast and fast.next:\n slow = slow.next\n fast = fast.next.next\n if slow == fast:\n break\nelse:\n return None\nwhile head != slo... | <|body_start_0|>
seen = set()
while head not in seen:
if head is None:
return head
seen.add(head)
head = head.next
return head
<|end_body_0|>
<|body_start_1|>
slow = fast = head
while fast and fast.next:
slow = slow... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def detectCycle(self, head):
"""my solution: HashMap time: O(N) space: O(N) :type head: ListNode :rtype: ListNode"""
<|body_0|>
def detectCycle_two_pointers(self, head):
"""slow and fast pointers time: O(N) space: O(1) :type head: ListNode :rtype: ListNode"... | stack_v2_sparse_classes_75kplus_train_001744 | 1,046 | no_license | [
{
"docstring": "my solution: HashMap time: O(N) space: O(N) :type head: ListNode :rtype: ListNode",
"name": "detectCycle",
"signature": "def detectCycle(self, head)"
},
{
"docstring": "slow and fast pointers time: O(N) space: O(1) :type head: ListNode :rtype: ListNode",
"name": "detectCycle_... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def detectCycle(self, head): my solution: HashMap time: O(N) space: O(N) :type head: ListNode :rtype: ListNode
- def detectCycle_two_pointers(self, head): slow and fast pointers ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def detectCycle(self, head): my solution: HashMap time: O(N) space: O(N) :type head: ListNode :rtype: ListNode
- def detectCycle_two_pointers(self, head): slow and fast pointers ... | 85f71621c54f6b0029f3a2746f022f89dd7419d9 | <|skeleton|>
class Solution:
def detectCycle(self, head):
"""my solution: HashMap time: O(N) space: O(N) :type head: ListNode :rtype: ListNode"""
<|body_0|>
def detectCycle_two_pointers(self, head):
"""slow and fast pointers time: O(N) space: O(1) :type head: ListNode :rtype: ListNode"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def detectCycle(self, head):
"""my solution: HashMap time: O(N) space: O(N) :type head: ListNode :rtype: ListNode"""
seen = set()
while head not in seen:
if head is None:
return head
seen.add(head)
head = head.next
r... | the_stack_v2_python_sparse | LeetCode/LinkedList/142_linked_list_cycle_ii.py | XyK0907/for_work | train | 0 | |
c69af57d51ab2a28f89e78451e82b356dc7d5ea8 | [
"self.version_number = '1.3.1'\nif args is None:\n self.args = sys.argv\nelse:\n self.args = args\nself.input_stream = None\nself.output_stream = None\nself.controller = None\nself.config = None\nself.parser = None\nself.configure_parser()",
"self.parser = parser_class(prog='tppp', description='TPPP - Text ... | <|body_start_0|>
self.version_number = '1.3.1'
if args is None:
self.args = sys.argv
else:
self.args = args
self.input_stream = None
self.output_stream = None
self.controller = None
self.config = None
self.parser = None
self... | Set up and run the program. Todo: ApiDoc | TPPRunner | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TPPRunner:
"""Set up and run the program. Todo: ApiDoc"""
def __init__(self, args=None):
"""Todo: ApiDoc."""
<|body_0|>
def configure_parser(self, parser_class=argparse.ArgumentParser):
"""Create argument parser, handle command line parameters, provide command li... | stack_v2_sparse_classes_75kplus_train_001745 | 4,913 | permissive | [
{
"docstring": "Todo: ApiDoc.",
"name": "__init__",
"signature": "def __init__(self, args=None)"
},
{
"docstring": "Create argument parser, handle command line parameters, provide command line help. Avoid a global default configuration by setting default values here. Factory method @see: https:/... | 5 | stack_v2_sparse_classes_30k_train_018207 | Implement the Python class `TPPRunner` described below.
Class description:
Set up and run the program. Todo: ApiDoc
Method signatures and docstrings:
- def __init__(self, args=None): Todo: ApiDoc.
- def configure_parser(self, parser_class=argparse.ArgumentParser): Create argument parser, handle command line parameter... | Implement the Python class `TPPRunner` described below.
Class description:
Set up and run the program. Todo: ApiDoc
Method signatures and docstrings:
- def __init__(self, args=None): Todo: ApiDoc.
- def configure_parser(self, parser_class=argparse.ArgumentParser): Create argument parser, handle command line parameter... | 9bb6db774d77f74c54ed2fa004e97c1aa114fff9 | <|skeleton|>
class TPPRunner:
"""Set up and run the program. Todo: ApiDoc"""
def __init__(self, args=None):
"""Todo: ApiDoc."""
<|body_0|>
def configure_parser(self, parser_class=argparse.ArgumentParser):
"""Create argument parser, handle command line parameters, provide command li... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TPPRunner:
"""Set up and run the program. Todo: ApiDoc"""
def __init__(self, args=None):
"""Todo: ApiDoc."""
self.version_number = '1.3.1'
if args is None:
self.args = sys.argv
else:
self.args = args
self.input_stream = None
self.out... | the_stack_v2_python_sparse | tpp/TPPRunner.py | pennyarcade/TPPP | train | 0 |
a29bc23e97b98afd4c39417c6d0b71a7f5a796cc | [
"self.name = name\nself.id = id\nself.voa = voa\nself.voi = voi\nself.state_agg = state_agg\nself.ach = ach\nself.trans_agg = trans_agg\nself.aha = aha\nself.child_institutions = child_institutions\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\nname = dictionary.ge... | <|body_start_0|>
self.name = name
self.id = id
self.voa = voa
self.voi = voi
self.state_agg = state_agg
self.ach = ach
self.trans_agg = trans_agg
self.aha = aha
self.child_institutions = child_institutions
self.additional_properties = addit... | Implementation of the 'Certified Institution' model. TODO: type model description here. Attributes: name (string): Institution's name id (long|int): Institution's Id voa (bool): VOA Certification voi (bool): VOI Certification state_agg (bool): State Agg Certification ach (bool): ACH Certification trans_agg (bool): Tran... | CertifiedInstitution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CertifiedInstitution:
"""Implementation of the 'Certified Institution' model. TODO: type model description here. Attributes: name (string): Institution's name id (long|int): Institution's Id voa (bool): VOA Certification voi (bool): VOI Certification state_agg (bool): State Agg Certification ach ... | stack_v2_sparse_classes_75kplus_train_001746 | 3,628 | permissive | [
{
"docstring": "Constructor for the CertifiedInstitution class",
"name": "__init__",
"signature": "def __init__(self, name=None, id=None, voa=None, voi=None, state_agg=None, ach=None, trans_agg=None, aha=None, child_institutions=None, additional_properties={})"
},
{
"docstring": "Creates an inst... | 2 | stack_v2_sparse_classes_30k_train_045967 | Implement the Python class `CertifiedInstitution` described below.
Class description:
Implementation of the 'Certified Institution' model. TODO: type model description here. Attributes: name (string): Institution's name id (long|int): Institution's Id voa (bool): VOA Certification voi (bool): VOI Certification state_a... | Implement the Python class `CertifiedInstitution` described below.
Class description:
Implementation of the 'Certified Institution' model. TODO: type model description here. Attributes: name (string): Institution's name id (long|int): Institution's Id voa (bool): VOA Certification voi (bool): VOI Certification state_a... | b2ab1ded435db75c78d42261f5e4acd2a3061487 | <|skeleton|>
class CertifiedInstitution:
"""Implementation of the 'Certified Institution' model. TODO: type model description here. Attributes: name (string): Institution's name id (long|int): Institution's Id voa (bool): VOA Certification voi (bool): VOI Certification state_agg (bool): State Agg Certification ach ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CertifiedInstitution:
"""Implementation of the 'Certified Institution' model. TODO: type model description here. Attributes: name (string): Institution's name id (long|int): Institution's Id voa (bool): VOA Certification voi (bool): VOI Certification state_agg (bool): State Agg Certification ach (bool): ACH C... | the_stack_v2_python_sparse | finicityapi/models/certified_institution.py | monarchmoney/finicity-python | train | 0 |
f7ffc96f8d50584cdb138824c83eb96c30db3f32 | [
"self.gsrt = args[0]\nself.asrt = args[1]\nself.gn = args[2]\nself.result = [0] * self.gn\nself.a = Fastlist(self.asrt, load=500, sorted=1)",
"for i in range(self.gn):\n g = self.gsrt[i]\n it = self.a.lower_bound((g[1], 0))\n if not it.iter_end():\n alb = it.iter_getitem()\n if alb[0] > g[0... | <|body_start_0|>
self.gsrt = args[0]
self.asrt = args[1]
self.gn = args[2]
self.result = [0] * self.gn
self.a = Fastlist(self.asrt, load=500, sorted=1)
<|end_body_0|>
<|body_start_1|>
for i in range(self.gn):
g = self.gsrt[i]
it = self.a.lower_bou... | Fug representation | Fug | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fug:
"""Fug representation"""
def __init__(self, args):
"""Default constructor"""
<|body_0|>
def calculate(self):
"""Main calcualtion function of the class"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.gsrt = args[0]
self.asrt = a... | stack_v2_sparse_classes_75kplus_train_001747 | 13,066 | permissive | [
{
"docstring": "Default constructor",
"name": "__init__",
"signature": "def __init__(self, args)"
},
{
"docstring": "Main calcualtion function of the class",
"name": "calculate",
"signature": "def calculate(self)"
}
] | 2 | null | Implement the Python class `Fug` described below.
Class description:
Fug representation
Method signatures and docstrings:
- def __init__(self, args): Default constructor
- def calculate(self): Main calcualtion function of the class | Implement the Python class `Fug` described below.
Class description:
Fug representation
Method signatures and docstrings:
- def __init__(self, args): Default constructor
- def calculate(self): Main calcualtion function of the class
<|skeleton|>
class Fug:
"""Fug representation"""
def __init__(self, args):
... | ae02ea872ca91ef98630cc172a844b82cc56f621 | <|skeleton|>
class Fug:
"""Fug representation"""
def __init__(self, args):
"""Default constructor"""
<|body_0|>
def calculate(self):
"""Main calcualtion function of the class"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Fug:
"""Fug representation"""
def __init__(self, args):
"""Default constructor"""
self.gsrt = args[0]
self.asrt = args[1]
self.gn = args[2]
self.result = [0] * self.gn
self.a = Fastlist(self.asrt, load=500, sorted=1)
def calculate(self):
"""Mai... | the_stack_v2_python_sparse | codeforces/556D_fug_fastlist2.py | snsokolov/contests | train | 1 |
ea1aa675ed0a8f74994ab7e1daec79ac202f0702 | [
"super().__init__()\nself.generator = generator_cls(img_size, latent_dim, num_channels)\nself.discriminator = discriminator_cls(num_channels, img_size)\nself._latent_dim = latent_dim\nself.generator.apply(weights_init_normal)\nself.discriminator.apply(weights_init_normal)\nself.lambda_gp = lambda_gp",
"if noise i... | <|body_start_0|>
super().__init__()
self.generator = generator_cls(img_size, latent_dim, num_channels)
self.discriminator = discriminator_cls(num_channels, img_size)
self._latent_dim = latent_dim
self.generator.apply(weights_init_normal)
self.discriminator.apply(weights_i... | Implementation of Generative Adversarial Networks following the convergence and stability guidance of ``On Convergence and Stability of GANs`` References ---------- `Paper <https://arxiv.org/abs/1705.07215>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained ne... | DRAGAN | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DRAGAN:
"""Implementation of Generative Adversarial Networks following the convergence and stability guidance of ``On Convergence and Stability of GANs`` References ---------- `Paper <https://arxiv.org/abs/1705.07215>`_ Warnings -------- This Network is designed for training only; if you want to ... | stack_v2_sparse_classes_75kplus_train_001748 | 5,304 | permissive | [
{
"docstring": "Parameters ---------- latent_dim : int size of the latent dimension num_channels : int number of channels for image generation and discrimination img_size : int number of pixels per image side lambda_gp : float weighting factor for gradient penalty generator_cls : class implementing the actual g... | 2 | stack_v2_sparse_classes_30k_train_048866 | Implement the Python class `DRAGAN` described below.
Class description:
Implementation of Generative Adversarial Networks following the convergence and stability guidance of ``On Convergence and Stability of GANs`` References ---------- `Paper <https://arxiv.org/abs/1705.07215>`_ Warnings -------- This Network is desi... | Implement the Python class `DRAGAN` described below.
Class description:
Implementation of Generative Adversarial Networks following the convergence and stability guidance of ``On Convergence and Stability of GANs`` References ---------- `Paper <https://arxiv.org/abs/1705.07215>`_ Warnings -------- This Network is desi... | 1078f5030b8aac2bf022daf5fa14d66f74c3c893 | <|skeleton|>
class DRAGAN:
"""Implementation of Generative Adversarial Networks following the convergence and stability guidance of ``On Convergence and Stability of GANs`` References ---------- `Paper <https://arxiv.org/abs/1705.07215>`_ Warnings -------- This Network is designed for training only; if you want to ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DRAGAN:
"""Implementation of Generative Adversarial Networks following the convergence and stability guidance of ``On Convergence and Stability of GANs`` References ---------- `Paper <https://arxiv.org/abs/1705.07215>`_ Warnings -------- This Network is designed for training only; if you want to predict from ... | the_stack_v2_python_sparse | dlutils/models/gans/dragan/dragan.py | justusschock/dl-utils | train | 15 |
80c0e24423aa62f932ec85bb6c172dfac5c9244b | [
"map = {'(': -3, '{': -2, '[': -1, ']': 1, '}': 2, ')': 3}\nif s == '':\n return True\nif len(s) % 2 != 0:\n return False\nstack = []\nfor e in s:\n n = len(stack)\n if map[e] < 0:\n stack.append(e)\n continue\n if n > 0 and map[stack[n - 1]] + map[e] == 0:\n stack.pop()\n ... | <|body_start_0|>
map = {'(': -3, '{': -2, '[': -1, ']': 1, '}': 2, ')': 3}
if s == '':
return True
if len(s) % 2 != 0:
return False
stack = []
for e in s:
n = len(stack)
if map[e] < 0:
stack.append(e)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isValid2(self, s):
"""([)]"""
<|body_1|>
def isValid3(self, s):
"""这也行!!!!! :type s: str :rtype: bool"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_001749 | 2,041 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "isValid",
"signature": "def isValid(self, s)"
},
{
"docstring": "([)]",
"name": "isValid2",
"signature": "def isValid2(self, s)"
},
{
"docstring": "这也行!!!!! :type s: str :rtype: bool",
"name": "isValid3",
"signature": "... | 3 | stack_v2_sparse_classes_30k_train_036751 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def isValid2(self, s): ([)]
- def isValid3(self, s): 这也行!!!!! :type s: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def isValid2(self, s): ([)]
- def isValid3(self, s): 这也行!!!!! :type s: str :rtype: bool
<|skeleton|>
class Solution:
def i... | 85128e7d26157b3c36eb43868269de42ea2fcb98 | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isValid2(self, s):
"""([)]"""
<|body_1|>
def isValid3(self, s):
"""这也行!!!!! :type s: str :rtype: bool"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
map = {'(': -3, '{': -2, '[': -1, ']': 1, '}': 2, ')': 3}
if s == '':
return True
if len(s) % 2 != 0:
return False
stack = []
for e in s:
n = len(stack)
... | the_stack_v2_python_sparse | src/Valid Parentheses.py | jsdiuf/leetcode | train | 1 | |
e12ddb1f436a8398ddb67dbc489202a9fe558faa | [
"self.cloud_threshold = cloud_threshold\nself.convection_threshold = convection_threshold\nself.model_id_attr = model_id_attr\nself.cloud_constraint = iris.Constraint(cube_func=lambda cube: 'cloud_area_fraction' in cube.name())\nself.convection_constraint = iris.Constraint(cube_func=lambda cube: 'convective_ratio' ... | <|body_start_0|>
self.cloud_threshold = cloud_threshold
self.convection_threshold = convection_threshold
self.model_id_attr = model_id_attr
self.cloud_constraint = iris.Constraint(cube_func=lambda cube: 'cloud_area_fraction' in cube.name())
self.convection_constraint = iris.Const... | Plugin to calculate the probability that conditions are such that precipitation, should it be present, will be showery, based on input cloud amounts and the convective ratio. | ShowerConditionProbability | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShowerConditionProbability:
"""Plugin to calculate the probability that conditions are such that precipitation, should it be present, will be showery, based on input cloud amounts and the convective ratio."""
def __init__(self, cloud_threshold: float=0.8125, convection_threshold: float=0.8, ... | stack_v2_sparse_classes_75kplus_train_001750 | 7,888 | permissive | [
{
"docstring": "Args: cloud_threshold: The fractional cloud coverage value at which to threshold the cloud data. convection_threshold: The convective ratio value at which to threshold the convective ratio data. model_id_attr: Name of the attribute used to identify the source model for blending.",
"name": "_... | 4 | stack_v2_sparse_classes_30k_train_042707 | Implement the Python class `ShowerConditionProbability` described below.
Class description:
Plugin to calculate the probability that conditions are such that precipitation, should it be present, will be showery, based on input cloud amounts and the convective ratio.
Method signatures and docstrings:
- def __init__(se... | Implement the Python class `ShowerConditionProbability` described below.
Class description:
Plugin to calculate the probability that conditions are such that precipitation, should it be present, will be showery, based on input cloud amounts and the convective ratio.
Method signatures and docstrings:
- def __init__(se... | cd2c9019944345df1e703bf8f625db537ad9f559 | <|skeleton|>
class ShowerConditionProbability:
"""Plugin to calculate the probability that conditions are such that precipitation, should it be present, will be showery, based on input cloud amounts and the convective ratio."""
def __init__(self, cloud_threshold: float=0.8125, convection_threshold: float=0.8, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ShowerConditionProbability:
"""Plugin to calculate the probability that conditions are such that precipitation, should it be present, will be showery, based on input cloud amounts and the convective ratio."""
def __init__(self, cloud_threshold: float=0.8125, convection_threshold: float=0.8, model_id_attr... | the_stack_v2_python_sparse | improver/precipitation_type/shower_condition_probability.py | metoppv/improver | train | 101 |
571decb2462cdbde483836a9cc776f31c84606d3 | [
"dp = [-100 for _ in range(len(nums))]\ndp[0] = nums[0]\nfor i in range(1, len(nums)):\n for j in range(i + 1):\n dp[i] = max([dp[i], sum(nums[j:i + 1])])\nreturn max(dp)",
"dp = [-100 for _ in range(len(nums))]\ndp[0] = nums[0]\nfor i in range(1, len(nums)):\n dp[i] = dp[i - 1] + max(nums[i - 1], 0)... | <|body_start_0|>
dp = [-100 for _ in range(len(nums))]
dp[0] = nums[0]
for i in range(1, len(nums)):
for j in range(i + 1):
dp[i] = max([dp[i], sum(nums[j:i + 1])])
return max(dp)
<|end_body_0|>
<|body_start_1|>
dp = [-100 for _ in range(len(nums))]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSubArray_fail(self, nums):
"""暴力法 :param nums: :return:"""
<|body_0|>
def maxSubArray_self(self, nums):
"""暴力法 :param nums: :return:"""
<|body_1|>
def maxSubArray(self, nums):
"""f(n+1) 只与 f(n) 与 nums[n+1]有关 只要nums[n+1]>0 则f(n)必然... | stack_v2_sparse_classes_75kplus_train_001751 | 2,523 | no_license | [
{
"docstring": "暴力法 :param nums: :return:",
"name": "maxSubArray_fail",
"signature": "def maxSubArray_fail(self, nums)"
},
{
"docstring": "暴力法 :param nums: :return:",
"name": "maxSubArray_self",
"signature": "def maxSubArray_self(self, nums)"
},
{
"docstring": "f(n+1) 只与 f(n) 与 n... | 3 | stack_v2_sparse_classes_30k_train_054100 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray_fail(self, nums): 暴力法 :param nums: :return:
- def maxSubArray_self(self, nums): 暴力法 :param nums: :return:
- def maxSubArray(self, nums): f(n+1) 只与 f(n) 与 nums[n+1... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray_fail(self, nums): 暴力法 :param nums: :return:
- def maxSubArray_self(self, nums): 暴力法 :param nums: :return:
- def maxSubArray(self, nums): f(n+1) 只与 f(n) 与 nums[n+1... | e12ead66d28175d34b51eac4ccdd6de06eb4d92d | <|skeleton|>
class Solution:
def maxSubArray_fail(self, nums):
"""暴力法 :param nums: :return:"""
<|body_0|>
def maxSubArray_self(self, nums):
"""暴力法 :param nums: :return:"""
<|body_1|>
def maxSubArray(self, nums):
"""f(n+1) 只与 f(n) 与 nums[n+1]有关 只要nums[n+1]>0 则f(n)必然... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxSubArray_fail(self, nums):
"""暴力法 :param nums: :return:"""
dp = [-100 for _ in range(len(nums))]
dp[0] = nums[0]
for i in range(1, len(nums)):
for j in range(i + 1):
dp[i] = max([dp[i], sum(nums[j:i + 1])])
return max(dp)
... | the_stack_v2_python_sparse | df_42_maxSubArray.py | zhenglinghan/leetcode_jianzhi_Offer | train | 2 | |
6a8cd2950f6b94c5d9344334fede04012c162db9 | [
"xx = x / x_0\nexponent = -alpha - beta * np.log(xx)\nreturn amplitude * xx ** exponent",
"xx = x / x_0\nlog_xx = np.log(xx)\nexponent = -alpha - beta * log_xx\nd_amplitude = xx ** exponent\nd_beta = -amplitude * d_amplitude * log_xx ** 2\nd_x_0 = amplitude * d_amplitude * (beta * log_xx / x_0 - exponent / x_0)\n... | <|body_start_0|>
xx = x / x_0
exponent = -alpha - beta * np.log(xx)
return amplitude * xx ** exponent
<|end_body_0|>
<|body_start_1|>
xx = x / x_0
log_xx = np.log(xx)
exponent = -alpha - beta * log_xx
d_amplitude = xx ** exponent
d_beta = -amplitude * d_a... | One dimensional log parabola model (sometimes called curved power law). Parameters ---------- amplitude : float Model amplitude x_0 : float Reference point alpha : float Power law index beta : float Power law curvature See Also -------- PowerLaw1D, BrokenPowerLaw1D, ExponentialCutoffPowerLaw1D Notes ----- Model formula... | LogParabola1D | [
"Python-2.0",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogParabola1D:
"""One dimensional log parabola model (sometimes called curved power law). Parameters ---------- amplitude : float Model amplitude x_0 : float Reference point alpha : float Power law index beta : float Power law curvature See Also -------- PowerLaw1D, BrokenPowerLaw1D, ExponentialC... | stack_v2_sparse_classes_75kplus_train_001752 | 6,539 | permissive | [
{
"docstring": "One dimensional log parabola model function",
"name": "evaluate",
"signature": "def evaluate(x, amplitude, x_0, alpha, beta)"
},
{
"docstring": "One dimensional log parabola derivative with respect to parameters",
"name": "fit_deriv",
"signature": "def fit_deriv(x, amplit... | 2 | stack_v2_sparse_classes_30k_train_007817 | Implement the Python class `LogParabola1D` described below.
Class description:
One dimensional log parabola model (sometimes called curved power law). Parameters ---------- amplitude : float Model amplitude x_0 : float Reference point alpha : float Power law index beta : float Power law curvature See Also -------- Pow... | Implement the Python class `LogParabola1D` described below.
Class description:
One dimensional log parabola model (sometimes called curved power law). Parameters ---------- amplitude : float Model amplitude x_0 : float Reference point alpha : float Power law index beta : float Power law curvature See Also -------- Pow... | 2c9002f16bb5c265e0d14f4a2314c86eeaa35cb6 | <|skeleton|>
class LogParabola1D:
"""One dimensional log parabola model (sometimes called curved power law). Parameters ---------- amplitude : float Model amplitude x_0 : float Reference point alpha : float Power law index beta : float Power law curvature See Also -------- PowerLaw1D, BrokenPowerLaw1D, ExponentialC... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LogParabola1D:
"""One dimensional log parabola model (sometimes called curved power law). Parameters ---------- amplitude : float Model amplitude x_0 : float Reference point alpha : float Power law index beta : float Power law curvature See Also -------- PowerLaw1D, BrokenPowerLaw1D, ExponentialCutoffPowerLaw... | the_stack_v2_python_sparse | lib/python2.7/site-packages/astropy/modeling/powerlaws.py | wangyum/Anaconda | train | 11 |
0188a3036a03be53b1697d07374c06ffcfbb8e6a | [
"self.X = X_init\nself.Y = Y_init\nself.l = l\nself.sigma_f = sigma_f\nself.K = self.kernel(self.X, self.X)",
"a = np.sum(X1 ** 2, axis=1, keepdims=True)\nb = np.sum(X2 ** 2, axis=1, keepdims=True)\nc = np.matmul(X1, X2.T)\ndist_sq = a + b.reshape(1, -1) - 2 * c\nK = self.sigma_f ** 2 * np.exp(-0.5 * (1 / self.l ... | <|body_start_0|>
self.X = X_init
self.Y = Y_init
self.l = l
self.sigma_f = sigma_f
self.K = self.kernel(self.X, self.X)
<|end_body_0|>
<|body_start_1|>
a = np.sum(X1 ** 2, axis=1, keepdims=True)
b = np.sum(X2 ** 2, axis=1, keepdims=True)
c = np.matmul(X1,... | that instantiates a noiseless 1D Gaussian process | GaussianProcess | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GaussianProcess:
"""that instantiates a noiseless 1D Gaussian process"""
def __init__(self, X_init, Y_init, l=1, sigma_f=1):
"""constructor"""
<|body_0|>
def kernel(self, X1, X2):
"""the covariance kernel matrix"""
<|body_1|>
def predict(self, X_s):
... | stack_v2_sparse_classes_75kplus_train_001753 | 1,175 | no_license | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self, X_init, Y_init, l=1, sigma_f=1)"
},
{
"docstring": "the covariance kernel matrix",
"name": "kernel",
"signature": "def kernel(self, X1, X2)"
},
{
"docstring": "Predicts the mean and standard deviat... | 3 | stack_v2_sparse_classes_30k_train_019434 | Implement the Python class `GaussianProcess` described below.
Class description:
that instantiates a noiseless 1D Gaussian process
Method signatures and docstrings:
- def __init__(self, X_init, Y_init, l=1, sigma_f=1): constructor
- def kernel(self, X1, X2): the covariance kernel matrix
- def predict(self, X_s): Pred... | Implement the Python class `GaussianProcess` described below.
Class description:
that instantiates a noiseless 1D Gaussian process
Method signatures and docstrings:
- def __init__(self, X_init, Y_init, l=1, sigma_f=1): constructor
- def kernel(self, X1, X2): the covariance kernel matrix
- def predict(self, X_s): Pred... | bda9efa60075afa834433ff1b5179db80f2487ae | <|skeleton|>
class GaussianProcess:
"""that instantiates a noiseless 1D Gaussian process"""
def __init__(self, X_init, Y_init, l=1, sigma_f=1):
"""constructor"""
<|body_0|>
def kernel(self, X1, X2):
"""the covariance kernel matrix"""
<|body_1|>
def predict(self, X_s):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GaussianProcess:
"""that instantiates a noiseless 1D Gaussian process"""
def __init__(self, X_init, Y_init, l=1, sigma_f=1):
"""constructor"""
self.X = X_init
self.Y = Y_init
self.l = l
self.sigma_f = sigma_f
self.K = self.kernel(self.X, self.X)
def ke... | the_stack_v2_python_sparse | unsupervised_learning/0x03-hyperparameter_tuning/1-gp.py | vandeldiegoc/holbertonschool-machine_learning | train | 0 |
5a8c91fce9d573e162b62b67b517c8646a70c2fd | [
"result = float('inf')\nx, y, z = (0, 0, 0)\nfor a in arr1:\n for b in arr2:\n for c in arr3:\n curr = abs(max(a, b, c) - min(a, b, c))\n if curr < result:\n x, y, z = (a, b, c)\n result = curr\nreturn (result, (x, y, z))",
"len1, len2, len3 = (len(arr... | <|body_start_0|>
result = float('inf')
x, y, z = (0, 0, 0)
for a in arr1:
for b in arr2:
for c in arr3:
curr = abs(max(a, b, c) - min(a, b, c))
if curr < result:
x, y, z = (a, b, c)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def min_diff_1(self, arr1, arr2, arr3):
"""Naive algorithm. Returns minimum possible value of |max(a, b, c) - min(a, b, c)| and a, b, c. Algorithm checks all possible values of a, b, c from three arrays and chooses the minimum. Time complexity: O(n1 * n2 * n3). Space complexity... | stack_v2_sparse_classes_75kplus_train_001754 | 3,525 | no_license | [
{
"docstring": "Naive algorithm. Returns minimum possible value of |max(a, b, c) - min(a, b, c)| and a, b, c. Algorithm checks all possible values of a, b, c from three arrays and chooses the minimum. Time complexity: O(n1 * n2 * n3). Space complexity: O(1), where n1, n2, n3 are len(arr1), len(arr2), len(arr3).... | 2 | stack_v2_sparse_classes_30k_train_011570 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def min_diff_1(self, arr1, arr2, arr3): Naive algorithm. Returns minimum possible value of |max(a, b, c) - min(a, b, c)| and a, b, c. Algorithm checks all possible values of a, b... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def min_diff_1(self, arr1, arr2, arr3): Naive algorithm. Returns minimum possible value of |max(a, b, c) - min(a, b, c)| and a, b, c. Algorithm checks all possible values of a, b... | 71b722ddfe8da04572e527b055cf8723d5c87bbf | <|skeleton|>
class Solution:
def min_diff_1(self, arr1, arr2, arr3):
"""Naive algorithm. Returns minimum possible value of |max(a, b, c) - min(a, b, c)| and a, b, c. Algorithm checks all possible values of a, b, c from three arrays and chooses the minimum. Time complexity: O(n1 * n2 * n3). Space complexity... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def min_diff_1(self, arr1, arr2, arr3):
"""Naive algorithm. Returns minimum possible value of |max(a, b, c) - min(a, b, c)| and a, b, c. Algorithm checks all possible values of a, b, c from three arrays and chooses the minimum. Time complexity: O(n1 * n2 * n3). Space complexity: O(1), where ... | the_stack_v2_python_sparse | Arrays/minimize_abs_diff.py | vladn90/Algorithms | train | 0 | |
c0feb78bc410b42f80d1108e7fe9c5149aad3ed3 | [
"super().__init__()\nself.model = TFT5ForConditionalGeneration.from_pretrained(model_size)\nself.root_folder = root_folder\nself.model_folder = model_folder",
"list_model_folder = listdir(self.root_folder + '/' + self.model_folder)\nlist_model_folder = [self.root_folder + '/' + self.model_folder + '/' + item for ... | <|body_start_0|>
super().__init__()
self.model = TFT5ForConditionalGeneration.from_pretrained(model_size)
self.root_folder = root_folder
self.model_folder = model_folder
<|end_body_0|>
<|body_start_1|>
list_model_folder = listdir(self.root_folder + '/' + self.model_folder)
... | Model loader to load different checkpoints of models trained on the TPU | ModelLoader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelLoader:
"""Model loader to load different checkpoints of models trained on the TPU"""
def __init__(self, model_size, root_folder, model_folder) -> None:
"""Init :param model_size: Model size :type model_size: str :param root_folder: Root folder of project :type root_folder: str ... | stack_v2_sparse_classes_75kplus_train_001755 | 2,210 | no_license | [
{
"docstring": "Init :param model_size: Model size :type model_size: str :param root_folder: Root folder of project :type root_folder: str :param model_folder: folder of model :type model_folder: str",
"name": "__init__",
"signature": "def __init__(self, model_size, root_folder, model_folder) -> None"
... | 4 | stack_v2_sparse_classes_30k_train_016860 | Implement the Python class `ModelLoader` described below.
Class description:
Model loader to load different checkpoints of models trained on the TPU
Method signatures and docstrings:
- def __init__(self, model_size, root_folder, model_folder) -> None: Init :param model_size: Model size :type model_size: str :param ro... | Implement the Python class `ModelLoader` described below.
Class description:
Model loader to load different checkpoints of models trained on the TPU
Method signatures and docstrings:
- def __init__(self, model_size, root_folder, model_folder) -> None: Init :param model_size: Model size :type model_size: str :param ro... | a6c112668d0b20e88cd5346f2bdc9399ea74afc8 | <|skeleton|>
class ModelLoader:
"""Model loader to load different checkpoints of models trained on the TPU"""
def __init__(self, model_size, root_folder, model_folder) -> None:
"""Init :param model_size: Model size :type model_size: str :param root_folder: Root folder of project :type root_folder: str ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ModelLoader:
"""Model loader to load different checkpoints of models trained on the TPU"""
def __init__(self, model_size, root_folder, model_folder) -> None:
"""Init :param model_size: Model size :type model_size: str :param root_folder: Root folder of project :type root_folder: str :param model_... | the_stack_v2_python_sparse | src/python_files/model_loader.py | yahah100/cross_lingual_summarization | train | 0 |
993b3e3652dc7eebbb9ce2ace77f83b1b4caed27 | [
"try:\n if not data['project_id'] or not data['id']:\n return JsonResponse(code='999996', msg='参数有误!')\n if not isinstance(data['project_id'], int) or not isinstance(data['id'], int):\n return JsonResponse(code='999996', msg='参数有误!')\nexcept KeyError:\n return JsonResponse(code='999996', msg=... | <|body_start_0|>
try:
if not data['project_id'] or not data['id']:
return JsonResponse(code='999996', msg='参数有误!')
if not isinstance(data['project_id'], int) or not isinstance(data['id'], int):
return JsonResponse(code='999996', msg='参数有误!')
except... | UpdateApiMockStatus | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateApiMockStatus:
def parameter_check(self, data):
"""校验参数 :param data: :return:"""
<|body_0|>
def post(self, request):
"""新增接口 :param request: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
if not data['project_id'] or... | stack_v2_sparse_classes_75kplus_train_001756 | 47,841 | permissive | [
{
"docstring": "校验参数 :param data: :return:",
"name": "parameter_check",
"signature": "def parameter_check(self, data)"
},
{
"docstring": "新增接口 :param request: :return:",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003184 | Implement the Python class `UpdateApiMockStatus` described below.
Class description:
Implement the UpdateApiMockStatus class.
Method signatures and docstrings:
- def parameter_check(self, data): 校验参数 :param data: :return:
- def post(self, request): 新增接口 :param request: :return: | Implement the Python class `UpdateApiMockStatus` described below.
Class description:
Implement the UpdateApiMockStatus class.
Method signatures and docstrings:
- def parameter_check(self, data): 校验参数 :param data: :return:
- def post(self, request): 新增接口 :param request: :return:
<|skeleton|>
class UpdateApiMockStatus... | 6d08f58fa6985415ef7beae733e6f8147026806e | <|skeleton|>
class UpdateApiMockStatus:
def parameter_check(self, data):
"""校验参数 :param data: :return:"""
<|body_0|>
def post(self, request):
"""新增接口 :param request: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UpdateApiMockStatus:
def parameter_check(self, data):
"""校验参数 :param data: :return:"""
try:
if not data['project_id'] or not data['id']:
return JsonResponse(code='999996', msg='参数有误!')
if not isinstance(data['project_id'], int) or not isinstance(data['id... | the_stack_v2_python_sparse | api_test/api/ApiDoc.py | yourant/tapi | train | 0 | |
3a22897ae9fbf3a754be03343fbd247a0f715fc0 | [
"no_of_percentiles = 3\nresult = choose_set_of_percentiles(no_of_percentiles)\nself.assertIsInstance(result, list)\nself.assertEqual(len(result), no_of_percentiles)",
"data = np.array([25, 50, 75])\nno_of_percentiles = 3\nresult = choose_set_of_percentiles(no_of_percentiles)\nself.assertArrayAlmostEqual(result, d... | <|body_start_0|>
no_of_percentiles = 3
result = choose_set_of_percentiles(no_of_percentiles)
self.assertIsInstance(result, list)
self.assertEqual(len(result), no_of_percentiles)
<|end_body_0|>
<|body_start_1|>
data = np.array([25, 50, 75])
no_of_percentiles = 3
r... | Test the choose_set_of_percentiles plugin. | Test_choose_set_of_percentiles | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_choose_set_of_percentiles:
"""Test the choose_set_of_percentiles plugin."""
def test_basic(self):
"""Test that the plugin returns a list with the expected number of percentiles."""
<|body_0|>
def test_data(self):
"""Test that the plugin returns a list with t... | stack_v2_sparse_classes_75kplus_train_001757 | 28,421 | permissive | [
{
"docstring": "Test that the plugin returns a list with the expected number of percentiles.",
"name": "test_basic",
"signature": "def test_basic(self)"
},
{
"docstring": "Test that the plugin returns a list with the expected data values for the percentiles.",
"name": "test_data",
"signa... | 4 | stack_v2_sparse_classes_30k_train_005366 | Implement the Python class `Test_choose_set_of_percentiles` described below.
Class description:
Test the choose_set_of_percentiles plugin.
Method signatures and docstrings:
- def test_basic(self): Test that the plugin returns a list with the expected number of percentiles.
- def test_data(self): Test that the plugin ... | Implement the Python class `Test_choose_set_of_percentiles` described below.
Class description:
Test the choose_set_of_percentiles plugin.
Method signatures and docstrings:
- def test_basic(self): Test that the plugin returns a list with the expected number of percentiles.
- def test_data(self): Test that the plugin ... | cd2c9019944345df1e703bf8f625db537ad9f559 | <|skeleton|>
class Test_choose_set_of_percentiles:
"""Test the choose_set_of_percentiles plugin."""
def test_basic(self):
"""Test that the plugin returns a list with the expected number of percentiles."""
<|body_0|>
def test_data(self):
"""Test that the plugin returns a list with t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Test_choose_set_of_percentiles:
"""Test the choose_set_of_percentiles plugin."""
def test_basic(self):
"""Test that the plugin returns a list with the expected number of percentiles."""
no_of_percentiles = 3
result = choose_set_of_percentiles(no_of_percentiles)
self.assert... | the_stack_v2_python_sparse | improver_tests/ensemble_copula_coupling/test_utilities.py | metoppv/improver | train | 101 |
7656cdaf5d5955e2ed7a7afbe67e73a16aed04df | [
"print('Remote processing\\nmainc.%s\\nargs: %s\\nkwargs: %s\\n\\n' % ('.'.join(pseq), args, kwargs))\ntoret = self._recurpseq(pseq, 0, mainc)\nif callable(toret):\n toret = toret(*args, **kwargs)\nelif args or kwargs:\n raise Exception('Too many arguments:\\n%s\\n%s' % (args, kwargs))\nif type(toret).__modul... | <|body_start_0|>
print('Remote processing\nmainc.%s\nargs: %s\nkwargs: %s\n\n' % ('.'.join(pseq), args, kwargs))
toret = self._recurpseq(pseq, 0, mainc)
if callable(toret):
toret = toret(*args, **kwargs)
elif args or kwargs:
raise Exception('Too many arguments:\n%... | Wrapper class around the logic used to parse the pseq of the requested call. A class instance is required by the multiprocessing manager library. | parse_pseq | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class parse_pseq:
"""Wrapper class around the logic used to parse the pseq of the requested call. A class instance is required by the multiprocessing manager library."""
def get_the_stuff(self, pseq, *args, **kwargs):
"""Endpoint to call any value found in mainc, forwarding the parameters ... | stack_v2_sparse_classes_75kplus_train_001758 | 4,258 | no_license | [
{
"docstring": "Endpoint to call any value found in mainc, forwarding the parameters used. :param list[str] pseq: point sequence in mainc to follow :param args: args to forward :param kwargs: kwargs to forward :returns: result of final layer :rtype: object :raises Exception: if the arguments do not match the re... | 2 | stack_v2_sparse_classes_30k_train_032794 | Implement the Python class `parse_pseq` described below.
Class description:
Wrapper class around the logic used to parse the pseq of the requested call. A class instance is required by the multiprocessing manager library.
Method signatures and docstrings:
- def get_the_stuff(self, pseq, *args, **kwargs): Endpoint to ... | Implement the Python class `parse_pseq` described below.
Class description:
Wrapper class around the logic used to parse the pseq of the requested call. A class instance is required by the multiprocessing manager library.
Method signatures and docstrings:
- def get_the_stuff(self, pseq, *args, **kwargs): Endpoint to ... | 2c3efbc9b3055a2722d5b54fea019e3745bfff98 | <|skeleton|>
class parse_pseq:
"""Wrapper class around the logic used to parse the pseq of the requested call. A class instance is required by the multiprocessing manager library."""
def get_the_stuff(self, pseq, *args, **kwargs):
"""Endpoint to call any value found in mainc, forwarding the parameters ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class parse_pseq:
"""Wrapper class around the logic used to parse the pseq of the requested call. A class instance is required by the multiprocessing manager library."""
def get_the_stuff(self, pseq, *args, **kwargs):
"""Endpoint to call any value found in mainc, forwarding the parameters used. :param ... | the_stack_v2_python_sparse | MultiProcessShare/InDill/_processor.py | Zaltu/simple-examples | train | 0 |
92dc05521ce4c3b8960a3161c907855642957967 | [
"ret = []\nqueue = deque([root])\nwhile any(queue):\n node = queue.popleft()\n if node is None:\n ret.append('null')\n continue\n ret.append(str(node.val))\n queue.append(node.left)\n queue.append(node.right)\nreturn ','.join(ret)",
"if not data:\n return None\ndata = data.split(',... | <|body_start_0|>
ret = []
queue = deque([root])
while any(queue):
node = queue.popleft()
if node is None:
ret.append('null')
continue
ret.append(str(node.val))
queue.append(node.left)
queue.append(node.ri... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_75kplus_train_001759 | 1,433 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | 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. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | cbd658ac052d4407e2567c9abc2a457dfe242bf8 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
ret = []
queue = deque([root])
while any(queue):
node = queue.popleft()
if node is None:
ret.append('null')
contin... | the_stack_v2_python_sparse | traverse_tree/py3/TreeNode.py | davidxk/Algorithm-Implementations | train | 37 | |
9728f22aa55768574b0f5cd3eb4965b34ec7ea67 | [
"super(Discriminator, self).__init__()\nself.first_conv_layer = ConvolutionDown(in_channels=3, out_channels=128, kernel_size=3)\nself.second_conv_layer = ConvolutionDown(in_channels=128, out_channels=256, kernel_size=3)\nself.third_conv_layer = ConvolutionDown(in_channels=256, out_channels=512, kernel_size=3)\nself... | <|body_start_0|>
super(Discriminator, self).__init__()
self.first_conv_layer = ConvolutionDown(in_channels=3, out_channels=128, kernel_size=3)
self.second_conv_layer = ConvolutionDown(in_channels=128, out_channels=256, kernel_size=3)
self.third_conv_layer = ConvolutionDown(in_channels=25... | Discriminator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Discriminator:
def __init__(self):
"""In the constructor we instantiate our custom modules and assign them as member variables."""
<|body_0|>
def forward(self, x):
"""In the forward function we accept a Variable of input data and we must return a Variable of output d... | stack_v2_sparse_classes_75kplus_train_001760 | 3,004 | no_license | [
{
"docstring": "In the constructor we instantiate our custom modules and assign them as member variables.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "In the forward function we accept a Variable of input data and we must return a Variable of output data. We can use... | 2 | null | Implement the Python class `Discriminator` described below.
Class description:
Implement the Discriminator class.
Method signatures and docstrings:
- def __init__(self): In the constructor we instantiate our custom modules and assign them as member variables.
- def forward(self, x): In the forward function we accept ... | Implement the Python class `Discriminator` described below.
Class description:
Implement the Discriminator class.
Method signatures and docstrings:
- def __init__(self): In the constructor we instantiate our custom modules and assign them as member variables.
- def forward(self, x): In the forward function we accept ... | 0adf5a0a5d4c2e4de41faac6fcc75700104c2b53 | <|skeleton|>
class Discriminator:
def __init__(self):
"""In the constructor we instantiate our custom modules and assign them as member variables."""
<|body_0|>
def forward(self, x):
"""In the forward function we accept a Variable of input data and we must return a Variable of output d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Discriminator:
def __init__(self):
"""In the constructor we instantiate our custom modules and assign them as member variables."""
super(Discriminator, self).__init__()
self.first_conv_layer = ConvolutionDown(in_channels=3, out_channels=128, kernel_size=3)
self.second_conv_laye... | the_stack_v2_python_sparse | PyTorch-practice/cyclegan_for_unified_hair_dyeing_acgan/discriminator_network.py | TheIllusion/TheIllusionsLibraries | train | 1 | |
ca09b011e46cc3e2540532ef0366740189e496e3 | [
"linear.drop_data()\nself.assertEqual(linear.show_available_products(), {})\nwith self.assertRaises(FileNotFoundError):\n result = linear.import_data('data2', 'p.csv', 'c.csv', 'r.csv')\nresult = linear.import_data('data', 'products.csv', 'customers.csv', 'rentals.csv')\nself.assertEqual(result[0][0], 1000)\nsel... | <|body_start_0|>
linear.drop_data()
self.assertEqual(linear.show_available_products(), {})
with self.assertRaises(FileNotFoundError):
result = linear.import_data('data2', 'p.csv', 'c.csv', 'r.csv')
result = linear.import_data('data', 'products.csv', 'customers.csv', 'rentals.... | Tests for population and data integrity of database. | RentalDbTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RentalDbTest:
"""Tests for population and data integrity of database."""
def test_1_import(self):
"""Test that the records are successfully imported."""
<|body_0|>
def test_2_show_rentals(self):
"""Test the integrity of the returned dictionary of active rentals."... | stack_v2_sparse_classes_75kplus_train_001761 | 3,511 | no_license | [
{
"docstring": "Test that the records are successfully imported.",
"name": "test_1_import",
"signature": "def test_1_import(self)"
},
{
"docstring": "Test the integrity of the returned dictionary of active rentals.",
"name": "test_2_show_rentals",
"signature": "def test_2_show_rentals(se... | 2 | stack_v2_sparse_classes_30k_train_045035 | Implement the Python class `RentalDbTest` described below.
Class description:
Tests for population and data integrity of database.
Method signatures and docstrings:
- def test_1_import(self): Test that the records are successfully imported.
- def test_2_show_rentals(self): Test the integrity of the returned dictionar... | Implement the Python class `RentalDbTest` described below.
Class description:
Tests for population and data integrity of database.
Method signatures and docstrings:
- def test_1_import(self): Test that the records are successfully imported.
- def test_2_show_rentals(self): Test the integrity of the returned dictionar... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class RentalDbTest:
"""Tests for population and data integrity of database."""
def test_1_import(self):
"""Test that the records are successfully imported."""
<|body_0|>
def test_2_show_rentals(self):
"""Test the integrity of the returned dictionary of active rentals."... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RentalDbTest:
"""Tests for population and data integrity of database."""
def test_1_import(self):
"""Test that the records are successfully imported."""
linear.drop_data()
self.assertEqual(linear.show_available_products(), {})
with self.assertRaises(FileNotFoundError):
... | the_stack_v2_python_sparse | students/shodges/lesson07/test_database.py | JavaRod/SP_Python220B_2019 | train | 1 |
153bef56d0717e41310e1905c7aaf33bb9835eb1 | [
"self.libm = libm\nself.gen_src = []\nself.clml_modules = None\nself.clml_builds = {}\nself.codegen = None\nself.nodes = None\nself.MakeFileHeader = Template('/*\\n * Licensed to the Apache Software Foundation (ASF) under one\\n * or more contributor license agreements. See the NOTICE file\\n ... | <|body_start_0|>
self.libm = libm
self.gen_src = []
self.clml_modules = None
self.clml_builds = {}
self.codegen = None
self.nodes = None
self.MakeFileHeader = Template('/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more con... | Generates CLML API source given a TVM compiled mod | CLMLGenSrc | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense",
"Zlib",
"LLVM-exception",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CLMLGenSrc:
"""Generates CLML API source given a TVM compiled mod"""
def __init__(self, libm):
"""Initialize Parameters ---------- libm : Module Compiled relay module"""
<|body_0|>
def get_clml_params(self):
"""Returns parameters from the TVM module"""
<|... | stack_v2_sparse_classes_75kplus_train_001762 | 49,674 | permissive | [
{
"docstring": "Initialize Parameters ---------- libm : Module Compiled relay module",
"name": "__init__",
"signature": "def __init__(self, libm)"
},
{
"docstring": "Returns parameters from the TVM module",
"name": "get_clml_params",
"signature": "def get_clml_params(self)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_046430 | Implement the Python class `CLMLGenSrc` described below.
Class description:
Generates CLML API source given a TVM compiled mod
Method signatures and docstrings:
- def __init__(self, libm): Initialize Parameters ---------- libm : Module Compiled relay module
- def get_clml_params(self): Returns parameters from the TVM... | Implement the Python class `CLMLGenSrc` described below.
Class description:
Generates CLML API source given a TVM compiled mod
Method signatures and docstrings:
- def __init__(self, libm): Initialize Parameters ---------- libm : Module Compiled relay module
- def get_clml_params(self): Returns parameters from the TVM... | d75083cd97ede706338ab413dbc964009456d01b | <|skeleton|>
class CLMLGenSrc:
"""Generates CLML API source given a TVM compiled mod"""
def __init__(self, libm):
"""Initialize Parameters ---------- libm : Module Compiled relay module"""
<|body_0|>
def get_clml_params(self):
"""Returns parameters from the TVM module"""
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CLMLGenSrc:
"""Generates CLML API source given a TVM compiled mod"""
def __init__(self, libm):
"""Initialize Parameters ---------- libm : Module Compiled relay module"""
self.libm = libm
self.gen_src = []
self.clml_modules = None
self.clml_builds = {}
self.... | the_stack_v2_python_sparse | python/tvm/relay/op/contrib/clml.py | apache/tvm | train | 4,575 |
567a8c805b4c416561d66d16eba511fd2d23526f | [
"super().__init__()\nself._logger = logging.getLogger(self.__class__.__name__)\nself.weights_dim = weights_dim\nself.prepool = nn.Sequential(nn.Conv1d(4, 64, 1), nn.GroupNorm(8, 64), nn.ReLU(), nn.Conv1d(64, 64, 1), nn.GroupNorm(8, 64), nn.ReLU(), nn.Conv1d(64, 64, 1), nn.GroupNorm(8, 64), nn.ReLU(), nn.Conv1d(64, ... | <|body_start_0|>
super().__init__()
self._logger = logging.getLogger(self.__class__.__name__)
self.weights_dim = weights_dim
self.prepool = nn.Sequential(nn.Conv1d(4, 64, 1), nn.GroupNorm(8, 64), nn.ReLU(), nn.Conv1d(64, 64, 1), nn.GroupNorm(8, 64), nn.ReLU(), nn.Conv1d(64, 64, 1), nn.Gr... | ParameterPredictionNet | [
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParameterPredictionNet:
def __init__(self, weights_dim):
"""PointNet based Parameter prediction network Args: weights_dim: Number of weights to predict (excluding beta), should be something like [3], or [64, 3], for 3 types of features"""
<|body_0|>
def forward(self, x):
... | stack_v2_sparse_classes_75kplus_train_001763 | 14,032 | permissive | [
{
"docstring": "PointNet based Parameter prediction network Args: weights_dim: Number of weights to predict (excluding beta), should be something like [3], or [64, 3], for 3 types of features",
"name": "__init__",
"signature": "def __init__(self, weights_dim)"
},
{
"docstring": "Returns alpha, b... | 2 | stack_v2_sparse_classes_30k_train_051335 | Implement the Python class `ParameterPredictionNet` described below.
Class description:
Implement the ParameterPredictionNet class.
Method signatures and docstrings:
- def __init__(self, weights_dim): PointNet based Parameter prediction network Args: weights_dim: Number of weights to predict (excluding beta), should ... | Implement the Python class `ParameterPredictionNet` described below.
Class description:
Implement the ParameterPredictionNet class.
Method signatures and docstrings:
- def __init__(self, weights_dim): PointNet based Parameter prediction network Args: weights_dim: Number of weights to predict (excluding beta), should ... | 2a5578577ce58786f05bb8701f2329b32ed6bb3a | <|skeleton|>
class ParameterPredictionNet:
def __init__(self, weights_dim):
"""PointNet based Parameter prediction network Args: weights_dim: Number of weights to predict (excluding beta), should be something like [3], or [64, 3], for 3 types of features"""
<|body_0|>
def forward(self, x):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ParameterPredictionNet:
def __init__(self, weights_dim):
"""PointNet based Parameter prediction network Args: weights_dim: Number of weights to predict (excluding beta), should be something like [3], or [64, 3], for 3 types of features"""
super().__init__()
self._logger = logging.getLo... | the_stack_v2_python_sparse | shapmagn/modules_reg/networks/rpmnet.py | dugushiyu/shapmagn | train | 0 | |
6358d3d7501de46d702c58c8ceaaef3f0338bdd4 | [
"super().__init__(input, output, context)\nif len(self.input) % len(self.output) != 0:\n raise ValueError('length of output must be a divisor of length of input')",
"n = len(self.output)\nslice_len = int(len(self.input) / n)\nreturn [sum(self.input[i * slice_len:(i + 1) * slice_len]) % self.context.mod for i i... | <|body_start_0|>
super().__init__(input, output, context)
if len(self.input) % len(self.output) != 0:
raise ValueError('length of output must be a divisor of length of input')
<|end_body_0|>
<|body_start_1|>
n = len(self.output)
slice_len = int(len(self.input) / n)
r... | SMC summation protocol. | Summation | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Summation:
"""SMC summation protocol."""
def __init__(self, input, output, context=None):
"""Instantiate a new summation protocol block with the given attributes. Args: input: A list of integers to be summed together. This is divided into equal-length slices and each individual slice... | stack_v2_sparse_classes_75kplus_train_001764 | 3,090 | permissive | [
{
"docstring": "Instantiate a new summation protocol block with the given attributes. Args: input: A list of integers to be summed together. This is divided into equal-length slices and each individual slice is summed together. The number of slices is determined by the length of *output*. output: A list contain... | 2 | null | Implement the Python class `Summation` described below.
Class description:
SMC summation protocol.
Method signatures and docstrings:
- def __init__(self, input, output, context=None): Instantiate a new summation protocol block with the given attributes. Args: input: A list of integers to be summed together. This is d... | Implement the Python class `Summation` described below.
Class description:
SMC summation protocol.
Method signatures and docstrings:
- def __init__(self, input, output, context=None): Instantiate a new summation protocol block with the given attributes. Args: input: A list of integers to be summed together. This is d... | 3208228e198f1a143c043fa01475e2b52694c0e4 | <|skeleton|>
class Summation:
"""SMC summation protocol."""
def __init__(self, input, output, context=None):
"""Instantiate a new summation protocol block with the given attributes. Args: input: A list of integers to be summed together. This is divided into equal-length slices and each individual slice... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Summation:
"""SMC summation protocol."""
def __init__(self, input, output, context=None):
"""Instantiate a new summation protocol block with the given attributes. Args: input: A list of integers to be summed together. This is divided into equal-length slices and each individual slice is summed to... | the_stack_v2_python_sparse | smplayer/core/protocol/summation.py | sharemind-sdk/computation-audit | train | 0 |
7d09720da5ea06331d00288385a49190e001fcca | [
"left = i = 0\nright = len(nums) - 1\nwhile i <= right:\n if nums[i] == 0:\n nums[i], nums[left] = (nums[left], nums[i])\n left += 1\n i += 1\n elif nums[i] == 1:\n i += 1\n else:\n nums[i], nums[right] = (nums[right], nums[i])\n right -= 1",
"red = white = blue ... | <|body_start_0|>
left = i = 0
right = len(nums) - 1
while i <= right:
if nums[i] == 0:
nums[i], nums[left] = (nums[left], nums[i])
left += 1
i += 1
elif nums[i] == 1:
i += 1
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sortColors(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_0|>
def sortColorsEasy(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_75kplus_train_001765 | 1,748 | no_license | [
{
"docstring": "Do not return anything, modify nums in-place instead.",
"name": "sortColors",
"signature": "def sortColors(self, nums: List[int]) -> None"
},
{
"docstring": "Do not return anything, modify nums in-place instead.",
"name": "sortColorsEasy",
"signature": "def sortColorsEasy... | 2 | stack_v2_sparse_classes_30k_train_042902 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortColors(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead.
- def sortColorsEasy(self, nums: List[int]) -> None: Do not return anything, ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortColors(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead.
- def sortColorsEasy(self, nums: List[int]) -> None: Do not return anything, ... | e75e4e4cccf69368ec2d74785cc156084d7fc3cd | <|skeleton|>
class Solution:
def sortColors(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_0|>
def sortColorsEasy(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def sortColors(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead."""
left = i = 0
right = len(nums) - 1
while i <= right:
if nums[i] == 0:
nums[i], nums[left] = (nums[left], nums[i])
lef... | the_stack_v2_python_sparse | python/medium/75SortColors.py | jwestfromtheeast/CodingChallenges | train | 0 | |
fc5e6fda819be04c471b8b857ae069ee6a74b348 | [
"self.bot = bot\nself.query = query\nself.user = user\nself.data = self.query.data.split(':')\nself.callback_type = CallbackType(int(self.data[0]))\nself.payload = self.data[1]\ntry:\n self.action = int(self.data[2])\nexcept ValueError:\n self.action = self.data[2]\nself.poll = session.query(Poll).get(self.pa... | <|body_start_0|>
self.bot = bot
self.query = query
self.user = user
self.data = self.query.data.split(':')
self.callback_type = CallbackType(int(self.data[0]))
self.payload = self.data[1]
try:
self.action = int(self.data[2])
except ValueError:
... | Contains all important information for handling with callbacks. | CallbackContext | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"GPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CallbackContext:
"""Contains all important information for handling with callbacks."""
def __init__(self, session: scoped_session, bot, query, user):
"""Create a new CallbackContext from a query."""
<|body_0|>
def __repr__(self):
"""Print as string."""
<|... | stack_v2_sparse_classes_75kplus_train_001766 | 2,066 | permissive | [
{
"docstring": "Create a new CallbackContext from a query.",
"name": "__init__",
"signature": "def __init__(self, session: scoped_session, bot, query, user)"
},
{
"docstring": "Print as string.",
"name": "__repr__",
"signature": "def __repr__(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_054106 | Implement the Python class `CallbackContext` described below.
Class description:
Contains all important information for handling with callbacks.
Method signatures and docstrings:
- def __init__(self, session: scoped_session, bot, query, user): Create a new CallbackContext from a query.
- def __repr__(self): Print as ... | Implement the Python class `CallbackContext` described below.
Class description:
Contains all important information for handling with callbacks.
Method signatures and docstrings:
- def __init__(self, session: scoped_session, bot, query, user): Create a new CallbackContext from a query.
- def __repr__(self): Print as ... | 4e1beae329326296b8ee6b55bef62cfce1aa0e55 | <|skeleton|>
class CallbackContext:
"""Contains all important information for handling with callbacks."""
def __init__(self, session: scoped_session, bot, query, user):
"""Create a new CallbackContext from a query."""
<|body_0|>
def __repr__(self):
"""Print as string."""
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CallbackContext:
"""Contains all important information for handling with callbacks."""
def __init__(self, session: scoped_session, bot, query, user):
"""Create a new CallbackContext from a query."""
self.bot = bot
self.query = query
self.user = user
self.data = sel... | the_stack_v2_python_sparse | pollbot/telegram/callback_handler/context.py | Nukesor/ultimate-poll-bot | train | 147 |
f5c17ead6b571794dfabdb397c2dfa2f8f2699e7 | [
"try:\n user = User.objects.get(email=data)\nexcept User.DoesNotExist:\n raise serializers.ValidationError('1022: El email indicado no pertenece a ningun usuario')\nself.context['user'] = user\nreturn data",
"user = self.context['user']\nsend_reset_password_email.delay(user_pk=user.pk)\nreturn user"
] | <|body_start_0|>
try:
user = User.objects.get(email=data)
except User.DoesNotExist:
raise serializers.ValidationError('1022: El email indicado no pertenece a ningun usuario')
self.context['user'] = user
return data
<|end_body_0|>
<|body_start_1|>
user = s... | Serializer de email de reset de contraseña. | EmailPasswordSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmailPasswordSerializer:
"""Serializer de email de reset de contraseña."""
def validate_email(self, data):
"""Validamos que el email exista para un usuario"""
<|body_0|>
def save(self):
"""Update user's verified status."""
<|body_1|>
<|end_skeleton|>
<|... | stack_v2_sparse_classes_75kplus_train_001767 | 4,981 | no_license | [
{
"docstring": "Validamos que el email exista para un usuario",
"name": "validate_email",
"signature": "def validate_email(self, data)"
},
{
"docstring": "Update user's verified status.",
"name": "save",
"signature": "def save(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005291 | Implement the Python class `EmailPasswordSerializer` described below.
Class description:
Serializer de email de reset de contraseña.
Method signatures and docstrings:
- def validate_email(self, data): Validamos que el email exista para un usuario
- def save(self): Update user's verified status. | Implement the Python class `EmailPasswordSerializer` described below.
Class description:
Serializer de email de reset de contraseña.
Method signatures and docstrings:
- def validate_email(self, data): Validamos que el email exista para un usuario
- def save(self): Update user's verified status.
<|skeleton|>
class Em... | 4d008e315d49f942e314ac79f9bcdb5c0f84c568 | <|skeleton|>
class EmailPasswordSerializer:
"""Serializer de email de reset de contraseña."""
def validate_email(self, data):
"""Validamos que el email exista para un usuario"""
<|body_0|>
def save(self):
"""Update user's verified status."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EmailPasswordSerializer:
"""Serializer de email de reset de contraseña."""
def validate_email(self, data):
"""Validamos que el email exista para un usuario"""
try:
user = User.objects.get(email=data)
except User.DoesNotExist:
raise serializers.ValidationErr... | the_stack_v2_python_sparse | foodyplus/foodyplus/users/serializers/users.py | Sanguet/Platzi-Olimpiada | train | 0 |
ee656c34e88475be0ff6de97ed272df54eb71116 | [
"self.top_phase = _Phase('overall profile', -1, None)\nself.current_phase = self.top_phase\nself.next_color = 0\nself.original_thread_id = threading.current_thread().ident\nself.trace_context = opt_trace_context\nself.trace_service = opt_trace_service\nself.project_id = app_identity.get_application_id()",
"if sel... | <|body_start_0|>
self.top_phase = _Phase('overall profile', -1, None)
self.current_phase = self.top_phase
self.next_color = 0
self.original_thread_id = threading.current_thread().ident
self.trace_context = opt_trace_context
self.trace_service = opt_trace_service
s... | Object to record and help display request processing profiling info. The Profiler class holds a list of phase objects, which can hold additional phase objects (which are subphases). Each phase or subphase represents some meaningful part of this application's HTTP request processing. | Profiler | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Profiler:
"""Object to record and help display request processing profiling info. The Profiler class holds a list of phase objects, which can hold additional phase objects (which are subphases). Each phase or subphase represents some meaningful part of this application's HTTP request processing."... | stack_v2_sparse_classes_75kplus_train_001768 | 6,677 | permissive | [
{
"docstring": "Each request processing profile begins with an empty list of phases.",
"name": "__init__",
"signature": "def __init__(self, opt_trace_context=None, opt_trace_service=None)"
},
{
"docstring": "Begin a (sub)phase by pushing a new phase onto a stack.",
"name": "StartPhase",
... | 6 | null | Implement the Python class `Profiler` described below.
Class description:
Object to record and help display request processing profiling info. The Profiler class holds a list of phase objects, which can hold additional phase objects (which are subphases). Each phase or subphase represents some meaningful part of this ... | Implement the Python class `Profiler` described below.
Class description:
Object to record and help display request processing profiling info. The Profiler class holds a list of phase objects, which can hold additional phase objects (which are subphases). Each phase or subphase represents some meaningful part of this ... | b5d4783f99461438ca9e6a477535617fadab6ba3 | <|skeleton|>
class Profiler:
"""Object to record and help display request processing profiling info. The Profiler class holds a list of phase objects, which can hold additional phase objects (which are subphases). Each phase or subphase represents some meaningful part of this application's HTTP request processing."... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Profiler:
"""Object to record and help display request processing profiling info. The Profiler class holds a list of phase objects, which can hold additional phase objects (which are subphases). Each phase or subphase represents some meaningful part of this application's HTTP request processing."""
def _... | the_stack_v2_python_sparse | appengine/monorail/framework/profiler.py | xinghun61/infra | train | 2 |
df0eaab624dbffbebf9ad18fdc3db6b04349b0cb | [
"if not cookies:\n return False\nassert isinstance(cookies, dict)\nurl = 'https://kyfw.12306.cn/otn/login/conf'\nresp = self.submit(url, method='POST', cookies=cookies)\nif resp['data']['is_login'] == 'Y':\n return True\nelse:\n return False",
"route_pattern = re.compile('route=[0-9, a-z]*;')\njsessionid... | <|body_start_0|>
if not cookies:
return False
assert isinstance(cookies, dict)
url = 'https://kyfw.12306.cn/otn/login/conf'
resp = self.submit(url, method='POST', cookies=cookies)
if resp['data']['is_login'] == 'Y':
return True
else:
re... | 认证 | TrainAuthAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrainAuthAPI:
"""认证"""
def auth_check_login(self, cookies=None, **kwargs):
"""用户-检查是否登录 :params cookies: 用户 Session 信息 :return True:已登录 False:未登录"""
<|body_0|>
def auth_init(self, **kwargs):
"""认证-初始化,获取 cookies 信息 :return JSON DICT"""
<|body_1|>
def... | stack_v2_sparse_classes_75kplus_train_001769 | 10,466 | no_license | [
{
"docstring": "用户-检查是否登录 :params cookies: 用户 Session 信息 :return True:已登录 False:未登录",
"name": "auth_check_login",
"signature": "def auth_check_login(self, cookies=None, **kwargs)"
},
{
"docstring": "认证-初始化,获取 cookies 信息 :return JSON DICT",
"name": "auth_init",
"signature": "def auth_init... | 6 | stack_v2_sparse_classes_30k_train_034514 | Implement the Python class `TrainAuthAPI` described below.
Class description:
认证
Method signatures and docstrings:
- def auth_check_login(self, cookies=None, **kwargs): 用户-检查是否登录 :params cookies: 用户 Session 信息 :return True:已登录 False:未登录
- def auth_init(self, **kwargs): 认证-初始化,获取 cookies 信息 :return JSON DICT
- def aut... | Implement the Python class `TrainAuthAPI` described below.
Class description:
认证
Method signatures and docstrings:
- def auth_check_login(self, cookies=None, **kwargs): 用户-检查是否登录 :params cookies: 用户 Session 信息 :return True:已登录 False:未登录
- def auth_init(self, **kwargs): 认证-初始化,获取 cookies 信息 :return JSON DICT
- def aut... | d12dcdec770f9c2cd91cb19f405e887cfd996745 | <|skeleton|>
class TrainAuthAPI:
"""认证"""
def auth_check_login(self, cookies=None, **kwargs):
"""用户-检查是否登录 :params cookies: 用户 Session 信息 :return True:已登录 False:未登录"""
<|body_0|>
def auth_init(self, **kwargs):
"""认证-初始化,获取 cookies 信息 :return JSON DICT"""
<|body_1|>
def... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TrainAuthAPI:
"""认证"""
def auth_check_login(self, cookies=None, **kwargs):
"""用户-检查是否登录 :params cookies: 用户 Session 信息 :return True:已登录 False:未登录"""
if not cookies:
return False
assert isinstance(cookies, dict)
url = 'https://kyfw.12306.cn/otn/login/conf'
... | the_stack_v2_python_sparse | ticket/cml12306/auth.py | limi444/z12306 | train | 0 |
9f1bb1feaf46134c745b053a89994751f99fdc8d | [
"items = Balance.objects.filter(date__lt=date)\ntotal = sum((i.value for i in items))\nreturn total",
"items = Balance.objects.filter(date__year=year, date__month=month)\ntotal = sum((i.value for i in items))\nreturn total"
] | <|body_start_0|>
items = Balance.objects.filter(date__lt=date)
total = sum((i.value for i in items))
return total
<|end_body_0|>
<|body_start_1|>
items = Balance.objects.filter(date__year=year, date__month=month)
total = sum((i.value for i in items))
return total
<|end_b... | Balance | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Balance:
def total_balance_before(date):
"""Returns the total value until the date that was given."""
<|body_0|>
def balance_from_month(year, month):
"""Returns the total value from the year and month that was given."""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_75kplus_train_001770 | 5,267 | permissive | [
{
"docstring": "Returns the total value until the date that was given.",
"name": "total_balance_before",
"signature": "def total_balance_before(date)"
},
{
"docstring": "Returns the total value from the year and month that was given.",
"name": "balance_from_month",
"signature": "def bala... | 2 | stack_v2_sparse_classes_30k_train_030501 | Implement the Python class `Balance` described below.
Class description:
Implement the Balance class.
Method signatures and docstrings:
- def total_balance_before(date): Returns the total value until the date that was given.
- def balance_from_month(year, month): Returns the total value from the year and month that w... | Implement the Python class `Balance` described below.
Class description:
Implement the Balance class.
Method signatures and docstrings:
- def total_balance_before(date): Returns the total value until the date that was given.
- def balance_from_month(year, month): Returns the total value from the year and month that w... | 2f46ba65fb0e376361ff47c86ea7a62c50b6c91b | <|skeleton|>
class Balance:
def total_balance_before(date):
"""Returns the total value until the date that was given."""
<|body_0|>
def balance_from_month(year, month):
"""Returns the total value from the year and month that was given."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Balance:
def total_balance_before(date):
"""Returns the total value until the date that was given."""
items = Balance.objects.filter(date__lt=date)
total = sum((i.value for i in items))
return total
def balance_from_month(year, month):
"""Returns the total value fr... | the_stack_v2_python_sparse | estofadora/statement/models.py | delete/estofadora | train | 6 | |
c9c6a74bf47b9be9792fe8b207a94906f08e48a5 | [
"self._attr_unique_id = hashlib.sha256(user.name.encode('utf-8')).hexdigest()\nself._attr_name = user.name\nself._user = user",
"self._attr_entity_picture = self._user.get_image()\nif (now_playing := self._user.get_now_playing()):\n self._attr_native_value = format_track(now_playing)\nelse:\n self._attr_nat... | <|body_start_0|>
self._attr_unique_id = hashlib.sha256(user.name.encode('utf-8')).hexdigest()
self._attr_name = user.name
self._user = user
<|end_body_0|>
<|body_start_1|>
self._attr_entity_picture = self._user.get_image()
if (now_playing := self._user.get_now_playing()):
... | A class for the Last.fm account. | LastFmSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LastFmSensor:
"""A class for the Last.fm account."""
def __init__(self, user: User, lastfm_api: LastFMNetwork) -> None:
"""Initialize the sensor."""
<|body_0|>
def update(self) -> None:
"""Update device state."""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_75kplus_train_001771 | 2,863 | permissive | [
{
"docstring": "Initialize the sensor.",
"name": "__init__",
"signature": "def __init__(self, user: User, lastfm_api: LastFMNetwork) -> None"
},
{
"docstring": "Update device state.",
"name": "update",
"signature": "def update(self) -> None"
}
] | 2 | stack_v2_sparse_classes_30k_train_052210 | Implement the Python class `LastFmSensor` described below.
Class description:
A class for the Last.fm account.
Method signatures and docstrings:
- def __init__(self, user: User, lastfm_api: LastFMNetwork) -> None: Initialize the sensor.
- def update(self) -> None: Update device state. | Implement the Python class `LastFmSensor` described below.
Class description:
A class for the Last.fm account.
Method signatures and docstrings:
- def __init__(self, user: User, lastfm_api: LastFMNetwork) -> None: Initialize the sensor.
- def update(self) -> None: Update device state.
<|skeleton|>
class LastFmSensor... | 2e65b77b2b5c17919939481f327963abdfdc53f0 | <|skeleton|>
class LastFmSensor:
"""A class for the Last.fm account."""
def __init__(self, user: User, lastfm_api: LastFMNetwork) -> None:
"""Initialize the sensor."""
<|body_0|>
def update(self) -> None:
"""Update device state."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LastFmSensor:
"""A class for the Last.fm account."""
def __init__(self, user: User, lastfm_api: LastFMNetwork) -> None:
"""Initialize the sensor."""
self._attr_unique_id = hashlib.sha256(user.name.encode('utf-8')).hexdigest()
self._attr_name = user.name
self._user = user
... | the_stack_v2_python_sparse | homeassistant/components/lastfm/sensor.py | konnected-io/home-assistant | train | 24 |
321d66ea604d881adb1ddb560ac9d8d138f7f499 | [
"precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')\nfor line in self:\n if not float_is_zero(qty, precision_digits=precision):\n vals = line._prepare_invoice_lines(qty=qty)\n vals.update({'invoice_id': invoice_id, 'pos_line_ids': [(6, 0, [line.id])]})\n self.... | <|body_start_0|>
precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')
for line in self:
if not float_is_zero(qty, precision_digits=precision):
vals = line._prepare_invoice_lines(qty=qty)
vals.update({'invoice_id': invoice_id, 'pos... | posOrderLineInvoices | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class posOrderLineInvoices:
def invoice_lines_create(self, invoice_id, qty):
"""Create an invoice line. The quantity to invoice can be positive (invoice) or negative (refund). :param invoice_id: integer :param qty: float quantity to invoice"""
<|body_0|>
def _prepare_invoice_lines... | stack_v2_sparse_classes_75kplus_train_001772 | 12,663 | no_license | [
{
"docstring": "Create an invoice line. The quantity to invoice can be positive (invoice) or negative (refund). :param invoice_id: integer :param qty: float quantity to invoice",
"name": "invoice_lines_create",
"signature": "def invoice_lines_create(self, invoice_id, qty)"
},
{
"docstring": "Pre... | 2 | stack_v2_sparse_classes_30k_train_043514 | Implement the Python class `posOrderLineInvoices` described below.
Class description:
Implement the posOrderLineInvoices class.
Method signatures and docstrings:
- def invoice_lines_create(self, invoice_id, qty): Create an invoice line. The quantity to invoice can be positive (invoice) or negative (refund). :param in... | Implement the Python class `posOrderLineInvoices` described below.
Class description:
Implement the posOrderLineInvoices class.
Method signatures and docstrings:
- def invoice_lines_create(self, invoice_id, qty): Create an invoice line. The quantity to invoice can be positive (invoice) or negative (refund). :param in... | 83c54594e0b59e1fe3ff5eea1761992a9955faac | <|skeleton|>
class posOrderLineInvoices:
def invoice_lines_create(self, invoice_id, qty):
"""Create an invoice line. The quantity to invoice can be positive (invoice) or negative (refund). :param invoice_id: integer :param qty: float quantity to invoice"""
<|body_0|>
def _prepare_invoice_lines... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class posOrderLineInvoices:
def invoice_lines_create(self, invoice_id, qty):
"""Create an invoice line. The quantity to invoice can be positive (invoice) or negative (refund). :param invoice_id: integer :param qty: float quantity to invoice"""
precision = self.env['decimal.precision'].precision_get(... | the_stack_v2_python_sparse | pos_invoice/models/pos_invoice.py | rosalesdc/circulomoto_testing | train | 0 | |
cb913936875d189c6ee3090e99d4d93457041593 | [
"self.vs = cv2.VideoCapture(0)\nself.output_path = output_path\nself.current_image = None\nself.root = tk.Tk()\nself.root.title('OpenCV and Tkinter')\nself.root.protocol('WM_DELETE_WINDOW', self.destructor)\nself.panel = tk.Label(self.root)\nself.panel.pack(padx=10, pady=10)\nbtn = tk.Button(self.root, text='Snapsh... | <|body_start_0|>
self.vs = cv2.VideoCapture(0)
self.output_path = output_path
self.current_image = None
self.root = tk.Tk()
self.root.title('OpenCV and Tkinter')
self.root.protocol('WM_DELETE_WINDOW', self.destructor)
self.panel = tk.Label(self.root)
self.... | Application | [
"LicenseRef-scancode-proprietary-license",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Application:
def __init__(self, output_path='./'):
"""Initialize application which uses OpenCV + Tkinter. It displays a video stream in a Tkinter window and stores current snapshot on disk"""
<|body_0|>
def video_loop(self):
"""Get frame from the video stream and sho... | stack_v2_sparse_classes_75kplus_train_001773 | 3,301 | permissive | [
{
"docstring": "Initialize application which uses OpenCV + Tkinter. It displays a video stream in a Tkinter window and stores current snapshot on disk",
"name": "__init__",
"signature": "def __init__(self, output_path='./')"
},
{
"docstring": "Get frame from the video stream and show it in Tkint... | 4 | stack_v2_sparse_classes_30k_train_030163 | Implement the Python class `Application` described below.
Class description:
Implement the Application class.
Method signatures and docstrings:
- def __init__(self, output_path='./'): Initialize application which uses OpenCV + Tkinter. It displays a video stream in a Tkinter window and stores current snapshot on disk... | Implement the Python class `Application` described below.
Class description:
Implement the Application class.
Method signatures and docstrings:
- def __init__(self, output_path='./'): Initialize application which uses OpenCV + Tkinter. It displays a video stream in a Tkinter window and stores current snapshot on disk... | 9d2310c5323b8c8f3b1829787e5176f6fe3fd3cb | <|skeleton|>
class Application:
def __init__(self, output_path='./'):
"""Initialize application which uses OpenCV + Tkinter. It displays a video stream in a Tkinter window and stores current snapshot on disk"""
<|body_0|>
def video_loop(self):
"""Get frame from the video stream and sho... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Application:
def __init__(self, output_path='./'):
"""Initialize application which uses OpenCV + Tkinter. It displays a video stream in a Tkinter window and stores current snapshot on disk"""
self.vs = cv2.VideoCapture(0)
self.output_path = output_path
self.current_image = None... | the_stack_v2_python_sparse | opencv_tkinter.py | foobar167/junkyard | train | 86 | |
af7725b18d5e20d2abc76a87d531d538be1095ec | [
"self.name = name\nif name is None:\n self.name = ''.join([str(i) for i in np.random.randint(5)])\nself.incomingRelation = incomingRelation\nself.incomingNodes = incomingNodes\nself.autoFill = autofill\nself.hidden = hidden",
"if self.name not in values:\n if self.autoFill is not None:\n if self.auto... | <|body_start_0|>
self.name = name
if name is None:
self.name = ''.join([str(i) for i in np.random.randint(5)])
self.incomingRelation = incomingRelation
self.incomingNodes = incomingNodes
self.autoFill = autofill
self.hidden = hidden
<|end_body_0|>
<|body_star... | CausalNode | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CausalNode:
def __init__(self, name=None, incomingRelation=None, incomingNodes=[], autofill=None, hidden=False):
"""Provide outgoing as a list of nodes. Name must be unique in the network."""
<|body_0|>
def simulate(self, values, rnn=False):
"""Computes own value. As... | stack_v2_sparse_classes_75kplus_train_001774 | 13,980 | no_license | [
{
"docstring": "Provide outgoing as a list of nodes. Name must be unique in the network.",
"name": "__init__",
"signature": "def __init__(self, name=None, incomingRelation=None, incomingNodes=[], autofill=None, hidden=False)"
},
{
"docstring": "Computes own value. Assumes all required variables ... | 2 | stack_v2_sparse_classes_30k_train_010246 | Implement the Python class `CausalNode` described below.
Class description:
Implement the CausalNode class.
Method signatures and docstrings:
- def __init__(self, name=None, incomingRelation=None, incomingNodes=[], autofill=None, hidden=False): Provide outgoing as a list of nodes. Name must be unique in the network.
... | Implement the Python class `CausalNode` described below.
Class description:
Implement the CausalNode class.
Method signatures and docstrings:
- def __init__(self, name=None, incomingRelation=None, incomingNodes=[], autofill=None, hidden=False): Provide outgoing as a list of nodes. Name must be unique in the network.
... | 2b2ff49a6a6fe60c7e77b45d6c81b21e9b75034d | <|skeleton|>
class CausalNode:
def __init__(self, name=None, incomingRelation=None, incomingNodes=[], autofill=None, hidden=False):
"""Provide outgoing as a list of nodes. Name must be unique in the network."""
<|body_0|>
def simulate(self, values, rnn=False):
"""Computes own value. As... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CausalNode:
def __init__(self, name=None, incomingRelation=None, incomingNodes=[], autofill=None, hidden=False):
"""Provide outgoing as a list of nodes. Name must be unique in the network."""
self.name = name
if name is None:
self.name = ''.join([str(i) for i in np.random.r... | the_stack_v2_python_sparse | causal/CausalNode.py | rjbruin/causal-discovery-with-lstm | train | 3 | |
00443d1ea00a666e3243f663a74f5c852162aecc | [
"Condition.__init__(self)\nassert query != None, 'No query specified.'\nself.__query = query",
"isMet = False\nif value == None:\n isMet = False\nelif valueType == ValueType.SINGLE_VALUE:\n isMet = self.__query.IsSatisfiedBy(value)\nelse:\n isMet = Condition.MetBy(self, value, valueType)\nreturn isMet"
] | <|body_start_0|>
Condition.__init__(self)
assert query != None, 'No query specified.'
self.__query = query
<|end_body_0|>
<|body_start_1|>
isMet = False
if value == None:
isMet = False
elif valueType == ValueType.SINGLE_VALUE:
isMet = self.__query... | Conditions based on ASQL query. | QueryCondition | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QueryCondition:
"""Conditions based on ASQL query."""
def __init__(self, query):
"""In: query - A FASQLQuery object."""
<|body_0|>
def MetBy(self, value, valueType):
"""In: value - An FObject derived object that tests if the condition is met. valueType - Type of ... | stack_v2_sparse_classes_75kplus_train_001775 | 6,558 | no_license | [
{
"docstring": "In: query - A FASQLQuery object.",
"name": "__init__",
"signature": "def __init__(self, query)"
},
{
"docstring": "In: value - An FObject derived object that tests if the condition is met. valueType - Type of value. Out: True if the condition was met, False otherwise.",
"name... | 2 | stack_v2_sparse_classes_30k_train_026147 | Implement the Python class `QueryCondition` described below.
Class description:
Conditions based on ASQL query.
Method signatures and docstrings:
- def __init__(self, query): In: query - A FASQLQuery object.
- def MetBy(self, value, valueType): In: value - An FObject derived object that tests if the condition is met.... | Implement the Python class `QueryCondition` described below.
Class description:
Conditions based on ASQL query.
Method signatures and docstrings:
- def __init__(self, query): In: query - A FASQLQuery object.
- def MetBy(self, value, valueType): In: value - An FObject derived object that tests if the condition is met.... | 5e7cc7de3495145501ca53deb9efee2233ab7e1c | <|skeleton|>
class QueryCondition:
"""Conditions based on ASQL query."""
def __init__(self, query):
"""In: query - A FASQLQuery object."""
<|body_0|>
def MetBy(self, value, valueType):
"""In: value - An FObject derived object that tests if the condition is met. valueType - Type of ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QueryCondition:
"""Conditions based on ASQL query."""
def __init__(self, query):
"""In: query - A FASQLQuery object."""
Condition.__init__(self)
assert query != None, 'No query specified.'
self.__query = query
def MetBy(self, value, valueType):
"""In: value - ... | the_stack_v2_python_sparse | Extensions/Default/FPythonCode/FOperationsRuleEngine.py | webclinic017/fa-absa-py3 | train | 0 |
d7b2b2888b529eb9dbe25474e0bc27d70f4198da | [
"log.debug('creating buffer %s/%s' % (component_name, property_name))\nsuper(Buffer, self).__init__()\nself._log = log\nself._component_name = component_name\nself._property_name = property_name\nself._property_type = property_type\nif property_type is PropertyType.ENUMERATION:\n self._property_type_desc = get_e... | <|body_start_0|>
log.debug('creating buffer %s/%s' % (component_name, property_name))
super(Buffer, self).__init__()
self._log = log
self._component_name = component_name
self._property_name = property_name
self._property_type = property_type
if property_type is P... | This buffer doesn't store monitoring/time series data but writes it to the log. | Buffer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Buffer:
"""This buffer doesn't store monitoring/time series data but writes it to the log."""
def __init__(self, log, component_name, property_name, property_type, property_type_desc, disable):
"""ctor. @param log: The logger to write data to. @type log: logging.Logger @param compone... | stack_v2_sparse_classes_75kplus_train_001776 | 5,402 | no_license | [
{
"docstring": "ctor. @param log: The logger to write data to. @type log: logging.Logger @param component_name: Component name and @type component_name: string @param property_name: property name this buffer will receive data from. @type property_name: string @param property_type: The property type. @type prope... | 3 | stack_v2_sparse_classes_30k_train_023228 | Implement the Python class `Buffer` described below.
Class description:
This buffer doesn't store monitoring/time series data but writes it to the log.
Method signatures and docstrings:
- def __init__(self, log, component_name, property_name, property_type, property_type_desc, disable): ctor. @param log: The logger t... | Implement the Python class `Buffer` described below.
Class description:
This buffer doesn't store monitoring/time series data but writes it to the log.
Method signatures and docstrings:
- def __init__(self, log, component_name, property_name, property_type, property_type_desc, disable): ctor. @param log: The logger t... | b0e590302a5787782bb834b36231b0595b08d60b | <|skeleton|>
class Buffer:
"""This buffer doesn't store monitoring/time series data but writes it to the log."""
def __init__(self, log, component_name, property_name, property_type, property_type_desc, disable):
"""ctor. @param log: The logger to write data to. @type log: logging.Logger @param compone... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Buffer:
"""This buffer doesn't store monitoring/time series data but writes it to the log."""
def __init__(self, log, component_name, property_name, property_type, property_type_desc, disable):
"""ctor. @param log: The logger to write data to. @type log: logging.Logger @param component_name: Comp... | the_stack_v2_python_sparse | src/ctamonitoring/property_recorder/backend/log/registry.py | sliusar/ctamonitoring | train | 0 |
f0ce57f748edd1673a3c153d7d2d3275141e6c4c | [
"self.a = a.getArray3()\nself.b = b.getArray3()\nself.c = c.getArray3()\nself.color = color\nself.reflectivity = reflectivity\nif transformation != None:\n self.transformation = transformation\nif an != None:\n self.an = an\nelse:\n self.an = np.cross(self.c - self.a, self.b - self.a)\nif bn != None:\n ... | <|body_start_0|>
self.a = a.getArray3()
self.b = b.getArray3()
self.c = c.getArray3()
self.color = color
self.reflectivity = reflectivity
if transformation != None:
self.transformation = transformation
if an != None:
self.an = an
el... | A triangle object | TriangleNumpy | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriangleNumpy:
"""A triangle object"""
def __init__(self, a, b, c, color, reflectivity, transformation=None, an=None, bn=None, cn=None):
"""Constructor for the triangle class taking the three edge points a,b and c."""
<|body_0|>
def intersect(self, ray):
"""The i... | stack_v2_sparse_classes_75kplus_train_001777 | 2,669 | no_license | [
{
"docstring": "Constructor for the triangle class taking the three edge points a,b and c.",
"name": "__init__",
"signature": "def __init__(self, a, b, c, color, reflectivity, transformation=None, an=None, bn=None, cn=None)"
},
{
"docstring": "The intersection routine",
"name": "intersect",
... | 2 | stack_v2_sparse_classes_30k_train_014988 | Implement the Python class `TriangleNumpy` described below.
Class description:
A triangle object
Method signatures and docstrings:
- def __init__(self, a, b, c, color, reflectivity, transformation=None, an=None, bn=None, cn=None): Constructor for the triangle class taking the three edge points a,b and c.
- def inters... | Implement the Python class `TriangleNumpy` described below.
Class description:
A triangle object
Method signatures and docstrings:
- def __init__(self, a, b, c, color, reflectivity, transformation=None, an=None, bn=None, cn=None): Constructor for the triangle class taking the three edge points a,b and c.
- def inters... | 525a6fdc94d46a5a657ca46156d357fbae8ad71e | <|skeleton|>
class TriangleNumpy:
"""A triangle object"""
def __init__(self, a, b, c, color, reflectivity, transformation=None, an=None, bn=None, cn=None):
"""Constructor for the triangle class taking the three edge points a,b and c."""
<|body_0|>
def intersect(self, ray):
"""The i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TriangleNumpy:
"""A triangle object"""
def __init__(self, a, b, c, color, reflectivity, transformation=None, an=None, bn=None, cn=None):
"""Constructor for the triangle class taking the three edge points a,b and c."""
self.a = a.getArray3()
self.b = b.getArray3()
self.c = ... | the_stack_v2_python_sparse | src/shape/TriangleNumpy.py | v0lta/pyTrace | train | 0 |
ee7b959f12a81d2d981a9ebf5c2fdb4cef154f76 | [
"super(InfoGAN_Discriminator, self).__init__()\nself.n_layer = n_layer\nself.n_conti = n_conti\nself.n_discrete = n_discrete\nself.num_category = num_category\nself.featmap_dim = featmap_dim\nconvs = []\nBNs = []\nfor layer in range(self.n_layer):\n if layer == self.n_layer - 1:\n n_conv_in = n_channel\n ... | <|body_start_0|>
super(InfoGAN_Discriminator, self).__init__()
self.n_layer = n_layer
self.n_conti = n_conti
self.n_discrete = n_discrete
self.num_category = num_category
self.featmap_dim = featmap_dim
convs = []
BNs = []
for layer in range(self.n_... | InfoGAN_Discriminator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InfoGAN_Discriminator:
def __init__(self, n_layer=3, n_conti=2, n_discrete=1, num_category=10, use_gpu=False, featmap_dim=256, n_channel=1):
"""InfoGAN Discriminator, have additional outputs for latent codes. Architecture brought from DCGAN."""
<|body_0|>
def forward(self, x... | stack_v2_sparse_classes_75kplus_train_001778 | 19,546 | no_license | [
{
"docstring": "InfoGAN Discriminator, have additional outputs for latent codes. Architecture brought from DCGAN.",
"name": "__init__",
"signature": "def __init__(self, n_layer=3, n_conti=2, n_discrete=1, num_category=10, use_gpu=False, featmap_dim=256, n_channel=1)"
},
{
"docstring": "Output th... | 2 | stack_v2_sparse_classes_30k_train_043382 | Implement the Python class `InfoGAN_Discriminator` described below.
Class description:
Implement the InfoGAN_Discriminator class.
Method signatures and docstrings:
- def __init__(self, n_layer=3, n_conti=2, n_discrete=1, num_category=10, use_gpu=False, featmap_dim=256, n_channel=1): InfoGAN Discriminator, have additi... | Implement the Python class `InfoGAN_Discriminator` described below.
Class description:
Implement the InfoGAN_Discriminator class.
Method signatures and docstrings:
- def __init__(self, n_layer=3, n_conti=2, n_discrete=1, num_category=10, use_gpu=False, featmap_dim=256, n_channel=1): InfoGAN Discriminator, have additi... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class InfoGAN_Discriminator:
def __init__(self, n_layer=3, n_conti=2, n_discrete=1, num_category=10, use_gpu=False, featmap_dim=256, n_channel=1):
"""InfoGAN Discriminator, have additional outputs for latent codes. Architecture brought from DCGAN."""
<|body_0|>
def forward(self, x... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InfoGAN_Discriminator:
def __init__(self, n_layer=3, n_conti=2, n_discrete=1, num_category=10, use_gpu=False, featmap_dim=256, n_channel=1):
"""InfoGAN Discriminator, have additional outputs for latent codes. Architecture brought from DCGAN."""
super(InfoGAN_Discriminator, self).__init__()
... | the_stack_v2_python_sparse | generated/test_AaronYALai_Generative_Adversarial_Networks_PyTorch.py | jansel/pytorch-jit-paritybench | train | 35 | |
da5dd2afd5a977bb23c5afc5f28f72f6157eb559 | [
"name = self.browse(cr, uid, ids[0], context=context).name\nif len(self.search(cr, uid, [('name', '=ilike', name)], context=context)) > 1:\n raise osv.except_osv(_('Constraint Error'), _('The Name Must Be Unique!'))\nreturn True",
"count = 0\nfor product in self.browse(cr, uid, ids, context=context):\n if p... | <|body_start_0|>
name = self.browse(cr, uid, ids[0], context=context).name
if len(self.search(cr, uid, [('name', '=ilike', name)], context=context)) > 1:
raise osv.except_osv(_('Constraint Error'), _('The Name Must Be Unique!'))
return True
<|end_body_0|>
<|body_start_1|>
co... | To manage fuel products | product_product | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class product_product:
"""To manage fuel products"""
def _check_unique_insesitive(self, cr, uid, ids, context=None):
"""Check uniqueness of product name. @return: Boolean of True or False"""
<|body_0|>
def _check_cost(self, cr, uid, ids, context=None):
"""Check the val... | stack_v2_sparse_classes_75kplus_train_001779 | 1,926 | no_license | [
{
"docstring": "Check uniqueness of product name. @return: Boolean of True or False",
"name": "_check_unique_insesitive",
"signature": "def _check_unique_insesitive(self, cr, uid, ids, context=None)"
},
{
"docstring": "Check the value of product standard price, if greater than zero or not. @retu... | 2 | null | Implement the Python class `product_product` described below.
Class description:
To manage fuel products
Method signatures and docstrings:
- def _check_unique_insesitive(self, cr, uid, ids, context=None): Check uniqueness of product name. @return: Boolean of True or False
- def _check_cost(self, cr, uid, ids, context... | Implement the Python class `product_product` described below.
Class description:
To manage fuel products
Method signatures and docstrings:
- def _check_unique_insesitive(self, cr, uid, ids, context=None): Check uniqueness of product name. @return: Boolean of True or False
- def _check_cost(self, cr, uid, ids, context... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class product_product:
"""To manage fuel products"""
def _check_unique_insesitive(self, cr, uid, ids, context=None):
"""Check uniqueness of product name. @return: Boolean of True or False"""
<|body_0|>
def _check_cost(self, cr, uid, ids, context=None):
"""Check the val... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class product_product:
"""To manage fuel products"""
def _check_unique_insesitive(self, cr, uid, ids, context=None):
"""Check uniqueness of product name. @return: Boolean of True or False"""
name = self.browse(cr, uid, ids[0], context=context).name
if len(self.search(cr, uid, [('name', ... | the_stack_v2_python_sparse | v_7/Dongola/admin_affairs/fuel_management/model/product.py | musabahmed/baba | train | 0 |
f07806006c298a28ad82d28de5280161094c355f | [
"vals = super(PurchaseOrder, self)._prepare_picking()\nif self.inter_company_transfer_id:\n vals.update({'inter_company_transfer_id': self.inter_company_transfer_id.id})\nreturn vals",
"action = super(PurchaseOrder, self).action_view_invoice()\nif self.env.context.get('create_bill', False) and self.inter_compa... | <|body_start_0|>
vals = super(PurchaseOrder, self)._prepare_picking()
if self.inter_company_transfer_id:
vals.update({'inter_company_transfer_id': self.inter_company_transfer_id.id})
return vals
<|end_body_0|>
<|body_start_1|>
action = super(PurchaseOrder, self).action_view_... | Inherited for adding relation with inter company transfer. @author: Maulik Barad on Date 24-Sep-2019. | PurchaseOrder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PurchaseOrder:
"""Inherited for adding relation with inter company transfer. @author: Maulik Barad on Date 24-Sep-2019."""
def _prepare_picking(self):
"""Inherited for adding relation with ICT if created by it. @author: Maulik Barad on Date 16-Oct-2019. @return: Dictionary for creati... | stack_v2_sparse_classes_75kplus_train_001780 | 1,503 | no_license | [
{
"docstring": "Inherited for adding relation with ICT if created by it. @author: Maulik Barad on Date 16-Oct-2019. @return: Dictionary for creating picking.",
"name": "_prepare_picking",
"signature": "def _prepare_picking(self)"
},
{
"docstring": "Inherited for adding relation with ICT if creat... | 2 | stack_v2_sparse_classes_30k_train_036561 | Implement the Python class `PurchaseOrder` described below.
Class description:
Inherited for adding relation with inter company transfer. @author: Maulik Barad on Date 24-Sep-2019.
Method signatures and docstrings:
- def _prepare_picking(self): Inherited for adding relation with ICT if created by it. @author: Maulik ... | Implement the Python class `PurchaseOrder` described below.
Class description:
Inherited for adding relation with inter company transfer. @author: Maulik Barad on Date 24-Sep-2019.
Method signatures and docstrings:
- def _prepare_picking(self): Inherited for adding relation with ICT if created by it. @author: Maulik ... | 45749da5cc82d0a50cdf5627072b9bd43a4206dc | <|skeleton|>
class PurchaseOrder:
"""Inherited for adding relation with inter company transfer. @author: Maulik Barad on Date 24-Sep-2019."""
def _prepare_picking(self):
"""Inherited for adding relation with ICT if created by it. @author: Maulik Barad on Date 16-Oct-2019. @return: Dictionary for creati... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PurchaseOrder:
"""Inherited for adding relation with inter company transfer. @author: Maulik Barad on Date 24-Sep-2019."""
def _prepare_picking(self):
"""Inherited for adding relation with ICT if created by it. @author: Maulik Barad on Date 16-Oct-2019. @return: Dictionary for creating picking.""... | the_stack_v2_python_sparse | intercompany_transaction_ept/models/purchase.py | ecgroupca/ECGroup | train | 1 |
4b2213cfa726901a00f300e46d4d805883f21bdc | [
"self.identifier_exceptions = []\nself.iterator_exceptions = []\nself.iterator_list = []\nself.identifier = None",
"list_args = sum([[(i, k) for k, v in iterator.items() if isinstance(v, list) and k not in self.iterator_exceptions] for i, iterator in enumerate(self.iterator_list)], [])\nif True in [len(la) > 0 fo... | <|body_start_0|>
self.identifier_exceptions = []
self.iterator_exceptions = []
self.iterator_list = []
self.identifier = None
<|end_body_0|>
<|body_start_1|>
list_args = sum([[(i, k) for k, v in iterator.items() if isinstance(v, list) and k not in self.iterator_exceptions] for i... | Descriptor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Descriptor:
def __init__(self):
"""Parent class for all Descriptor objects"""
<|body_0|>
def __iter__(self):
"""Iteration over the Descriptor returns all combinations of Descriptor definitions that were provided as Lists."""
<|body_1|>
def build_identifi... | stack_v2_sparse_classes_75kplus_train_001781 | 23,780 | no_license | [
{
"docstring": "Parent class for all Descriptor objects",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Iteration over the Descriptor returns all combinations of Descriptor definitions that were provided as Lists.",
"name": "__iter__",
"signature": "def __iter_... | 3 | stack_v2_sparse_classes_30k_train_053462 | Implement the Python class `Descriptor` described below.
Class description:
Implement the Descriptor class.
Method signatures and docstrings:
- def __init__(self): Parent class for all Descriptor objects
- def __iter__(self): Iteration over the Descriptor returns all combinations of Descriptor definitions that were p... | Implement the Python class `Descriptor` described below.
Class description:
Implement the Descriptor class.
Method signatures and docstrings:
- def __init__(self): Parent class for all Descriptor objects
- def __iter__(self): Iteration over the Descriptor returns all combinations of Descriptor definitions that were p... | 3c8aed76ac4dd5aa38539897a0d93b51801031b1 | <|skeleton|>
class Descriptor:
def __init__(self):
"""Parent class for all Descriptor objects"""
<|body_0|>
def __iter__(self):
"""Iteration over the Descriptor returns all combinations of Descriptor definitions that were provided as Lists."""
<|body_1|>
def build_identifi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Descriptor:
def __init__(self):
"""Parent class for all Descriptor objects"""
self.identifier_exceptions = []
self.iterator_exceptions = []
self.iterator_list = []
self.identifier = None
def __iter__(self):
"""Iteration over the Descriptor returns all combi... | the_stack_v2_python_sparse | descriptor.py | m-guggenmos/decog | train | 1 | |
619d99a2055980d316131dd312d338269ad3357d | [
"dna_reads_illumina = []\neol = 0\nstart = 0\nend = 0\nstartlist = []\nendlist = []\nfor i in range(len(reads)):\n if reads[i] == '\\n':\n eol += 1\n if eol % 4 == 1:\n start = i + 1\n if eol % 4 == 2:\n end = i\n if end > start and reads[start:end] not in dna_re... | <|body_start_0|>
dna_reads_illumina = []
eol = 0
start = 0
end = 0
startlist = []
endlist = []
for i in range(len(reads)):
if reads[i] == '\n':
eol += 1
if eol % 4 == 1:
start = i + 1
... | Lab1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Lab1:
def parse_reads_illumina(self, reads):
"""Input - Illumina reads file as a string Output - list of DNA reads"""
<|body_0|>
def unique_lengths(self, dna_reads):
"""Input - list of dna reads Output - set of counts of reads"""
<|body_1|>
def check_imp... | stack_v2_sparse_classes_75kplus_train_001782 | 3,967 | no_license | [
{
"docstring": "Input - Illumina reads file as a string Output - list of DNA reads",
"name": "parse_reads_illumina",
"signature": "def parse_reads_illumina(self, reads)"
},
{
"docstring": "Input - list of dna reads Output - set of counts of reads",
"name": "unique_lengths",
"signature": ... | 5 | stack_v2_sparse_classes_30k_train_044920 | Implement the Python class `Lab1` described below.
Class description:
Implement the Lab1 class.
Method signatures and docstrings:
- def parse_reads_illumina(self, reads): Input - Illumina reads file as a string Output - list of DNA reads
- def unique_lengths(self, dna_reads): Input - list of dna reads Output - set of... | Implement the Python class `Lab1` described below.
Class description:
Implement the Lab1 class.
Method signatures and docstrings:
- def parse_reads_illumina(self, reads): Input - Illumina reads file as a string Output - list of DNA reads
- def unique_lengths(self, dna_reads): Input - list of dna reads Output - set of... | b9c7eab00927baf4b4926b121f513162dc06da0d | <|skeleton|>
class Lab1:
def parse_reads_illumina(self, reads):
"""Input - Illumina reads file as a string Output - list of DNA reads"""
<|body_0|>
def unique_lengths(self, dna_reads):
"""Input - list of dna reads Output - set of counts of reads"""
<|body_1|>
def check_imp... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Lab1:
def parse_reads_illumina(self, reads):
"""Input - Illumina reads file as a string Output - list of DNA reads"""
dna_reads_illumina = []
eol = 0
start = 0
end = 0
startlist = []
endlist = []
for i in range(len(reads)):
if reads[i... | the_stack_v2_python_sparse | Genomics_Lab1/main.py | XiaoShuhong/ECE365SP21 | train | 1 | |
03dbe21f557017fe3259d0a4dbc62745d4e68736 | [
"if not root:\n return str([])\nqueue = deque()\nresult = []\nqueue.append(root)\nwhile queue:\n r = queue.popleft()\n if not r:\n result.append(None)\n continue\n result.append(r.val)\n queue.append(r.left)\n queue.append(r.right)\nreturn str(result)",
"data = deque(eval(data))\ni... | <|body_start_0|>
if not root:
return str([])
queue = deque()
result = []
queue.append(root)
while queue:
r = queue.popleft()
if not r:
result.append(None)
continue
result.append(r.val)
que... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_75kplus_train_001783 | 1,773 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_049598 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 8e338ee7a5c9f124e897491d6a1f4bcd1d1a6270 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return str([])
queue = deque()
result = []
queue.append(root)
while queue:
r = queue.popleft()
if not r:
... | the_stack_v2_python_sparse | src/297.二叉树的序列化与反序列化.py | hysapphire/leetcode-python | train | 0 | |
a66ac323516cf0027e565878a732a98c63e61971 | [
"organization = Organization.objects.create(domain='example.org', fullname='Example Organisation')\nCommentForm = django_comments.get_form()\ndata = {'honeypot': '', 'comment': 'Content', 'name': 'Ron', **CommentForm(organization).generate_security_data()}\nform = CommentForm(organization, data)\nself.assertTrue(fo... | <|body_start_0|>
organization = Organization.objects.create(domain='example.org', fullname='Example Organisation')
CommentForm = django_comments.get_form()
data = {'honeypot': '', 'comment': 'Content', 'name': 'Ron', **CommentForm(organization).generate_security_data()}
form = CommentFor... | TestEmailFieldRequiredness | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestEmailFieldRequiredness:
def test_email_field_requiredness(self):
"""Regression test for #1944. Previously a user without email address would not be able to add a comment."""
<|body_0|>
def test_email_field_requiredness_POST(self):
"""Regression test for #1944. Pr... | stack_v2_sparse_classes_75kplus_train_001784 | 2,880 | permissive | [
{
"docstring": "Regression test for #1944. Previously a user without email address would not be able to add a comment.",
"name": "test_email_field_requiredness",
"signature": "def test_email_field_requiredness(self)"
},
{
"docstring": "Regression test for #1944. Previously a user without email a... | 2 | stack_v2_sparse_classes_30k_train_036461 | Implement the Python class `TestEmailFieldRequiredness` described below.
Class description:
Implement the TestEmailFieldRequiredness class.
Method signatures and docstrings:
- def test_email_field_requiredness(self): Regression test for #1944. Previously a user without email address would not be able to add a comment... | Implement the Python class `TestEmailFieldRequiredness` described below.
Class description:
Implement the TestEmailFieldRequiredness class.
Method signatures and docstrings:
- def test_email_field_requiredness(self): Regression test for #1944. Previously a user without email address would not be able to add a comment... | f97631b2f3dd8e8f502e90bdb04dd72f048d4837 | <|skeleton|>
class TestEmailFieldRequiredness:
def test_email_field_requiredness(self):
"""Regression test for #1944. Previously a user without email address would not be able to add a comment."""
<|body_0|>
def test_email_field_requiredness_POST(self):
"""Regression test for #1944. Pr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestEmailFieldRequiredness:
def test_email_field_requiredness(self):
"""Regression test for #1944. Previously a user without email address would not be able to add a comment."""
organization = Organization.objects.create(domain='example.org', fullname='Example Organisation')
CommentFor... | the_stack_v2_python_sparse | amy/extcomments/tests.py | pbanaszkiewicz/amy | train | 0 | |
4840243eacd85fa7b2ebf3578174c243e7ed8ff0 | [
"def _default_message_on_done(task):\n return f'{task.completed} steps done in {get_readable_time(seconds=task.finished_time)}'\ncolumns = columns or [SpinnerColumn(), _OnDoneColumn(f'DONE', description, 'progress.description'), BarColumn(complete_style='green', finished_style='yellow'), TimeElapsedColumn(), '[p... | <|body_start_0|>
def _default_message_on_done(task):
return f'{task.completed} steps done in {get_readable_time(seconds=task.finished_time)}'
columns = columns or [SpinnerColumn(), _OnDoneColumn(f'DONE', description, 'progress.description'), BarColumn(complete_style='green', finished_style='... | A progress bar made with rich. Example: .. highlight:: python .. code-block:: python with ProgressBar(100, 'loop') as p_bar: for i in range(100): do_busy() p_bar.update() | ProgressBar | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProgressBar:
"""A progress bar made with rich. Example: .. highlight:: python .. code-block:: python with ProgressBar(100, 'loop') as p_bar: for i in range(100): do_busy() p_bar.update()"""
def __init__(self, description: str='Working...', total_length: Optional[float]=None, message_on_done:... | stack_v2_sparse_classes_75kplus_train_001785 | 8,843 | permissive | [
{
"docstring": "Init a custom progress bar based on rich. This is the default progress bar of jina if you want to customize it you should probably just use a rich `Progress` and add your custom column and task :param description: description of your task ex : 'Working...' :param total_length: the number of step... | 2 | stack_v2_sparse_classes_30k_train_049232 | Implement the Python class `ProgressBar` described below.
Class description:
A progress bar made with rich. Example: .. highlight:: python .. code-block:: python with ProgressBar(100, 'loop') as p_bar: for i in range(100): do_busy() p_bar.update()
Method signatures and docstrings:
- def __init__(self, description: st... | Implement the Python class `ProgressBar` described below.
Class description:
A progress bar made with rich. Example: .. highlight:: python .. code-block:: python with ProgressBar(100, 'loop') as p_bar: for i in range(100): do_busy() p_bar.update()
Method signatures and docstrings:
- def __init__(self, description: st... | 23c7b8c78fc4ad67d16d83fc0c9f0eae9e935e71 | <|skeleton|>
class ProgressBar:
"""A progress bar made with rich. Example: .. highlight:: python .. code-block:: python with ProgressBar(100, 'loop') as p_bar: for i in range(100): do_busy() p_bar.update()"""
def __init__(self, description: str='Working...', total_length: Optional[float]=None, message_on_done:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProgressBar:
"""A progress bar made with rich. Example: .. highlight:: python .. code-block:: python with ProgressBar(100, 'loop') as p_bar: for i in range(100): do_busy() p_bar.update()"""
def __init__(self, description: str='Working...', total_length: Optional[float]=None, message_on_done: Optional[Uni... | the_stack_v2_python_sparse | jina/logging/profile.py | jina-ai/jina | train | 20,687 |
1cbd42a9439d8a0ae321d906befc6e48993ecb12 | [
"im = cv2.imread('sample_images/exam_1.jpg')\nis_success, im_buf_arr = cv2.imencode('.jpg', im)\nbyte_im = im_buf_arr.tobytes()\nresult = conn.insert_values_test(age=20, gender=1, handedness=1, image=byte_im)\nself.assertEqual(type(result), int, 'Checking output type.')\nself.assertNotEqual(result, 0, 'Incorrect da... | <|body_start_0|>
im = cv2.imread('sample_images/exam_1.jpg')
is_success, im_buf_arr = cv2.imencode('.jpg', im)
byte_im = im_buf_arr.tobytes()
result = conn.insert_values_test(age=20, gender=1, handedness=1, image=byte_im)
self.assertEqual(type(result), int, 'Checking output type.... | Class to test mysql_connection. | MysqlConnectionTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MysqlConnectionTest:
"""Class to test mysql_connection."""
def test_insert_values_test(self):
"""Method to test insert_values_test method in mysql_connection."""
<|body_0|>
def test_insert_result_test_image(self):
"""Method to test insert_values_test_image method... | stack_v2_sparse_classes_75kplus_train_001786 | 5,327 | no_license | [
{
"docstring": "Method to test insert_values_test method in mysql_connection.",
"name": "test_insert_values_test",
"signature": "def test_insert_values_test(self)"
},
{
"docstring": "Method to test insert_values_test_image method in mysql_connection.",
"name": "test_insert_result_test_image"... | 4 | stack_v2_sparse_classes_30k_train_035064 | Implement the Python class `MysqlConnectionTest` described below.
Class description:
Class to test mysql_connection.
Method signatures and docstrings:
- def test_insert_values_test(self): Method to test insert_values_test method in mysql_connection.
- def test_insert_result_test_image(self): Method to test insert_val... | Implement the Python class `MysqlConnectionTest` described below.
Class description:
Class to test mysql_connection.
Method signatures and docstrings:
- def test_insert_values_test(self): Method to test insert_values_test method in mysql_connection.
- def test_insert_result_test_image(self): Method to test insert_val... | b4943fea82483c6910694d7c4c40e3715f65c3b5 | <|skeleton|>
class MysqlConnectionTest:
"""Class to test mysql_connection."""
def test_insert_values_test(self):
"""Method to test insert_values_test method in mysql_connection."""
<|body_0|>
def test_insert_result_test_image(self):
"""Method to test insert_values_test_image method... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MysqlConnectionTest:
"""Class to test mysql_connection."""
def test_insert_values_test(self):
"""Method to test insert_values_test method in mysql_connection."""
im = cv2.imread('sample_images/exam_1.jpg')
is_success, im_buf_arr = cv2.imencode('.jpg', im)
byte_im = im_buf_... | the_stack_v2_python_sparse | Backend/DetectPD/test_mysql_connection.py | RadhikaRanasinghe/Meraki | train | 5 |
f102d34df70c163ce058ca3e2f1b53db408cbb23 | [
"super(PR_CNN, self).__init__()\nself.expected_input_size = (28, 28)\nself.conv1 = nn.Sequential(nn.Conv2d(in_channels=1, out_channels=24, kernel_size=5, stride=3), nn.LeakyReLU())\nself.fc = nn.Sequential(Flatten(), nn.Linear(1536, 10))",
"x = self.conv1(x)\nx = self.fc(x)\nreturn x"
] | <|body_start_0|>
super(PR_CNN, self).__init__()
self.expected_input_size = (28, 28)
self.conv1 = nn.Sequential(nn.Conv2d(in_channels=1, out_channels=24, kernel_size=5, stride=3), nn.LeakyReLU())
self.fc = nn.Sequential(Flatten(), nn.Linear(1536, 10))
<|end_body_0|>
<|body_start_1|>
... | Simple feed forward convolutional neural network Attributes ---------- expected_input_size : tuple(int,int) Expected input size (width, height) conv1 : torch.nn.Sequential conv2 : torch.nn.Sequential conv3 : torch.nn.Sequential Convolutional layers of the network fc : torch.nn.Linear Final classification fully connecte... | PR_CNN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PR_CNN:
"""Simple feed forward convolutional neural network Attributes ---------- expected_input_size : tuple(int,int) Expected input size (width, height) conv1 : torch.nn.Sequential conv2 : torch.nn.Sequential conv3 : torch.nn.Sequential Convolutional layers of the network fc : torch.nn.Linear F... | stack_v2_sparse_classes_75kplus_train_001787 | 14,728 | no_license | [
{
"docstring": "Creates an CNN_basic model from the scratch. Parameters ---------- output_channels : int Number of neurons in the last layer input_channels : int Dimensionality of the input, typically 3 for RGB",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "... | 2 | stack_v2_sparse_classes_30k_train_004423 | Implement the Python class `PR_CNN` described below.
Class description:
Simple feed forward convolutional neural network Attributes ---------- expected_input_size : tuple(int,int) Expected input size (width, height) conv1 : torch.nn.Sequential conv2 : torch.nn.Sequential conv3 : torch.nn.Sequential Convolutional layer... | Implement the Python class `PR_CNN` described below.
Class description:
Simple feed forward convolutional neural network Attributes ---------- expected_input_size : tuple(int,int) Expected input size (width, height) conv1 : torch.nn.Sequential conv2 : torch.nn.Sequential conv3 : torch.nn.Sequential Convolutional layer... | 180fef6f4e657c6f2fd18e0187145b2c5cd7dff5 | <|skeleton|>
class PR_CNN:
"""Simple feed forward convolutional neural network Attributes ---------- expected_input_size : tuple(int,int) Expected input size (width, height) conv1 : torch.nn.Sequential conv2 : torch.nn.Sequential conv3 : torch.nn.Sequential Convolutional layers of the network fc : torch.nn.Linear F... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PR_CNN:
"""Simple feed forward convolutional neural network Attributes ---------- expected_input_size : tuple(int,int) Expected input size (width, height) conv1 : torch.nn.Sequential conv2 : torch.nn.Sequential conv3 : torch.nn.Sequential Convolutional layers of the network fc : torch.nn.Linear Final classifi... | the_stack_v2_python_sparse | Ex2c_added/CNN_perm.py | maurogwerder/pattern_recognition_exercises | train | 3 |
755c3359f19d18c462332c3c40758739b1b14c5c | [
"super(AttentionalFactorizationMachineLayer, self).__init__()\nself.attention = nn.Sequential()\nself.attention.add_module('Linear', nn.Linear(embed_size, attn_size))\nself.attention.add_module('Activation', nn.ReLU())\nself.attention.add_module('OutProj', nn.Linear(attn_size, 1))\nself.attention.add_module('Softma... | <|body_start_0|>
super(AttentionalFactorizationMachineLayer, self).__init__()
self.attention = nn.Sequential()
self.attention.add_module('Linear', nn.Linear(embed_size, attn_size))
self.attention.add_module('Activation', nn.ReLU())
self.attention.add_module('OutProj', nn.Linear(a... | Layer class of Attentional Factorization Machine (AFM). Attentional Factorization Machine is to calculate interaction between each pair of features by using element-wise product (i.e. Pairwise Interaction Layer), compressing interaction tensors to a single representation. The output shape is (B, 1, E). :Reference: #. `... | AttentionalFactorizationMachineLayer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttentionalFactorizationMachineLayer:
"""Layer class of Attentional Factorization Machine (AFM). Attentional Factorization Machine is to calculate interaction between each pair of features by using element-wise product (i.e. Pairwise Interaction Layer), compressing interaction tensors to a single... | stack_v2_sparse_classes_75kplus_train_001788 | 4,420 | permissive | [
{
"docstring": "Initialize AttentionalFactorizationMachineLayer Args: embed_size (int): Size of embedding tensor num_fields (int): Number of inputs' fields attn_size (int): Size of attention layer dropout_p (float, optional): Probability of Dropout in AFM. Defaults to 0.1. Attributes: attention (torch.nn.Sequen... | 2 | stack_v2_sparse_classes_30k_train_001686 | Implement the Python class `AttentionalFactorizationMachineLayer` described below.
Class description:
Layer class of Attentional Factorization Machine (AFM). Attentional Factorization Machine is to calculate interaction between each pair of features by using element-wise product (i.e. Pairwise Interaction Layer), comp... | Implement the Python class `AttentionalFactorizationMachineLayer` described below.
Class description:
Layer class of Attentional Factorization Machine (AFM). Attentional Factorization Machine is to calculate interaction between each pair of features by using element-wise product (i.e. Pairwise Interaction Layer), comp... | 07a6a38c7eb44225f2b22f332081f697c3b92894 | <|skeleton|>
class AttentionalFactorizationMachineLayer:
"""Layer class of Attentional Factorization Machine (AFM). Attentional Factorization Machine is to calculate interaction between each pair of features by using element-wise product (i.e. Pairwise Interaction Layer), compressing interaction tensors to a single... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AttentionalFactorizationMachineLayer:
"""Layer class of Attentional Factorization Machine (AFM). Attentional Factorization Machine is to calculate interaction between each pair of features by using element-wise product (i.e. Pairwise Interaction Layer), compressing interaction tensors to a single representati... | the_stack_v2_python_sparse | torecsys/layers/ctr/attentional_factorization_machine.py | zwcdp/torecsys | train | 0 |
2ae12c270e15950e2a9cf86d55e1865b6a2f354f | [
"QMimeData.__init__(self)\nself._local_instance = data\nif data is not None:\n try:\n pdata = dumps(data)\n except:\n return\n self.setData(self.MIME_TYPE, dumps(data.__class__) + pdata)",
"if isinstance(md, cls):\n return md\nif not md.hasFormat(cls.MIME_TYPE):\n return None\nnmd = c... | <|body_start_0|>
QMimeData.__init__(self)
self._local_instance = data
if data is not None:
try:
pdata = dumps(data)
except:
return
self.setData(self.MIME_TYPE, dumps(data.__class__) + pdata)
<|end_body_0|>
<|body_start_1|>
... | The PyMimeData wraps a Python instance as MIME data. | PyMimeData | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PyMimeData:
"""The PyMimeData wraps a Python instance as MIME data."""
def __init__(self, data=None):
"""Initialise the instance."""
<|body_0|>
def coerce(cls, md):
"""Coerce a QMimeData instance to a PyMimeData instance if possible."""
<|body_1|>
de... | stack_v2_sparse_classes_75kplus_train_001789 | 9,642 | permissive | [
{
"docstring": "Initialise the instance.",
"name": "__init__",
"signature": "def __init__(self, data=None)"
},
{
"docstring": "Coerce a QMimeData instance to a PyMimeData instance if possible.",
"name": "coerce",
"signature": "def coerce(cls, md)"
},
{
"docstring": "Return the in... | 4 | stack_v2_sparse_classes_30k_train_024919 | Implement the Python class `PyMimeData` described below.
Class description:
The PyMimeData wraps a Python instance as MIME data.
Method signatures and docstrings:
- def __init__(self, data=None): Initialise the instance.
- def coerce(cls, md): Coerce a QMimeData instance to a PyMimeData instance if possible.
- def in... | Implement the Python class `PyMimeData` described below.
Class description:
The PyMimeData wraps a Python instance as MIME data.
Method signatures and docstrings:
- def __init__(self, data=None): Initialise the instance.
- def coerce(cls, md): Coerce a QMimeData instance to a PyMimeData instance if possible.
- def in... | 4d42121e4af850ba1bf9a4140c11fe10ba218cdd | <|skeleton|>
class PyMimeData:
"""The PyMimeData wraps a Python instance as MIME data."""
def __init__(self, data=None):
"""Initialise the instance."""
<|body_0|>
def coerce(cls, md):
"""Coerce a QMimeData instance to a PyMimeData instance if possible."""
<|body_1|>
de... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PyMimeData:
"""The PyMimeData wraps a Python instance as MIME data."""
def __init__(self, data=None):
"""Initialise the instance."""
QMimeData.__init__(self)
self._local_instance = data
if data is not None:
try:
pdata = dumps(data)
e... | the_stack_v2_python_sparse | yy.py | shyamal388/PythonBlocks | train | 0 |
e5afab72c410928c2e58b74a29abda331d944473 | [
"self.filepath = filepath\nself.folder, self.filename = os.path.split(filepath)\nself.parsed = None",
"r = csv.reader(open(self.filepath, 'r'))\nlines = [line for line in r]\npath_list = lines[0][1].split('\\\\')\nimage_filename = os.path.splitext(path_list[-1])[0]\nhscale, vscale = (np.ceil(float(l)) for l in li... | <|body_start_0|>
self.filepath = filepath
self.folder, self.filename = os.path.split(filepath)
self.parsed = None
<|end_body_0|>
<|body_start_1|>
r = csv.reader(open(self.filepath, 'r'))
lines = [line for line in r]
path_list = lines[0][1].split('\\')
image_filen... | CPCFileParser | [
"Zlib"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CPCFileParser:
def __init__(self, filepath):
"""This class parses a CPCe file (*.cpc) into a more useful and manageable format than the original. All data should be retained, and the output can be saved to file. NB: IT ASSUMES THE CPC FILE REFERS ONLY TO A SINGLE IMAGE. filepath: (str) p... | stack_v2_sparse_classes_75kplus_train_001790 | 5,789 | permissive | [
{
"docstring": "This class parses a CPCe file (*.cpc) into a more useful and manageable format than the original. All data should be retained, and the output can be saved to file. NB: IT ASSUMES THE CPC FILE REFERS ONLY TO A SINGLE IMAGE. filepath: (str) path to the .cpc file.",
"name": "__init__",
"sig... | 2 | stack_v2_sparse_classes_30k_train_046954 | Implement the Python class `CPCFileParser` described below.
Class description:
Implement the CPCFileParser class.
Method signatures and docstrings:
- def __init__(self, filepath): This class parses a CPCe file (*.cpc) into a more useful and manageable format than the original. All data should be retained, and the out... | Implement the Python class `CPCFileParser` described below.
Class description:
Implement the CPCFileParser class.
Method signatures and docstrings:
- def __init__(self, filepath): This class parses a CPCe file (*.cpc) into a more useful and manageable format than the original. All data should be retained, and the out... | 2a2ef0046702fab756c384411b9dd5ac970c3904 | <|skeleton|>
class CPCFileParser:
def __init__(self, filepath):
"""This class parses a CPCe file (*.cpc) into a more useful and manageable format than the original. All data should be retained, and the output can be saved to file. NB: IT ASSUMES THE CPC FILE REFERS ONLY TO A SINGLE IMAGE. filepath: (str) p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CPCFileParser:
def __init__(self, filepath):
"""This class parses a CPCe file (*.cpc) into a more useful and manageable format than the original. All data should be retained, and the output can be saved to file. NB: IT ASSUMES THE CPC FILE REFERS ONLY TO A SINGLE IMAGE. filepath: (str) path to the .cp... | the_stack_v2_python_sparse | collection/cpc.py | acfrmarine/squidle | train | 6 | |
bdb48958fcac6c11c6d484aef90d200fd0f0e617 | [
"self.num_units = num_units\nself.state_is_tuple = state_is_tuple\nif name is None:\n global name_id\n name = 'my_lstm_cell_%d' % name_id\n name_id += 1\nself.name = name",
"with tf.variable_scope(self.name):\n units = self.num_units\n if self.state_is_tuple:\n c, h = state\n else:\n ... | <|body_start_0|>
self.num_units = num_units
self.state_is_tuple = state_is_tuple
if name is None:
global name_id
name = 'my_lstm_cell_%d' % name_id
name_id += 1
self.name = name
<|end_body_0|>
<|body_start_1|>
with tf.variable_scope(self.name)... | MyLSTMCell | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyLSTMCell:
def __init__(self, num_units, state_is_tuple=True, name=None):
"""初始化 :param num_units: 中间状态的维度会根据输入的第一个维度确定,保证每一维都进行存储 :param state_is_tuple: 状态是否为元组 :param name:"""
<|body_0|>
def __call__(self, inputs, state):
"""调用函数 :param inputs: [-1, num_units] :pa... | stack_v2_sparse_classes_75kplus_train_001791 | 2,348 | no_license | [
{
"docstring": "初始化 :param num_units: 中间状态的维度会根据输入的第一个维度确定,保证每一维都进行存储 :param state_is_tuple: 状态是否为元组 :param name:",
"name": "__init__",
"signature": "def __init__(self, num_units, state_is_tuple=True, name=None)"
},
{
"docstring": "调用函数 :param inputs: [-1, num_units] :param state: tuple of [-1, ... | 3 | null | Implement the Python class `MyLSTMCell` described below.
Class description:
Implement the MyLSTMCell class.
Method signatures and docstrings:
- def __init__(self, num_units, state_is_tuple=True, name=None): 初始化 :param num_units: 中间状态的维度会根据输入的第一个维度确定,保证每一维都进行存储 :param state_is_tuple: 状态是否为元组 :param name:
- def __call_... | Implement the Python class `MyLSTMCell` described below.
Class description:
Implement the MyLSTMCell class.
Method signatures and docstrings:
- def __init__(self, num_units, state_is_tuple=True, name=None): 初始化 :param num_units: 中间状态的维度会根据输入的第一个维度确定,保证每一维都进行存储 :param state_is_tuple: 状态是否为元组 :param name:
- def __call_... | c8827e74e0db42fa617c91f1d14b71abcff8780a | <|skeleton|>
class MyLSTMCell:
def __init__(self, num_units, state_is_tuple=True, name=None):
"""初始化 :param num_units: 中间状态的维度会根据输入的第一个维度确定,保证每一维都进行存储 :param state_is_tuple: 状态是否为元组 :param name:"""
<|body_0|>
def __call__(self, inputs, state):
"""调用函数 :param inputs: [-1, num_units] :pa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyLSTMCell:
def __init__(self, num_units, state_is_tuple=True, name=None):
"""初始化 :param num_units: 中间状态的维度会根据输入的第一个维度确定,保证每一维都进行存储 :param state_is_tuple: 状态是否为元组 :param name:"""
self.num_units = num_units
self.state_is_tuple = state_is_tuple
if name is None:
global... | the_stack_v2_python_sparse | deeplearning_tensorflow_p/p65_my_lstm.py | provenclei/tensorflow_cv | train | 0 | |
7778a269b3ec39862b6e8813fa22c03c03665439 | [
"logger.debug('CreateNSView::get')\nret = GetNSInfoService().get_ns_info()\nlogger.debug('CreateNSView::get::ret=%s', ret)\nresp_serializer = _QueryNsRespSerializer(data=ret, many=True)\nif not resp_serializer.is_valid():\n raise NSLCMException(resp_serializer.errors)\nreturn Response(data=ret, status=status.HTT... | <|body_start_0|>
logger.debug('CreateNSView::get')
ret = GetNSInfoService().get_ns_info()
logger.debug('CreateNSView::get::ret=%s', ret)
resp_serializer = _QueryNsRespSerializer(data=ret, many=True)
if not resp_serializer.is_valid():
raise NSLCMException(resp_serializ... | CreateNSView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateNSView:
def get(self, request):
"""Query multiple NS instances :param request: :return:"""
<|body_0|>
def post(self, request):
"""Create a NS instance resource :param request: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
logger.deb... | stack_v2_sparse_classes_75kplus_train_001792 | 4,085 | permissive | [
{
"docstring": "Query multiple NS instances :param request: :return:",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Create a NS instance resource :param request: :return:",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_050154 | Implement the Python class `CreateNSView` described below.
Class description:
Implement the CreateNSView class.
Method signatures and docstrings:
- def get(self, request): Query multiple NS instances :param request: :return:
- def post(self, request): Create a NS instance resource :param request: :return: | Implement the Python class `CreateNSView` described below.
Class description:
Implement the CreateNSView class.
Method signatures and docstrings:
- def get(self, request): Query multiple NS instances :param request: :return:
- def post(self, request): Create a NS instance resource :param request: :return:
<|skeleton... | 129029584597941bb7603dd7440b7d37f823ef96 | <|skeleton|>
class CreateNSView:
def get(self, request):
"""Query multiple NS instances :param request: :return:"""
<|body_0|>
def post(self, request):
"""Create a NS instance resource :param request: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CreateNSView:
def get(self, request):
"""Query multiple NS instances :param request: :return:"""
logger.debug('CreateNSView::get')
ret = GetNSInfoService().get_ns_info()
logger.debug('CreateNSView::get::ret=%s', ret)
resp_serializer = _QueryNsRespSerializer(data=ret, ma... | the_stack_v2_python_sparse | lcm/ns/views/deprecated/create_ns_view.py | onap/vfc-nfvo-lcm | train | 5 | |
6e5a64ab53bc1efb17b885f09fcf08c992340d53 | [
"super(FinalizeSlicedDownloadTask, self).__init__(source_resource, final_destination_resource, posix_to_set=posix_to_set, user_request_args=user_request_args)\nself._temporary_destination_resource = temporary_destination_resource\nself._final_destination_resource = final_destination_resource\nself._delete_source = ... | <|body_start_0|>
super(FinalizeSlicedDownloadTask, self).__init__(source_resource, final_destination_resource, posix_to_set=posix_to_set, user_request_args=user_request_args)
self._temporary_destination_resource = temporary_destination_resource
self._final_destination_resource = final_destinatio... | Performs final steps of sliced download. | FinalizeSlicedDownloadTask | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FinalizeSlicedDownloadTask:
"""Performs final steps of sliced download."""
def __init__(self, source_resource, temporary_destination_resource, final_destination_resource, delete_source=False, do_not_decompress=False, posix_to_set=None, print_created_message=False, system_posix_data=None, use... | stack_v2_sparse_classes_75kplus_train_001793 | 7,015 | permissive | [
{
"docstring": "Initializes task. Args: source_resource (resource_reference.ObjectResource): Should contain object's metadata for checking content encoding. temporary_destination_resource (resource_reference.FileObjectResource): Must contain a local path to the temporary file written to during transfers. final_... | 2 | stack_v2_sparse_classes_30k_val_003029 | Implement the Python class `FinalizeSlicedDownloadTask` described below.
Class description:
Performs final steps of sliced download.
Method signatures and docstrings:
- def __init__(self, source_resource, temporary_destination_resource, final_destination_resource, delete_source=False, do_not_decompress=False, posix_t... | Implement the Python class `FinalizeSlicedDownloadTask` described below.
Class description:
Performs final steps of sliced download.
Method signatures and docstrings:
- def __init__(self, source_resource, temporary_destination_resource, final_destination_resource, delete_source=False, do_not_decompress=False, posix_t... | 392abf004b16203030e6efd2f0af24db7c8d669e | <|skeleton|>
class FinalizeSlicedDownloadTask:
"""Performs final steps of sliced download."""
def __init__(self, source_resource, temporary_destination_resource, final_destination_resource, delete_source=False, do_not_decompress=False, posix_to_set=None, print_created_message=False, system_posix_data=None, use... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FinalizeSlicedDownloadTask:
"""Performs final steps of sliced download."""
def __init__(self, source_resource, temporary_destination_resource, final_destination_resource, delete_source=False, do_not_decompress=False, posix_to_set=None, print_created_message=False, system_posix_data=None, user_request_arg... | the_stack_v2_python_sparse | lib/googlecloudsdk/command_lib/storage/tasks/cp/finalize_sliced_download_task.py | google-cloud-sdk-unofficial/google-cloud-sdk | train | 9 |
bf902f72d626e008e5d3ec43c39409035d5521d2 | [
"self.ls = []\nself.k2v = {}\nself.cap = capacity",
"if key in self.k2v:\n self.ls.remove(key)\n self.ls.append(key)\n return self.k2v[key]\nreturn -1",
"if key in self.k2v:\n self.ls.remove(key)\nelif len(self.ls) >= self.cap:\n del self.k2v[self.ls.pop(0)]\nself.k2v[key] = value\nself.ls.append... | <|body_start_0|>
self.ls = []
self.k2v = {}
self.cap = capacity
<|end_body_0|>
<|body_start_1|>
if key in self.k2v:
self.ls.remove(key)
self.ls.append(key)
return self.k2v[key]
return -1
<|end_body_1|>
<|body_start_2|>
if key in self.... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":rtype: int"""
<|body_1|>
def set(self, key, value):
""":type key: int :type value: int :rtype: nothing"""
<|body_2|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_75kplus_train_001794 | 1,307 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: nothing",
"name": "set",
"sig... | 3 | stack_v2_sparse_classes_30k_train_020399 | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :rtype: int
- def set(self, key, value): :type key: int :type value: int :rtype: nothing | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :rtype: int
- def set(self, key, value): :type key: int :type value: int :rtype: nothing
<|skeleton|>
cla... | 737b9bac5a73c319e46cda8c3e9d729f734d7792 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":rtype: int"""
<|body_1|>
def set(self, key, value):
""":type key: int :type value: int :rtype: nothing"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.ls = []
self.k2v = {}
self.cap = capacity
def get(self, key):
""":rtype: int"""
if key in self.k2v:
self.ls.remove(key)
self.ls.append(key)
return sel... | the_stack_v2_python_sparse | leetcode/python/passedProblems/146-lru-cache.py | iampkuhz/OnlineJudge_cpp | train | 0 | |
e227b26cb22484f0788feb7ca59a082801c31ca9 | [
"return_codes = []\nfor nc_process in self:\n return_codes.append(nc_process.return_code)",
"for nc_process in self:\n if not nc_process.is_ok:\n return False\nreturn True",
"NC_processes = []\nfor nc_process in self:\n NC_processes.append('NCProc(\\n\\tcmd={}\\n\\treturn_code={}'.format(' '.joi... | <|body_start_0|>
return_codes = []
for nc_process in self:
return_codes.append(nc_process.return_code)
<|end_body_0|>
<|body_start_1|>
for nc_process in self:
if not nc_process.is_ok:
return False
return True
<|end_body_1|>
<|body_start_2|>
... | Processes class aggregates Process list. Provide helper methods to retrieve information about all executed processes. | NCProcesses | [
"MIT",
"Intel",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NCProcesses:
"""Processes class aggregates Process list. Provide helper methods to retrieve information about all executed processes."""
def return_code_all(self) -> None:
"""Provide list of return codes of all Process. :rtype : list :return: List of int with process return codes."""... | stack_v2_sparse_classes_75kplus_train_001795 | 2,271 | permissive | [
{
"docstring": "Provide list of return codes of all Process. :rtype : list :return: List of int with process return codes.",
"name": "return_code_all",
"signature": "def return_code_all(self) -> None"
},
{
"docstring": "Property provide information if all executed process during one call execute... | 4 | stack_v2_sparse_classes_30k_train_030526 | Implement the Python class `NCProcesses` described below.
Class description:
Processes class aggregates Process list. Provide helper methods to retrieve information about all executed processes.
Method signatures and docstrings:
- def return_code_all(self) -> None: Provide list of return codes of all Process. :rtype ... | Implement the Python class `NCProcesses` described below.
Class description:
Processes class aggregates Process list. Provide helper methods to retrieve information about all executed processes.
Method signatures and docstrings:
- def return_code_all(self) -> None: Provide list of return codes of all Process. :rtype ... | 3976edc4215398e69ce0213f87ec295f5dc96e0e | <|skeleton|>
class NCProcesses:
"""Processes class aggregates Process list. Provide helper methods to retrieve information about all executed processes."""
def return_code_all(self) -> None:
"""Provide list of return codes of all Process. :rtype : list :return: List of int with process return codes."""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NCProcesses:
"""Processes class aggregates Process list. Provide helper methods to retrieve information about all executed processes."""
def return_code_all(self) -> None:
"""Provide list of return codes of all Process. :rtype : list :return: List of int with process return codes."""
retu... | the_stack_v2_python_sparse | neural_compressor/ux/utils/processes.py | Skp80/neural-compressor | train | 0 |
96876fc92d54df740de58a64b1c644e5db583887 | [
"num_dof = self.num_points * self.num_dof\nk = np.zeros((num_dof, num_dof))\nfor n, xi in enumerate(self.gauss_points):\n weight = self.gauss_weights[n]\n jac = self.jacobian(xi, coords)\n B = self.b_matrix(xi, coords)\n stran = np.dot(B, u)\n km = self.mat.get_stiff(stran)\n k += km * jac * weigh... | <|body_start_0|>
num_dof = self.num_points * self.num_dof
k = np.zeros((num_dof, num_dof))
for n, xi in enumerate(self.gauss_points):
weight = self.gauss_weights[n]
jac = self.jacobian(xi, coords)
B = self.b_matrix(xi, coords)
stran = np.dot(B, u)
... | Element | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Element:
def stiff(self, coords, u):
"""Element force for a 1D linear element Parameters ---------- coords : ndarray of real Element nodal coordinates Returns ------- k : ndarray or real (num_dof, num_dof) The element stiffness array"""
<|body_0|>
def force(self, coords, q, ... | stack_v2_sparse_classes_75kplus_train_001796 | 21,624 | no_license | [
{
"docstring": "Element force for a 1D linear element Parameters ---------- coords : ndarray of real Element nodal coordinates Returns ------- k : ndarray or real (num_dof, num_dof) The element stiffness array",
"name": "stiff",
"signature": "def stiff(self, coords, u)"
},
{
"docstring": "Elemen... | 5 | stack_v2_sparse_classes_30k_train_022720 | Implement the Python class `Element` described below.
Class description:
Implement the Element class.
Method signatures and docstrings:
- def stiff(self, coords, u): Element force for a 1D linear element Parameters ---------- coords : ndarray of real Element nodal coordinates Returns ------- k : ndarray or real (num_... | Implement the Python class `Element` described below.
Class description:
Implement the Element class.
Method signatures and docstrings:
- def stiff(self, coords, u): Element force for a 1D linear element Parameters ---------- coords : ndarray of real Element nodal coordinates Returns ------- k : ndarray or real (num_... | 75b4257432110a71e7fda765ee6b8797853276c4 | <|skeleton|>
class Element:
def stiff(self, coords, u):
"""Element force for a 1D linear element Parameters ---------- coords : ndarray of real Element nodal coordinates Returns ------- k : ndarray or real (num_dof, num_dof) The element stiffness array"""
<|body_0|>
def force(self, coords, q, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Element:
def stiff(self, coords, u):
"""Element force for a 1D linear element Parameters ---------- coords : ndarray of real Element nodal coordinates Returns ------- k : ndarray or real (num_dof, num_dof) The element stiffness array"""
num_dof = self.num_points * self.num_dof
k = np.z... | the_stack_v2_python_sparse | ezfem/femcodes/ezfem_7.py | 1406513649/Legacy | train | 0 | |
931a8cb2b290552c882aa785614ea0c4d6bd687b | [
"self.__dict__ = self.__shared_state\nif not hasattr(self, 'sounds'):\n self.loadSounds()",
"try:\n import wave\n import pymedia.audio.sound as sound\n SoundManager.HAS_PYMEDIA = True\nexcept ImportError:\n SoundManager.HAS_PYMEDIA = False\n try:\n import pygame.mixer\n from pygame... | <|body_start_0|>
self.__dict__ = self.__shared_state
if not hasattr(self, 'sounds'):
self.loadSounds()
<|end_body_0|>
<|body_start_1|>
try:
import wave
import pymedia.audio.sound as sound
SoundManager.HAS_PYMEDIA = True
except ImportError:... | Manager Class for Sounds Implements the Borg paradigm for shared state | SoundManager | [
"GPL-2.0-only",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SoundManager:
"""Manager Class for Sounds Implements the Borg paradigm for shared state"""
def __init__(self):
"""Constructor Initialize sounds on the first initialization"""
<|body_0|>
def loadSounds(self):
"""Load sound files from preferences"""
<|body_... | stack_v2_sparse_classes_75kplus_train_001797 | 19,875 | permissive | [
{
"docstring": "Constructor Initialize sounds on the first initialization",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Load sound files from preferences",
"name": "loadSounds",
"signature": "def loadSounds(self)"
},
{
"docstring": "Play sound @param ... | 3 | null | Implement the Python class `SoundManager` described below.
Class description:
Manager Class for Sounds Implements the Borg paradigm for shared state
Method signatures and docstrings:
- def __init__(self): Constructor Initialize sounds on the first initialization
- def loadSounds(self): Load sound files from preferenc... | Implement the Python class `SoundManager` described below.
Class description:
Manager Class for Sounds Implements the Borg paradigm for shared state
Method signatures and docstrings:
- def __init__(self): Constructor Initialize sounds on the first initialization
- def loadSounds(self): Load sound files from preferenc... | 1beec323c084d9d477c770ca6b9625c8f5682a39 | <|skeleton|>
class SoundManager:
"""Manager Class for Sounds Implements the Borg paradigm for shared state"""
def __init__(self):
"""Constructor Initialize sounds on the first initialization"""
<|body_0|>
def loadSounds(self):
"""Load sound files from preferences"""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SoundManager:
"""Manager Class for Sounds Implements the Borg paradigm for shared state"""
def __init__(self):
"""Constructor Initialize sounds on the first initialization"""
self.__dict__ = self.__shared_state
if not hasattr(self, 'sounds'):
self.loadSounds()
def... | the_stack_v2_python_sparse | apps/pyscrabble/pyscrabble-hatchet-diamond/pyscrabble/manager.py | UWSysLab/diamond | train | 22 |
9f6bd885b1f72e95c0c6abaf23878d839c9f0516 | [
"if component_type is None or not isinstance(component_container, ComponentContainer) or (not hasattr(component_container, 'has_component')):\n return False\nreturn component_container.has_component(component_type)",
"if component_type is None or not isinstance(component_container, ComponentContainer) or (not ... | <|body_start_0|>
if component_type is None or not isinstance(component_container, ComponentContainer) or (not hasattr(component_container, 'has_component')):
return False
return component_container.has_component(component_type)
<|end_body_0|>
<|body_start_1|>
if component_type is No... | Utilities for handling components of component containers. | CommonComponentUtils | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommonComponentUtils:
"""Utilities for handling components of component containers."""
def has_component(component_container: ComponentContainer, component_type: CommonComponentType) -> bool:
"""has_component(component_container, component_type) Determine if a ComponentContainer has ... | stack_v2_sparse_classes_75kplus_train_001798 | 3,633 | permissive | [
{
"docstring": "has_component(component_container, component_type) Determine if a ComponentContainer has a component of the specified type. :param component_container: The ComponentContainer to check. :type component_container: ComponentContainer :param component_type: The type of component to locate. :type com... | 3 | stack_v2_sparse_classes_30k_train_030219 | Implement the Python class `CommonComponentUtils` described below.
Class description:
Utilities for handling components of component containers.
Method signatures and docstrings:
- def has_component(component_container: ComponentContainer, component_type: CommonComponentType) -> bool: has_component(component_containe... | Implement the Python class `CommonComponentUtils` described below.
Class description:
Utilities for handling components of component containers.
Method signatures and docstrings:
- def has_component(component_container: ComponentContainer, component_type: CommonComponentType) -> bool: has_component(component_containe... | b59ea7e5f4bd01d3b3bd7603843d525a9c179867 | <|skeleton|>
class CommonComponentUtils:
"""Utilities for handling components of component containers."""
def has_component(component_container: ComponentContainer, component_type: CommonComponentType) -> bool:
"""has_component(component_container, component_type) Determine if a ComponentContainer has ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CommonComponentUtils:
"""Utilities for handling components of component containers."""
def has_component(component_container: ComponentContainer, component_type: CommonComponentType) -> bool:
"""has_component(component_container, component_type) Determine if a ComponentContainer has a component o... | the_stack_v2_python_sparse | src/sims4communitylib/utils/common_component_utils.py | velocist/TS4CheatsInfo | train | 1 |
3a37a9f0e75faaf3573016a784f5b381e5a57dff | [
"if isinstance(form, KYCForm):\n data = form.cleaned_data\n user = PolarisUser.objects.filter(email=data.get('email')).first()\n if not user:\n user = PolarisUser.objects.create(first_name=data.get('first_name'), last_name=data.get('last_name'), email=data.get('email'))\n account = PolarisStellar... | <|body_start_0|>
if isinstance(form, KYCForm):
data = form.cleaned_data
user = PolarisUser.objects.filter(email=data.get('email')).first()
if not user:
user = PolarisUser.objects.create(first_name=data.get('first_name'), last_name=data.get('last_name'), email=... | SEP24KYC | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SEP24KYC:
def track_user_activity(form: forms.Form, transaction: Transaction):
"""Creates a PolarisUserTransaction object, and depending on the form passed, also creates a new PolarisStellarAccount and potentially a new PolarisUser. This function ensures an accurate record of a particula... | stack_v2_sparse_classes_75kplus_train_001799 | 5,811 | permissive | [
{
"docstring": "Creates a PolarisUserTransaction object, and depending on the form passed, also creates a new PolarisStellarAccount and potentially a new PolarisUser. This function ensures an accurate record of a particular person's activity.",
"name": "track_user_activity",
"signature": "def track_user... | 2 | stack_v2_sparse_classes_30k_train_052950 | Implement the Python class `SEP24KYC` described below.
Class description:
Implement the SEP24KYC class.
Method signatures and docstrings:
- def track_user_activity(form: forms.Form, transaction: Transaction): Creates a PolarisUserTransaction object, and depending on the form passed, also creates a new PolarisStellarA... | Implement the Python class `SEP24KYC` described below.
Class description:
Implement the SEP24KYC class.
Method signatures and docstrings:
- def track_user_activity(form: forms.Form, transaction: Transaction): Creates a PolarisUserTransaction object, and depending on the form passed, also creates a new PolarisStellarA... | fb2af83fa50c4c04801e3a68d8c09459e14d8c37 | <|skeleton|>
class SEP24KYC:
def track_user_activity(form: forms.Form, transaction: Transaction):
"""Creates a PolarisUserTransaction object, and depending on the form passed, also creates a new PolarisStellarAccount and potentially a new PolarisUser. This function ensures an accurate record of a particula... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SEP24KYC:
def track_user_activity(form: forms.Form, transaction: Transaction):
"""Creates a PolarisUserTransaction object, and depending on the form passed, also creates a new PolarisStellarAccount and potentially a new PolarisUser. This function ensures an accurate record of a particular person's act... | the_stack_v2_python_sparse | server/integrations/sep24_kyc.py | stellar/django-polaris | train | 97 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.