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
df20f248a8ac767375322240a686bef587420019
[ "super(SupervisedTrainer, self).__init__(agent, env, log_mode, 'epoch', device=device, **kwargs)\nself.agent = agent\nif isinstance(dataset, (str, os.PathLike)):\n self.dataset = MarioExpertTransitions(data_path=dataset, screen_size=84, grayscale=True, device=device, length=length)\nelif isinstance(dataset, Data...
<|body_start_0|> super(SupervisedTrainer, self).__init__(agent, env, log_mode, 'epoch', device=device, **kwargs) self.agent = agent if isinstance(dataset, (str, os.PathLike)): self.dataset = MarioExpertTransitions(data_path=dataset, screen_size=84, grayscale=True, device=device, leng...
SupervisedTrainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupervisedTrainer: def __init__(self, agent, env, dataset, possible_actions: List=None, embedding: bool=False, shuffle: bool=True, log_mode=['stdout'], device='cpu', length=None, **kwargs): """Trainer for behavior cloning of dataset into agent Args: agent: Agent to train env: Env from wh...
stack_v2_sparse_classes_75kplus_train_007900
4,158
no_license
[ { "docstring": "Trainer for behavior cloning of dataset into agent Args: agent: Agent to train env: Env from which daa has originated dataset: Dataset to train on. Can be path to dataset or dataset object. possible_actions (List, optional): All actions that are possible. Defaults to None which implies all actio...
2
stack_v2_sparse_classes_30k_train_037317
Implement the Python class `SupervisedTrainer` described below. Class description: Implement the SupervisedTrainer class. Method signatures and docstrings: - def __init__(self, agent, env, dataset, possible_actions: List=None, embedding: bool=False, shuffle: bool=True, log_mode=['stdout'], device='cpu', length=None, ...
Implement the Python class `SupervisedTrainer` described below. Class description: Implement the SupervisedTrainer class. Method signatures and docstrings: - def __init__(self, agent, env, dataset, possible_actions: List=None, embedding: bool=False, shuffle: bool=True, log_mode=['stdout'], device='cpu', length=None, ...
0af7771fc8c6970d2b402ac77c59d04e4544c032
<|skeleton|> class SupervisedTrainer: def __init__(self, agent, env, dataset, possible_actions: List=None, embedding: bool=False, shuffle: bool=True, log_mode=['stdout'], device='cpu', length=None, **kwargs): """Trainer for behavior cloning of dataset into agent Args: agent: Agent to train env: Env from wh...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SupervisedTrainer: def __init__(self, agent, env, dataset, possible_actions: List=None, embedding: bool=False, shuffle: bool=True, log_mode=['stdout'], device='cpu', length=None, **kwargs): """Trainer for behavior cloning of dataset into agent Args: agent: Agent to train env: Env from which daa has or...
the_stack_v2_python_sparse
mario/supervised/supervised.py
sampreet-arthi/emotionalmario
train
0
e8e9eb5f505df6e09ec40360d3a68d403593d7d1
[ "self.type = req_type\nself.topic_name = topic_name\nself.tutorials = tutorials\nself.title = title\nself.link = link", "self.type = metadata['type']\nif self.type == 'internal':\n self.topic_name = metadata['topic_name']\n if 'tutorials' in metadata:\n self.tutorials = metadata['tutorials']\nelse:\n...
<|body_start_0|> self.type = req_type self.topic_name = topic_name self.tutorials = tutorials self.title = title self.link = link <|end_body_0|> <|body_start_1|> self.type = metadata['type'] if self.type == 'internal': self.topic_name = metadata['topi...
Class to describe a training requirement.
Requirement
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Requirement: """Class to describe a training requirement.""" def __init__(self, req_type='internal', topic_name='introduction', title=None, tutorials=None, link=None): """Init a Requirement instance.""" <|body_0|> def init_from_dict(self, metadata): """Init from ...
stack_v2_sparse_classes_75kplus_train_007901
2,056
permissive
[ { "docstring": "Init a Requirement instance.", "name": "__init__", "signature": "def __init__(self, req_type='internal', topic_name='introduction', title=None, tutorials=None, link=None)" }, { "docstring": "Init from a dictionary generated by export_to_ordered_dict.", "name": "init_from_dict...
3
stack_v2_sparse_classes_30k_train_002312
Implement the Python class `Requirement` described below. Class description: Class to describe a training requirement. Method signatures and docstrings: - def __init__(self, req_type='internal', topic_name='introduction', title=None, tutorials=None, link=None): Init a Requirement instance. - def init_from_dict(self, ...
Implement the Python class `Requirement` described below. Class description: Class to describe a training requirement. Method signatures and docstrings: - def __init__(self, req_type='internal', topic_name='introduction', title=None, tutorials=None, link=None): Init a Requirement instance. - def init_from_dict(self, ...
95db94dbd77ab8f273f1fad37fb82c529a94d382
<|skeleton|> class Requirement: """Class to describe a training requirement.""" def __init__(self, req_type='internal', topic_name='introduction', title=None, tutorials=None, link=None): """Init a Requirement instance.""" <|body_0|> def init_from_dict(self, metadata): """Init from ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Requirement: """Class to describe a training requirement.""" def __init__(self, req_type='internal', topic_name='introduction', title=None, tutorials=None, link=None): """Init a Requirement instance.""" self.type = req_type self.topic_name = topic_name self.tutorials = tut...
the_stack_v2_python_sparse
planemo/training/utils.py
galaxyproject/planemo
train
85
df9745a20f57537e87c0a1aef7b28c95c0bf8f55
[ "if not accumulate:\n buffer.reset()\nself.buffer = buffer\nself.accumulate = accumulate", "stream = PushBackStream(stream)\nfor mark, event in stream:\n if mark:\n if not self.accumulate:\n self.buffer.reset()\n events = [(mark, event)]\n self.buffer.append(event)\n s...
<|body_start_0|> if not accumulate: buffer.reset() self.buffer = buffer self.accumulate = accumulate <|end_body_0|> <|body_start_1|> stream = PushBackStream(stream) for mark, event in stream: if mark: if not self.accumulate: ...
Copy selected events into a buffer for later insertion.
CopyTransformation
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CopyTransformation: """Copy selected events into a buffer for later insertion.""" def __init__(self, buffer, accumulate=False): """Create the copy transformation. :param buffer: the `StreamBuffer` in which the selection should be stored""" <|body_0|> def __call__(self, s...
stack_v2_sparse_classes_75kplus_train_007902
48,275
permissive
[ { "docstring": "Create the copy transformation. :param buffer: the `StreamBuffer` in which the selection should be stored", "name": "__init__", "signature": "def __init__(self, buffer, accumulate=False)" }, { "docstring": "Apply the transformation to the marked stream. :param stream: the marked ...
2
stack_v2_sparse_classes_30k_test_002293
Implement the Python class `CopyTransformation` described below. Class description: Copy selected events into a buffer for later insertion. Method signatures and docstrings: - def __init__(self, buffer, accumulate=False): Create the copy transformation. :param buffer: the `StreamBuffer` in which the selection should ...
Implement the Python class `CopyTransformation` described below. Class description: Copy selected events into a buffer for later insertion. Method signatures and docstrings: - def __init__(self, buffer, accumulate=False): Create the copy transformation. :param buffer: the `StreamBuffer` in which the selection should ...
e1612568cbf3349a0160f67eee5b255e35057f45
<|skeleton|> class CopyTransformation: """Copy selected events into a buffer for later insertion.""" def __init__(self, buffer, accumulate=False): """Create the copy transformation. :param buffer: the `StreamBuffer` in which the selection should be stored""" <|body_0|> def __call__(self, s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CopyTransformation: """Copy selected events into a buffer for later insertion.""" def __init__(self, buffer, accumulate=False): """Create the copy transformation. :param buffer: the `StreamBuffer` in which the selection should be stored""" if not accumulate: buffer.reset() ...
the_stack_v2_python_sparse
genshi/filters/transform.py
edgewall/genshi
train
76
df4a52bbfd32fbf8f0ac006a288b3399d57abc96
[ "pygame.init()\nself.screen = pygame.display.set_mode((1200, 700))\npygame.display.set_caption('Alien')\nself.bg_color = (0, 0, 230)\nself.foto = Foto(self)", "while True:\n for event in pygame.event.get():\n if event.type == pygame.QUIT:\n sys.exit()\n self.screen.fill(self.bg_color)\n ...
<|body_start_0|> pygame.init() self.screen = pygame.display.set_mode((1200, 700)) pygame.display.set_caption('Alien') self.bg_color = (0, 0, 230) self.foto = Foto(self) <|end_body_0|> <|body_start_1|> while True: for event in pygame.event.get(): ...
Класс для управления ресурсами и поведением игры.
Blue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Blue: """Класс для управления ресурсами и поведением игры.""" def __init__(self): """Инициализирует игру и создает игровые ресурсы.""" <|body_0|> def run_game(self): """Запуск основного цикла игры.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_007903
1,349
no_license
[ { "docstring": "Инициализирует игру и создает игровые ресурсы.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Запуск основного цикла игры.", "name": "run_game", "signature": "def run_game(self)" } ]
2
stack_v2_sparse_classes_30k_train_030150
Implement the Python class `Blue` described below. Class description: Класс для управления ресурсами и поведением игры. Method signatures and docstrings: - def __init__(self): Инициализирует игру и создает игровые ресурсы. - def run_game(self): Запуск основного цикла игры.
Implement the Python class `Blue` described below. Class description: Класс для управления ресурсами и поведением игры. Method signatures and docstrings: - def __init__(self): Инициализирует игру и создает игровые ресурсы. - def run_game(self): Запуск основного цикла игры. <|skeleton|> class Blue: """Класс для у...
4a8f948bf6d9622cc45fa9586d3c111cf948abbf
<|skeleton|> class Blue: """Класс для управления ресурсами и поведением игры.""" def __init__(self): """Инициализирует игру и создает игровые ресурсы.""" <|body_0|> def run_game(self): """Запуск основного цикла игры.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Blue: """Класс для управления ресурсами и поведением игры.""" def __init__(self): """Инициализирует игру и создает игровые ресурсы.""" pygame.init() self.screen = pygame.display.set_mode((1200, 700)) pygame.display.set_caption('Alien') self.bg_color = (0, 0, 230) ...
the_stack_v2_python_sparse
14/homework/blue.py
Naumov89/python_metiz
train
0
0cec33dbc4e960cfb8edc8f59541ac7a51aaea07
[ "dic_roman = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000, 'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900}\ni = 0\nnum = 0\nrom_size = 0\nsRomNum = sRomNum.replace('U', 'V')\nwhile i < len(sRomNum):\n if i + 1 < len(sRomNum) and sRomNum[i:i + 2] in dic_roman:\n num += dic_r...
<|body_start_0|> dic_roman = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000, 'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900} i = 0 num = 0 rom_size = 0 sRomNum = sRomNum.replace('U', 'V') while i < len(sRomNum): if i + 1 < len(sRo...
RomanNumbers
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RomanNumbers: def romanToInt(self, sRomNum): """Convert roman (string) into number (int)""" <|body_0|> def intToRoman(self, num): """Convert number (int) into roman (string)""" <|body_1|> <|end_skeleton|> <|body_start_0|> dic_roman = {'I': 1, 'V': 5...
stack_v2_sparse_classes_75kplus_train_007904
7,978
permissive
[ { "docstring": "Convert roman (string) into number (int)", "name": "romanToInt", "signature": "def romanToInt(self, sRomNum)" }, { "docstring": "Convert number (int) into roman (string)", "name": "intToRoman", "signature": "def intToRoman(self, num)" } ]
2
stack_v2_sparse_classes_30k_train_033443
Implement the Python class `RomanNumbers` described below. Class description: Implement the RomanNumbers class. Method signatures and docstrings: - def romanToInt(self, sRomNum): Convert roman (string) into number (int) - def intToRoman(self, num): Convert number (int) into roman (string)
Implement the Python class `RomanNumbers` described below. Class description: Implement the RomanNumbers class. Method signatures and docstrings: - def romanToInt(self, sRomNum): Convert roman (string) into number (int) - def intToRoman(self, num): Convert number (int) into roman (string) <|skeleton|> class RomanNum...
921fb5ec3f5b40b169bd3f65417580878365ccab
<|skeleton|> class RomanNumbers: def romanToInt(self, sRomNum): """Convert roman (string) into number (int)""" <|body_0|> def intToRoman(self, num): """Convert number (int) into roman (string)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RomanNumbers: def romanToInt(self, sRomNum): """Convert roman (string) into number (int)""" dic_roman = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000, 'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900} i = 0 num = 0 rom_size = 0 sRomN...
the_stack_v2_python_sparse
passim/passim/utils.py
ErwinKomen/RU-passim
train
0
679907b3f6ce26210793a204bcf396f0834bc00b
[ "self._width = width\nself._height = height\nself._images = {}\nreturn", "bmp = self._images.get(filename)\nif bmp is None:\n image = wx.Image(filename, wx.BITMAP_TYPE_ANY)\n self._scale(image)\n bmp = image.ConvertToBitmap()\n self._images[filename] = bmp\nreturn bmp", "if image.GetWidth() != self....
<|body_start_0|> self._width = width self._height = height self._images = {} return <|end_body_0|> <|body_start_1|> bmp = self._images.get(filename) if bmp is None: image = wx.Image(filename, wx.BITMAP_TYPE_ANY) self._scale(image) bmp ...
An image cache.
ImageCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageCache: """An image cache.""" def __init__(self, width, height): """Creates a new image cache.""" <|body_0|> def get_image(self, filename): """Returns the specified image (currently as a bitmap).""" <|body_1|> def _scale(self, image): """...
stack_v2_sparse_classes_75kplus_train_007905
2,463
no_license
[ { "docstring": "Creates a new image cache.", "name": "__init__", "signature": "def __init__(self, width, height)" }, { "docstring": "Returns the specified image (currently as a bitmap).", "name": "get_image", "signature": "def get_image(self, filename)" }, { "docstring": "Scales ...
3
stack_v2_sparse_classes_30k_train_018303
Implement the Python class `ImageCache` described below. Class description: An image cache. Method signatures and docstrings: - def __init__(self, width, height): Creates a new image cache. - def get_image(self, filename): Returns the specified image (currently as a bitmap). - def _scale(self, image): Scales the spec...
Implement the Python class `ImageCache` described below. Class description: An image cache. Method signatures and docstrings: - def __init__(self, width, height): Creates a new image cache. - def get_image(self, filename): Returns the specified image (currently as a bitmap). - def _scale(self, image): Scales the spec...
5466f5858dbd2f1f082fa0d7417b57c8fb068fad
<|skeleton|> class ImageCache: """An image cache.""" def __init__(self, width, height): """Creates a new image cache.""" <|body_0|> def get_image(self, filename): """Returns the specified image (currently as a bitmap).""" <|body_1|> def _scale(self, image): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageCache: """An image cache.""" def __init__(self, width, height): """Creates a new image cache.""" self._width = width self._height = height self._images = {} return def get_image(self, filename): """Returns the specified image (currently as a bitma...
the_stack_v2_python_sparse
maps/build/EnthoughtBase/enthought/util/wx/image_cache.py
m-elhussieny/code
train
0
bf776e813123b81703495bedd3d7d299e0577058
[ "if request.matched_route:\n return (request.matched_route.name, request.method) in cls.API_WHITELIST\nreturn False", "auth_client = self._get_auth_client(request)\nif not auth_client:\n return None\nuser = None\nif (forwarded_userid := request.headers.get('X-Forwarded-User', None)):\n try:\n user...
<|body_start_0|> if request.matched_route: return (request.matched_route.name, request.method) in cls.API_WHITELIST return False <|end_body_0|> <|body_start_1|> auth_client = self._get_auth_client(request) if not auth_client: return None user = None ...
An authentication policy for registered AuthClients. Auth clients must be registered with grant type `client_credentials` and will need to perform basic HTTP auth with their username and password set to their auth client id, and secret. A client can also pass an `X-Forwarded-User` header with the userid to act as user ...
AuthClientPolicy
[ "BSD-2-Clause", "BSD-3-Clause", "BSD-2-Clause-Views" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthClientPolicy: """An authentication policy for registered AuthClients. Auth clients must be registered with grant type `client_credentials` and will need to perform basic HTTP auth with their username and password set to their auth client id, and secret. A client can also pass an `X-Forwarded-...
stack_v2_sparse_classes_75kplus_train_007906
3,907
permissive
[ { "docstring": "Get whether this policy should accept this request.", "name": "handles", "signature": "def handles(cls, request)" }, { "docstring": "Get an Identity object for valid credentials. :param request: Pyramid request to inspect :returns: An `Identity` object if the login is authenticat...
3
null
Implement the Python class `AuthClientPolicy` described below. Class description: An authentication policy for registered AuthClients. Auth clients must be registered with grant type `client_credentials` and will need to perform basic HTTP auth with their username and password set to their auth client id, and secret. ...
Implement the Python class `AuthClientPolicy` described below. Class description: An authentication policy for registered AuthClients. Auth clients must be registered with grant type `client_credentials` and will need to perform basic HTTP auth with their username and password set to their auth client id, and secret. ...
232446d776fdb906d2fb253cf0a409c6813a08d6
<|skeleton|> class AuthClientPolicy: """An authentication policy for registered AuthClients. Auth clients must be registered with grant type `client_credentials` and will need to perform basic HTTP auth with their username and password set to their auth client id, and secret. A client can also pass an `X-Forwarded-...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuthClientPolicy: """An authentication policy for registered AuthClients. Auth clients must be registered with grant type `client_credentials` and will need to perform basic HTTP auth with their username and password set to their auth client id, and secret. A client can also pass an `X-Forwarded-User` header ...
the_stack_v2_python_sparse
h/security/policy/_basic_http_auth.py
hypothesis/h
train
2,558
b598dc9882b29cc3ae97b6249cd39d3dc8576ec3
[ "nums.sort()\nlength = len(nums)\ndp = [0] * length\nmax = 0\nmax_index = 0\nchild = [0] * length\nans = []\nfor i in xrange(length - 1, -1, -1):\n for j in xrange(i, length):\n if nums[j] % nums[i] == 0 and dp[i] < dp[j] + 1:\n dp[i] = dp[j] + 1\n child[i] = j\n if max < ...
<|body_start_0|> nums.sort() length = len(nums) dp = [0] * length max = 0 max_index = 0 child = [0] * length ans = [] for i in xrange(length - 1, -1, -1): for j in xrange(i, length): if nums[j] % nums[i] == 0 and dp[i] < dp[j] +...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestDivisibleSubset(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def largestDivisibleSubset2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums.sort(...
stack_v2_sparse_classes_75kplus_train_007907
2,280
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "largestDivisibleSubset", "signature": "def largestDivisibleSubset(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "largestDivisibleSubset2", "signature": "def largestDivisibleSubset2(self...
2
stack_v2_sparse_classes_30k_train_019357
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestDivisibleSubset(self, nums): :type nums: List[int] :rtype: List[int] - def largestDivisibleSubset2(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestDivisibleSubset(self, nums): :type nums: List[int] :rtype: List[int] - def largestDivisibleSubset2(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> c...
2d5fa4cd696d5035ea8859befeadc5cc436959c9
<|skeleton|> class Solution: def largestDivisibleSubset(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def largestDivisibleSubset2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def largestDivisibleSubset(self, nums): """:type nums: List[int] :rtype: List[int]""" nums.sort() length = len(nums) dp = [0] * length max = 0 max_index = 0 child = [0] * length ans = [] for i in xrange(length - 1, -1, -1): ...
the_stack_v2_python_sparse
SourceCode/Python/Problem/00368.Largest Divisible Subset.py
roger6blog/LeetCode
train
0
842008ecb8fd17b3f1189ffe2782722c8e3440c2
[ "self.hass = hass\nself.config_entry: ConfigEntry = config_entry\nself.cam = cam\nsuper().__init__(self.hass, _LOGGER, name=f'{DOMAIN} {config_entry.data[CONF_HOST]}', update_interval=timedelta(seconds=10))", "try:\n await self.cam.update()\nexcept PyDroidIPCamException as err:\n raise UpdateFailed(err) fro...
<|body_start_0|> self.hass = hass self.config_entry: ConfigEntry = config_entry self.cam = cam super().__init__(self.hass, _LOGGER, name=f'{DOMAIN} {config_entry.data[CONF_HOST]}', update_interval=timedelta(seconds=10)) <|end_body_0|> <|body_start_1|> try: await self...
Coordinator class for the Android IP Webcam.
AndroidIPCamDataUpdateCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AndroidIPCamDataUpdateCoordinator: """Coordinator class for the Android IP Webcam.""" def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, cam: PyDroidIPCam) -> None: """Initialize the Android IP Webcam.""" <|body_0|> async def _async_update_data(self) -> N...
stack_v2_sparse_classes_75kplus_train_007908
1,351
permissive
[ { "docstring": "Initialize the Android IP Webcam.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, cam: PyDroidIPCam) -> None" }, { "docstring": "Update Android IP Webcam entities.", "name": "_async_update_data", "signature": "async d...
2
stack_v2_sparse_classes_30k_val_001456
Implement the Python class `AndroidIPCamDataUpdateCoordinator` described below. Class description: Coordinator class for the Android IP Webcam. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, cam: PyDroidIPCam) -> None: Initialize the Android IP Webcam. - async d...
Implement the Python class `AndroidIPCamDataUpdateCoordinator` described below. Class description: Coordinator class for the Android IP Webcam. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, cam: PyDroidIPCam) -> None: Initialize the Android IP Webcam. - async d...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class AndroidIPCamDataUpdateCoordinator: """Coordinator class for the Android IP Webcam.""" def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, cam: PyDroidIPCam) -> None: """Initialize the Android IP Webcam.""" <|body_0|> async def _async_update_data(self) -> N...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AndroidIPCamDataUpdateCoordinator: """Coordinator class for the Android IP Webcam.""" def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, cam: PyDroidIPCam) -> None: """Initialize the Android IP Webcam.""" self.hass = hass self.config_entry: ConfigEntry = config_ent...
the_stack_v2_python_sparse
homeassistant/components/android_ip_webcam/coordinator.py
home-assistant/core
train
35,501
2b8a21124a357217d1f3f1183ce4c836f4cb657c
[ "try:\n stream.write(json.dumps(data, indent=2))\nexcept Exception as e:\n raise SerDeError('JSON dump error') from e", "try:\n return json.load(stream)\nexcept Exception as e:\n raise SerDeError('JSON load error') from e" ]
<|body_start_0|> try: stream.write(json.dumps(data, indent=2)) except Exception as e: raise SerDeError('JSON dump error') from e <|end_body_0|> <|body_start_1|> try: return json.load(stream) except Exception as e: raise SerDeError('JSON lo...
A Json Serializer/deserializer.
JsonSerDe
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JsonSerDe: """A Json Serializer/deserializer.""" def serialize_to_stream(self, data: Any, stream: TextIO) -> None: """Write serialized data as Json into a stream. Args: data: data stream: a stream Raises: SerDeError: if an error occurred during writing or serialization""" <|b...
stack_v2_sparse_classes_75kplus_train_007909
1,197
no_license
[ { "docstring": "Write serialized data as Json into a stream. Args: data: data stream: a stream Raises: SerDeError: if an error occurred during writing or serialization", "name": "serialize_to_stream", "signature": "def serialize_to_stream(self, data: Any, stream: TextIO) -> None" }, { "docstring...
2
stack_v2_sparse_classes_30k_train_036437
Implement the Python class `JsonSerDe` described below. Class description: A Json Serializer/deserializer. Method signatures and docstrings: - def serialize_to_stream(self, data: Any, stream: TextIO) -> None: Write serialized data as Json into a stream. Args: data: data stream: a stream Raises: SerDeError: if an erro...
Implement the Python class `JsonSerDe` described below. Class description: A Json Serializer/deserializer. Method signatures and docstrings: - def serialize_to_stream(self, data: Any, stream: TextIO) -> None: Write serialized data as Json into a stream. Args: data: data stream: a stream Raises: SerDeError: if an erro...
3da2161c3c9e0652c2cfc78ab514359bcf2e436b
<|skeleton|> class JsonSerDe: """A Json Serializer/deserializer.""" def serialize_to_stream(self, data: Any, stream: TextIO) -> None: """Write serialized data as Json into a stream. Args: data: data stream: a stream Raises: SerDeError: if an error occurred during writing or serialization""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JsonSerDe: """A Json Serializer/deserializer.""" def serialize_to_stream(self, data: Any, stream: TextIO) -> None: """Write serialized data as Json into a stream. Args: data: data stream: a stream Raises: SerDeError: if an error occurred during writing or serialization""" try: ...
the_stack_v2_python_sparse
ywh2bt/core/serializers/json.py
yeswehack/ywh2bugtracker
train
10
ca99f6a5e32ce4dcab7c7c8cda4b5ad922d3cbca
[ "b = GraphBuilder('GZTest', {'fontname': '\"sans bold\"', 'shape': 'doublecircle', 'style': 'filled'})\nb.node('A', attrs={'label': '\"STOP!\"', 'color': 'red'})\nb.node('C', attrs={'fillcolor': 'green', 'color': 'black', 'fontcolor': 'white', 'label': '\"go\"'})\nb.edge('A', 'B', 'C')\nb.nodeCluster('A', 'B', 'C',...
<|body_start_0|> b = GraphBuilder('GZTest', {'fontname': '"sans bold"', 'shape': 'doublecircle', 'style': 'filled'}) b.node('A', attrs={'label': '"STOP!"', 'color': 'red'}) b.node('C', attrs={'fillcolor': 'green', 'color': 'black', 'fontcolor': 'white', 'label': '"go"'}) b.edge('A', 'B',...
python3 -m unittest graphviz.GZTest
TestGZ
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGZ: """python3 -m unittest graphviz.GZTest""" def test_graph_builder(self): """python3 -m unittest graphviz.GZTest.TestGZ.test_graph_builder""" <|body_0|> def test_digraph_builder(self): """python3 -m unittest graphviz.GZTest.TestGZ.test_digraph_builder""" ...
stack_v2_sparse_classes_75kplus_train_007910
1,395
no_license
[ { "docstring": "python3 -m unittest graphviz.GZTest.TestGZ.test_graph_builder", "name": "test_graph_builder", "signature": "def test_graph_builder(self)" }, { "docstring": "python3 -m unittest graphviz.GZTest.TestGZ.test_digraph_builder", "name": "test_digraph_builder", "signature": "def...
2
stack_v2_sparse_classes_30k_train_046538
Implement the Python class `TestGZ` described below. Class description: python3 -m unittest graphviz.GZTest Method signatures and docstrings: - def test_graph_builder(self): python3 -m unittest graphviz.GZTest.TestGZ.test_graph_builder - def test_digraph_builder(self): python3 -m unittest graphviz.GZTest.TestGZ.test_...
Implement the Python class `TestGZ` described below. Class description: python3 -m unittest graphviz.GZTest Method signatures and docstrings: - def test_graph_builder(self): python3 -m unittest graphviz.GZTest.TestGZ.test_graph_builder - def test_digraph_builder(self): python3 -m unittest graphviz.GZTest.TestGZ.test_...
0d12fbb8e5a4418c8c43b20452672e288bcca031
<|skeleton|> class TestGZ: """python3 -m unittest graphviz.GZTest""" def test_graph_builder(self): """python3 -m unittest graphviz.GZTest.TestGZ.test_graph_builder""" <|body_0|> def test_digraph_builder(self): """python3 -m unittest graphviz.GZTest.TestGZ.test_digraph_builder""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestGZ: """python3 -m unittest graphviz.GZTest""" def test_graph_builder(self): """python3 -m unittest graphviz.GZTest.TestGZ.test_graph_builder""" b = GraphBuilder('GZTest', {'fontname': '"sans bold"', 'shape': 'doublecircle', 'style': 'filled'}) b.node('A', attrs={'label': '"STO...
the_stack_v2_python_sparse
graphviz/GZTest.py
rcrowther/wild
train
0
4bdf84211d39ef691061a0bc57d411a9efb966cf
[ "self.measure_list = measure_list\nself.op_list = [item.operations for item in measure_list]\nself.operations = dict()\nself.operation_statistics()", "for item in self.op_list:\n for key in item:\n if key not in self.operations:\n self.operations[key] = item[key]\n else:\n s...
<|body_start_0|> self.measure_list = measure_list self.op_list = [item.operations for item in measure_list] self.operations = dict() self.operation_statistics() <|end_body_0|> <|body_start_1|> for item in self.op_list: for key in item: if key not in s...
MeasureList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeasureList: def __init__(self, measure_list): """measure_list: a list of Measure Objects""" <|body_0|> def operation_statistics(self): """add up operations consumption of all layers""" <|body_1|> def get_operation_time(self): """return a string ...
stack_v2_sparse_classes_75kplus_train_007911
5,111
permissive
[ { "docstring": "measure_list: a list of Measure Objects", "name": "__init__", "signature": "def __init__(self, measure_list)" }, { "docstring": "add up operations consumption of all layers", "name": "operation_statistics", "signature": "def operation_statistics(self)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_020951
Implement the Python class `MeasureList` described below. Class description: Implement the MeasureList class. Method signatures and docstrings: - def __init__(self, measure_list): measure_list: a list of Measure Objects - def operation_statistics(self): add up operations consumption of all layers - def get_operation_...
Implement the Python class `MeasureList` described below. Class description: Implement the MeasureList class. Method signatures and docstrings: - def __init__(self, measure_list): measure_list: a list of Measure Objects - def operation_statistics(self): add up operations consumption of all layers - def get_operation_...
6c3031487cd1447b7f5362483c14b108177387bb
<|skeleton|> class MeasureList: def __init__(self, measure_list): """measure_list: a list of Measure Objects""" <|body_0|> def operation_statistics(self): """add up operations consumption of all layers""" <|body_1|> def get_operation_time(self): """return a string ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MeasureList: def __init__(self, measure_list): """measure_list: a list of Measure Objects""" self.measure_list = measure_list self.op_list = [item.operations for item in measure_list] self.operations = dict() self.operation_statistics() def operation_statistics(sel...
the_stack_v2_python_sparse
keras_wide_deep_98_table_15GB/output/analyze.py
WenqiJiang/FPGA-Accelerator-for-Recommender-Systems
train
6
745ba62ecc7fbfe8a1efeb84d3f5a000a396f6ef
[ "b = (m ^ n).bit_length()\nb = int(log(m ^ n) // log(2)) + 1\nm >>= b\nreturn m << b", "if m == n:\n return m\ncnt, digits = (0, 1)\ntmp = n\nwhile tmp > 1:\n digits += 1\n tmp >>= 1\nwhile digits > 1:\n if m < 2 ** (digits - 1):\n return cnt\n cnt += 2 ** (digits - 1)\n m -= 2 ** (digits...
<|body_start_0|> b = (m ^ n).bit_length() b = int(log(m ^ n) // log(2)) + 1 m >>= b return m << b <|end_body_0|> <|body_start_1|> if m == n: return m cnt, digits = (0, 1) tmp = n while tmp > 1: digits += 1 tmp >>= 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rangeBitwiseAnd_math(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def rangeBitwiseAnd(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> b = (m ^ n).bit_length()...
stack_v2_sparse_classes_75kplus_train_007912
1,248
no_license
[ { "docstring": ":type m: int :type n: int :rtype: int", "name": "rangeBitwiseAnd_math", "signature": "def rangeBitwiseAnd_math(self, m, n)" }, { "docstring": ":type m: int :type n: int :rtype: int", "name": "rangeBitwiseAnd", "signature": "def rangeBitwiseAnd(self, m, n)" } ]
2
stack_v2_sparse_classes_30k_train_023330
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rangeBitwiseAnd_math(self, m, n): :type m: int :type n: int :rtype: int - def rangeBitwiseAnd(self, m, n): :type m: int :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rangeBitwiseAnd_math(self, m, n): :type m: int :type n: int :rtype: int - def rangeBitwiseAnd(self, m, n): :type m: int :type n: int :rtype: int <|skeleton|> class Solution:...
f3fc71f344cd758cfce77f16ab72992c99ab288e
<|skeleton|> class Solution: def rangeBitwiseAnd_math(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def rangeBitwiseAnd(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rangeBitwiseAnd_math(self, m, n): """:type m: int :type n: int :rtype: int""" b = (m ^ n).bit_length() b = int(log(m ^ n) // log(2)) + 1 m >>= b return m << b def rangeBitwiseAnd(self, m, n): """:type m: int :type n: int :rtype: int""" ...
the_stack_v2_python_sparse
201_rangeBitwiseAnd.py
jennyChing/leetCode
train
2
b051135f95f515cfb0dbedd7cc96c737a76c04f7
[ "proxy = self.get_random_proxy()\nprint('this is request ip:' + proxy)\nrequest.meta['proxy'] = proxy", "if response.status != 200:\n proxy = self.get_random_proxy()\n print('this is response ip:' + proxy)\n request.meta['proxy'] = proxy\n return request\nreturn response", "with open('JD/ip_pool/ip_...
<|body_start_0|> proxy = self.get_random_proxy() print('this is request ip:' + proxy) request.meta['proxy'] = proxy <|end_body_0|> <|body_start_1|> if response.status != 200: proxy = self.get_random_proxy() print('this is response ip:' + proxy) reques...
docstring for ProxyMiddleWare
ProxyMiddleware
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProxyMiddleware: """docstring for ProxyMiddleWare""" def process_request(self, request, spider): """对request对象加上proxy""" <|body_0|> def process_response(self, request, response, spider): """对返回的response处理""" <|body_1|> def get_random_proxy(self): ...
stack_v2_sparse_classes_75kplus_train_007913
1,384
no_license
[ { "docstring": "对request对象加上proxy", "name": "process_request", "signature": "def process_request(self, request, spider)" }, { "docstring": "对返回的response处理", "name": "process_response", "signature": "def process_response(self, request, response, spider)" }, { "docstring": "随机从文件中读...
3
stack_v2_sparse_classes_30k_train_024719
Implement the Python class `ProxyMiddleware` described below. Class description: docstring for ProxyMiddleWare Method signatures and docstrings: - def process_request(self, request, spider): 对request对象加上proxy - def process_response(self, request, response, spider): 对返回的response处理 - def get_random_proxy(self): 随机从文件中读...
Implement the Python class `ProxyMiddleware` described below. Class description: docstring for ProxyMiddleWare Method signatures and docstrings: - def process_request(self, request, spider): 对request对象加上proxy - def process_response(self, request, response, spider): 对返回的response处理 - def get_random_proxy(self): 随机从文件中读...
e15c36ca8c168fdf012cf616c1d38d202d677509
<|skeleton|> class ProxyMiddleware: """docstring for ProxyMiddleWare""" def process_request(self, request, spider): """对request对象加上proxy""" <|body_0|> def process_response(self, request, response, spider): """对返回的response处理""" <|body_1|> def get_random_proxy(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProxyMiddleware: """docstring for ProxyMiddleWare""" def process_request(self, request, spider): """对request对象加上proxy""" proxy = self.get_random_proxy() print('this is request ip:' + proxy) request.meta['proxy'] = proxy def process_response(self, request, response, sp...
the_stack_v2_python_sparse
JD/middlewares.py
Super-Louis/scrapy-JD
train
3
0192f5c1becc8097e579a4a02b2821f032af2c7f
[ "ctype, object_pk = self.get_target_ctype_pk(context)\nif not object_pk:\n return self.comment_model.objects.none()\nqs = self.comment_model.objects.filter(content_type=ctype, object_pk=smart_unicode(object_pk))\nqs = qs.filter(is_public=True)\nif getattr(settings, 'COMMENTS_HIDE_REMOVED', False):\n qs = qs.f...
<|body_start_0|> ctype, object_pk = self.get_target_ctype_pk(context) if not object_pk: return self.comment_model.objects.none() qs = self.comment_model.objects.filter(content_type=ctype, object_pk=smart_unicode(object_pk)) qs = qs.filter(is_public=True) if getattr(se...
EllaMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EllaMixin: def get_query_set(self, context): """Override for the django..comments..BaseCommentNode.get_query_set that ignores the site FK""" <|body_0|> def get_target_ctype_pk(self, context): """override of the default behavior that handles Publishables specifically ...
stack_v2_sparse_classes_75kplus_train_007914
5,481
no_license
[ { "docstring": "Override for the django..comments..BaseCommentNode.get_query_set that ignores the site FK", "name": "get_query_set", "signature": "def get_query_set(self, context)" }, { "docstring": "override of the default behavior that handles Publishables specifically - it returns their speci...
2
stack_v2_sparse_classes_30k_train_052390
Implement the Python class `EllaMixin` described below. Class description: Implement the EllaMixin class. Method signatures and docstrings: - def get_query_set(self, context): Override for the django..comments..BaseCommentNode.get_query_set that ignores the site FK - def get_target_ctype_pk(self, context): override o...
Implement the Python class `EllaMixin` described below. Class description: Implement the EllaMixin class. Method signatures and docstrings: - def get_query_set(self, context): Override for the django..comments..BaseCommentNode.get_query_set that ignores the site FK - def get_target_ctype_pk(self, context): override o...
edcae8ac03816631cf8fbae98b7730479f4c41b6
<|skeleton|> class EllaMixin: def get_query_set(self, context): """Override for the django..comments..BaseCommentNode.get_query_set that ignores the site FK""" <|body_0|> def get_target_ctype_pk(self, context): """override of the default behavior that handles Publishables specifically ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EllaMixin: def get_query_set(self, context): """Override for the django..comments..BaseCommentNode.get_query_set that ignores the site FK""" ctype, object_pk = self.get_target_ctype_pk(context) if not object_pk: return self.comment_model.objects.none() qs = self.com...
the_stack_v2_python_sparse
ella/ellacomments/templatetags/ellacomments_tags.py
majerm/ella
train
1
45c6349babc53629d9a05044afc51a540e0f4e34
[ "self.tf = try_import_tensorflow()\nself.tf.compat.v1.disable_eager_execution()\ngraph = self.tf.Graph()\nwith graph.as_default():\n self.tf.import_graph_def(graph_def=input_graph, name='')\nself.ops = graph.get_operations()\nplaceholders = list(filter(lambda op: op.type == 'Placeholder', self.ops))\nassert len(...
<|body_start_0|> self.tf = try_import_tensorflow() self.tf.compat.v1.disable_eager_execution() graph = self.tf.Graph() with graph.as_default(): self.tf.import_graph_def(graph_def=input_graph, name='') self.ops = graph.get_operations() placeholders = list(filte...
ShapeFetcher
[ "LicenseRef-scancode-generic-cla", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShapeFetcher: def __init__(self, input_graph): """Dynamically inference the node shapes. Parameters ---------- input_graph : graph_def The tensorflow input graph_def file.""" <|body_0|> def get_shape_by_name(self, op_name): """Get the node output shape by its name Pa...
stack_v2_sparse_classes_75kplus_train_007915
2,660
permissive
[ { "docstring": "Dynamically inference the node shapes. Parameters ---------- input_graph : graph_def The tensorflow input graph_def file.", "name": "__init__", "signature": "def __init__(self, input_graph)" }, { "docstring": "Get the node output shape by its name Parameters ---------- op_name : ...
2
stack_v2_sparse_classes_30k_train_011928
Implement the Python class `ShapeFetcher` described below. Class description: Implement the ShapeFetcher class. Method signatures and docstrings: - def __init__(self, input_graph): Dynamically inference the node shapes. Parameters ---------- input_graph : graph_def The tensorflow input graph_def file. - def get_shape...
Implement the Python class `ShapeFetcher` described below. Class description: Implement the ShapeFetcher class. Method signatures and docstrings: - def __init__(self, input_graph): Dynamically inference the node shapes. Parameters ---------- input_graph : graph_def The tensorflow input graph_def file. - def get_shape...
c11b8223ecf8b5ba881528071a8ae18df80584ba
<|skeleton|> class ShapeFetcher: def __init__(self, input_graph): """Dynamically inference the node shapes. Parameters ---------- input_graph : graph_def The tensorflow input graph_def file.""" <|body_0|> def get_shape_by_name(self, op_name): """Get the node output shape by its name Pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ShapeFetcher: def __init__(self, input_graph): """Dynamically inference the node shapes. Parameters ---------- input_graph : graph_def The tensorflow input graph_def file.""" self.tf = try_import_tensorflow() self.tf.compat.v1.disable_eager_execution() graph = self.tf.Graph() ...
the_stack_v2_python_sparse
nn_meter/ir_converters/frozenpb_converter/shape_fetcher.py
JiahangXu/nn-Meter
train
0
f34d04c6577fd8f9c685ef6b5d38dbaca3bc1c7c
[ "dicoms = []\ncompLines = []\nif otherReplaceValues:\n replaceValues.update(otherReplaceValues)\nif filename == newFilename:\n bkpFN = filename.split('.')[0] + '.BKP'\n shutil.copy(filename, bkpFN)\n os.remove(filename)\n slicer.app.processEvents()\n filename = bkpFN\nmrmlFile = codecs.open(filena...
<|body_start_0|> dicoms = [] compLines = [] if otherReplaceValues: replaceValues.update(otherReplaceValues) if filename == newFilename: bkpFN = filename.split('.')[0] + '.BKP' shutil.copy(filename, bkpFN) os.remove(filename) sli...
MrmlParser handles the parsing of a MRML file (XML-based) and either changes the paths of the remotely linked files to local directories, or to relative directories.
MrmlParser
[ "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MrmlParser: """MrmlParser handles the parsing of a MRML file (XML-based) and either changes the paths of the remotely linked files to local directories, or to relative directories.""" def changeValues(filename, newFilename, replaceValues, otherReplaceValues, removeOriginalFile=False, debug=T...
stack_v2_sparse_classes_75kplus_train_007916
9,290
permissive
[ { "docstring": "Changes the string values within a given file based on a provided lists 'replaceValues' and 'otherReplaceValues'.", "name": "changeValues", "signature": "def changeValues(filename, newFilename, replaceValues, otherReplaceValues, removeOriginalFile=False, debug=True)" }, { "docstr...
2
stack_v2_sparse_classes_30k_val_000495
Implement the Python class `MrmlParser` described below. Class description: MrmlParser handles the parsing of a MRML file (XML-based) and either changes the paths of the remotely linked files to local directories, or to relative directories. Method signatures and docstrings: - def changeValues(filename, newFilename, ...
Implement the Python class `MrmlParser` described below. Class description: MrmlParser handles the parsing of a MRML file (XML-based) and either changes the paths of the remotely linked files to local directories, or to relative directories. Method signatures and docstrings: - def changeValues(filename, newFilename, ...
06867037842e2a074ae5ed3b0bdf4bf016a231a5
<|skeleton|> class MrmlParser: """MrmlParser handles the parsing of a MRML file (XML-based) and either changes the paths of the remotely linked files to local directories, or to relative directories.""" def changeValues(filename, newFilename, replaceValues, otherReplaceValues, removeOriginalFile=False, debug=T...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MrmlParser: """MrmlParser handles the parsing of a MRML file (XML-based) and either changes the paths of the remotely linked files to local directories, or to relative directories.""" def changeValues(filename, newFilename, replaceValues, otherReplaceValues, removeOriginalFile=False, debug=True): ...
the_stack_v2_python_sparse
XNATSlicer/XnatSlicerLib/utils/SlicerUtils.py
NrgXnat/XNATSlicer
train
4
26fc0086323210d04d7c3eb48e1d51c5bbf009bd
[ "spec = importlib.util.spec_from_file_location('setup', str(AEA_ROOT_DIR / 'setup.py'))\nassert spec\nsetup = importlib.util.module_from_spec(spec)\nsys.modules[spec.name] = setup\nspec.loader.exec_module(setup)\nsections_dependencies = copy.deepcopy(setup.all_extras)\nsections_dependencies.pop('all')\nbase = setup...
<|body_start_0|> spec = importlib.util.spec_from_file_location('setup', str(AEA_ROOT_DIR / 'setup.py')) assert spec setup = importlib.util.module_from_spec(spec) sys.modules[spec.name] = setup spec.loader.exec_module(setup) sections_dependencies = copy.deepcopy(setup.all_...
Tool to check imports in sources match dependencies in setup.py.
CheckTool
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckTool: """Tool to check imports in sources match dependencies in setup.py.""" def get_section_dependencies_from_setup(cls) -> Dict[str, Dict[str, List[Path]]]: """Get sections with dependencies with files lists.""" <|body_0|> def sections_dependencies_add_files(secti...
stack_v2_sparse_classes_75kplus_train_007917
10,606
permissive
[ { "docstring": "Get sections with dependencies with files lists.", "name": "get_section_dependencies_from_setup", "signature": "def get_section_dependencies_from_setup(cls) -> Dict[str, Dict[str, List[Path]]]" }, { "docstring": "Add packages file lists to dependencies in sections.", "name": ...
5
stack_v2_sparse_classes_30k_train_031214
Implement the Python class `CheckTool` described below. Class description: Tool to check imports in sources match dependencies in setup.py. Method signatures and docstrings: - def get_section_dependencies_from_setup(cls) -> Dict[str, Dict[str, List[Path]]]: Get sections with dependencies with files lists. - def secti...
Implement the Python class `CheckTool` described below. Class description: Tool to check imports in sources match dependencies in setup.py. Method signatures and docstrings: - def get_section_dependencies_from_setup(cls) -> Dict[str, Dict[str, List[Path]]]: Get sections with dependencies with files lists. - def secti...
bec49adaeba661d8d0f03ac9935dc89f39d95a0d
<|skeleton|> class CheckTool: """Tool to check imports in sources match dependencies in setup.py.""" def get_section_dependencies_from_setup(cls) -> Dict[str, Dict[str, List[Path]]]: """Get sections with dependencies with files lists.""" <|body_0|> def sections_dependencies_add_files(secti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CheckTool: """Tool to check imports in sources match dependencies in setup.py.""" def get_section_dependencies_from_setup(cls) -> Dict[str, Dict[str, List[Path]]]: """Get sections with dependencies with files lists.""" spec = importlib.util.spec_from_file_location('setup', str(AEA_ROOT_DI...
the_stack_v2_python_sparse
scripts/check_imports_and_dependencies.py
fetchai/agents-aea
train
192
7d596da67bd5973431e3a4e4a99edcba6f78bb2d
[ "instance = parser.add_argument('instance', help='Cloud SQL instance ID.')\ncli = Connect.GetCLIGenerator()\ninstance.completer = remote_completion.RemoteCompletion.GetCompleterForResource('sql.instances', cli)\nparser.add_argument('--user', '-u', required=False, help='Cloud SQL instance user to connect as.')", "...
<|body_start_0|> instance = parser.add_argument('instance', help='Cloud SQL instance ID.') cli = Connect.GetCLIGenerator() instance.completer = remote_completion.RemoteCompletion.GetCompleterForResource('sql.instances', cli) parser.add_argument('--user', '-u', required=False, help='Cloud...
Connects to a Cloud SQL instance.
Connect
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Connect: """Connects to a Cloud SQL instance.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional arguments are allowe...
stack_v2_sparse_classes_75kplus_train_007918
6,959
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional arguments are allowed.", "name": "Args", "signature": "def Args(parser)" }, { "docstri...
2
stack_v2_sparse_classes_30k_train_009735
Implement the Python class `Connect` described below. Class description: Connects to a Cloud SQL instance. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command...
Implement the Python class `Connect` described below. Class description: Connects to a Cloud SQL instance. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command...
b7f676ab7bd494d71dbb5bda1d6a9094dfaedc0a
<|skeleton|> class Connect: """Connects to a Cloud SQL instance.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional arguments are allowe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Connect: """Connects to a Cloud SQL instance.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional arguments are allowed.""" ...
the_stack_v2_python_sparse
smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/sql/tools/connect.py
wemanuel/smry
train
0
a52197b59eda44c3b937a925affb83433f628d98
[ "super().__init__()\nKp = diagonalize_gain(to_tensor(Kp))\nKd = diagonalize_gain(to_tensor(Kd))\nassert Kp.shape == torch.Size([6, 6])\nassert Kd.shape == torch.Size([6, 6])\nself.Kp = torch.nn.Parameter(Kp)\nself.Kd = torch.nn.Parameter(Kd)\nself.robot_model = robot_model", "ee_pos_current, ee_quat_current = sel...
<|body_start_0|> super().__init__() Kp = diagonalize_gain(to_tensor(Kp)) Kd = diagonalize_gain(to_tensor(Kd)) assert Kp.shape == torch.Size([6, 6]) assert Kd.shape == torch.Size([6, 6]) self.Kp = torch.nn.Parameter(Kp) self.Kd = torch.nn.Parameter(Kd) self...
PD feedback control in operational space. Errors are computed in Cartesian space, then projected back into joint space to compute joint torques. nA is the action dimension and N is the number of degrees of freedom Module parameters: - Kp: P gain matrix of shape (nA, N) - Kd: D gain matrix of shape (nA, N)
OperationalSpacePD
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OperationalSpacePD: """PD feedback control in operational space. Errors are computed in Cartesian space, then projected back into joint space to compute joint torques. nA is the action dimension and N is the number of degrees of freedom Module parameters: - Kp: P gain matrix of shape (nA, N) - Kd...
stack_v2_sparse_classes_75kplus_train_007919
9,060
permissive
[ { "docstring": "Args: Kp: P gain matrix of shape (nA, N) or shape (N,) representing a N-by-N diagonal matrix (if nA=N) Kd: D gain matrix of shape (nA, N) or shape (N,) representing a N-by-N diagonal matrix (if nA=N) robot_model: A valid robot model module from torchcontrol.models", "name": "__init__", "...
2
stack_v2_sparse_classes_30k_train_053716
Implement the Python class `OperationalSpacePD` described below. Class description: PD feedback control in operational space. Errors are computed in Cartesian space, then projected back into joint space to compute joint torques. nA is the action dimension and N is the number of degrees of freedom Module parameters: - ...
Implement the Python class `OperationalSpacePD` described below. Class description: PD feedback control in operational space. Errors are computed in Cartesian space, then projected back into joint space to compute joint torques. nA is the action dimension and N is the number of degrees of freedom Module parameters: - ...
1b2ea8528d4fb9ad72cec9c766be4cbdbdf76f18
<|skeleton|> class OperationalSpacePD: """PD feedback control in operational space. Errors are computed in Cartesian space, then projected back into joint space to compute joint torques. nA is the action dimension and N is the number of degrees of freedom Module parameters: - Kp: P gain matrix of shape (nA, N) - Kd...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OperationalSpacePD: """PD feedback control in operational space. Errors are computed in Cartesian space, then projected back into joint space to compute joint torques. nA is the action dimension and N is the number of degrees of freedom Module parameters: - Kp: P gain matrix of shape (nA, N) - Kd: D gain matr...
the_stack_v2_python_sparse
polymetis/python/torchcontrol/modules/feedback.py
facebookresearch/polymetis
train
44
1bcc30a820d7bc38d7387ab645dfa02320fabb37
[ "self.last_results = []\nself.host = config[CONF_HOST]\nself.username = config[CONF_USERNAME]\nself.password = config[CONF_PASSWORD]\nself.success_init = True\ntry:\n self.fritz_box = FritzHosts(address=self.host, user=self.username, password=self.password)\nexcept (ValueError, TypeError):\n self.fritz_box = ...
<|body_start_0|> self.last_results = [] self.host = config[CONF_HOST] self.username = config[CONF_USERNAME] self.password = config[CONF_PASSWORD] self.success_init = True try: self.fritz_box = FritzHosts(address=self.host, user=self.username, password=self.pas...
This class queries a FRITZ!Box router.
FritzBoxScanner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FritzBoxScanner: """This class queries a FRITZ!Box router.""" def __init__(self, config): """Initialize the scanner.""" <|body_0|> def scan_devices(self): """Scan for new devices and return a list of found device ids.""" <|body_1|> def get_device_nam...
stack_v2_sparse_classes_75kplus_train_007920
3,266
permissive
[ { "docstring": "Initialize the scanner.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Scan for new devices and return a list of found device ids.", "name": "scan_devices", "signature": "def scan_devices(self)" }, { "docstring": "Return the nam...
5
stack_v2_sparse_classes_30k_train_030811
Implement the Python class `FritzBoxScanner` described below. Class description: This class queries a FRITZ!Box router. Method signatures and docstrings: - def __init__(self, config): Initialize the scanner. - def scan_devices(self): Scan for new devices and return a list of found device ids. - def get_device_name(se...
Implement the Python class `FritzBoxScanner` described below. Class description: This class queries a FRITZ!Box router. Method signatures and docstrings: - def __init__(self, config): Initialize the scanner. - def scan_devices(self): Scan for new devices and return a list of found device ids. - def get_device_name(se...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class FritzBoxScanner: """This class queries a FRITZ!Box router.""" def __init__(self, config): """Initialize the scanner.""" <|body_0|> def scan_devices(self): """Scan for new devices and return a list of found device ids.""" <|body_1|> def get_device_nam...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FritzBoxScanner: """This class queries a FRITZ!Box router.""" def __init__(self, config): """Initialize the scanner.""" self.last_results = [] self.host = config[CONF_HOST] self.username = config[CONF_USERNAME] self.password = config[CONF_PASSWORD] self.suc...
the_stack_v2_python_sparse
homeassistant/components/fritz/device_tracker.py
tchellomello/home-assistant
train
8
11955f5dff75c8df0908e72a0a0e978d8254355b
[ "coins.sort()\ndp = [1] + [0] * amount\nfor c in coins:\n for i in range(c, amount + 1):\n if dp[i - c]:\n dp[i] += dp[i - c]\nreturn dp[-1]", "dp = [0] * (amount + 1)\ndp[0] = 1\nfor i in coins:\n for j in range(1, amount + 1):\n if j >= i:\n dp[j] += dp[j - i]\nreturn d...
<|body_start_0|> coins.sort() dp = [1] + [0] * amount for c in coins: for i in range(c, amount + 1): if dp[i - c]: dp[i] += dp[i - c] return dp[-1] <|end_body_0|> <|body_start_1|> dp = [0] * (amount + 1) dp[0] = 1 f...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int beats 93.06%""" <|body_0|> def change0(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int https://leetcode.com/problems/coin-change-2/discuss...
stack_v2_sparse_classes_75kplus_train_007921
3,013
no_license
[ { "docstring": ":type amount: int :type coins: List[int] :rtype: int beats 93.06%", "name": "change", "signature": "def change(self, amount, coins)" }, { "docstring": ":type amount: int :type coins: List[int] :rtype: int https://leetcode.com/problems/coin-change-2/discuss/99210/python-O(n)-space...
5
stack_v2_sparse_classes_30k_train_005185
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int beats 93.06% - def change0(self, amount, coins): :type amount: int :type coins: List[int] :r...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int beats 93.06% - def change0(self, amount, coins): :type amount: int :type coins: List[int] :r...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int beats 93.06%""" <|body_0|> def change0(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int https://leetcode.com/problems/coin-change-2/discuss...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int beats 93.06%""" coins.sort() dp = [1] + [0] * amount for c in coins: for i in range(c, amount + 1): if dp[i - c]: dp[i] += dp[i - c...
the_stack_v2_python_sparse
LeetCode/518_coin_change_2.py
yao23/Machine_Learning_Playground
train
12
cf9ec76dac9fbe5f467fb8b66415d108fe7eb25e
[ "mes = {'message': 'success'}\nproduct_name = kwargs.get('product_name', '')\nspecification = kwargs.get('specification', '')\nnet_contents = kwargs.get('net_contents', '')\npackage_ratio = kwargs.get('package_ratio', '')\ndb_client = orm_module.get_client()\nw = orm_module.get_write_concern()\ncol = orm_module.get...
<|body_start_0|> mes = {'message': 'success'} product_name = kwargs.get('product_name', '') specification = kwargs.get('specification', '') net_contents = kwargs.get('net_contents', '') package_ratio = kwargs.get('package_ratio', '') db_client = orm_module.get_client() ...
公司产品信息
Product
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Product: """公司产品信息""" def add(cls, **kwargs) -> dict: """添加产品 :param kwargs: :return:""" <|body_0|> def selector_data(cls, filter_dict: dict=None) -> dict: """获取产品的选择器 :param filter_dict: 查询字典,None表示查询第一级 :return: 每一级别的查询方式如下: 第一级: None 返回{product_name:_id} 第二级: ...
stack_v2_sparse_classes_75kplus_train_007922
27,644
no_license
[ { "docstring": "添加产品 :param kwargs: :return:", "name": "add", "signature": "def add(cls, **kwargs) -> dict" }, { "docstring": "获取产品的选择器 :param filter_dict: 查询字典,None表示查询第一级 :return: 每一级别的查询方式如下: 第一级: None 返回{product_name:_id} 第二级: {\"product_name\": product_name} 返回{specification:_id} 第三级: {\"sp...
2
stack_v2_sparse_classes_30k_train_050401
Implement the Python class `Product` described below. Class description: 公司产品信息 Method signatures and docstrings: - def add(cls, **kwargs) -> dict: 添加产品 :param kwargs: :return: - def selector_data(cls, filter_dict: dict=None) -> dict: 获取产品的选择器 :param filter_dict: 查询字典,None表示查询第一级 :return: 每一级别的查询方式如下: 第一级: None 返回{pr...
Implement the Python class `Product` described below. Class description: 公司产品信息 Method signatures and docstrings: - def add(cls, **kwargs) -> dict: 添加产品 :param kwargs: :return: - def selector_data(cls, filter_dict: dict=None) -> dict: 获取产品的选择器 :param filter_dict: 查询字典,None表示查询第一级 :return: 每一级别的查询方式如下: 第一级: None 返回{pr...
3a2bdfd1598bfcdfe56386ec0c46fcede772cbfe
<|skeleton|> class Product: """公司产品信息""" def add(cls, **kwargs) -> dict: """添加产品 :param kwargs: :return:""" <|body_0|> def selector_data(cls, filter_dict: dict=None) -> dict: """获取产品的选择器 :param filter_dict: 查询字典,None表示查询第一级 :return: 每一级别的查询方式如下: 第一级: None 返回{product_name:_id} 第二级: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Product: """公司产品信息""" def add(cls, **kwargs) -> dict: """添加产品 :param kwargs: :return:""" mes = {'message': 'success'} product_name = kwargs.get('product_name', '') specification = kwargs.get('specification', '') net_contents = kwargs.get('net_contents', '') ...
the_stack_v2_python_sparse
query_server/module/system_module.py
SYYDSN/py_projects
train
0
d31134d6d03f1a33bffb33e259ea0347f0e0f75b
[ "HTTPBasicAuthHandler.__init__(self, *args, **kwargs)\nself._tried_login = False\nself._otp_token_method = None\nself._otp_token_attempts = 0\nself._last_otp_token = None", "otp_header = headers.get(self.OTP_TOKEN_HEADER, '')\nif otp_header and otp_header.startswith('required'):\n try:\n self._otp_token...
<|body_start_0|> HTTPBasicAuthHandler.__init__(self, *args, **kwargs) self._tried_login = False self._otp_token_method = None self._otp_token_attempts = 0 self._last_otp_token = None <|end_body_0|> <|body_start_1|> otp_header = headers.get(self.OTP_TOKEN_HEADER, '') ...
Custom Basic Auth handler that doesn't retry excessively. urllib's HTTPBasicAuthHandler retries over and over, which is useless. This subclass only retries once to make sure we've attempted with a valid username and password. It will then fail so we can use our own retry handler. This also supports two-factor auth, for...
ReviewBoardHTTPBasicAuthHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReviewBoardHTTPBasicAuthHandler: """Custom Basic Auth handler that doesn't retry excessively. urllib's HTTPBasicAuthHandler retries over and over, which is useless. This subclass only retries once to make sure we've attempted with a valid username and password. It will then fail so we can use our...
stack_v2_sparse_classes_75kplus_train_007923
29,345
permissive
[ { "docstring": "Initialize the Basic Auth handler. Args: *args (tuple): Positional arguments to pass to the parent class. **kwargs (dict): Keyword arguments to pass to the parent class.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Handle an HTTP 401...
3
stack_v2_sparse_classes_30k_val_002310
Implement the Python class `ReviewBoardHTTPBasicAuthHandler` described below. Class description: Custom Basic Auth handler that doesn't retry excessively. urllib's HTTPBasicAuthHandler retries over and over, which is useless. This subclass only retries once to make sure we've attempted with a valid username and passwo...
Implement the Python class `ReviewBoardHTTPBasicAuthHandler` described below. Class description: Custom Basic Auth handler that doesn't retry excessively. urllib's HTTPBasicAuthHandler retries over and over, which is useless. This subclass only retries once to make sure we've attempted with a valid username and passwo...
b106c84c274c59f7944ba5bf7706d865c78a3408
<|skeleton|> class ReviewBoardHTTPBasicAuthHandler: """Custom Basic Auth handler that doesn't retry excessively. urllib's HTTPBasicAuthHandler retries over and over, which is useless. This subclass only retries once to make sure we've attempted with a valid username and password. It will then fail so we can use our...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReviewBoardHTTPBasicAuthHandler: """Custom Basic Auth handler that doesn't retry excessively. urllib's HTTPBasicAuthHandler retries over and over, which is useless. This subclass only retries once to make sure we've attempted with a valid username and password. It will then fail so we can use our own retry ha...
the_stack_v2_python_sparse
rbtools/api/request.py
anirudha-banerjee/rbtools
train
1
f949fc333ddf0261a6ebdea764012c8f43904cb1
[ "if not root:\n return []\nq = deque()\nq.append(root)\nserial = []\nwhile len(q) != 0:\n node = q.popleft()\n if node:\n serial.append(node.val)\n q.append(node.left)\n q.append(node.right)\n else:\n serial.append(None)\nwhile serial[-1] == None:\n serial.pop()\nreturn se...
<|body_start_0|> if not root: return [] q = deque() q.append(root) serial = [] while len(q) != 0: node = q.popleft() if node: serial.append(node.val) q.append(node.left) q.append(node.right) ...
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_007924
2,370
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_000618
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:...
1f7af97bf2e42fc1fe87f31bf0af159dc76486fa
<|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 [] q = deque() q.append(root) serial = [] while len(q) != 0: node = q.popleft() if node: ...
the_stack_v2_python_sparse
数据结构/二叉树的序列化和反序列化.py
zhangler1/leetcodepractice
train
2
bb564f6309a38947826166466425d37f98ffaa2d
[ "params = {'airport': 'EGKK', 'howMany': 15, 'filter': 'airline', 'offset': 15}\nclient = FlightClient()\nclient.get_live_request('Enroute', params)", "params = {'airport': 'EGKK', 'howMany': 15, 'filter': 'airline', 'offset': 15}\nclient = FlightClient()\nclient.get_live_request('Arrived', params)", "params = ...
<|body_start_0|> params = {'airport': 'EGKK', 'howMany': 15, 'filter': 'airline', 'offset': 15} client = FlightClient() client.get_live_request('Enroute', params) <|end_body_0|> <|body_start_1|> params = {'airport': 'EGKK', 'howMany': 15, 'filter': 'airline', 'offset': 15} clien...
def test_json_client_makes_a_test_enroute_request(self): client = FlightClient() client.get_test_request('Enroute') self.assertEqual(len(client.request), 15) def test_json_client_makes_a_test_data_request(self): client = FlightClient() client.get_test_request('Enroute') self.assertEqual(len(client.request), 15) def tes...
FlightClientTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlightClientTest: """def test_json_client_makes_a_test_enroute_request(self): client = FlightClient() client.get_test_request('Enroute') self.assertEqual(len(client.request), 15) def test_json_client_makes_a_test_data_request(self): client = FlightClient() client.get_test_request('Enroute') self....
stack_v2_sparse_classes_75kplus_train_007925
4,252
no_license
[ { "docstring": "Request data is obtained from file server. Use with caution to avoid unnecessary costs.", "name": "test_json_client_makes_a_live_enroute_request", "signature": "def test_json_client_makes_a_live_enroute_request(self)" }, { "docstring": "Request data is obtained from file server. ...
4
null
Implement the Python class `FlightClientTest` described below. Class description: def test_json_client_makes_a_test_enroute_request(self): client = FlightClient() client.get_test_request('Enroute') self.assertEqual(len(client.request), 15) def test_json_client_makes_a_test_data_request(self): client = FlightClient() c...
Implement the Python class `FlightClientTest` described below. Class description: def test_json_client_makes_a_test_enroute_request(self): client = FlightClient() client.get_test_request('Enroute') self.assertEqual(len(client.request), 15) def test_json_client_makes_a_test_data_request(self): client = FlightClient() c...
b1eb31e8915040ecd1220302f84e2f7319419e97
<|skeleton|> class FlightClientTest: """def test_json_client_makes_a_test_enroute_request(self): client = FlightClient() client.get_test_request('Enroute') self.assertEqual(len(client.request), 15) def test_json_client_makes_a_test_data_request(self): client = FlightClient() client.get_test_request('Enroute') self....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FlightClientTest: """def test_json_client_makes_a_test_enroute_request(self): client = FlightClient() client.get_test_request('Enroute') self.assertEqual(len(client.request), 15) def test_json_client_makes_a_test_data_request(self): client = FlightClient() client.get_test_request('Enroute') self.assertEqual(l...
the_stack_v2_python_sparse
flights/data/tests.py
dave-caputo/flights-app
train
0
50c2974d7e18fdb0f8b7c577f03c79e9bcf642ad
[ "inferred_data = json.loads(self.request.body)\nraw_data = model.RRCInferenceRawData()\nraw_data.phone_id = util.HashDeviceId(str(inferred_data['phone_id']))\nraw_data.test_id = inferred_data['test_id']\nraw_data.network_type = inferred_data['network_type']\nraw_data.rtt_low = inferred_data['rtt_low']\nraw_data.rtt...
<|body_start_0|> inferred_data = json.loads(self.request.body) raw_data = model.RRCInferenceRawData() raw_data.phone_id = util.HashDeviceId(str(inferred_data['phone_id'])) raw_data.test_id = inferred_data['test_id'] raw_data.network_type = inferred_data['network_type'] ra...
Interact with RRC-related data stored in the database
RRCStates
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RRCStates: """Interact with RRC-related data stored in the database""" def uploadRRCInference(self, **unused_args): """Handler for uploadRRCInference request generated from client. Take the results of the RRC inference tasks and store them in the database. Note that this is the resul...
stack_v2_sparse_classes_75kplus_train_007926
4,420
permissive
[ { "docstring": "Handler for uploadRRCInference request generated from client. Take the results of the RRC inference tasks and store them in the database. Note that this is the result of *one* test, i.e. one sequence of three packets sent. A set of tests with varying inter-packet intervals can be identified by a...
2
stack_v2_sparse_classes_30k_train_043024
Implement the Python class `RRCStates` described below. Class description: Interact with RRC-related data stored in the database Method signatures and docstrings: - def uploadRRCInference(self, **unused_args): Handler for uploadRRCInference request generated from client. Take the results of the RRC inference tasks an...
Implement the Python class `RRCStates` described below. Class description: Interact with RRC-related data stored in the database Method signatures and docstrings: - def uploadRRCInference(self, **unused_args): Handler for uploadRRCInference request generated from client. Take the results of the RRC inference tasks an...
9277f9e0623eafe9a2f2cd387f3a2f0dfa9b94ba
<|skeleton|> class RRCStates: """Interact with RRC-related data stored in the database""" def uploadRRCInference(self, **unused_args): """Handler for uploadRRCInference request generated from client. Take the results of the RRC inference tasks and store them in the database. Note that this is the resul...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RRCStates: """Interact with RRC-related data stored in the database""" def uploadRRCInference(self, **unused_args): """Handler for uploadRRCInference request generated from client. Take the results of the RRC inference tasks and store them in the database. Note that this is the result of *one* te...
the_stack_v2_python_sparse
server/gspeedometer/controllers/RRCstates.py
Bugbustrs/bugb-mobiperf
train
0
11d7ad0146b63656733bc07d42cab8febb365031
[ "super().__init__()\nout_channels = channels * self.expansion\nif cardinality == 1:\n rc = channels\nelse:\n width_ratio = channels * (width / self.start_filts)\n rc = cardinality * math.floor(width_ratio)\nself.conv_reduce = ConvNd(n_dim, in_channels, rc, kernel_size=1, stride=1, padding=0, bias=False)\ns...
<|body_start_0|> super().__init__() out_channels = channels * self.expansion if cardinality == 1: rc = channels else: width_ratio = channels * (width / self.start_filts) rc = cardinality * math.floor(width_ratio) self.conv_reduce = ConvNd(n_dim...
_BottleneckX
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _BottleneckX: def __init__(self, in_channels: int, channels: int, stride: Union[int, Sequence[int]], cardinality: int, width: int, n_dim: int, norm_layer: str): """Parameters ---------- in_channels : int number of input channels stride : int stride of 3x3 convolution layer cardinality : ...
stack_v2_sparse_classes_75kplus_train_007927
12,047
permissive
[ { "docstring": "Parameters ---------- in_channels : int number of input channels stride : int stride of 3x3 convolution layer cardinality : int number of convolution groups width : int width of resnext block n_dim : int dimensionality of convolutions norm_layer: str type of normalization layer", "name": "__...
2
stack_v2_sparse_classes_30k_train_045255
Implement the Python class `_BottleneckX` described below. Class description: Implement the _BottleneckX class. Method signatures and docstrings: - def __init__(self, in_channels: int, channels: int, stride: Union[int, Sequence[int]], cardinality: int, width: int, n_dim: int, norm_layer: str): Parameters ---------- i...
Implement the Python class `_BottleneckX` described below. Class description: Implement the _BottleneckX class. Method signatures and docstrings: - def __init__(self, in_channels: int, channels: int, stride: Union[int, Sequence[int]], cardinality: int, width: int, n_dim: int, norm_layer: str): Parameters ---------- i...
1078f5030b8aac2bf022daf5fa14d66f74c3c893
<|skeleton|> class _BottleneckX: def __init__(self, in_channels: int, channels: int, stride: Union[int, Sequence[int]], cardinality: int, width: int, n_dim: int, norm_layer: str): """Parameters ---------- in_channels : int number of input channels stride : int stride of 3x3 convolution layer cardinality : ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _BottleneckX: def __init__(self, in_channels: int, channels: int, stride: Union[int, Sequence[int]], cardinality: int, width: int, n_dim: int, norm_layer: str): """Parameters ---------- in_channels : int number of input channels stride : int stride of 3x3 convolution layer cardinality : int number of ...
the_stack_v2_python_sparse
dlutils/models/resnext.py
justusschock/dl-utils
train
15
437ca40fffb85b10b39af2d4bceceec0b99a41b5
[ "threading.Thread.__init__(self)\nself.opc_client = Client('opc.tcp://10.0.0.57:4048')\nself.opc_client.connect()\nself.initiate_nodes()", "self.temp_value = self.opc_client.get_node('ns=2; s=\"Room_Temperature\"')\nself.hum_value = self.opc_client.get_node('ns=2; s=\"Room_Humidity\"')\nself.flux_value = self.opc...
<|body_start_0|> threading.Thread.__init__(self) self.opc_client = Client('opc.tcp://10.0.0.57:4048') self.opc_client.connect() self.initiate_nodes() <|end_body_0|> <|body_start_1|> self.temp_value = self.opc_client.get_node('ns=2; s="Room_Temperature"') self.hum_value =...
OPC_Client_Rpi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OPC_Client_Rpi: def __init__(self): """* Module constructor function that connects OPC client at Raspberry pi with OPC Server""" <|body_0|> def initiate_nodes(self): """* Connecting with nodes created at OPC Server for continuous data exchange""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_007928
2,354
no_license
[ { "docstring": "* Module constructor function that connects OPC client at Raspberry pi with OPC Server", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "* Connecting with nodes created at OPC Server for continuous data exchange", "name": "initiate_nodes", "signat...
3
stack_v2_sparse_classes_30k_train_047310
Implement the Python class `OPC_Client_Rpi` described below. Class description: Implement the OPC_Client_Rpi class. Method signatures and docstrings: - def __init__(self): * Module constructor function that connects OPC client at Raspberry pi with OPC Server - def initiate_nodes(self): * Connecting with nodes created...
Implement the Python class `OPC_Client_Rpi` described below. Class description: Implement the OPC_Client_Rpi class. Method signatures and docstrings: - def __init__(self): * Module constructor function that connects OPC client at Raspberry pi with OPC Server - def initiate_nodes(self): * Connecting with nodes created...
f704b53b7db099f7dffb9d6df05468a28e56d332
<|skeleton|> class OPC_Client_Rpi: def __init__(self): """* Module constructor function that connects OPC client at Raspberry pi with OPC Server""" <|body_0|> def initiate_nodes(self): """* Connecting with nodes created at OPC Server for continuous data exchange""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OPC_Client_Rpi: def __init__(self): """* Module constructor function that connects OPC client at Raspberry pi with OPC Server""" threading.Thread.__init__(self) self.opc_client = Client('opc.tcp://10.0.0.57:4048') self.opc_client.connect() self.initiate_nodes() def...
the_stack_v2_python_sparse
module09/OPC_Client_Rpi.py
naveenORT/Remote-Electrical-Substation-Monitoring
train
0
f722550f336ff81adaf66fadbd5b8bd4b6a0d5d6
[ "blog = self.client.get(reverse('blog:list'))\nself.assertEqual(blog.status_code, 200)\nself.assertContains(blog, 'No posts have been written yet!')\nself.assertQuerysetEqual(blog.context['posts'], [])", "draft_post = create_post(title='Draft Post', text='This is a draft post', days=None, status='D')\nblog = self...
<|body_start_0|> blog = self.client.get(reverse('blog:list')) self.assertEqual(blog.status_code, 200) self.assertContains(blog, 'No posts have been written yet!') self.assertQuerysetEqual(blog.context['posts'], []) <|end_body_0|> <|body_start_1|> draft_post = create_post(title='...
PostIndexViewTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostIndexViewTests: def test_no_posts(self): """If no posts exist, display an appropriate message""" <|body_0|> def test_draft_post(self): """If a post is a draft, it shouldn't appear in the post list and the slug should be a 404""" <|body_1|> def test_u...
stack_v2_sparse_classes_75kplus_train_007929
4,107
permissive
[ { "docstring": "If no posts exist, display an appropriate message", "name": "test_no_posts", "signature": "def test_no_posts(self)" }, { "docstring": "If a post is a draft, it shouldn't appear in the post list and the slug should be a 404", "name": "test_draft_post", "signature": "def te...
6
stack_v2_sparse_classes_30k_train_004744
Implement the Python class `PostIndexViewTests` described below. Class description: Implement the PostIndexViewTests class. Method signatures and docstrings: - def test_no_posts(self): If no posts exist, display an appropriate message - def test_draft_post(self): If a post is a draft, it shouldn't appear in the post ...
Implement the Python class `PostIndexViewTests` described below. Class description: Implement the PostIndexViewTests class. Method signatures and docstrings: - def test_no_posts(self): If no posts exist, display an appropriate message - def test_draft_post(self): If a post is a draft, it shouldn't appear in the post ...
33287005d19287f2851837e38bca974b4e6682bd
<|skeleton|> class PostIndexViewTests: def test_no_posts(self): """If no posts exist, display an appropriate message""" <|body_0|> def test_draft_post(self): """If a post is a draft, it shouldn't appear in the post list and the slug should be a 404""" <|body_1|> def test_u...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PostIndexViewTests: def test_no_posts(self): """If no posts exist, display an appropriate message""" blog = self.client.get(reverse('blog:list')) self.assertEqual(blog.status_code, 200) self.assertContains(blog, 'No posts have been written yet!') self.assertQuerysetEqua...
the_stack_v2_python_sparse
site/blog/tests.py
marcus-crane/site
train
2
5c82cb99e568a7365b0748d3930c8d7e30083d7d
[ "if not A:\n return []\nresult = list(A[0])\nfor colum in A[1:]:\n current = []\n for c in colum:\n if c in result:\n current.append(c)\n result.remove(c)\n result = current\nreturn result", "if not A:\n return []\ndata = {}\nfor d in A[0]:\n data[d] = data.get(d, 0)...
<|body_start_0|> if not A: return [] result = list(A[0]) for colum in A[1:]: current = [] for c in colum: if c in result: current.append(c) result.remove(c) result = current return res...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _commonChars(self, A): """:type A: List[str] :rtype: List[str]""" <|body_0|> def commonChars(self, A): """:type A: List[str] :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not A: return [] resu...
stack_v2_sparse_classes_75kplus_train_007930
1,982
permissive
[ { "docstring": ":type A: List[str] :rtype: List[str]", "name": "_commonChars", "signature": "def _commonChars(self, A)" }, { "docstring": ":type A: List[str] :rtype: List[str]", "name": "commonChars", "signature": "def commonChars(self, A)" } ]
2
stack_v2_sparse_classes_30k_train_000689
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _commonChars(self, A): :type A: List[str] :rtype: List[str] - def commonChars(self, A): :type A: List[str] :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _commonChars(self, A): :type A: List[str] :rtype: List[str] - def commonChars(self, A): :type A: List[str] :rtype: List[str] <|skeleton|> class Solution: def _commonCha...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _commonChars(self, A): """:type A: List[str] :rtype: List[str]""" <|body_0|> def commonChars(self, A): """:type A: 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 _commonChars(self, A): """:type A: List[str] :rtype: List[str]""" if not A: return [] result = list(A[0]) for colum in A[1:]: current = [] for c in colum: if c in result: current.append(c) ...
the_stack_v2_python_sparse
1002.find-common-characters.py
windard/leeeeee
train
0
e06e64d3d73e5503ee8a4e3abfda8784b1a6cf27
[ "url = host + '/api/mart/find'\ndata = {'id': kp_id}\nr = requests.get(url=url, data=data).json()\nout_format('砍价详情:', r)\nreturn r", "url = host + '/api/mart/join'\ndata = {'id': kp_id}\nr = requests.get(url=url, headers=header, params=data).json()\nout_format('参与此砍价活动:', r)\nreturn r", "url = host + '/api/mar...
<|body_start_0|> url = host + '/api/mart/find' data = {'id': kp_id} r = requests.get(url=url, data=data).json() out_format('砍价详情:', r) return r <|end_body_0|> <|body_start_1|> url = host + '/api/mart/join' data = {'id': kp_id} r = requests.get(url=url, he...
定义一个砍价的测试类
Bargain
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bargain: """定义一个砍价的测试类""" def mart_details(self): """砍价详情""" <|body_0|> def join(self): """参与此砍价活动 :param:id:产品id :param:uid:当前用户id(已封装到头部header_s文件的header中)""" <|body_1|> def who_list(self): """我的砍价列表 :param:uid:当前用户ID,(此处直接传UID即可,暂不用TOKEN,没...
stack_v2_sparse_classes_75kplus_train_007931
3,122
no_license
[ { "docstring": "砍价详情", "name": "mart_details", "signature": "def mart_details(self)" }, { "docstring": "参与此砍价活动 :param:id:产品id :param:uid:当前用户id(已封装到头部header_s文件的header中)", "name": "join", "signature": "def join(self)" }, { "docstring": "我的砍价列表 :param:uid:当前用户ID,(此处直接传UID即可,暂不用TO...
5
null
Implement the Python class `Bargain` described below. Class description: 定义一个砍价的测试类 Method signatures and docstrings: - def mart_details(self): 砍价详情 - def join(self): 参与此砍价活动 :param:id:产品id :param:uid:当前用户id(已封装到头部header_s文件的header中) - def who_list(self): 我的砍价列表 :param:uid:当前用户ID,(此处直接传UID即可,暂不用TOKEN,没有重要数据,无关紧要) :pa...
Implement the Python class `Bargain` described below. Class description: 定义一个砍价的测试类 Method signatures and docstrings: - def mart_details(self): 砍价详情 - def join(self): 参与此砍价活动 :param:id:产品id :param:uid:当前用户id(已封装到头部header_s文件的header中) - def who_list(self): 我的砍价列表 :param:uid:当前用户ID,(此处直接传UID即可,暂不用TOKEN,没有重要数据,无关紧要) :pa...
0ebaae335de2f1633e31c4fc3f60e556220a8bfb
<|skeleton|> class Bargain: """定义一个砍价的测试类""" def mart_details(self): """砍价详情""" <|body_0|> def join(self): """参与此砍价活动 :param:id:产品id :param:uid:当前用户id(已封装到头部header_s文件的header中)""" <|body_1|> def who_list(self): """我的砍价列表 :param:uid:当前用户ID,(此处直接传UID即可,暂不用TOKEN,没...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Bargain: """定义一个砍价的测试类""" def mart_details(self): """砍价详情""" url = host + '/api/mart/find' data = {'id': kp_id} r = requests.get(url=url, data=data).json() out_format('砍价详情:', r) return r def join(self): """参与此砍价活动 :param:id:产品id :param:uid:当前用...
the_stack_v2_python_sparse
Atle/interface/framework/base/bargain.py
shiqi0128/My_scripts
train
0
5dae4251d4c02a798880f85493ba9593ea1f4a96
[ "self.lst = head\nself.length = 0\nwhile head != None:\n self.length, head = (self.length + 1, head.next)", "pos = random.randint(0, self.length - 1)\nnew_head = self.lst\nwhile pos > 0:\n new_head, pos = (new_head.next, pos - 1)\nreturn new_head.val" ]
<|body_start_0|> self.lst = head self.length = 0 while head != None: self.length, head = (self.length + 1, head.next) <|end_body_0|> <|body_start_1|> pos = random.randint(0, self.length - 1) new_head = self.lst while pos > 0: new_head, pos = (new_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int""" ...
stack_v2_sparse_classes_75kplus_train_007932
930
no_license
[ { "docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode", "name": "__init__", "signature": "def __init__(self, head)" }, { "docstring": "Returns a random node's value. :rtype: int", "name": "g...
2
stack_v2_sparse_classes_30k_train_026983
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
2418b3eed1ab85cfd9cac039c6cfdc1a349ad345
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" self.lst = head self.length = 0 while head != None: self.length, head = (self.length...
the_stack_v2_python_sparse
leetcode-first_time/leetcode382(Linked List Random Node)_random.py
HopeCheung/leetcode
train
0
a6baefee293177b5f32bb3be0ade3a0113d477b4
[ "p = self.codomain().base_ring().order()\nN = self.codomain().ambient_space().dimension_relative()\nreturn sum((hash(self[i]) * p ** i for i in range(N)))", "Orbit = []\nindex = 1\nP = self\nwhile not P in Orbit:\n Orbit.append(P)\n P = f(P)\n index += 1\nI = Orbit.index(P)\nreturn [I, index - I - 1]" ]
<|body_start_0|> p = self.codomain().base_ring().order() N = self.codomain().ambient_space().dimension_relative() return sum((hash(self[i]) * p ** i for i in range(N))) <|end_body_0|> <|body_start_1|> Orbit = [] index = 1 P = self while not P in Orbit: ...
SchemeMorphism_point_affine_finite_field
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchemeMorphism_point_affine_finite_field: def __hash__(self): """Returns the integer hash of the point. OUTPUT: Integer. EXAMPLES:: sage: P.<x,y,z> = AffineSpace(GF(5), 3) sage: hash(P(2, 1, 2)) 57 :: sage: P.<x,y,z> = AffineSpace(GF(7), 3) sage: X = P.subscheme(x^2-y^2) sage: hash(X(1, ...
stack_v2_sparse_classes_75kplus_train_007933
15,505
no_license
[ { "docstring": "Returns the integer hash of the point. OUTPUT: Integer. EXAMPLES:: sage: P.<x,y,z> = AffineSpace(GF(5), 3) sage: hash(P(2, 1, 2)) 57 :: sage: P.<x,y,z> = AffineSpace(GF(7), 3) sage: X = P.subscheme(x^2-y^2) sage: hash(X(1, 1, 2)) 106 :: sage: P.<x,y> = AffineSpace(GF(13), 2) sage: hash(P(3, 4)) ...
2
stack_v2_sparse_classes_30k_train_016723
Implement the Python class `SchemeMorphism_point_affine_finite_field` described below. Class description: Implement the SchemeMorphism_point_affine_finite_field class. Method signatures and docstrings: - def __hash__(self): Returns the integer hash of the point. OUTPUT: Integer. EXAMPLES:: sage: P.<x,y,z> = AffineSpa...
Implement the Python class `SchemeMorphism_point_affine_finite_field` described below. Class description: Implement the SchemeMorphism_point_affine_finite_field class. Method signatures and docstrings: - def __hash__(self): Returns the integer hash of the point. OUTPUT: Integer. EXAMPLES:: sage: P.<x,y,z> = AffineSpa...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class SchemeMorphism_point_affine_finite_field: def __hash__(self): """Returns the integer hash of the point. OUTPUT: Integer. EXAMPLES:: sage: P.<x,y,z> = AffineSpace(GF(5), 3) sage: hash(P(2, 1, 2)) 57 :: sage: P.<x,y,z> = AffineSpace(GF(7), 3) sage: X = P.subscheme(x^2-y^2) sage: hash(X(1, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SchemeMorphism_point_affine_finite_field: def __hash__(self): """Returns the integer hash of the point. OUTPUT: Integer. EXAMPLES:: sage: P.<x,y,z> = AffineSpace(GF(5), 3) sage: hash(P(2, 1, 2)) 57 :: sage: P.<x,y,z> = AffineSpace(GF(7), 3) sage: X = P.subscheme(x^2-y^2) sage: hash(X(1, 1, 2)) 106 :: ...
the_stack_v2_python_sparse
sage/src/sage/schemes/affine/affine_point.py
bopopescu/geosci
train
0
0b492b71a35ba32da19b45acf5f03baec3023ec3
[ "super().__init__(game, x, y, 'SPEEDUP')\nself.picker = None\nself.picked_at = 0\nself.picker_speed = 0\nself.picker_max_speed = 0", "self.item_group.remove(self)\nself.rect = pygame.Rect(-1000, -1000, 0, 0)\nspeed_up = ITEMS['SPEEDUP']['SPEED']\nself.picker = picker\nself.picker_speed = picker.speed\nself.picker...
<|body_start_0|> super().__init__(game, x, y, 'SPEEDUP') self.picker = None self.picked_at = 0 self.picker_speed = 0 self.picker_max_speed = 0 <|end_body_0|> <|body_start_1|> self.item_group.remove(self) self.rect = pygame.Rect(-1000, -1000, 0, 0) speed_u...
SpeedUp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpeedUp: def __init__(self, game, x, y): """Speed up increases player's speed for a few seconds, then returns it back to regular speed, so it needs to store original values and when it was picked""" <|body_0|> def picked_by(self, picker): """Once picked we remove fro...
stack_v2_sparse_classes_75kplus_train_007934
10,333
no_license
[ { "docstring": "Speed up increases player's speed for a few seconds, then returns it back to regular speed, so it needs to store original values and when it was picked", "name": "__init__", "signature": "def __init__(self, game, x, y)" }, { "docstring": "Once picked we remove from items group - ...
3
stack_v2_sparse_classes_30k_train_004792
Implement the Python class `SpeedUp` described below. Class description: Implement the SpeedUp class. Method signatures and docstrings: - def __init__(self, game, x, y): Speed up increases player's speed for a few seconds, then returns it back to regular speed, so it needs to store original values and when it was pic...
Implement the Python class `SpeedUp` described below. Class description: Implement the SpeedUp class. Method signatures and docstrings: - def __init__(self, game, x, y): Speed up increases player's speed for a few seconds, then returns it back to regular speed, so it needs to store original values and when it was pic...
349367254f85e3e4273cede067ca950913a1332c
<|skeleton|> class SpeedUp: def __init__(self, game, x, y): """Speed up increases player's speed for a few seconds, then returns it back to regular speed, so it needs to store original values and when it was picked""" <|body_0|> def picked_by(self, picker): """Once picked we remove fro...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpeedUp: def __init__(self, game, x, y): """Speed up increases player's speed for a few seconds, then returns it back to regular speed, so it needs to store original values and when it was picked""" super().__init__(game, x, y, 'SPEEDUP') self.picker = None self.picked_at = 0 ...
the_stack_v2_python_sparse
11-videogames/Referencia/11-Items/sprites.py
pythoncanarias/eoi
train
26
34bd14745ee405713abcf63a74837d4c52a05538
[ "if not email_messages:\n return\nself._lock.acquire()\ntry:\n try:\n stream_created = self.open()\n for message in email_messages:\n self.stream.write(message.body.encode('utf-8'))\n self.stream.flush()\n if stream_created:\n self.close()\n except:\n ...
<|body_start_0|> if not email_messages: return self._lock.acquire() try: try: stream_created = self.open() for message in email_messages: self.stream.write(message.body.encode('utf-8')) self.stream.fl...
EmailBackend
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailBackend: def send_messages(self, email_messages): """Write all messages to the stream in a thread-safe way.""" <|body_0|> def _get_filename(self): """Return a unique file name.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not email_messag...
stack_v2_sparse_classes_75kplus_train_007935
1,336
no_license
[ { "docstring": "Write all messages to the stream in a thread-safe way.", "name": "send_messages", "signature": "def send_messages(self, email_messages)" }, { "docstring": "Return a unique file name.", "name": "_get_filename", "signature": "def _get_filename(self)" } ]
2
stack_v2_sparse_classes_30k_train_031589
Implement the Python class `EmailBackend` described below. Class description: Implement the EmailBackend class. Method signatures and docstrings: - def send_messages(self, email_messages): Write all messages to the stream in a thread-safe way. - def _get_filename(self): Return a unique file name.
Implement the Python class `EmailBackend` described below. Class description: Implement the EmailBackend class. Method signatures and docstrings: - def send_messages(self, email_messages): Write all messages to the stream in a thread-safe way. - def _get_filename(self): Return a unique file name. <|skeleton|> class ...
7c3acc39a24c38ae2ee06b71104a24cfbbde8453
<|skeleton|> class EmailBackend: def send_messages(self, email_messages): """Write all messages to the stream in a thread-safe way.""" <|body_0|> def _get_filename(self): """Return a unique file name.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EmailBackend: def send_messages(self, email_messages): """Write all messages to the stream in a thread-safe way.""" if not email_messages: return self._lock.acquire() try: try: stream_created = self.open() for message in e...
the_stack_v2_python_sparse
project/utils/mail/backends/htmlfiles.py
chrisblythe812/gamemine
train
1
b3abd0e7231c934c8b477173808c06c117ba3493
[ "if type(num_nodes) is int:\n max_d = 15\n nnodes = num_nodes\nelse:\n if type(num_nodes) is not tuple:\n raise ParameterError('Expecting int or tuple for num_nodes parameter, got %s' % type(num_nodes))\n if len(num_nodes) != 2:\n raise ParameterError('Expecting 1 or 2 arguments for num_no...
<|body_start_0|> if type(num_nodes) is int: max_d = 15 nnodes = num_nodes else: if type(num_nodes) is not tuple: raise ParameterError('Expecting int or tuple for num_nodes parameter, got %s' % type(num_nodes)) if len(num_nodes) != 2: ...
Implements equidistant nodes with blended barycentric interpolation Attributes: fh_weights: blended FH weights for barycentric interpolation
Equidistant_RDC
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Equidistant_RDC: """Implements equidistant nodes with blended barycentric interpolation Attributes: fh_weights: blended FH weights for barycentric interpolation""" def __init__(self, num_nodes, tleft=0, tright=1, **kwargs): """Initialization Args: num_nodes: number of nodes tleft (fl...
stack_v2_sparse_classes_75kplus_train_007936
5,629
permissive
[ { "docstring": "Initialization Args: num_nodes: number of nodes tleft (float): left interval boundary (usually 0) tright (float): right interval boundary (usually 1)", "name": "__init__", "signature": "def __init__(self, num_nodes, tleft=0, tright=1, **kwargs)" }, { "docstring": "Computes blende...
4
stack_v2_sparse_classes_30k_train_049720
Implement the Python class `Equidistant_RDC` described below. Class description: Implements equidistant nodes with blended barycentric interpolation Attributes: fh_weights: blended FH weights for barycentric interpolation Method signatures and docstrings: - def __init__(self, num_nodes, tleft=0, tright=1, **kwargs): ...
Implement the Python class `Equidistant_RDC` described below. Class description: Implements equidistant nodes with blended barycentric interpolation Attributes: fh_weights: blended FH weights for barycentric interpolation Method signatures and docstrings: - def __init__(self, num_nodes, tleft=0, tright=1, **kwargs): ...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class Equidistant_RDC: """Implements equidistant nodes with blended barycentric interpolation Attributes: fh_weights: blended FH weights for barycentric interpolation""" def __init__(self, num_nodes, tleft=0, tright=1, **kwargs): """Initialization Args: num_nodes: number of nodes tleft (fl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Equidistant_RDC: """Implements equidistant nodes with blended barycentric interpolation Attributes: fh_weights: blended FH weights for barycentric interpolation""" def __init__(self, num_nodes, tleft=0, tright=1, **kwargs): """Initialization Args: num_nodes: number of nodes tleft (float): left in...
the_stack_v2_python_sparse
pySDC/projects/RDC/equidistant_RDC.py
Parallel-in-Time/pySDC
train
30
f567fc172ecb924bb312a1fb3f96e181706792fe
[ "super().__init__()\ncovmat_sqrt = cp.Parameter((n_assets, n_assets))\nrets = cp.Parameter(n_assets)\nalpha = cp.Parameter(nonneg=True)\nw = cp.Variable(n_assets)\nret = rets @ w\nrisk = cp.sum_squares(covmat_sqrt @ w)\nreg = alpha * cp.norm(w) ** 2\nprob = cp.Problem(cp.Maximize(ret - risk - reg), [cp.sum(w) == 1,...
<|body_start_0|> super().__init__() covmat_sqrt = cp.Parameter((n_assets, n_assets)) rets = cp.Parameter(n_assets) alpha = cp.Parameter(nonneg=True) w = cp.Variable(n_assets) ret = rets @ w risk = cp.sum_squares(covmat_sqrt @ w) reg = alpha * cp.norm(w) **...
Convex optimization layer stylized into portfolio optimization problem. Parameters ---------- n_assets : int Number of assets. Attributes ---------- cvxpylayer : CvxpyLayer Custom layer used by a third party package called cvxpylayers. References ---------- [1] https://github.com/cvxgrp/cvxpylayers
NumericalMarkowitz
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumericalMarkowitz: """Convex optimization layer stylized into portfolio optimization problem. Parameters ---------- n_assets : int Number of assets. Attributes ---------- cvxpylayer : CvxpyLayer Custom layer used by a third party package called cvxpylayers. References ---------- [1] https://gith...
stack_v2_sparse_classes_75kplus_train_007937
19,769
permissive
[ { "docstring": "Construct.", "name": "__init__", "signature": "def __init__(self, n_assets, max_weight=1)" }, { "docstring": "Perform forward pass. Parameters ---------- rets : torch.Tensor Of shape (n_samples, n_assets) representing expected returns (or whatever the feature extractor decided to...
2
null
Implement the Python class `NumericalMarkowitz` described below. Class description: Convex optimization layer stylized into portfolio optimization problem. Parameters ---------- n_assets : int Number of assets. Attributes ---------- cvxpylayer : CvxpyLayer Custom layer used by a third party package called cvxpylayers....
Implement the Python class `NumericalMarkowitz` described below. Class description: Convex optimization layer stylized into portfolio optimization problem. Parameters ---------- n_assets : int Number of assets. Attributes ---------- cvxpylayer : CvxpyLayer Custom layer used by a third party package called cvxpylayers....
7c2b243080fea8ebe535f6494ce98d907d71ada9
<|skeleton|> class NumericalMarkowitz: """Convex optimization layer stylized into portfolio optimization problem. Parameters ---------- n_assets : int Number of assets. Attributes ---------- cvxpylayer : CvxpyLayer Custom layer used by a third party package called cvxpylayers. References ---------- [1] https://gith...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumericalMarkowitz: """Convex optimization layer stylized into portfolio optimization problem. Parameters ---------- n_assets : int Number of assets. Attributes ---------- cvxpylayer : CvxpyLayer Custom layer used by a third party package called cvxpylayers. References ---------- [1] https://github.com/cvxgrp...
the_stack_v2_python_sparse
deepdow/layers/allocate.py
rodrigosnader/deepdow
train
1
ce9c034a1a8cca208d23b5ae7f3a721d71178484
[ "corp = CorporationFactory.get()\nlabel_group = corp.product_label_group_repository.get_label_group(args['label_group_id'])\nresult = label_group.add_label(args['label_name'])\nif isinstance(result, basestring):\n return (500, result)\nelse:\n return {'label': {'id': result.id, 'name': result.name, 'label_gro...
<|body_start_0|> corp = CorporationFactory.get() label_group = corp.product_label_group_repository.get_label_group(args['label_group_id']) result = label_group.add_label(args['label_name']) if isinstance(result, basestring): return (500, result) else: retu...
商品标签
AProductLable
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AProductLable: """商品标签""" def put(args): """创建标签""" <|body_0|> def delete(args): """删除标签""" <|body_1|> <|end_skeleton|> <|body_start_0|> corp = CorporationFactory.get() label_group = corp.product_label_group_repository.get_label_group(ar...
stack_v2_sparse_classes_75kplus_train_007938
1,045
no_license
[ { "docstring": "创建标签", "name": "put", "signature": "def put(args)" }, { "docstring": "删除标签", "name": "delete", "signature": "def delete(args)" } ]
2
stack_v2_sparse_classes_30k_train_028958
Implement the Python class `AProductLable` described below. Class description: 商品标签 Method signatures and docstrings: - def put(args): 创建标签 - def delete(args): 删除标签
Implement the Python class `AProductLable` described below. Class description: 商品标签 Method signatures and docstrings: - def put(args): 创建标签 - def delete(args): 删除标签 <|skeleton|> class AProductLable: """商品标签""" def put(args): """创建标签""" <|body_0|> def delete(args): """删除标签""" ...
39860a451678ab50ad93ce8ebe2ef8490af65d62
<|skeleton|> class AProductLable: """商品标签""" def put(args): """创建标签""" <|body_0|> def delete(args): """删除标签""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AProductLable: """商品标签""" def put(args): """创建标签""" corp = CorporationFactory.get() label_group = corp.product_label_group_repository.get_label_group(args['label_group_id']) result = label_group.add_label(args['label_name']) if isinstance(result, basestring): ...
the_stack_v2_python_sparse
api/mall/product_label/a_product_label.py
chengdg/gaia
train
0
bdc0258a196df6980c3249c064d9762e25509ee5
[ "self.extent = width / 2.0\nself.sub = rospy.Subscriber('input_scan', LaserScan, self.filter_scan, queue_size=10)\nself.pub = rospy.Publisher('output_scan', LaserScan, queue_size=10)", "angles = linspace(msg.angle_min, msg.angle_max, len(msg.ranges))\npoints = [r * sin(theta) for r, theta in zip(msg.ranges, angle...
<|body_start_0|> self.extent = width / 2.0 self.sub = rospy.Subscriber('input_scan', LaserScan, self.filter_scan, queue_size=10) self.pub = rospy.Publisher('output_scan', LaserScan, queue_size=10) <|end_body_0|> <|body_start_1|> angles = linspace(msg.angle_min, msg.angle_max, len(msg.ra...
A class that implements a LaserScan filter that removes all of the points that are not in front of the robot.
FrontFilter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FrontFilter: """A class that implements a LaserScan filter that removes all of the points that are not in front of the robot.""" def __init__(self, width): """:param self: The self reference. :param width: The width of the robot.""" <|body_0|> def filter_scan(self, msg):...
stack_v2_sparse_classes_75kplus_train_007939
2,270
permissive
[ { "docstring": ":param self: The self reference. :param width: The width of the robot.", "name": "__init__", "signature": "def __init__(self, width)" }, { "docstring": ":param self: Self reference. :param msg: LaserScan message.", "name": "filter_scan", "signature": "def filter_scan(self...
2
stack_v2_sparse_classes_30k_train_024537
Implement the Python class `FrontFilter` described below. Class description: A class that implements a LaserScan filter that removes all of the points that are not in front of the robot. Method signatures and docstrings: - def __init__(self, width): :param self: The self reference. :param width: The width of the robo...
Implement the Python class `FrontFilter` described below. Class description: A class that implements a LaserScan filter that removes all of the points that are not in front of the robot. Method signatures and docstrings: - def __init__(self, width): :param self: The self reference. :param width: The width of the robo...
0da63ef9a36e174f782c00f56099eb71bc15ca8b
<|skeleton|> class FrontFilter: """A class that implements a LaserScan filter that removes all of the points that are not in front of the robot.""" def __init__(self, width): """:param self: The self reference. :param width: The width of the robot.""" <|body_0|> def filter_scan(self, msg):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FrontFilter: """A class that implements a LaserScan filter that removes all of the points that are not in front of the robot.""" def __init__(self, width): """:param self: The self reference. :param width: The width of the robot.""" self.extent = width / 2.0 self.sub = rospy.Subsc...
the_stack_v2_python_sparse
rob599_hw1_ref/src/front_filter.py
patu0/rob599
train
0
a73fb36f7945463622b46b1a6d8a9458d4831625
[ "def convert(p):\n return str(p.val) + '{' + convert(p.left) + '}{' + convert(p.right) + '}' if p else '$'\nreturn convert(root)", "if data == '$':\n return None\ni = 0\nwhile i < len(data) and data[i] != '{':\n i += 1\nT = TreeNode(int(data[:i]))\nleft_start = i + 1\nleft_no, i = (1, i + 1)\nwhile i < l...
<|body_start_0|> def convert(p): return str(p.val) + '{' + convert(p.left) + '}{' + convert(p.right) + '}' if p else '$' return convert(root) <|end_body_0|> <|body_start_1|> if data == '$': return None i = 0 while i < len(data) and data[i] != '{': ...
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_007940
3,466
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_004241
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:...
78d36486ad4ec2bfb88fd35a5fd7fd4f0003ee97
<|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""" def convert(p): return str(p.val) + '{' + convert(p.left) + '}{' + convert(p.right) + '}' if p else '$' return convert(root) def deserialize(self, data): ...
the_stack_v2_python_sparse
297_serialize&deserializeBT.py
YeahHuang/Leetcode
train
1
54c4e6255daf07af72fd2519815b937a73f09439
[ "self.aws_access_key = aws_access_key\nself.aws_secret_key = aws_secret_key\nself.aws_session_token = aws_session_token\nself.verify = verify\nself.endpoint_url = endpoint_url\nself.cloudwatch = boto3.client('cloudwatch', region_name=region_name, endpoint_url=endpoint_url, aws_access_key_id=aws_access_key, aws_secr...
<|body_start_0|> self.aws_access_key = aws_access_key self.aws_secret_key = aws_secret_key self.aws_session_token = aws_session_token self.verify = verify self.endpoint_url = endpoint_url self.cloudwatch = boto3.client('cloudwatch', region_name=region_name, endpoint_url=e...
Reports processing metrics to CloudWatch.
MetricsSession
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetricsSession: """Reports processing metrics to CloudWatch.""" def __init__(self, endpoint_url: str=None, aws_access_key: str=None, aws_secret_key: str=None, aws_session_token: str=None, region_name: str=None, verify: bool=True) -> None: """Initialize with AWS configuration.""" ...
stack_v2_sparse_classes_75kplus_train_007941
4,000
no_license
[ { "docstring": "Initialize with AWS configuration.", "name": "__init__", "signature": "def __init__(self, endpoint_url: str=None, aws_access_key: str=None, aws_secret_key: str=None, aws_session_token: str=None, region_name: str=None, verify: bool=True) -> None" }, { "docstring": "Put data for a ...
2
stack_v2_sparse_classes_30k_train_014807
Implement the Python class `MetricsSession` described below. Class description: Reports processing metrics to CloudWatch. Method signatures and docstrings: - def __init__(self, endpoint_url: str=None, aws_access_key: str=None, aws_secret_key: str=None, aws_session_token: str=None, region_name: str=None, verify: bool=...
Implement the Python class `MetricsSession` described below. Class description: Reports processing metrics to CloudWatch. Method signatures and docstrings: - def __init__(self, endpoint_url: str=None, aws_access_key: str=None, aws_secret_key: str=None, aws_session_token: str=None, region_name: str=None, verify: bool=...
8cc1431e172b38b85f473e2686c20e0371165dda
<|skeleton|> class MetricsSession: """Reports processing metrics to CloudWatch.""" def __init__(self, endpoint_url: str=None, aws_access_key: str=None, aws_secret_key: str=None, aws_session_token: str=None, region_name: str=None, verify: bool=True) -> None: """Initialize with AWS configuration.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MetricsSession: """Reports processing metrics to CloudWatch.""" def __init__(self, endpoint_url: str=None, aws_access_key: str=None, aws_secret_key: str=None, aws_session_token: str=None, region_name: str=None, verify: bool=True) -> None: """Initialize with AWS configuration.""" self.aws_...
the_stack_v2_python_sparse
fulltext/services/metrics.py
CornellCAC/arxiv-fulltext
train
0
9f79f26badca04ddf1a3cbdbaa307bab41e2e4d4
[ "if hdl[:5] == 'xxxxx':\n self.msg = self.dh.hh[hdl]\nelse:\n if url == None:\n thisid = hdl.replace('hdl:999999', '10876.test')\n if thisid[:4] == 'hdl:':\n thisid = thisid[4:]\n url = self.htmpl % thisid\n self.fetch(url)", "try:\n fh = request.urlopen(url)\n self....
<|body_start_0|> if hdl[:5] == 'xxxxx': self.msg = self.dh.hh[hdl] else: if url == None: thisid = hdl.replace('hdl:999999', '10876.test') if thisid[:4] == 'hdl:': thisid = thisid[4:] url = self.htmpl % thisid ...
Remote
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Remote: def __init__(self, hdl, url=None): """Class to retrieve a handle .. optionally to retrieve from test data. Still needs some error handling based on the HTTP response code.""" <|body_0|> def fetch(self, url): """Retrieve the handle data, using urllib ir reques...
stack_v2_sparse_classes_75kplus_train_007942
14,203
permissive
[ { "docstring": "Class to retrieve a handle .. optionally to retrieve from test data. Still needs some error handling based on the HTTP response code.", "name": "__init__", "signature": "def __init__(self, hdl, url=None)" }, { "docstring": "Retrieve the handle data, using urllib ir requests libra...
2
stack_v2_sparse_classes_30k_train_008960
Implement the Python class `Remote` described below. Class description: Implement the Remote class. Method signatures and docstrings: - def __init__(self, hdl, url=None): Class to retrieve a handle .. optionally to retrieve from test data. Still needs some error handling based on the HTTP response code. - def fetch(s...
Implement the Python class `Remote` described below. Class description: Implement the Remote class. Method signatures and docstrings: - def __init__(self, hdl, url=None): Class to retrieve a handle .. optionally to retrieve from test data. Still needs some error handling based on the HTTP response code. - def fetch(s...
6fca2632029a2adb9736bfc1382b39f82d8a27e1
<|skeleton|> class Remote: def __init__(self, hdl, url=None): """Class to retrieve a handle .. optionally to retrieve from test data. Still needs some error handling based on the HTTP response code.""" <|body_0|> def fetch(self, url): """Retrieve the handle data, using urllib ir reques...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Remote: def __init__(self, hdl, url=None): """Class to retrieve a handle .. optionally to retrieve from test data. Still needs some error handling based on the HTTP response code.""" if hdl[:5] == 'xxxxx': self.msg = self.dh.hh[hdl] else: if url == None: ...
the_stack_v2_python_sparse
ddc_packages/hddump/hddump/hddumpMain.py
cp4cds/cmip6_range_check_2
train
0
6b136531c96bff1dfcba00461204b32db7c4a264
[ "file_path = os.path.abspath(os.path.join(config_path, sign + '.yaml'))\ntry:\n with open(file_path, 'rb') as f:\n return yaml.load(f, Loader=yaml.FullLoader)\nexcept Exception as e:\n msg = '配置文件读取异常,请确认你的文件名'\n raise Exception(msg)", "data = Config().read_data(sign)\nold_data = data\nfile_path =...
<|body_start_0|> file_path = os.path.abspath(os.path.join(config_path, sign + '.yaml')) try: with open(file_path, 'rb') as f: return yaml.load(f, Loader=yaml.FullLoader) except Exception as e: msg = '配置文件读取异常,请确认你的文件名' raise Exception(msg) <|en...
# 统一封装YAML文件读写方法
Config
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Config: """# 统一封装YAML文件读写方法""" def read_data(self, sign): """读取YAML文件数据 @:param sign 文件名称(不包含文件后缀.yaml) # aws配置文件路径: base_aws_config.yaml # 基础接口url配置文件路径: base_url_config.yaml # 数据库配置文件路径: base_db_config.yaml # 数据删除脚本配置文件路径: base_delete_sql.yaml # 接口参数配置文件路径: base_interface_config.ya...
stack_v2_sparse_classes_75kplus_train_007943
2,883
no_license
[ { "docstring": "读取YAML文件数据 @:param sign 文件名称(不包含文件后缀.yaml) # aws配置文件路径: base_aws_config.yaml # 基础接口url配置文件路径: base_url_config.yaml # 数据库配置文件路径: base_db_config.yaml # 数据删除脚本配置文件路径: base_delete_sql.yaml # 接口参数配置文件路径: base_interface_config.yaml # auth参数配置文件路径: encryption_config.yaml # easybuy的订单order相关配置: easybuy_...
2
stack_v2_sparse_classes_30k_train_017298
Implement the Python class `Config` described below. Class description: # 统一封装YAML文件读写方法 Method signatures and docstrings: - def read_data(self, sign): 读取YAML文件数据 @:param sign 文件名称(不包含文件后缀.yaml) # aws配置文件路径: base_aws_config.yaml # 基础接口url配置文件路径: base_url_config.yaml # 数据库配置文件路径: base_db_config.yaml # 数据删除脚本配置文件路径: ba...
Implement the Python class `Config` described below. Class description: # 统一封装YAML文件读写方法 Method signatures and docstrings: - def read_data(self, sign): 读取YAML文件数据 @:param sign 文件名称(不包含文件后缀.yaml) # aws配置文件路径: base_aws_config.yaml # 基础接口url配置文件路径: base_url_config.yaml # 数据库配置文件路径: base_db_config.yaml # 数据删除脚本配置文件路径: ba...
5a40ef2488252c1f3736a0672f5f44efd61c1e97
<|skeleton|> class Config: """# 统一封装YAML文件读写方法""" def read_data(self, sign): """读取YAML文件数据 @:param sign 文件名称(不包含文件后缀.yaml) # aws配置文件路径: base_aws_config.yaml # 基础接口url配置文件路径: base_url_config.yaml # 数据库配置文件路径: base_db_config.yaml # 数据删除脚本配置文件路径: base_delete_sql.yaml # 接口参数配置文件路径: base_interface_config.ya...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Config: """# 统一封装YAML文件读写方法""" def read_data(self, sign): """读取YAML文件数据 @:param sign 文件名称(不包含文件后缀.yaml) # aws配置文件路径: base_aws_config.yaml # 基础接口url配置文件路径: base_url_config.yaml # 数据库配置文件路径: base_db_config.yaml # 数据删除脚本配置文件路径: base_delete_sql.yaml # 接口参数配置文件路径: base_interface_config.yaml # auth参数配置...
the_stack_v2_python_sparse
ui2_xueqiu/confing/yaml.py
pj1124/teststudy
train
0
52c56be8c0934026a4f5c5321120e5fe513a8936
[ "self.outvar = outvar\nself.invar = invar\nself.mask = mask\nself.scale = scale\nself.bias = bias\nself.sense = sense", "biases = np.reshape(self.bias[index, ...], [-1])\nslopes = np.reshape(self.scale[index, ...], [-1])\nmask = np.reshape(self.mask[index, ...], [-1])\nfor act_index, (slope, bias) in enumerate(zi...
<|body_start_0|> self.outvar = outvar self.invar = invar self.mask = mask self.scale = scale self.bias = bias self.sense = sense <|end_body_0|> <|body_start_1|> biases = np.reshape(self.bias[index, ...], [-1]) slopes = np.reshape(self.scale[index, ...], [...
Linear constraint involved in the relaxation of an activation.
RelaxActivationConstraint
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelaxActivationConstraint: """Linear constraint involved in the relaxation of an activation.""" def __init__(self, outvar, invar, mask, scale, bias, sense): """Represents the constraint outvar =(>)(<) scale * invar + bias.""" <|body_0|> def encode_into_solver(self, solve...
stack_v2_sparse_classes_75kplus_train_007944
26,545
permissive
[ { "docstring": "Represents the constraint outvar =(>)(<) scale * invar + bias.", "name": "__init__", "signature": "def __init__(self, outvar, invar, mask, scale, bias, sense)" }, { "docstring": "Encode the linear constraints into the provided solver. Args: solver: RelaxationSolver to create the ...
2
stack_v2_sparse_classes_30k_train_054029
Implement the Python class `RelaxActivationConstraint` described below. Class description: Linear constraint involved in the relaxation of an activation. Method signatures and docstrings: - def __init__(self, outvar, invar, mask, scale, bias, sense): Represents the constraint outvar =(>)(<) scale * invar + bias. - de...
Implement the Python class `RelaxActivationConstraint` described below. Class description: Linear constraint involved in the relaxation of an activation. Method signatures and docstrings: - def __init__(self, outvar, invar, mask, scale, bias, sense): Represents the constraint outvar =(>)(<) scale * invar + bias. - de...
96e4abb160f5022af4bf1aa8bb854822eb45a59b
<|skeleton|> class RelaxActivationConstraint: """Linear constraint involved in the relaxation of an activation.""" def __init__(self, outvar, invar, mask, scale, bias, sense): """Represents the constraint outvar =(>)(<) scale * invar + bias.""" <|body_0|> def encode_into_solver(self, solve...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RelaxActivationConstraint: """Linear constraint involved in the relaxation of an activation.""" def __init__(self, outvar, invar, mask, scale, bias, sense): """Represents the constraint outvar =(>)(<) scale * invar + bias.""" self.outvar = outvar self.invar = invar self.ma...
the_stack_v2_python_sparse
jax_verify/src/mip_solver/relaxation.py
harmonicm/jax_verify
train
0
8a5a9f0629e7e2d621d84945a74df0166430248c
[ "df = process.imp_all(import_dictionary, cd, datatype, windowlength, polyorder)\ndf_ch = df\nreturn df_ch", "cycle = []\ncharge_descript = pd.DataFrame()\nlength_dict = {key: len(value) for key, value in import_dictionary.items()}\nlenmax = max(length_dict.values())\nfor k, v in import_dictionary.items():\n cy...
<|body_start_0|> df = process.imp_all(import_dictionary, cd, datatype, windowlength, polyorder) df_ch = df return df_ch <|end_body_0|> <|body_start_1|> cycle = [] charge_descript = pd.DataFrame() length_dict = {key: len(value) for key, value in import_dictionary.items()}...
process
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class process: def df_generate(import_dictionary, cd, datatype, windowlength, polyorder): """Creates a pandas dataframe for each battery's charge/ discharge cycle in the import_filepath folder. import_filepath = filepath containing cleaned separated cycles cd = 'c' for charge and 'd' for disch...
stack_v2_sparse_classes_75kplus_train_007945
33,344
permissive
[ { "docstring": "Creates a pandas dataframe for each battery's charge/ discharge cycle in the import_filepath folder. import_filepath = filepath containing cleaned separated cycles cd = 'c' for charge and 'd' for discharge Output: df_ch = pandas dataframe for all cycles of all batteries in a col_ch = list of num...
6
stack_v2_sparse_classes_30k_train_022408
Implement the Python class `process` described below. Class description: Implement the process class. Method signatures and docstrings: - def df_generate(import_dictionary, cd, datatype, windowlength, polyorder): Creates a pandas dataframe for each battery's charge/ discharge cycle in the import_filepath folder. impo...
Implement the Python class `process` described below. Class description: Implement the process class. Method signatures and docstrings: - def df_generate(import_dictionary, cd, datatype, windowlength, polyorder): Creates a pandas dataframe for each battery's charge/ discharge cycle in the import_filepath folder. impo...
c1a3f877ae3a54acc751ccc5446868a36e61b4fe
<|skeleton|> class process: def df_generate(import_dictionary, cd, datatype, windowlength, polyorder): """Creates a pandas dataframe for each battery's charge/ discharge cycle in the import_filepath folder. import_filepath = filepath containing cleaned separated cycles cd = 'c' for charge and 'd' for disch...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class process: def df_generate(import_dictionary, cd, datatype, windowlength, polyorder): """Creates a pandas dataframe for each battery's charge/ discharge cycle in the import_filepath folder. import_filepath = filepath containing cleaned separated cycles cd = 'c' for charge and 'd' for discharge Output: d...
the_stack_v2_python_sparse
chachies/descriptors.py
BeckResearchLab/chachies
train
1
51b028eef8e7f5b711a9990f4ee5468a000d874e
[ "self.key = ''\nself.children = []\nself.endOfWord = False", "trie = self\nfor s in word:\n flag = 0\n for i in range(len(trie.children)):\n if trie.children[i].key == s:\n trie = trie.children[i]\n flag = 1\n break\n if flag == 0:\n new_node = Trie()\n ...
<|body_start_0|> self.key = '' self.children = [] self.endOfWord = False <|end_body_0|> <|body_start_1|> trie = self for s in word: flag = 0 for i in range(len(trie.children)): if trie.children[i].key == s: trie = trie....
Trie
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trie: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, word: str) -> None: """Inserts a word into the trie.""" <|body_1|> def search(self, word: str) -> bool: """Returns if the word is in the trie.""" ...
stack_v2_sparse_classes_75kplus_train_007946
1,881
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inserts a word into the trie.", "name": "insert", "signature": "def insert(self, word: str) -> None" }, { "docstring": "Returns if the word is in the tr...
4
null
Implement the Python class `Trie` described below. Class description: Implement the Trie class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, word: str) -> None: Inserts a word into the trie. - def search(self, word: str) -> bool: Returns if the word i...
Implement the Python class `Trie` described below. Class description: Implement the Trie class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, word: str) -> None: Inserts a word into the trie. - def search(self, word: str) -> bool: Returns if the word i...
1a341180755dc678f1d33247a0d980e13c3d1d03
<|skeleton|> class Trie: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, word: str) -> None: """Inserts a word into the trie.""" <|body_1|> def search(self, word: str) -> bool: """Returns if the word is in the trie.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Trie: def __init__(self): """Initialize your data structure here.""" self.key = '' self.children = [] self.endOfWord = False def insert(self, word: str) -> None: """Inserts a word into the trie.""" trie = self for s in word: flag = 0 ...
the_stack_v2_python_sparse
Trie/Trie.py
varun21290/leetcode_solutions
train
0
ffd4f8b36a784daea7c45f271e23b5d030621c20
[ "self.shape = shape\nself.topk = topk\nself.upto = equiv_len\nif topk is not None:\n if equiv_len is None:\n self.upto = topk\n if self.upto > self.topk:\n raise ValueError(f'Equiv length {equiv_len} cannot exceed topk={topk}.')\nself.gumbel_noise = Gumbel(0, 1.0 / shape)\nself.log_scores = log_...
<|body_start_0|> self.shape = shape self.topk = topk self.upto = equiv_len if topk is not None: if equiv_len is None: self.upto = topk if self.upto > self.topk: raise ValueError(f'Equiv length {equiv_len} cannot exceed topk={topk}.'...
FrechetSort
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FrechetSort: def __init__(self, shape: float=1.0, topk: Optional[int]=None, equiv_len: Optional[int]=None, log_scores: bool=False): """FréchetSort is a softer version of descending sort which samples all possible orderings of items favoring orderings which resemble descending sort. This ...
stack_v2_sparse_classes_75kplus_train_007947
6,759
permissive
[ { "docstring": "FréchetSort is a softer version of descending sort which samples all possible orderings of items favoring orderings which resemble descending sort. This can be used to convert descending sort by rank score into a differentiable, stochastic policy amenable to policy gradient algorithms. :param sh...
3
stack_v2_sparse_classes_30k_train_016393
Implement the Python class `FrechetSort` described below. Class description: Implement the FrechetSort class. Method signatures and docstrings: - def __init__(self, shape: float=1.0, topk: Optional[int]=None, equiv_len: Optional[int]=None, log_scores: bool=False): FréchetSort is a softer version of descending sort wh...
Implement the Python class `FrechetSort` described below. Class description: Implement the FrechetSort class. Method signatures and docstrings: - def __init__(self, shape: float=1.0, topk: Optional[int]=None, equiv_len: Optional[int]=None, log_scores: bool=False): FréchetSort is a softer version of descending sort wh...
c5f1a8371a677b4f8fb0882b600bf331eba5259d
<|skeleton|> class FrechetSort: def __init__(self, shape: float=1.0, topk: Optional[int]=None, equiv_len: Optional[int]=None, log_scores: bool=False): """FréchetSort is a softer version of descending sort which samples all possible orderings of items favoring orderings which resemble descending sort. This ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FrechetSort: def __init__(self, shape: float=1.0, topk: Optional[int]=None, equiv_len: Optional[int]=None, log_scores: bool=False): """FréchetSort is a softer version of descending sort which samples all possible orderings of items favoring orderings which resemble descending sort. This can be used to...
the_stack_v2_python_sparse
reagent/samplers/frechet.py
facebookresearch/ReAgent
train
1,480
18af1d7efde7b5b07149f6fb68c9c6ff43d78bd5
[ "printtime('Starting mashsippr analysis pipeline', self.starttime)\nif not self.pipeline:\n objects = Objectprep(self)\n objects.objectprep()\n self.runmetadata = objects.samples\nMash(self, self.analysistype)", "self.commit = str(pipelinecommit)\nself.starttime = startingtime\nself.homepath = scriptpath...
<|body_start_0|> printtime('Starting mashsippr analysis pipeline', self.starttime) if not self.pipeline: objects = Objectprep(self) objects.objectprep() self.runmetadata = objects.samples Mash(self, self.analysistype) <|end_body_0|> <|body_start_1|> s...
MashSippr
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MashSippr: def runner(self): """Run the necessary methods in the correct order""" <|body_0|> def __init__(self, args, pipelinecommit, startingtime, scriptpath): """:param args: command line arguments :param pipelinecommit: pipeline commit or version :param startingti...
stack_v2_sparse_classes_75kplus_train_007948
6,801
permissive
[ { "docstring": "Run the necessary methods in the correct order", "name": "runner", "signature": "def runner(self)" }, { "docstring": ":param args: command line arguments :param pipelinecommit: pipeline commit or version :param startingtime: time the script was started :param scriptpath: home pat...
2
stack_v2_sparse_classes_30k_train_010618
Implement the Python class `MashSippr` described below. Class description: Implement the MashSippr class. Method signatures and docstrings: - def runner(self): Run the necessary methods in the correct order - def __init__(self, args, pipelinecommit, startingtime, scriptpath): :param args: command line arguments :para...
Implement the Python class `MashSippr` described below. Class description: Implement the MashSippr class. Method signatures and docstrings: - def runner(self): Run the necessary methods in the correct order - def __init__(self, args, pipelinecommit, startingtime, scriptpath): :param args: command line arguments :para...
b4cc546485bddbbe26de6a80b629350314db6422
<|skeleton|> class MashSippr: def runner(self): """Run the necessary methods in the correct order""" <|body_0|> def __init__(self, args, pipelinecommit, startingtime, scriptpath): """:param args: command line arguments :param pipelinecommit: pipeline commit or version :param startingti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MashSippr: def runner(self): """Run the necessary methods in the correct order""" printtime('Starting mashsippr analysis pipeline', self.starttime) if not self.pipeline: objects = Objectprep(self) objects.objectprep() self.runmetadata = objects.sampl...
the_stack_v2_python_sparse
genemethods/MASHsippr/mashsippr.py
OLC-LOC-Bioinformatics/genemethods
train
1
7730af6fc733fdf98d564d81dd57ed7cb5d0231b
[ "super(Window, self).__init__(parent)\nself.systemtray_icon = systemtray_icon\nself.statusBar()\nself.widget = MainWidget(self)\nself.setCentralWidget(self.widget)\nself.resize(500, 200)\nself.setWindowTitle(APP_NAME)\nself.setWindowIcon(QIcon(ICON_PATH))\nself.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())\nhel...
<|body_start_0|> super(Window, self).__init__(parent) self.systemtray_icon = systemtray_icon self.statusBar() self.widget = MainWidget(self) self.setCentralWidget(self.widget) self.resize(500, 200) self.setWindowTitle(APP_NAME) self.setWindowIcon(QIcon(ICO...
Personal mainWindow class.
Window
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Window: """Personal mainWindow class.""" def __init__(self, systemtray_icon=None, parent=None): """Init window.""" <|body_0|> def helper(self): """Display help.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(Window, self).__init__(parent)...
stack_v2_sparse_classes_75kplus_train_007949
11,571
permissive
[ { "docstring": "Init window.", "name": "__init__", "signature": "def __init__(self, systemtray_icon=None, parent=None)" }, { "docstring": "Display help.", "name": "helper", "signature": "def helper(self)" } ]
2
stack_v2_sparse_classes_30k_train_015116
Implement the Python class `Window` described below. Class description: Personal mainWindow class. Method signatures and docstrings: - def __init__(self, systemtray_icon=None, parent=None): Init window. - def helper(self): Display help.
Implement the Python class `Window` described below. Class description: Personal mainWindow class. Method signatures and docstrings: - def __init__(self, systemtray_icon=None, parent=None): Init window. - def helper(self): Display help. <|skeleton|> class Window: """Personal mainWindow class.""" def __init_...
93dd7abb03d27cf3490d8b2514365260d67ab15b
<|skeleton|> class Window: """Personal mainWindow class.""" def __init__(self, systemtray_icon=None, parent=None): """Init window.""" <|body_0|> def helper(self): """Display help.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Window: """Personal mainWindow class.""" def __init__(self, systemtray_icon=None, parent=None): """Init window.""" super(Window, self).__init__(parent) self.systemtray_icon = systemtray_icon self.statusBar() self.widget = MainWidget(self) self.setCentralWid...
the_stack_v2_python_sparse
Work_Log_Generator/work_log.py
hastagAB/Awesome-Python-Scripts
train
1,757
39c370cbfc2c9c3eb979774815674077a68109fc
[ "self.tolerance = tolerance\nassert tolerance_type in ['Dalton', 'ppm'], \"Expected type from ['Dalton', 'ppm']\"\nself.type = tolerance_type", "precursormz_ref = reference.get('precursor_mz')\nprecursormz_query = query.get('precursor_mz')\nassert precursormz_ref is not None and precursormz_query is not None, 'Mi...
<|body_start_0|> self.tolerance = tolerance assert tolerance_type in ['Dalton', 'ppm'], "Expected type from ['Dalton', 'ppm']" self.type = tolerance_type <|end_body_0|> <|body_start_1|> precursormz_ref = reference.get('precursor_mz') precursormz_query = query.get('precursor_mz')...
Return True if spectrums match in precursor m/z (within tolerance), and False otherwise. The match within tolerance can be calculated based on an absolute m/z difference (tolerance_type="Dalton") or based on a relative difference in ppm (tolerance_type="ppm"). Example to calculate scores between 2 pairs of spectrums an...
PrecursorMzMatch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrecursorMzMatch: """Return True if spectrums match in precursor m/z (within tolerance), and False otherwise. The match within tolerance can be calculated based on an absolute m/z difference (tolerance_type="Dalton") or based on a relative difference in ppm (tolerance_type="ppm"). Example to calc...
stack_v2_sparse_classes_75kplus_train_007950
7,316
permissive
[ { "docstring": "Parameters ---------- tolerance Specify tolerance below which two m/z are counted as match. tolerance_type Chose between fixed tolerance in Dalton (=\"Dalton\") or a relative difference in ppm (=\"ppm\").", "name": "__init__", "signature": "def __init__(self, tolerance: float=0.1, tolera...
3
stack_v2_sparse_classes_30k_train_009682
Implement the Python class `PrecursorMzMatch` described below. Class description: Return True if spectrums match in precursor m/z (within tolerance), and False otherwise. The match within tolerance can be calculated based on an absolute m/z difference (tolerance_type="Dalton") or based on a relative difference in ppm ...
Implement the Python class `PrecursorMzMatch` described below. Class description: Return True if spectrums match in precursor m/z (within tolerance), and False otherwise. The match within tolerance can be calculated based on an absolute m/z difference (tolerance_type="Dalton") or based on a relative difference in ppm ...
d5c6cd79c891325815099c87bf6dfe2ff2db562b
<|skeleton|> class PrecursorMzMatch: """Return True if spectrums match in precursor m/z (within tolerance), and False otherwise. The match within tolerance can be calculated based on an absolute m/z difference (tolerance_type="Dalton") or based on a relative difference in ppm (tolerance_type="ppm"). Example to calc...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrecursorMzMatch: """Return True if spectrums match in precursor m/z (within tolerance), and False otherwise. The match within tolerance can be calculated based on an absolute m/z difference (tolerance_type="Dalton") or based on a relative difference in ppm (tolerance_type="ppm"). Example to calculate scores ...
the_stack_v2_python_sparse
matchms/similarity/PrecursorMzMatch.py
AxelRolov/matchms
train
0
33ca0f1f40b77f6b89b2a5ced7efeebde7a06410
[ "self.transforms = []\nif photo_metric_distortion is not None:\n pass\nif expand is not None:\n pass\nif random_rotate is not None:\n pass\nif complex_aug is not None:\n pass", "assert isinstance(results, dict) and 'img' in results\nimg = results['img'].astype(np.float32)\nfor transform in self.transf...
<|body_start_0|> self.transforms = [] if photo_metric_distortion is not None: pass if expand is not None: pass if random_rotate is not None: pass if complex_aug is not None: pass <|end_body_0|> <|body_start_1|> assert isins...
text recognition augmentation setting
RcgExtraAugmentation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RcgExtraAugmentation: """text recognition augmentation setting""" def __init__(self, photo_metric_distortion=None, expand=None, random_rotate=None, complex_aug=None): """Args: photo_metric_distortion (dict): photo metric distortion setting expand (dict): image expand setting random_r...
stack_v2_sparse_classes_75kplus_train_007951
2,329
permissive
[ { "docstring": "Args: photo_metric_distortion (dict): photo metric distortion setting expand (dict): image expand setting random_rotate (dict): random rotate setting complex_aug (dict): extra augmentation setting", "name": "__init__", "signature": "def __init__(self, photo_metric_distortion=None, expand...
2
stack_v2_sparse_classes_30k_train_048117
Implement the Python class `RcgExtraAugmentation` described below. Class description: text recognition augmentation setting Method signatures and docstrings: - def __init__(self, photo_metric_distortion=None, expand=None, random_rotate=None, complex_aug=None): Args: photo_metric_distortion (dict): photo metric distor...
Implement the Python class `RcgExtraAugmentation` described below. Class description: text recognition augmentation setting Method signatures and docstrings: - def __init__(self, photo_metric_distortion=None, expand=None, random_rotate=None, complex_aug=None): Args: photo_metric_distortion (dict): photo metric distor...
fb47a96d1a38f5ce634c6f12d710ed5300cc89fc
<|skeleton|> class RcgExtraAugmentation: """text recognition augmentation setting""" def __init__(self, photo_metric_distortion=None, expand=None, random_rotate=None, complex_aug=None): """Args: photo_metric_distortion (dict): photo metric distortion setting expand (dict): image expand setting random_r...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RcgExtraAugmentation: """text recognition augmentation setting""" def __init__(self, photo_metric_distortion=None, expand=None, random_rotate=None, complex_aug=None): """Args: photo_metric_distortion (dict): photo metric distortion setting expand (dict): image expand setting random_rotate (dict):...
the_stack_v2_python_sparse
davarocr/davarocr/davar_rcg/datasets/pipelines/rcg_extra_aug.py
OCRWorld/DAVAR-Lab-OCR
train
0
188c6141a615dc5b75b822e02884276508e800c3
[ "try:\n obj = cls.objects.get(type=4, agent_id=agent_id)\n return model_to_dict(obj, fields=['api', 'user', 'password'])\nexcept:\n return dict()", "try:\n obj = cls.objects.get(type=1, agent_id=agent_id)\n return model_to_dict(obj)\nexcept:\n return dict()", "try:\n obj = cls.objects.get(t...
<|body_start_0|> try: obj = cls.objects.get(type=4, agent_id=agent_id) return model_to_dict(obj, fields=['api', 'user', 'password']) except: return dict() <|end_body_0|> <|body_start_1|> try: obj = cls.objects.get(type=1, agent_id=agent_id) ...
代理商消息的设置,包括邮件、短信等
Message
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Message: """代理商消息的设置,包括邮件、短信等""" def get_cloud_info(cls, agent_id): """获取cloud 发邮件的需要数据 :return:""" <|body_0|> def get_smtp_info(cls, agent_id): """获取smtp服务信息 :param msg: :return:""" <|body_1|> def get_msg_info(cls, agent_id): """获取发短信信息 :par...
stack_v2_sparse_classes_75kplus_train_007952
13,020
no_license
[ { "docstring": "获取cloud 发邮件的需要数据 :return:", "name": "get_cloud_info", "signature": "def get_cloud_info(cls, agent_id)" }, { "docstring": "获取smtp服务信息 :param msg: :return:", "name": "get_smtp_info", "signature": "def get_smtp_info(cls, agent_id)" }, { "docstring": "获取发短信信息 :param a...
3
stack_v2_sparse_classes_30k_train_039996
Implement the Python class `Message` described below. Class description: 代理商消息的设置,包括邮件、短信等 Method signatures and docstrings: - def get_cloud_info(cls, agent_id): 获取cloud 发邮件的需要数据 :return: - def get_smtp_info(cls, agent_id): 获取smtp服务信息 :param msg: :return: - def get_msg_info(cls, agent_id): 获取发短信信息 :param agent_id: :r...
Implement the Python class `Message` described below. Class description: 代理商消息的设置,包括邮件、短信等 Method signatures and docstrings: - def get_cloud_info(cls, agent_id): 获取cloud 发邮件的需要数据 :return: - def get_smtp_info(cls, agent_id): 获取smtp服务信息 :param msg: :return: - def get_msg_info(cls, agent_id): 获取发短信信息 :param agent_id: :r...
d6e025d7e9d9e3aecfd399c77f376130edd8a2df
<|skeleton|> class Message: """代理商消息的设置,包括邮件、短信等""" def get_cloud_info(cls, agent_id): """获取cloud 发邮件的需要数据 :return:""" <|body_0|> def get_smtp_info(cls, agent_id): """获取smtp服务信息 :param msg: :return:""" <|body_1|> def get_msg_info(cls, agent_id): """获取发短信信息 :par...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Message: """代理商消息的设置,包括邮件、短信等""" def get_cloud_info(cls, agent_id): """获取cloud 发邮件的需要数据 :return:""" try: obj = cls.objects.get(type=4, agent_id=agent_id) return model_to_dict(obj, fields=['api', 'user', 'password']) except: return dict() de...
the_stack_v2_python_sparse
soc_system/models.py
sundw2015/841
train
4
0ab0b0c37a84d9b350b48acb1b70954d5714ac12
[ "with pytest.raises(SystemExit):\n main.main([])\nout, err = capsys.readouterr()\nassert out == ''\nassert 'error: too few arguments' in err or 'error: the following arguments are required: source' in err", "with pytest.raises(SystemExit):\n main.main(['foo', '-i', 'bar.bmp'])\nout, err = capsys.readouterr(...
<|body_start_0|> with pytest.raises(SystemExit): main.main([]) out, err = capsys.readouterr() assert out == '' assert 'error: too few arguments' in err or 'error: the following arguments are required: source' in err <|end_body_0|> <|body_start_1|> with pytest.raises(...
TestArguments
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestArguments: def test_fails_without_source(self, capsys): """Fail If no source is passed.""" <|body_0|> def test_fails_with_unknown_icon(self, capsys): """Fail if icon is not PNG.""" <|body_1|> def test_handles_unknown_doc_types(self, monkeypatch, tmpd...
stack_v2_sparse_classes_75kplus_train_007953
35,122
no_license
[ { "docstring": "Fail If no source is passed.", "name": "test_fails_without_source", "signature": "def test_fails_without_source(self, capsys)" }, { "docstring": "Fail if icon is not PNG.", "name": "test_fails_with_unknown_icon", "signature": "def test_fails_with_unknown_icon(self, capsys...
3
stack_v2_sparse_classes_30k_train_028643
Implement the Python class `TestArguments` described below. Class description: Implement the TestArguments class. Method signatures and docstrings: - def test_fails_without_source(self, capsys): Fail If no source is passed. - def test_fails_with_unknown_icon(self, capsys): Fail if icon is not PNG. - def test_handles_...
Implement the Python class `TestArguments` described below. Class description: Implement the TestArguments class. Method signatures and docstrings: - def test_fails_without_source(self, capsys): Fail If no source is passed. - def test_fails_with_unknown_icon(self, capsys): Fail if icon is not PNG. - def test_handles_...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class TestArguments: def test_fails_without_source(self, capsys): """Fail If no source is passed.""" <|body_0|> def test_fails_with_unknown_icon(self, capsys): """Fail if icon is not PNG.""" <|body_1|> def test_handles_unknown_doc_types(self, monkeypatch, tmpd...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestArguments: def test_fails_without_source(self, capsys): """Fail If no source is passed.""" with pytest.raises(SystemExit): main.main([]) out, err = capsys.readouterr() assert out == '' assert 'error: too few arguments' in err or 'error: the following arg...
the_stack_v2_python_sparse
repoData/hynek-doc2dash/allPythonContent.py
aCoffeeYin/pyreco
train
0
f720b5011987aa38eaca3b0ccf778cb043c22c57
[ "super(Encoder, self).__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(input_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, self.dm)\nself.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for n in range(self.N)]\nself.dropout = tf.keras.layers.Dropout(drop_ra...
<|body_start_0|> super(Encoder, self).__init__() self.N = N self.dm = dm self.embedding = tf.keras.layers.Embedding(input_vocab, dm) self.positional_encoding = positional_encoding(max_seq_len, self.dm) self.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for n in range(s...
Encoder Class
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Encoder Class""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """Class constructor Args: N (int): the number of blocks in the encoder. dm (int): the dimensionality of the model. h (int): the number of heads. hidden (int): the number of hi...
stack_v2_sparse_classes_75kplus_train_007954
2,055
no_license
[ { "docstring": "Class constructor Args: N (int): the number of blocks in the encoder. dm (int): the dimensionality of the model. h (int): the number of heads. hidden (int): the number of hidden units in the fully connected layer. input_vocab (int): the size of the input vocabulary. max_seq_len (int): the maximu...
2
stack_v2_sparse_classes_30k_train_027759
Implement the Python class `Encoder` described below. Class description: Encoder Class Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): Class constructor Args: N (int): the number of blocks in the encoder. dm (int): the dimensionality of the model. h (...
Implement the Python class `Encoder` described below. Class description: Encoder Class Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): Class constructor Args: N (int): the number of blocks in the encoder. dm (int): the dimensionality of the model. h (...
5aff923277cfe9f2b5324a773e4e5c3cac810a0c
<|skeleton|> class Encoder: """Encoder Class""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """Class constructor Args: N (int): the number of blocks in the encoder. dm (int): the dimensionality of the model. h (int): the number of heads. hidden (int): the number of hi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Encoder: """Encoder Class""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """Class constructor Args: N (int): the number of blocks in the encoder. dm (int): the dimensionality of the model. h (int): the number of heads. hidden (int): the number of hidden units in...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/9-transformer_encoder.py
cmmolanos1/holbertonschool-machine_learning
train
1
8a291a798ecc37b8d192cf8e3151f61da420eb6f
[ "gradeValue = float(gradeValue)\nif gradeValue > 10 or gradeValue < 1:\n raise ValueError", "if name == '':\n raise NameError\nfor index in name:\n try:\n int(index)\n raise NameError\n except ValueError:\n pass", "try:\n int(ID)\nexcept ValueError:\n raise idError" ]
<|body_start_0|> gradeValue = float(gradeValue) if gradeValue > 10 or gradeValue < 1: raise ValueError <|end_body_0|> <|body_start_1|> if name == '': raise NameError for index in name: try: int(index) raise NameError ...
Class that contains validators
Valid
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Valid: """Class that contains validators""" def grade(self, gradeValue): """function to validate a grade :param: gradeValue - grade to be validated""" <|body_0|> def name(self, name): """function to validate a name :param: name - name to be validated""" <...
stack_v2_sparse_classes_75kplus_train_007955
1,047
no_license
[ { "docstring": "function to validate a grade :param: gradeValue - grade to be validated", "name": "grade", "signature": "def grade(self, gradeValue)" }, { "docstring": "function to validate a name :param: name - name to be validated", "name": "name", "signature": "def name(self, name)" ...
3
stack_v2_sparse_classes_30k_train_048560
Implement the Python class `Valid` described below. Class description: Class that contains validators Method signatures and docstrings: - def grade(self, gradeValue): function to validate a grade :param: gradeValue - grade to be validated - def name(self, name): function to validate a name :param: name - name to be v...
Implement the Python class `Valid` described below. Class description: Class that contains validators Method signatures and docstrings: - def grade(self, gradeValue): function to validate a grade :param: gradeValue - grade to be validated - def name(self, name): function to validate a name :param: name - name to be v...
eb49a93660f117ecdbaab2d556969689167aab62
<|skeleton|> class Valid: """Class that contains validators""" def grade(self, gradeValue): """function to validate a grade :param: gradeValue - grade to be validated""" <|body_0|> def name(self, name): """function to validate a name :param: name - name to be validated""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Valid: """Class that contains validators""" def grade(self, gradeValue): """function to validate a grade :param: gradeValue - grade to be validated""" gradeValue = float(gradeValue) if gradeValue > 10 or gradeValue < 1: raise ValueError def name(self, name): ...
the_stack_v2_python_sparse
Validator/Validate.py
BendicRadu/Faculty-Application
train
1
141473f32d9d9a11f407bb01e81ecc8dea8d33bd
[ "ans = []\ni = 0\nwhile i < len(S):\n j = i + 1\n while j < len(S):\n if S[i] != S[j]:\n break\n else:\n j += 1\n if j - i >= 3:\n ans.append([i, j - 1])\n i = j\nreturn ans", "ans = []\ni = 0\nwhile i < len(S):\n j = i + 1\n while j < len(S):\n ...
<|body_start_0|> ans = [] i = 0 while i < len(S): j = i + 1 while j < len(S): if S[i] != S[j]: break else: j += 1 if j - i >= 3: ans.append([i, j - 1]) i = j ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largeGroupPositions(self, S): """:type S: str :rtype: List[List[int]]""" <|body_0|> def largeGroupPositions(self, S): """:type S: str :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ans = [] i = 0 ...
stack_v2_sparse_classes_75kplus_train_007956
920
no_license
[ { "docstring": ":type S: str :rtype: List[List[int]]", "name": "largeGroupPositions", "signature": "def largeGroupPositions(self, S)" }, { "docstring": ":type S: str :rtype: List[List[int]]", "name": "largeGroupPositions", "signature": "def largeGroupPositions(self, S)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largeGroupPositions(self, S): :type S: str :rtype: List[List[int]] - def largeGroupPositions(self, S): :type S: str :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largeGroupPositions(self, S): :type S: str :rtype: List[List[int]] - def largeGroupPositions(self, S): :type S: str :rtype: List[List[int]] <|skeleton|> class Solution: ...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def largeGroupPositions(self, S): """:type S: str :rtype: List[List[int]]""" <|body_0|> def largeGroupPositions(self, S): """:type S: str :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def largeGroupPositions(self, S): """:type S: str :rtype: List[List[int]]""" ans = [] i = 0 while i < len(S): j = i + 1 while j < len(S): if S[i] != S[j]: break else: j += ...
the_stack_v2_python_sparse
0830_Positions_of_Large_Groups.py
bingli8802/leetcode
train
0
7bcf39d41aa962b7d1772725a0c5863f1d5f6afb
[ "self.error = False\nself.command = command\nself.gro_err = gro_err.split('\\n')\nself.check()", "for line in self.gro_err:\n for error in self.e.keys():\n if line.startswith(error):\n raise self.e[error](self.command, error)" ]
<|body_start_0|> self.error = False self.command = command self.gro_err = gro_err.split('\n') self.check() <|end_body_0|> <|body_start_1|> for line in self.gro_err: for error in self.e.keys(): if line.startswith(error): raise self....
Load an error message and split it along as many properties as posible
GromacsMessages
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GromacsMessages: """Load an error message and split it along as many properties as posible""" def __init__(self, gro_err='', command='', *args, **kwargs): """Pass the command and the output of that command in "command" and "gro_err" kwargs. The check for "error" property""" <...
stack_v2_sparse_classes_75kplus_train_007957
1,762
no_license
[ { "docstring": "Pass the command and the output of that command in \"command\" and \"gro_err\" kwargs. The check for \"error\" property", "name": "__init__", "signature": "def __init__(self, gro_err='', command='', *args, **kwargs)" }, { "docstring": "Check if the GROMACS error message have any ...
2
null
Implement the Python class `GromacsMessages` described below. Class description: Load an error message and split it along as many properties as posible Method signatures and docstrings: - def __init__(self, gro_err='', command='', *args, **kwargs): Pass the command and the output of that command in "command" and "gro...
Implement the Python class `GromacsMessages` described below. Class description: Load an error message and split it along as many properties as posible Method signatures and docstrings: - def __init__(self, gro_err='', command='', *args, **kwargs): Pass the command and the output of that command in "command" and "gro...
ea2fe548c5b2ff930d36617903742feb3fd026cd
<|skeleton|> class GromacsMessages: """Load an error message and split it along as many properties as posible""" def __init__(self, gro_err='', command='', *args, **kwargs): """Pass the command and the output of that command in "command" and "gro_err" kwargs. The check for "error" property""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GromacsMessages: """Load an error message and split it along as many properties as posible""" def __init__(self, gro_err='', command='', *args, **kwargs): """Pass the command and the output of that command in "command" and "gro_err" kwargs. The check for "error" property""" self.error = F...
the_stack_v2_python_sparse
1_pre-equil_in_membrane/pymemdyn/groerrors.py
Pyshou/MD-FEP_parallel_Q5
train
3
82ba59cb5ccc331af05d3cf2014a300eebea8f3e
[ "if not (obj and len(Variable.objects.filter(version=obj))):\n return admin.ModelAdmin.get_fieldsets(self, request, obj=obj)\nelse:\n return ((None, {'fields': ('name', 'application'), 'description': '<div style=\"font-size: 16px;color: red;\">This version will be deleted when all linked variables will be del...
<|body_start_0|> if not (obj and len(Variable.objects.filter(version=obj))): return admin.ModelAdmin.get_fieldsets(self, request, obj=obj) else: return ((None, {'fields': ('name', 'application'), 'description': '<div style="font-size: 16px;color: red;">This version will be delete...
VersionAdmin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersionAdmin: def get_fieldsets(self, request, obj=None): """Display error message when it's impossible to delete the version""" <|body_0|> def has_delete_permission(self, request, obj=None): """Do not display delete button if some tests / variables are linked to thi...
stack_v2_sparse_classes_75kplus_train_007958
21,881
permissive
[ { "docstring": "Display error message when it's impossible to delete the version", "name": "get_fieldsets", "signature": "def get_fieldsets(self, request, obj=None)" }, { "docstring": "Do not display delete button if some tests / variables are linked to this application", "name": "has_delete...
3
stack_v2_sparse_classes_30k_train_015100
Implement the Python class `VersionAdmin` described below. Class description: Implement the VersionAdmin class. Method signatures and docstrings: - def get_fieldsets(self, request, obj=None): Display error message when it's impossible to delete the version - def has_delete_permission(self, request, obj=None): Do not ...
Implement the Python class `VersionAdmin` described below. Class description: Implement the VersionAdmin class. Method signatures and docstrings: - def get_fieldsets(self, request, obj=None): Display error message when it's impossible to delete the version - def has_delete_permission(self, request, obj=None): Do not ...
590c84d5078fee4021fa23956390eb612b5f123d
<|skeleton|> class VersionAdmin: def get_fieldsets(self, request, obj=None): """Display error message when it's impossible to delete the version""" <|body_0|> def has_delete_permission(self, request, obj=None): """Do not display delete button if some tests / variables are linked to thi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VersionAdmin: def get_fieldsets(self, request, obj=None): """Display error message when it's impossible to delete the version""" if not (obj and len(Variable.objects.filter(version=obj))): return admin.ModelAdmin.get_fieldsets(self, request, obj=obj) else: retur...
the_stack_v2_python_sparse
variableServer/admin.py
bhecquet/seleniumRobot-server
train
0
fef62df2b73ea735ce349933973ceeeb86e52ccc
[ "from dplkit.test.waveform import SineNarrator\nfrom datetime import datetime, timedelta\nstart = nau = datetime.utcnow()\nwidth = timedelta(microseconds=5000)\na = SineNarrator(N=64, start=nau, width=width, skew=np.array([0.0, np.pi / 2, np.pi]), channel_name='a')\n\ndef struct_maker(source):\n for f in source:...
<|body_start_0|> from dplkit.test.waveform import SineNarrator from datetime import datetime, timedelta start = nau = datetime.utcnow() width = timedelta(microseconds=5000) a = SineNarrator(N=64, start=nau, width=width, skew=np.array([0.0, np.pi / 2, np.pi]), channel_name='a') ...
Test the StructToDictFilter
TestStructToDict
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestStructToDict: """Test the StructToDictFilter""" def test_basic_struct(self): """Test converting generic struct-like frames.""" <|body_0|> def test_basic_dplkit_struct(self): """Test converting DplKit struct frames. Since DplKit struct frames have a special "a...
stack_v2_sparse_classes_75kplus_train_007959
11,464
no_license
[ { "docstring": "Test converting generic struct-like frames.", "name": "test_basic_struct", "signature": "def test_basic_struct(self)" }, { "docstring": "Test converting DplKit struct frames. Since DplKit struct frames have a special \"asdict\" method which will be used instead of \"vars(frame)\"...
2
null
Implement the Python class `TestStructToDict` described below. Class description: Test the StructToDictFilter Method signatures and docstrings: - def test_basic_struct(self): Test converting generic struct-like frames. - def test_basic_dplkit_struct(self): Test converting DplKit struct frames. Since DplKit struct fra...
Implement the Python class `TestStructToDict` described below. Class description: Test the StructToDictFilter Method signatures and docstrings: - def test_basic_struct(self): Test converting generic struct-like frames. - def test_basic_dplkit_struct(self): Test converting DplKit struct frames. Since DplKit struct fra...
32741e8fe1313ff8785029165bef31347cc2a3c3
<|skeleton|> class TestStructToDict: """Test the StructToDictFilter""" def test_basic_struct(self): """Test converting generic struct-like frames.""" <|body_0|> def test_basic_dplkit_struct(self): """Test converting DplKit struct frames. Since DplKit struct frames have a special "a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestStructToDict: """Test the StructToDictFilter""" def test_basic_struct(self): """Test converting generic struct-like frames.""" from dplkit.test.waveform import SineNarrator from datetime import datetime, timedelta start = nau = datetime.utcnow() width = timedel...
the_stack_v2_python_sparse
DplKit/python/dplkit/simple/filter.py
rayg-ssec/DplTools
train
0
acc318609c68c4aec45c04b19fa428c342644353
[ "self.mean_list = []\nself.cov_list = []\nself.p_k = []\nself.prob_k = []", "self.train_data = train_samples\nself.train_labels = train_labels\nself.labels = np.unique(self.train_labels)\nfor label in self.labels:\n class_data = self.train_data[self.train_labels == label]\n mean = sum(class_data) / len(clas...
<|body_start_0|> self.mean_list = [] self.cov_list = [] self.p_k = [] self.prob_k = [] <|end_body_0|> <|body_start_1|> self.train_data = train_samples self.train_labels = train_labels self.labels = np.unique(self.train_labels) for label in self.labels: ...
GaussianClassifier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianClassifier: def __init__(self): """Initialisiert den Klassifikator Legt Klassenvariablen fuer die Modellparameter an.""" <|body_0|> def estimate(self, train_samples, train_labels): """Erstellt den Normalverteilungsklassikator mittels Trainingdaten. Schaetzt d...
stack_v2_sparse_classes_75kplus_train_007960
22,476
no_license
[ { "docstring": "Initialisiert den Klassifikator Legt Klassenvariablen fuer die Modellparameter an.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Erstellt den Normalverteilungsklassikator mittels Trainingdaten. Schaetzt die Modellparameter auf Grundlage der Trainingsd...
3
stack_v2_sparse_classes_30k_train_004636
Implement the Python class `GaussianClassifier` described below. Class description: Implement the GaussianClassifier class. Method signatures and docstrings: - def __init__(self): Initialisiert den Klassifikator Legt Klassenvariablen fuer die Modellparameter an. - def estimate(self, train_samples, train_labels): Erst...
Implement the Python class `GaussianClassifier` described below. Class description: Implement the GaussianClassifier class. Method signatures and docstrings: - def __init__(self): Initialisiert den Klassifikator Legt Klassenvariablen fuer die Modellparameter an. - def estimate(self, train_samples, train_labels): Erst...
3b9107306993b8af263ffde21a00ae60d638441b
<|skeleton|> class GaussianClassifier: def __init__(self): """Initialisiert den Klassifikator Legt Klassenvariablen fuer die Modellparameter an.""" <|body_0|> def estimate(self, train_samples, train_labels): """Erstellt den Normalverteilungsklassikator mittels Trainingdaten. Schaetzt d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GaussianClassifier: def __init__(self): """Initialisiert den Klassifikator Legt Klassenvariablen fuer die Modellparameter an.""" self.mean_list = [] self.cov_list = [] self.p_k = [] self.prob_k = [] def estimate(self, train_samples, train_labels): """Erstel...
the_stack_v2_python_sparse
PatRecTutorials/patrec-tutorials/common/classification.py
morpheus176/Mustererkennung
train
0
389ecba9ae43e88b6069e5549751adcf6ca1f7f6
[ "fake_parser = commandline.ArgumentParser()\nfake_subparser = fake_parser.add_subparsers()\nimage_parser = fake_subparser.add_parser('image')\ncros_image.ImageCommand.AddParser(image_parser)\noptions = fake_parser.parse_args(['image'])\ninstance = options.command_class(options)\nself.assertEqual(instance.options.ad...
<|body_start_0|> fake_parser = commandline.ArgumentParser() fake_subparser = fake_parser.add_subparsers() image_parser = fake_subparser.add_parser('image') cros_image.ImageCommand.AddParser(image_parser) options = fake_parser.parse_args(['image']) instance = options.comma...
Test class for our ImageCommand's parser.
ImageCommandParserTest
[ "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageCommandParserTest: """Test class for our ImageCommand's parser.""" def testParserDefaults(self): """Tests that the parser's default values are correct.""" <|body_0|> def testParserSetValues(self): """Tests that the parser reads in values correctly.""" ...
stack_v2_sparse_classes_75kplus_train_007961
13,120
permissive
[ { "docstring": "Tests that the parser's default values are correct.", "name": "testParserDefaults", "signature": "def testParserDefaults(self)" }, { "docstring": "Tests that the parser reads in values correctly.", "name": "testParserSetValues", "signature": "def testParserSetValues(self)...
6
stack_v2_sparse_classes_30k_train_006631
Implement the Python class `ImageCommandParserTest` described below. Class description: Test class for our ImageCommand's parser. Method signatures and docstrings: - def testParserDefaults(self): Tests that the parser's default values are correct. - def testParserSetValues(self): Tests that the parser reads in values...
Implement the Python class `ImageCommandParserTest` described below. Class description: Test class for our ImageCommand's parser. Method signatures and docstrings: - def testParserDefaults(self): Tests that the parser's default values are correct. - def testParserSetValues(self): Tests that the parser reads in values...
e71f21b9b4b9b839f5093301974a45545dad2691
<|skeleton|> class ImageCommandParserTest: """Test class for our ImageCommand's parser.""" def testParserDefaults(self): """Tests that the parser's default values are correct.""" <|body_0|> def testParserSetValues(self): """Tests that the parser reads in values correctly.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageCommandParserTest: """Test class for our ImageCommand's parser.""" def testParserDefaults(self): """Tests that the parser's default values are correct.""" fake_parser = commandline.ArgumentParser() fake_subparser = fake_parser.add_subparsers() image_parser = fake_subp...
the_stack_v2_python_sparse
third_party/chromite/cli/cros/cros_image_unittest.py
zenoalbisser/chromium
train
0
d18a8f182db8e6ae38e7f07b22a2ee9ab644fc98
[ "super().__init__(name=name)\nself._common_layer_sizes = common_layer_sizes\nself._activation = activation\nself._output_dim = output_dim\nself._linear_layers = [hk.Linear(layer_size) for layer_size in self._common_layer_sizes]\nself._mean_output = hk.Linear(self._output_dim)\nself._log_var_output = hk.Linear(self....
<|body_start_0|> super().__init__(name=name) self._common_layer_sizes = common_layer_sizes self._activation = activation self._output_dim = output_dim self._linear_layers = [hk.Linear(layer_size) for layer_size in self._common_layer_sizes] self._mean_output = hk.Linear(se...
A module representing the variational distribution q(H | *O). H is assumed to be a continuous variable.
Variational
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Variational: """A module representing the variational distribution q(H | *O). H is assumed to be a continuous variable.""" def __init__(self, common_layer_sizes: Iterable[int], activation: Callable[[jnp.DeviceArray], jnp.DeviceArray]=jnp.tanh, output_dim: int=1, name: Optional[str]=None): ...
stack_v2_sparse_classes_75kplus_train_007962
3,148
permissive
[ { "docstring": "Initialises a `Variational` instance. Args: common_layer_sizes: The number of hidden units in the shared dense network layers. activation: Nonlinearity function to apply to each of the common layers. output_dim: The dimensionality of `H`. name: A name to assign to the module instance.", "nam...
2
null
Implement the Python class `Variational` described below. Class description: A module representing the variational distribution q(H | *O). H is assumed to be a continuous variable. Method signatures and docstrings: - def __init__(self, common_layer_sizes: Iterable[int], activation: Callable[[jnp.DeviceArray], jnp.Dev...
Implement the Python class `Variational` described below. Class description: A module representing the variational distribution q(H | *O). H is assumed to be a continuous variable. Method signatures and docstrings: - def __init__(self, common_layer_sizes: Iterable[int], activation: Callable[[jnp.DeviceArray], jnp.Dev...
a6ef8053380d6aa19aaae14b93f013ae9762d057
<|skeleton|> class Variational: """A module representing the variational distribution q(H | *O). H is assumed to be a continuous variable.""" def __init__(self, common_layer_sizes: Iterable[int], activation: Callable[[jnp.DeviceArray], jnp.DeviceArray]=jnp.tanh, output_dim: int=1, name: Optional[str]=None): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Variational: """A module representing the variational distribution q(H | *O). H is assumed to be a continuous variable.""" def __init__(self, common_layer_sizes: Iterable[int], activation: Callable[[jnp.DeviceArray], jnp.DeviceArray]=jnp.tanh, output_dim: int=1, name: Optional[str]=None): """Init...
the_stack_v2_python_sparse
counterfactual_fairness/variational.py
sethuramanio/deepmind-research
train
1
2270525993c51fef0632fa971e47e978af94118c
[ "self.sim_param = sim_param\nself.sim_state = SimState()\nself.system_state = SystemState(self)\nself.event_chain = EventChain()\nself.sim_result = SimResult(self)\nself.counter_collection = CounterCollection(self)\nif no_seed:\n self.rng = RNG(ExponentialRNS(1.0), ExponentialRNS(1.0 / float(self.sim_param.RHO))...
<|body_start_0|> self.sim_param = sim_param self.sim_state = SimState() self.system_state = SystemState(self) self.event_chain = EventChain() self.sim_result = SimResult(self) self.counter_collection = CounterCollection(self) if no_seed: self.rng = RNG...
Simulation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Simulation: def __init__(self, sim_param=SimParam(), no_seed=False): """Initialize the Simulation object. :param sim_param: is an optional SimParam object for parameter pre-configuration :param no_seed: is an optional parameter. If it is set to True, the RNG should be initialized without...
stack_v2_sparse_classes_75kplus_train_007963
4,689
no_license
[ { "docstring": "Initialize the Simulation object. :param sim_param: is an optional SimParam object for parameter pre-configuration :param no_seed: is an optional parameter. If it is set to True, the RNG should be initialized without a a specific seed.", "name": "__init__", "signature": "def __init__(sel...
4
stack_v2_sparse_classes_30k_train_018284
Implement the Python class `Simulation` described below. Class description: Implement the Simulation class. Method signatures and docstrings: - def __init__(self, sim_param=SimParam(), no_seed=False): Initialize the Simulation object. :param sim_param: is an optional SimParam object for parameter pre-configuration :p...
Implement the Python class `Simulation` described below. Class description: Implement the Simulation class. Method signatures and docstrings: - def __init__(self, sim_param=SimParam(), no_seed=False): Initialize the Simulation object. :param sim_param: is an optional SimParam object for parameter pre-configuration :p...
1a5936c8c0fcd0d74b61941504f2c58669154c15
<|skeleton|> class Simulation: def __init__(self, sim_param=SimParam(), no_seed=False): """Initialize the Simulation object. :param sim_param: is an optional SimParam object for parameter pre-configuration :param no_seed: is an optional parameter. If it is set to True, the RNG should be initialized without...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Simulation: def __init__(self, sim_param=SimParam(), no_seed=False): """Initialize the Simulation object. :param sim_param: is an optional SimParam object for parameter pre-configuration :param no_seed: is an optional parameter. If it is set to True, the RNG should be initialized without a a specific ...
the_stack_v2_python_sparse
DES_part5_03694565/DES_part5_03694565/simulation.py
gundoganalperen/ams-des
train
4
dc952934e1f950a2f4d0dbc8b639b3eae4f872e6
[ "from pymodule import ProcessOptions\nself.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)\nif self.analysis_method_id_ls is not None:\n self.analysis_method_id_ls = getListOutOfStr(self.analysis_method_id_ls, data_type=int)", ...
<|body_start_0|> from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) if self.analysis_method_id_ls is not None: self.analysis_method_id_ls = getListOutOfStr(self.a...
ResultsMethod2Results
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResultsMethod2Results: def __init__(self, **keywords): """2009-2-16""" <|body_0|> def rm2result(cls, session, rm, snp_info, max_rank=1000, commit=False, min_rank=1, results_directory=None): """2009-11-2 split out of run()""" <|body_1|> def run(self): ...
stack_v2_sparse_classes_75kplus_train_007964
4,990
no_license
[ { "docstring": "2009-2-16", "name": "__init__", "signature": "def __init__(self, **keywords)" }, { "docstring": "2009-11-2 split out of run()", "name": "rm2result", "signature": "def rm2result(cls, session, rm, snp_info, max_rank=1000, commit=False, min_rank=1, results_directory=None)" ...
3
stack_v2_sparse_classes_30k_train_025082
Implement the Python class `ResultsMethod2Results` described below. Class description: Implement the ResultsMethod2Results class. Method signatures and docstrings: - def __init__(self, **keywords): 2009-2-16 - def rm2result(cls, session, rm, snp_info, max_rank=1000, commit=False, min_rank=1, results_directory=None): ...
Implement the Python class `ResultsMethod2Results` described below. Class description: Implement the ResultsMethod2Results class. Method signatures and docstrings: - def __init__(self, **keywords): 2009-2-16 - def rm2result(cls, session, rm, snp_info, max_rank=1000, commit=False, min_rank=1, results_directory=None): ...
7b402496aae81665e6a915b5021b94d56e034c9d
<|skeleton|> class ResultsMethod2Results: def __init__(self, **keywords): """2009-2-16""" <|body_0|> def rm2result(cls, session, rm, snp_info, max_rank=1000, commit=False, min_rank=1, results_directory=None): """2009-11-2 split out of run()""" <|body_1|> def run(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResultsMethod2Results: def __init__(self, **keywords): """2009-2-16""" from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) if self.analysis_method_id_ls is n...
the_stack_v2_python_sparse
variation/trunk/src/ResultsMethod2Results.py
polyactis/repos
train
1
51d196f50ab397eb831cb32236d42c054beb8652
[ "self.circulation_strength = circulation_strength\nself.pressure_relaxation = pressure_relaxation\nself.viscosity = viscosity\nself.vtheta_max = vtheta_max\nself.core_radius = core_radius\nif vtheta_max is not None:\n self.method = 'vtheta_max'\nelif circulation_strength is not None and viscosity is not None and...
<|body_start_0|> self.circulation_strength = circulation_strength self.pressure_relaxation = pressure_relaxation self.viscosity = viscosity self.vtheta_max = vtheta_max self.core_radius = core_radius if vtheta_max is not None: self.method = 'vtheta_max' ...
AshVortex
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AshVortex: def __init__(self, core_radius, circulation_strength=None, viscosity=None, pressure_relaxation=None, vtheta_max=None): """Based on work by Robert Ash, Irfan Zardadkhan, Allan Zuckerwar in "The influence of pressure relaxation on the structure of an axial vortex" inputs must ei...
stack_v2_sparse_classes_75kplus_train_007965
2,746
permissive
[ { "docstring": "Based on work by Robert Ash, Irfan Zardadkhan, Allan Zuckerwar in \"The influence of pressure relaxation on the structure of an axial vortex\" inputs must either be: core_radius circulation_strength viscosity pressure_relaxation OR core_radius vtheta_max :param core_radius: :param circulation_st...
4
stack_v2_sparse_classes_30k_train_037460
Implement the Python class `AshVortex` described below. Class description: Implement the AshVortex class. Method signatures and docstrings: - def __init__(self, core_radius, circulation_strength=None, viscosity=None, pressure_relaxation=None, vtheta_max=None): Based on work by Robert Ash, Irfan Zardadkhan, Allan Zuck...
Implement the Python class `AshVortex` described below. Class description: Implement the AshVortex class. Method signatures and docstrings: - def __init__(self, core_radius, circulation_strength=None, viscosity=None, pressure_relaxation=None, vtheta_max=None): Based on work by Robert Ash, Irfan Zardadkhan, Allan Zuck...
f07a95610cec2a275f9edb2c15cf0f2dfb99a967
<|skeleton|> class AshVortex: def __init__(self, core_radius, circulation_strength=None, viscosity=None, pressure_relaxation=None, vtheta_max=None): """Based on work by Robert Ash, Irfan Zardadkhan, Allan Zuckerwar in "The influence of pressure relaxation on the structure of an axial vortex" inputs must ei...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AshVortex: def __init__(self, core_radius, circulation_strength=None, viscosity=None, pressure_relaxation=None, vtheta_max=None): """Based on work by Robert Ash, Irfan Zardadkhan, Allan Zuckerwar in "The influence of pressure relaxation on the structure of an axial vortex" inputs must either be: core_...
the_stack_v2_python_sparse
py/vortex_theory/AshVortex.py
alexlib/pivpr
train
0
446215ab1cfdbbd44e0fbc379e9749aa756be8cc
[ "self.agent = agent\nself.display = display\nself._state = None\nself._should_quit = False", "if self.display:\n self.display.root.update()\nelse:\n print(initial_state)\nself._should_quit = False\nself._state = initial_state\nreturn self._game_loop(initial_state, max_time)", "start = time.time()\nwhile n...
<|body_start_0|> self.agent = agent self.display = display self._state = None self._should_quit = False <|end_body_0|> <|body_start_1|> if self.display: self.display.root.update() else: print(initial_state) self._should_quit = False ...
A game class, that holds all the attributes and methods of a game.
Game
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Game: """A game class, that holds all the attributes and methods of a game.""" def __init__(self, agent, display=None): """constructs a new Game object.""" <|body_0|> def run(self, initial_state, max_time=None): """runs one game.""" <|body_1|> def _g...
stack_v2_sparse_classes_75kplus_train_007966
7,971
no_license
[ { "docstring": "constructs a new Game object.", "name": "__init__", "signature": "def __init__(self, agent, display=None)" }, { "docstring": "runs one game.", "name": "run", "signature": "def run(self, initial_state, max_time=None)" }, { "docstring": "the loop that runs a single ...
3
stack_v2_sparse_classes_30k_train_042331
Implement the Python class `Game` described below. Class description: A game class, that holds all the attributes and methods of a game. Method signatures and docstrings: - def __init__(self, agent, display=None): constructs a new Game object. - def run(self, initial_state, max_time=None): runs one game. - def _game_...
Implement the Python class `Game` described below. Class description: A game class, that holds all the attributes and methods of a game. Method signatures and docstrings: - def __init__(self, agent, display=None): constructs a new Game object. - def run(self, initial_state, max_time=None): runs one game. - def _game_...
912836ea0053ed5f09948787d9f960f64fb2e227
<|skeleton|> class Game: """A game class, that holds all the attributes and methods of a game.""" def __init__(self, agent, display=None): """constructs a new Game object.""" <|body_0|> def run(self, initial_state, max_time=None): """runs one game.""" <|body_1|> def _g...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Game: """A game class, that holds all the attributes and methods of a game.""" def __init__(self, agent, display=None): """constructs a new Game object.""" self.agent = agent self.display = display self._state = None self._should_quit = False def run(self, ini...
the_stack_v2_python_sparse
corona_apocalypse_project/game.py
noamoalem/ai
train
0
f34a29071aabec3b4f322d461488c8f4bf9b805c
[ "super(Bottleneck, self).__init__()\nself.downsample = downsample\nself._make_midout = nn.Sequential(nn.Conv3d(in_channels, out_channels, kernel_size=1, stride=1, padding=0, bias=False), nn.BatchNorm3d(out_channels), nn.ReLU(inplace=True), nn.Conv3d(out_channels, out_channels, kernel_size=(1, 3, 1), stride=(1, stri...
<|body_start_0|> super(Bottleneck, self).__init__() self.downsample = downsample self._make_midout = nn.Sequential(nn.Conv3d(in_channels, out_channels, kernel_size=1, stride=1, padding=0, bias=False), nn.BatchNorm3d(out_channels), nn.ReLU(inplace=True), nn.Conv3d(out_channels, out_channels, kern...
用于ResNet50,101和152的残差块,1x1 + 3x3 + 1x1的卷积优化为1x1 + 3x1 + 1*3 + 1x1
Bottleneck
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bottleneck: """用于ResNet50,101和152的残差块,1x1 + 3x3 + 1x1的卷积优化为1x1 + 3x1 + 1*3 + 1x1""" def __init__(self, in_channels, out_channels, stride=1, downsample=None): """小残差块初始化 :param: in_channels 卷积层输入通道数 :param: out_channels 卷积层输出通道数 :param: stride 卷积层步长 :param: downsample 是否要调整, 为下采样网络结构"...
stack_v2_sparse_classes_75kplus_train_007967
28,867
no_license
[ { "docstring": "小残差块初始化 :param: in_channels 卷积层输入通道数 :param: out_channels 卷积层输出通道数 :param: stride 卷积层步长 :param: downsample 是否要调整, 为下采样网络结构", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels, stride=1, downsample=None)" }, { "docstring": "前向传播 :param: x 图片变量 return o...
2
stack_v2_sparse_classes_30k_train_048135
Implement the Python class `Bottleneck` described below. Class description: 用于ResNet50,101和152的残差块,1x1 + 3x3 + 1x1的卷积优化为1x1 + 3x1 + 1*3 + 1x1 Method signatures and docstrings: - def __init__(self, in_channels, out_channels, stride=1, downsample=None): 小残差块初始化 :param: in_channels 卷积层输入通道数 :param: out_channels 卷积层输出通道数...
Implement the Python class `Bottleneck` described below. Class description: 用于ResNet50,101和152的残差块,1x1 + 3x3 + 1x1的卷积优化为1x1 + 3x1 + 1*3 + 1x1 Method signatures and docstrings: - def __init__(self, in_channels, out_channels, stride=1, downsample=None): 小残差块初始化 :param: in_channels 卷积层输入通道数 :param: out_channels 卷积层输出通道数...
2a68fd854bc5b1806319dfc40e36e084f9c4c5d0
<|skeleton|> class Bottleneck: """用于ResNet50,101和152的残差块,1x1 + 3x3 + 1x1的卷积优化为1x1 + 3x1 + 1*3 + 1x1""" def __init__(self, in_channels, out_channels, stride=1, downsample=None): """小残差块初始化 :param: in_channels 卷积层输入通道数 :param: out_channels 卷积层输出通道数 :param: stride 卷积层步长 :param: downsample 是否要调整, 为下采样网络结构"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Bottleneck: """用于ResNet50,101和152的残差块,1x1 + 3x3 + 1x1的卷积优化为1x1 + 3x1 + 1*3 + 1x1""" def __init__(self, in_channels, out_channels, stride=1, downsample=None): """小残差块初始化 :param: in_channels 卷积层输入通道数 :param: out_channels 卷积层输出通道数 :param: stride 卷积层步长 :param: downsample 是否要调整, 为下采样网络结构""" su...
the_stack_v2_python_sparse
code_keh/Pytorch_nets3d.py
ruichen9/3DCTLungDiseaseDiagnosis
train
0
026ad6e94548ccffdc0ce6d63ef3bd9841dca258
[ "if group >= 0 and index >= 0:\n view = get_group_view(self.window, group, index)\n if view is not None:\n file_name = view.file_name()\n if file_name is not None and os.path.exists(file_name):\n v = self.window.show_input_panel('Duplicate:', file_name, lambda x: self.on_done(file_nam...
<|body_start_0|> if group >= 0 and index >= 0: view = get_group_view(self.window, group, index) if view is not None: file_name = view.file_name() if file_name is not None and os.path.exists(file_name): v = self.window.show_input_panel('...
Duplicate tab.
TabsExtraDuplicateCommand
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TabsExtraDuplicateCommand: """Duplicate tab.""" def run(self, group=-1, index=-1): """Rename the given tab.""" <|body_0|> def on_done(self, old, new): """Handle the tab duplication when the user is done with the input panel.""" <|body_1|> def is_visi...
stack_v2_sparse_classes_75kplus_train_007968
33,758
permissive
[ { "docstring": "Rename the given tab.", "name": "run", "signature": "def run(self, group=-1, index=-1)" }, { "docstring": "Handle the tab duplication when the user is done with the input panel.", "name": "on_done", "signature": "def on_done(self, old, new)" }, { "docstring": "Che...
3
null
Implement the Python class `TabsExtraDuplicateCommand` described below. Class description: Duplicate tab. Method signatures and docstrings: - def run(self, group=-1, index=-1): Rename the given tab. - def on_done(self, old, new): Handle the tab duplication when the user is done with the input panel. - def is_visible(...
Implement the Python class `TabsExtraDuplicateCommand` described below. Class description: Duplicate tab. Method signatures and docstrings: - def run(self, group=-1, index=-1): Rename the given tab. - def on_done(self, old, new): Handle the tab duplication when the user is done with the input panel. - def is_visible(...
fa9d29c3553d7e05e9cc25f3fdf3fc410944927d
<|skeleton|> class TabsExtraDuplicateCommand: """Duplicate tab.""" def run(self, group=-1, index=-1): """Rename the given tab.""" <|body_0|> def on_done(self, old, new): """Handle the tab duplication when the user is done with the input panel.""" <|body_1|> def is_visi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TabsExtraDuplicateCommand: """Duplicate tab.""" def run(self, group=-1, index=-1): """Rename the given tab.""" if group >= 0 and index >= 0: view = get_group_view(self.window, group, index) if view is not None: file_name = view.file_name() ...
the_stack_v2_python_sparse
tabs_extra.py
facelessuser/TabsExtra
train
84
709e09f94aecc8f050f92416d192c4865192c8ce
[ "batch_size = inputs.shape[0]\ntrue_means, true_scales, true_log_weights = true_params\ntrue_log_weights = jnp.nan_to_num(true_log_weights, neginf=0.0)\nflat_true_params = vmap(flatten_gmm_params)(true_means, true_scales, true_log_weights)\npreds = self.model.call(params, inputs, input_lengths, ks)\nlog_weights = j...
<|body_start_0|> batch_size = inputs.shape[0] true_means, true_scales, true_log_weights = true_params true_log_weights = jnp.nan_to_num(true_log_weights, neginf=0.0) flat_true_params = vmap(flatten_gmm_params)(true_means, true_scales, true_log_weights) preds = self.model.call(par...
MeanScaleWeightInferenceMachine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeanScaleWeightInferenceMachine: def loss(self, params, inputs, input_lengths, true_params, ks, key): """Computes the wasserstein loss for this model. Args: params: The parameters of the model, returned from init(). inputs: A [batch_size, max_num_data_points, data_dim] set of input data....
stack_v2_sparse_classes_75kplus_train_007969
35,720
no_license
[ { "docstring": "Computes the wasserstein loss for this model. Args: params: The parameters of the model, returned from init(). inputs: A [batch_size, max_num_data_points, data_dim] set of input data. input_lengths: A [batch_size] set of integers representing the number of data points in each batch element. true...
3
stack_v2_sparse_classes_30k_train_030180
Implement the Python class `MeanScaleWeightInferenceMachine` described below. Class description: Implement the MeanScaleWeightInferenceMachine class. Method signatures and docstrings: - def loss(self, params, inputs, input_lengths, true_params, ks, key): Computes the wasserstein loss for this model. Args: params: The...
Implement the Python class `MeanScaleWeightInferenceMachine` described below. Class description: Implement the MeanScaleWeightInferenceMachine class. Method signatures and docstrings: - def loss(self, params, inputs, input_lengths, true_params, ks, key): Computes the wasserstein loss for this model. Args: params: The...
bf831d2b1c2c2fcc850a75c6f63c7b4da8bb0824
<|skeleton|> class MeanScaleWeightInferenceMachine: def loss(self, params, inputs, input_lengths, true_params, ks, key): """Computes the wasserstein loss for this model. Args: params: The parameters of the model, returned from init(). inputs: A [batch_size, max_num_data_points, data_dim] set of input data....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MeanScaleWeightInferenceMachine: def loss(self, params, inputs, input_lengths, true_params, ks, key): """Computes the wasserstein loss for this model. Args: params: The parameters of the model, returned from init(). inputs: A [batch_size, max_num_data_points, data_dim] set of input data. input_lengths...
the_stack_v2_python_sparse
gmm_models.py
dieterichlawson/learn_to_infer
train
1
e851975dd8ce9950ca404eae6ca24d821ae16928
[ "if isinstance(out_size, int):\n out_x = out_y = out_z = out_size\nelse:\n assert len(out_size) == 3\n assert mmcv.is_tuple_of(out_size, int)\n out_x, out_y, out_z = out_size\nnum_rois = rois.shape[0]\nnum_channels = pts_feature.shape[-1]\nnum_pts = pts.shape[0]\npooled_features = pts_feature.new_zeros(...
<|body_start_0|> if isinstance(out_size, int): out_x = out_y = out_z = out_size else: assert len(out_size) == 3 assert mmcv.is_tuple_of(out_size, int) out_x, out_y, out_z = out_size num_rois = rois.shape[0] num_channels = pts_feature.shape[...
RoIAwarePool3dFunction
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoIAwarePool3dFunction: def forward(ctx, rois, pts, pts_feature, out_size, max_pts_per_voxel, mode): """RoIAwarePool3d function forward. Args: rois (torch.Tensor): [N, 7], in LiDAR coordinate, (x, y, z) is the bottom center of rois pts (torch.Tensor): [npoints, 3] pts_feature (torch.Tens...
stack_v2_sparse_classes_75kplus_train_007970
3,504
permissive
[ { "docstring": "RoIAwarePool3d function forward. Args: rois (torch.Tensor): [N, 7], in LiDAR coordinate, (x, y, z) is the bottom center of rois pts (torch.Tensor): [npoints, 3] pts_feature (torch.Tensor): [npoints, C] out_size (int or tuple): n or [n1, n2, n3] max_pts_per_voxel (int): m mode (int): 0 (max pool)...
2
stack_v2_sparse_classes_30k_train_044043
Implement the Python class `RoIAwarePool3dFunction` described below. Class description: Implement the RoIAwarePool3dFunction class. Method signatures and docstrings: - def forward(ctx, rois, pts, pts_feature, out_size, max_pts_per_voxel, mode): RoIAwarePool3d function forward. Args: rois (torch.Tensor): [N, 7], in Li...
Implement the Python class `RoIAwarePool3dFunction` described below. Class description: Implement the RoIAwarePool3dFunction class. Method signatures and docstrings: - def forward(ctx, rois, pts, pts_feature, out_size, max_pts_per_voxel, mode): RoIAwarePool3d function forward. Args: rois (torch.Tensor): [N, 7], in Li...
feb0664e64684d3207859279f047fa54a1a806f6
<|skeleton|> class RoIAwarePool3dFunction: def forward(ctx, rois, pts, pts_feature, out_size, max_pts_per_voxel, mode): """RoIAwarePool3d function forward. Args: rois (torch.Tensor): [N, 7], in LiDAR coordinate, (x, y, z) is the bottom center of rois pts (torch.Tensor): [npoints, 3] pts_feature (torch.Tens...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RoIAwarePool3dFunction: def forward(ctx, rois, pts, pts_feature, out_size, max_pts_per_voxel, mode): """RoIAwarePool3d function forward. Args: rois (torch.Tensor): [N, 7], in LiDAR coordinate, (x, y, z) is the bottom center of rois pts (torch.Tensor): [npoints, 3] pts_feature (torch.Tensor): [npoints,...
the_stack_v2_python_sparse
mmdetection3d/mmdet3d/ops/roiaware_pool3d/roiaware_pool3d.py
hustvl/MapTR
train
643
d301a82951373b9f3f8190712eb56e4e1c56f2ed
[ "for param in params:\n if param not in self.__info__['space']:\n print('Error: not supported parameters {}'.format(param))\nif self.dataset_type == PROBLEM.CLASSIFICATION:\n layers = (params['Hidden1'], params['Hidden2'], params['Hidden3'], params['Hidden4'])\n model = MLPClassifier(hidden_layer_si...
<|body_start_0|> for param in params: if param not in self.__info__['space']: print('Error: not supported parameters {}'.format(param)) if self.dataset_type == PROBLEM.CLASSIFICATION: layers = (params['Hidden1'], params['Hidden2'], params['Hidden3'], params['Hidde...
MLPerceptron
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLPerceptron: def train(self, params): """Train the model with the given hyper-parameters. Args: :param params: dictionary of hyper-parameters. :return: trained model.""" <|body_0|> def evaluate(self, params): """Classify the test set of the chosen dataset and produc...
stack_v2_sparse_classes_75kplus_train_007971
3,221
no_license
[ { "docstring": "Train the model with the given hyper-parameters. Args: :param params: dictionary of hyper-parameters. :return: trained model.", "name": "train", "signature": "def train(self, params)" }, { "docstring": "Classify the test set of the chosen dataset and produce the result correspond...
2
stack_v2_sparse_classes_30k_val_001627
Implement the Python class `MLPerceptron` described below. Class description: Implement the MLPerceptron class. Method signatures and docstrings: - def train(self, params): Train the model with the given hyper-parameters. Args: :param params: dictionary of hyper-parameters. :return: trained model. - def evaluate(self...
Implement the Python class `MLPerceptron` described below. Class description: Implement the MLPerceptron class. Method signatures and docstrings: - def train(self, params): Train the model with the given hyper-parameters. Args: :param params: dictionary of hyper-parameters. :return: trained model. - def evaluate(self...
27f861c09615aedfd96cffdebf7d9653f72b4d7b
<|skeleton|> class MLPerceptron: def train(self, params): """Train the model with the given hyper-parameters. Args: :param params: dictionary of hyper-parameters. :return: trained model.""" <|body_0|> def evaluate(self, params): """Classify the test set of the chosen dataset and produc...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MLPerceptron: def train(self, params): """Train the model with the given hyper-parameters. Args: :param params: dictionary of hyper-parameters. :return: trained model.""" for param in params: if param not in self.__info__['space']: print('Error: not supported parame...
the_stack_v2_python_sparse
API/Metrics/MLPerceptron.py
AndreaCorsini1/Ahmet
train
1
47c71ca91a7dd0bd27a51e4b155dab3c1279b638
[ "diagnosis = DiagnosisPerm.objects.filter(diag_id=self, username=healthcare, perm_value__in=[2, 3])\nif diagnosis.count() == 0:\n return False\nelse:\n return True", "if self.patient_id == patient:\n return True\nelse:\n return False" ]
<|body_start_0|> diagnosis = DiagnosisPerm.objects.filter(diag_id=self, username=healthcare, perm_value__in=[2, 3]) if diagnosis.count() == 0: return False else: return True <|end_body_0|> <|body_start_1|> if self.patient_id == patient: return True ...
Diagnosis
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Diagnosis: def has_permission(self, healthcare): """Checks if a user has permissions to view the diagnosis.""" <|body_0|> def is_patient(self, patient): """Checks if the record belongs to the patient.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_007972
12,031
no_license
[ { "docstring": "Checks if a user has permissions to view the diagnosis.", "name": "has_permission", "signature": "def has_permission(self, healthcare)" }, { "docstring": "Checks if the record belongs to the patient.", "name": "is_patient", "signature": "def is_patient(self, patient)" }...
2
stack_v2_sparse_classes_30k_train_042736
Implement the Python class `Diagnosis` described below. Class description: Implement the Diagnosis class. Method signatures and docstrings: - def has_permission(self, healthcare): Checks if a user has permissions to view the diagnosis. - def is_patient(self, patient): Checks if the record belongs to the patient.
Implement the Python class `Diagnosis` described below. Class description: Implement the Diagnosis class. Method signatures and docstrings: - def has_permission(self, healthcare): Checks if a user has permissions to view the diagnosis. - def is_patient(self, patient): Checks if the record belongs to the patient. <|s...
685c2b9d40fb24ca1735352846a39fdf5d3728eb
<|skeleton|> class Diagnosis: def has_permission(self, healthcare): """Checks if a user has permissions to view the diagnosis.""" <|body_0|> def is_patient(self, patient): """Checks if the record belongs to the patient.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Diagnosis: def has_permission(self, healthcare): """Checks if a user has permissions to view the diagnosis.""" diagnosis = DiagnosisPerm.objects.filter(diag_id=self, username=healthcare, perm_value__in=[2, 3]) if diagnosis.count() == 0: return False else: ...
the_stack_v2_python_sparse
patientrecords/models.py
guekling/ifs4205team1
train
0
fb0c05ebb32e77b11d660f3d185972a184811137
[ "context = super(ThreadList, self).get_context_data(**kwargs)\ncontext['object_list'] = self.last_reads(context['object_list'], self.request.user)\ncontext['object_list'] = self.favorites(context['object_list'], self.request.user)\nreturn context", "last_read = LastRead.objects.filter(thread__in=thread_list, user...
<|body_start_0|> context = super(ThreadList, self).get_context_data(**kwargs) context['object_list'] = self.last_reads(context['object_list'], self.request.user) context['object_list'] = self.favorites(context['object_list'], self.request.user) return context <|end_body_0|> <|body_start...
ThreadList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreadList: def get_context_data(self, **kwargs): """set up extra context data""" <|body_0|> def last_reads(self, thread_list, user): """Annotate a queryset of threads with the last read status for a user. Add an unread boolean to each thread if it was read before ad...
stack_v2_sparse_classes_75kplus_train_007973
13,095
no_license
[ { "docstring": "set up extra context data", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Annotate a queryset of threads with the last read status for a user. Add an unread boolean to each thread if it was read before add a last_post_read id :...
3
stack_v2_sparse_classes_30k_train_006717
Implement the Python class `ThreadList` described below. Class description: Implement the ThreadList class. Method signatures and docstrings: - def get_context_data(self, **kwargs): set up extra context data - def last_reads(self, thread_list, user): Annotate a queryset of threads with the last read status for a user...
Implement the Python class `ThreadList` described below. Class description: Implement the ThreadList class. Method signatures and docstrings: - def get_context_data(self, **kwargs): set up extra context data - def last_reads(self, thread_list, user): Annotate a queryset of threads with the last read status for a user...
7753b617dba5d220fe655d80fe0699a54d9943e2
<|skeleton|> class ThreadList: def get_context_data(self, **kwargs): """set up extra context data""" <|body_0|> def last_reads(self, thread_list, user): """Annotate a queryset of threads with the last read status for a user. Add an unread boolean to each thread if it was read before ad...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ThreadList: def get_context_data(self, **kwargs): """set up extra context data""" context = super(ThreadList, self).get_context_data(**kwargs) context['object_list'] = self.last_reads(context['object_list'], self.request.user) context['object_list'] = self.favorites(context['ob...
the_stack_v2_python_sparse
arkestrator/board/views.py
adreyer/arkestrator
train
1
5a06abdd32f9ffd5d4256ef8a34c400ff2175f3f
[ "self.config_entry = config_entry\nself.options = dict(config_entry.options)\nself.blink = None", "self.blink = self.hass.data[DOMAIN][self.config_entry.entry_id]\nself.options[CONF_SCAN_INTERVAL] = self.blink.refresh_rate\nreturn await self.async_step_simple_options()", "if user_input is not None:\n self.op...
<|body_start_0|> self.config_entry = config_entry self.options = dict(config_entry.options) self.blink = None <|end_body_0|> <|body_start_1|> self.blink = self.hass.data[DOMAIN][self.config_entry.entry_id] self.options[CONF_SCAN_INTERVAL] = self.blink.refresh_rate return...
Handle Blink options.
BlinkOptionsFlowHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlinkOptionsFlowHandler: """Handle Blink options.""" def __init__(self, config_entry): """Initialize Blink options flow.""" <|body_0|> async def async_step_init(self, user_input=None): """Manage the Blink options.""" <|body_1|> async def async_step_s...
stack_v2_sparse_classes_75kplus_train_007974
5,114
permissive
[ { "docstring": "Initialize Blink options flow.", "name": "__init__", "signature": "def __init__(self, config_entry)" }, { "docstring": "Manage the Blink options.", "name": "async_step_init", "signature": "async def async_step_init(self, user_input=None)" }, { "docstring": "For si...
3
stack_v2_sparse_classes_30k_test_001762
Implement the Python class `BlinkOptionsFlowHandler` described below. Class description: Handle Blink options. Method signatures and docstrings: - def __init__(self, config_entry): Initialize Blink options flow. - async def async_step_init(self, user_input=None): Manage the Blink options. - async def async_step_simpl...
Implement the Python class `BlinkOptionsFlowHandler` described below. Class description: Handle Blink options. Method signatures and docstrings: - def __init__(self, config_entry): Initialize Blink options flow. - async def async_step_init(self, user_input=None): Manage the Blink options. - async def async_step_simpl...
4a65bed0eb9587d0374e03a267a2e630443a4065
<|skeleton|> class BlinkOptionsFlowHandler: """Handle Blink options.""" def __init__(self, config_entry): """Initialize Blink options flow.""" <|body_0|> async def async_step_init(self, user_input=None): """Manage the Blink options.""" <|body_1|> async def async_step_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BlinkOptionsFlowHandler: """Handle Blink options.""" def __init__(self, config_entry): """Initialize Blink options flow.""" self.config_entry = config_entry self.options = dict(config_entry.options) self.blink = None async def async_step_init(self, user_input=None): ...
the_stack_v2_python_sparse
homeassistant/components/blink/config_flow.py
Oliver84/home-assistant
train
4
c7cf466dae9557ed44cb788b0372903da3b0abe7
[ "if not matrix or not matrix[0]:\n return False\nrows = len(matrix)\nwhile rows > 0:\n if matrix[rows - 1][0] < target:\n return self.bin_search(matrix[rows - 1], target)\n elif matrix[rows - 1][0] == target:\n return True\n else:\n rows -= 1\nreturn False", "low, high = (0, len(d...
<|body_start_0|> if not matrix or not matrix[0]: return False rows = len(matrix) while rows > 0: if matrix[rows - 1][0] < target: return self.bin_search(matrix[rows - 1], target) elif matrix[rows - 1][0] == target: return True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def bin_search(self, data, target): """:type data: List[int] :type target: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_75kplus_train_007975
983
no_license
[ { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool", "name": "searchMatrix", "signature": "def searchMatrix(self, matrix, target)" }, { "docstring": ":type data: List[int] :type target: int :rtype: bool", "name": "bin_search", "signature": "def bin_search(self, ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def bin_search(self, data, target): :type data: List[int] :type target: int...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def bin_search(self, data, target): :type data: List[int] :type target: int...
74298f4674ae8e53ba1622df742ebced18b0bf1e
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def bin_search(self, data, target): """:type data: List[int] :type target: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" if not matrix or not matrix[0]: return False rows = len(matrix) while rows > 0: if matrix[rows - 1][0] < target: return s...
the_stack_v2_python_sparse
100/74.py
chinsun1/Python-LeetCode
train
1
c76bdeb34099414b91b0d717b82c3ec2f2ccfbbc
[ "Component.__init__(self)\nself.name = 'Compressor_default_name'\nself.bus_h2_in = None\nself.bus_h2_out = None\nself.bus_el = None\nself.m_flow_max = 33.6\nself.life_time = 20\nself.temp_in = 293.15\nself.efficiency = 0.88829\nself.set_parameters(params)\nself.spec_compression_energy = None\nself.R = 8.314\nself.M...
<|body_start_0|> Component.__init__(self) self.name = 'Compressor_default_name' self.bus_h2_in = None self.bus_h2_out = None self.bus_el = None self.m_flow_max = 33.6 self.life_time = 20 self.temp_in = 293.15 self.efficiency = 0.88829 self....
:param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compressor :type bus_el: str :param bus_h2_out: higher pressure hydrogen bus that is the...
CompressorH2
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompressorH2: """:param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compressor :type bus_el: str :param bus_h2_out: ...
stack_v2_sparse_classes_75kplus_train_007976
10,964
permissive
[ { "docstring": "Constructor method", "name": "__init__", "signature": "def __init__(self, params)" }, { "docstring": "Creates an oemof Transformer component using the information given in the CompressorH2 class, to be used in the oemof model :param busses: virtual buses used in the energy system...
4
stack_v2_sparse_classes_30k_train_007359
Implement the Python class `CompressorH2` described below. Class description: :param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compresso...
Implement the Python class `CompressorH2` described below. Class description: :param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compresso...
0d4d55d587c18d9e05258f85c1bb41c0b5fdaee7
<|skeleton|> class CompressorH2: """:param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compressor :type bus_el: str :param bus_h2_out: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CompressorH2: """:param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compressor :type bus_el: str :param bus_h2_out: higher pressu...
the_stack_v2_python_sparse
smooth/components/component_compressor_h2.py
rl-institut/smooth
train
7
6469a7a1086027f9df84aebbbf0141e12095f29d
[ "self.min_heap = []\nself.max_heap = []\nself.size = 0", "heapq.heappush(self.min_heap, num)\nif len(self.min_heap) - len(self.max_heap) > 1:\n ele = heapq.heappop(self.min_heap)\n heapq.heappush(self.max_heap, -ele)\nif self.min_heap and self.max_heap and (self.min_heap[0] < -self.max_heap[0]):\n ele = ...
<|body_start_0|> self.min_heap = [] self.max_heap = [] self.size = 0 <|end_body_0|> <|body_start_1|> heapq.heappush(self.min_heap, num) if len(self.min_heap) - len(self.max_heap) > 1: ele = heapq.heappop(self.min_heap) heapq.heappush(self.max_heap, -ele) ...
MedianFinder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_75kplus_train_007977
1,200
permissive
[ { "docstring": "initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type num: int :rtype: void", "name": "addNum", "signature": "def addNum(self, num)" }, { "docstring": ":rtype: float", "name": "findMedian", "s...
3
stack_v2_sparse_classes_30k_train_052611
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float <|skeleton|> class Me...
3719f5cb059eefd66b83eb8ae990652f4b7fd124
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MedianFinder: def __init__(self): """initialize your data structure here.""" self.min_heap = [] self.max_heap = [] self.size = 0 def addNum(self, num): """:type num: int :rtype: void""" heapq.heappush(self.min_heap, num) if len(self.min_heap) - len(...
the_stack_v2_python_sparse
Python3/0295-Find-Median-from-Data-Stream/soln.py
wyaadarsh/LeetCode-Solutions
train
0
5c65113d8fe3bf75317e6aaf727dbade145e3641
[ "if not itvls:\n return []\nitvls.sort(key=lambda x: x.start)\nret = [itvls[0]]\nfor cur in itvls[1:]:\n pre = ret[-1]\n if cur.start <= pre.end:\n pre.end = max(pre.end, cur.end)\n else:\n ret.append(cur)\nreturn ret", "if not itvls:\n return []\nret = [itvls[0]]\nfor interval in itv...
<|body_start_0|> if not itvls: return [] itvls.sort(key=lambda x: x.start) ret = [itvls[0]] for cur in itvls[1:]: pre = ret[-1] if cur.start <= pre.end: pre.end = max(pre.end, cur.end) else: ret.append(cur) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge(self, itvls): """scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval""" <|body_0|> def merge_error(self, itvls): """scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval""" ...
stack_v2_sparse_classes_75kplus_train_007978
2,093
permissive
[ { "docstring": "scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval", "name": "merge", "signature": "def merge(self, itvls)" }, { "docstring": "scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval", "name": "merge_error...
2
stack_v2_sparse_classes_30k_train_031751
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, itvls): scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval - def merge_error(self, itvls): scanning. No algorithm math :para...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, itvls): scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval - def merge_error(self, itvls): scanning. No algorithm math :para...
cbbd4a67ab342ada2421e13f82d660b1d47d4d20
<|skeleton|> class Solution: def merge(self, itvls): """scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval""" <|body_0|> def merge_error(self, itvls): """scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def merge(self, itvls): """scanning. No algorithm math :param itvls: a list of Interval :return: a list of Interval""" if not itvls: return [] itvls.sort(key=lambda x: x.start) ret = [itvls[0]] for cur in itvls[1:]: pre = ret[-1] ...
the_stack_v2_python_sparse
055 Merge Intervals.py
Aminaba123/LeetCode
train
1
5ac302d461e2c079be025e725c736f632e870d54
[ "self.commander_window = commander_window\nself.font = QtGui.QFont(self)\nself.font.setBold(True)\nself.font.setWeight(75)\nself.setup_footer_panel()", "self.create_footer_push_button('F3 View', 'F3')\nself.create_footer_push_button('F4 Edit', 'F4')\nself.create_footer_push_button('F5 Copy', 'F5')\nself.create_fo...
<|body_start_0|> self.commander_window = commander_window self.font = QtGui.QFont(self) self.font.setBold(True) self.font.setWeight(75) self.setup_footer_panel() <|end_body_0|> <|body_start_1|> self.create_footer_push_button('F3 View', 'F3') self.create_footer_pu...
WindowFooterPanel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowFooterPanel: def __init__(self, commander_window): """constructor initialize all footer panel elements Keyword arguments: :param commander_window: an initialized instance (parent main window) of CommanderWindow class""" <|body_0|> def setup_footer_panel(self): ...
stack_v2_sparse_classes_75kplus_train_007979
2,089
no_license
[ { "docstring": "constructor initialize all footer panel elements Keyword arguments: :param commander_window: an initialized instance (parent main window) of CommanderWindow class", "name": "__init__", "signature": "def __init__(self, commander_window)" }, { "docstring": "This method is meant to ...
3
stack_v2_sparse_classes_30k_train_027437
Implement the Python class `WindowFooterPanel` described below. Class description: Implement the WindowFooterPanel class. Method signatures and docstrings: - def __init__(self, commander_window): constructor initialize all footer panel elements Keyword arguments: :param commander_window: an initialized instance (pare...
Implement the Python class `WindowFooterPanel` described below. Class description: Implement the WindowFooterPanel class. Method signatures and docstrings: - def __init__(self, commander_window): constructor initialize all footer panel elements Keyword arguments: :param commander_window: an initialized instance (pare...
5f7ab5b39c1dc7d8d2182048c5d8eaff04de3d06
<|skeleton|> class WindowFooterPanel: def __init__(self, commander_window): """constructor initialize all footer panel elements Keyword arguments: :param commander_window: an initialized instance (parent main window) of CommanderWindow class""" <|body_0|> def setup_footer_panel(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WindowFooterPanel: def __init__(self, commander_window): """constructor initialize all footer panel elements Keyword arguments: :param commander_window: an initialized instance (parent main window) of CommanderWindow class""" self.commander_window = commander_window self.font = QtGui.Q...
the_stack_v2_python_sparse
views/window/window_footer_panel.py
jafi666/pyCommander
train
0
86756b8ec784b861af572de22246ebef3da7d1b0
[ "self.logger = logger.SecureTeaLogger(__name__, debug=debug)\nself.sisp = OrderedDict()\nself.simp = OrderedDict()\nself.misp = OrderedDict()\nself.mimp = OrderedDict()\nself._THRESHOLD = 10000", "if pkt.haslayer(scapy.IP) and pkt.haslayer(scapy.TCP):\n src_ip = pkt[scapy.IP].src\n dst_port = pkt[scapy.TCP]...
<|body_start_0|> self.logger = logger.SecureTeaLogger(__name__, debug=debug) self.sisp = OrderedDict() self.simp = OrderedDict() self.misp = OrderedDict() self.mimp = OrderedDict() self._THRESHOLD = 10000 <|end_body_0|> <|body_start_1|> if pkt.haslayer(scapy.IP) ...
Detect DDoS attacks.
DDoS
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DDoS: """Detect DDoS attacks.""" def __init__(self, debug=False): """Initialize DDoS attack detection. Args: None Raises: None Returns: None""" <|body_0|> def classify_ddos(self, pkt): """Classify DDoS attacks into the following: - SISP (Single IP Single Port) - ...
stack_v2_sparse_classes_75kplus_train_007980
6,794
permissive
[ { "docstring": "Initialize DDoS attack detection. Args: None Raises: None Returns: None", "name": "__init__", "signature": "def __init__(self, debug=False)" }, { "docstring": "Classify DDoS attacks into the following: - SISP (Single IP Single Port) - SIMP (Single IP Multiple Port) - MISP (Multip...
6
null
Implement the Python class `DDoS` described below. Class description: Detect DDoS attacks. Method signatures and docstrings: - def __init__(self, debug=False): Initialize DDoS attack detection. Args: None Raises: None Returns: None - def classify_ddos(self, pkt): Classify DDoS attacks into the following: - SISP (Sing...
Implement the Python class `DDoS` described below. Class description: Detect DDoS attacks. Method signatures and docstrings: - def __init__(self, debug=False): Initialize DDoS attack detection. Args: None Raises: None Returns: None - def classify_ddos(self, pkt): Classify DDoS attacks into the following: - SISP (Sing...
43dec187e5848b9ced8a6b4957b6e9028d4d43cd
<|skeleton|> class DDoS: """Detect DDoS attacks.""" def __init__(self, debug=False): """Initialize DDoS attack detection. Args: None Raises: None Returns: None""" <|body_0|> def classify_ddos(self, pkt): """Classify DDoS attacks into the following: - SISP (Single IP Single Port) - ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DDoS: """Detect DDoS attacks.""" def __init__(self, debug=False): """Initialize DDoS attack detection. Args: None Raises: None Returns: None""" self.logger = logger.SecureTeaLogger(__name__, debug=debug) self.sisp = OrderedDict() self.simp = OrderedDict() self.misp...
the_stack_v2_python_sparse
securetea/lib/ids/r2l_rules/ddos.py
rejahrehim/SecureTea-Project
train
1
e22a5fe19f0ab111177ab5476441fbb3758b9014
[ "self._test_start('test for Bay Area query by elevation')\nsd_test = [SeismicData(Point(-122.0322, 37.323, 0, UCVM_ELEVATION))]\nself.assertTrue(UCVM.query(sd_test, 'bayarea.elevation'))\nassert_velocity_properties(self, sd_test[0], VelocityProperties(1700.0, 390.0, 1990.0, 44.0, 22.0, 'bayarea', 'bayarea', 'bayare...
<|body_start_0|> self._test_start('test for Bay Area query by elevation') sd_test = [SeismicData(Point(-122.0322, 37.323, 0, UCVM_ELEVATION))] self.assertTrue(UCVM.query(sd_test, 'bayarea.elevation')) assert_velocity_properties(self, sd_test[0], VelocityProperties(1700.0, 390.0, 1990.0, ...
Defines the test cases for the Bay Area velocity model. Two tests are done: an acceptance test and a test query by elevation.
BayAreaVelocityModelTest
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BayAreaVelocityModelTest: """Defines the test cases for the Bay Area velocity model. Two tests are done: an acceptance test and a test query by elevation.""" def test_bayarea_basic_elevation(self): """Tests the Bay Area query capabilities using elevation. This uses the model's DEM, n...
stack_v2_sparse_classes_75kplus_train_007981
2,792
permissive
[ { "docstring": "Tests the Bay Area query capabilities using elevation. This uses the model's DEM, not the UCVM DEM. Returns: None", "name": "test_bayarea_basic_elevation", "signature": "def test_bayarea_basic_elevation(self)" }, { "docstring": "Runs the built-in acceptance test for the Bay Area ...
2
null
Implement the Python class `BayAreaVelocityModelTest` described below. Class description: Defines the test cases for the Bay Area velocity model. Two tests are done: an acceptance test and a test query by elevation. Method signatures and docstrings: - def test_bayarea_basic_elevation(self): Tests the Bay Area query c...
Implement the Python class `BayAreaVelocityModelTest` described below. Class description: Defines the test cases for the Bay Area velocity model. Two tests are done: an acceptance test and a test query by elevation. Method signatures and docstrings: - def test_bayarea_basic_elevation(self): Tests the Bay Area query c...
716db787a1b5b444d791547eeca4e2a3ee613da1
<|skeleton|> class BayAreaVelocityModelTest: """Defines the test cases for the Bay Area velocity model. Two tests are done: an acceptance test and a test query by elevation.""" def test_bayarea_basic_elevation(self): """Tests the Bay Area query capabilities using elevation. This uses the model's DEM, n...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BayAreaVelocityModelTest: """Defines the test cases for the Bay Area velocity model. Two tests are done: an acceptance test and a test query by elevation.""" def test_bayarea_basic_elevation(self): """Tests the Bay Area query capabilities using elevation. This uses the model's DEM, not the UCVM D...
the_stack_v2_python_sparse
ucvm/models/velocity/bayarea/test_bayarea.py
meihuisu/UCVM-reallyOld
train
0
67cb7e2b56f97472ceac685dd3afdb72c5def274
[ "parser = parent.add_parser('kill', help='signal container')\nparser.add_argument('--signal', '-s', action=SignalAction, default=9, help='Signal to send to the container. (default: %(default)s)')\nparser.add_argument('containers', nargs='+', help='containers to signal')\nparser.set_defaults(class_=cls, method='kill...
<|body_start_0|> parser = parent.add_parser('kill', help='signal container') parser.add_argument('--signal', '-s', action=SignalAction, default=9, help='Signal to send to the container. (default: %(default)s)') parser.add_argument('containers', nargs='+', help='containers to signal') par...
Class for sending signal to main process in container.
Kill
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Kill: """Class for sending signal to main process in container.""" def subparser(cls, parent): """Add Kill command to parent parser.""" <|body_0|> def kill(self): """Signal provided containers.""" <|body_1|> <|end_skeleton|> <|body_start_0|> par...
stack_v2_sparse_classes_75kplus_train_007982
1,598
permissive
[ { "docstring": "Add Kill command to parent parser.", "name": "subparser", "signature": "def subparser(cls, parent)" }, { "docstring": "Signal provided containers.", "name": "kill", "signature": "def kill(self)" } ]
2
stack_v2_sparse_classes_30k_train_003086
Implement the Python class `Kill` described below. Class description: Class for sending signal to main process in container. Method signatures and docstrings: - def subparser(cls, parent): Add Kill command to parent parser. - def kill(self): Signal provided containers.
Implement the Python class `Kill` described below. Class description: Class for sending signal to main process in container. Method signatures and docstrings: - def subparser(cls, parent): Add Kill command to parent parser. - def kill(self): Signal provided containers. <|skeleton|> class Kill: """Class for sendi...
94a46127cb0db2b6187186788a941ec72af476dd
<|skeleton|> class Kill: """Class for sending signal to main process in container.""" def subparser(cls, parent): """Add Kill command to parent parser.""" <|body_0|> def kill(self): """Signal provided containers.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Kill: """Class for sending signal to main process in container.""" def subparser(cls, parent): """Add Kill command to parent parser.""" parser = parent.add_parser('kill', help='signal container') parser.add_argument('--signal', '-s', action=SignalAction, default=9, help='Signal to...
the_stack_v2_python_sparse
pypodman/pypodman/lib/actions/kill_action.py
4383/python-podman
train
0
f103c509968499a5e25f5c6103abdb79bcda558c
[ "validators = {_RESPONSE_PRINCIPAL_ID: LambdaAuthorizerIAMPolicyPropertyValidator(_RESPONSE_PRINCIPAL_ID, [str]), _RESPONSE_POLICY_DOCUMENT: LambdaAuthorizerIAMPolicyPropertyValidator(_RESPONSE_POLICY_DOCUMENT, [dict])}\nfor prop_name, validator in validators.items():\n if not validator.is_valid(response):\n ...
<|body_start_0|> validators = {_RESPONSE_PRINCIPAL_ID: LambdaAuthorizerIAMPolicyPropertyValidator(_RESPONSE_PRINCIPAL_ID, [str]), _RESPONSE_POLICY_DOCUMENT: LambdaAuthorizerIAMPolicyPropertyValidator(_RESPONSE_POLICY_DOCUMENT, [dict])} for prop_name, validator in validators.items(): if not v...
LambdaAuthorizerIAMPolicyValidator
[ "Apache-2.0", "BSD-3-Clause", "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LambdaAuthorizerIAMPolicyValidator: def validate_policy_document(auth_name: str, response: dict) -> None: """Validate the properties of a Lambda authorizer response at the root level Parameters ---------- auth_name: str Name of the authorizer response: dict The response output from the L...
stack_v2_sparse_classes_75kplus_train_007983
18,712
permissive
[ { "docstring": "Validate the properties of a Lambda authorizer response at the root level Parameters ---------- auth_name: str Name of the authorizer response: dict The response output from the Lambda authorizer (should be in IAM format)", "name": "validate_policy_document", "signature": "def validate_p...
2
null
Implement the Python class `LambdaAuthorizerIAMPolicyValidator` described below. Class description: Implement the LambdaAuthorizerIAMPolicyValidator class. Method signatures and docstrings: - def validate_policy_document(auth_name: str, response: dict) -> None: Validate the properties of a Lambda authorizer response ...
Implement the Python class `LambdaAuthorizerIAMPolicyValidator` described below. Class description: Implement the LambdaAuthorizerIAMPolicyValidator class. Method signatures and docstrings: - def validate_policy_document(auth_name: str, response: dict) -> None: Validate the properties of a Lambda authorizer response ...
b297ff015f2b69d7c74059c2d42ece1c29ea73ee
<|skeleton|> class LambdaAuthorizerIAMPolicyValidator: def validate_policy_document(auth_name: str, response: dict) -> None: """Validate the properties of a Lambda authorizer response at the root level Parameters ---------- auth_name: str Name of the authorizer response: dict The response output from the L...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LambdaAuthorizerIAMPolicyValidator: def validate_policy_document(auth_name: str, response: dict) -> None: """Validate the properties of a Lambda authorizer response at the root level Parameters ---------- auth_name: str Name of the authorizer response: dict The response output from the Lambda authoriz...
the_stack_v2_python_sparse
samcli/local/apigw/authorizers/lambda_authorizer.py
aws/aws-sam-cli
train
1,402
7624c88e0535d23d0cf7b1da1706af02503f574c
[ "self.lr = lr\nself.gamma = gamma\nself.model = model\nself.optimizer = optim.Adam(model.parameters(), lr=self.lr)\nself.criterion = nn.MSELoss()", "state = torch.tensor(state, dtype=torch.float)\nnextState = torch.tensor(nextState, dtype=torch.float)\nfinalAction = torch.tensor(finalAction, dtype=torch.float)\nr...
<|body_start_0|> self.lr = lr self.gamma = gamma self.model = model self.optimizer = optim.Adam(model.parameters(), lr=self.lr) self.criterion = nn.MSELoss() <|end_body_0|> <|body_start_1|> state = torch.tensor(state, dtype=torch.float) nextState = torch.tensor(n...
class : QTrainer purpose : Trainer for the Q learning
QTrainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QTrainer: """class : QTrainer purpose : Trainer for the Q learning""" def __init__(self, model, lr, gamma): """Creates an instance of the QTrainer :param model: The model being used :param lr: The learning rate value :param gamma: The gamma value""" <|body_0|> def trainS...
stack_v2_sparse_classes_75kplus_train_007984
3,381
no_license
[ { "docstring": "Creates an instance of the QTrainer :param model: The model being used :param lr: The learning rate value :param gamma: The gamma value", "name": "__init__", "signature": "def __init__(self, model, lr, gamma)" }, { "docstring": "Computes one step of training :return:", "name"...
2
stack_v2_sparse_classes_30k_train_023598
Implement the Python class `QTrainer` described below. Class description: class : QTrainer purpose : Trainer for the Q learning Method signatures and docstrings: - def __init__(self, model, lr, gamma): Creates an instance of the QTrainer :param model: The model being used :param lr: The learning rate value :param gam...
Implement the Python class `QTrainer` described below. Class description: class : QTrainer purpose : Trainer for the Q learning Method signatures and docstrings: - def __init__(self, model, lr, gamma): Creates an instance of the QTrainer :param model: The model being used :param lr: The learning rate value :param gam...
b6c1fe531e6876e431a29f86cee16cfc4891577c
<|skeleton|> class QTrainer: """class : QTrainer purpose : Trainer for the Q learning""" def __init__(self, model, lr, gamma): """Creates an instance of the QTrainer :param model: The model being used :param lr: The learning rate value :param gamma: The gamma value""" <|body_0|> def trainS...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QTrainer: """class : QTrainer purpose : Trainer for the Q learning""" def __init__(self, model, lr, gamma): """Creates an instance of the QTrainer :param model: The model being used :param lr: The learning rate value :param gamma: The gamma value""" self.lr = lr self.gamma = gamma...
the_stack_v2_python_sparse
Model.py
Curtin-Machine-Learning-Club/SnakeAI
train
1
a8e68d70111dfd5f6f586d5f64f4cc906af7e865
[ "stack = []\nwhile head is not None:\n stack.append(head)\n head = head.next\nres = dummy = ListNode(None)\nwhile len(stack) > 0:\n res.next = stack.pop()\n res = res.next\nres.next = None\nreturn dummy.next", "if head == None or head.next == None:\n return head\np = self.reverseList(head.next)\nhe...
<|body_start_0|> stack = [] while head is not None: stack.append(head) head = head.next res = dummy = ListNode(None) while len(stack) > 0: res.next = stack.pop() res = res.next res.next = None return dummy.next <|end_body_0|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def naive_reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def recur_reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def reverseList(self, head): """:type head: ListNode :rt...
stack_v2_sparse_classes_75kplus_train_007985
1,784
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "naive_reverseList", "signature": "def naive_reverseList(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "recur_reverseList", "signature": "def recur_reverseList(self, head)" }, { "doc...
3
stack_v2_sparse_classes_30k_train_054409
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def naive_reverseList(self, head): :type head: ListNode :rtype: ListNode - def recur_reverseList(self, head): :type head: ListNode :rtype: ListNode - def reverseList(self, head):...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def naive_reverseList(self, head): :type head: ListNode :rtype: ListNode - def recur_reverseList(self, head): :type head: ListNode :rtype: ListNode - def reverseList(self, head):...
9746205998338fb4d7fd51300a21149c4181fc8f
<|skeleton|> class Solution: def naive_reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def recur_reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def reverseList(self, head): """:type head: ListNode :rt...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def naive_reverseList(self, head): """:type head: ListNode :rtype: ListNode""" stack = [] while head is not None: stack.append(head) head = head.next res = dummy = ListNode(None) while len(stack) > 0: res.next = stack.pop() ...
the_stack_v2_python_sparse
leetcode/linkedList/6_reverse_list.py
RuizhenMai/academic-blog
train
0
a39b21b56036fff078141ae0535dedfc23758f0e
[ "self.game_status = game_status\nself.frame = Frame(self.game_status)\nself.paddle = Paddle(self.frame)\nself.brick_layout = select_layout(self.game_status.get_stage(), self.frame)\nself.ball = Ball(self.frame, self.paddle, self.brick_layout)\nself.frame.display()\ntic = time()\nwhile True:\n flag = False\n t...
<|body_start_0|> self.game_status = game_status self.frame = Frame(self.game_status) self.paddle = Paddle(self.frame) self.brick_layout = select_layout(self.game_status.get_stage(), self.frame) self.ball = Ball(self.frame, self.paddle, self.brick_layout) self.frame.displa...
Manager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Manager: def __init__(self, game_status): """construct the walls, paddle, ball and frame""" <|body_0|> def schedular(self, flag): """Order of execution at each iteration.""" <|body_1|> def user_input(self): """Getting input from the user for padd...
stack_v2_sparse_classes_75kplus_train_007986
2,219
no_license
[ { "docstring": "construct the walls, paddle, ball and frame", "name": "__init__", "signature": "def __init__(self, game_status)" }, { "docstring": "Order of execution at each iteration.", "name": "schedular", "signature": "def schedular(self, flag)" }, { "docstring": "Getting inp...
3
stack_v2_sparse_classes_30k_train_053209
Implement the Python class `Manager` described below. Class description: Implement the Manager class. Method signatures and docstrings: - def __init__(self, game_status): construct the walls, paddle, ball and frame - def schedular(self, flag): Order of execution at each iteration. - def user_input(self): Getting inpu...
Implement the Python class `Manager` described below. Class description: Implement the Manager class. Method signatures and docstrings: - def __init__(self, game_status): construct the walls, paddle, ball and frame - def schedular(self, flag): Order of execution at each iteration. - def user_input(self): Getting inpu...
c4cd10f631aba51d290395dec446850a0fbfe1b5
<|skeleton|> class Manager: def __init__(self, game_status): """construct the walls, paddle, ball and frame""" <|body_0|> def schedular(self, flag): """Order of execution at each iteration.""" <|body_1|> def user_input(self): """Getting input from the user for padd...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Manager: def __init__(self, game_status): """construct the walls, paddle, ball and frame""" self.game_status = game_status self.frame = Frame(self.game_status) self.paddle = Paddle(self.frame) self.brick_layout = select_layout(self.game_status.get_stage(), self.frame) ...
the_stack_v2_python_sparse
v1/manager.py
ayushsharma-crypto/Brick-Breaker-Terminal-Based-Game
train
0
a5b6d6e3deeb7fbdb7824467544d34fcee5502fb
[ "amount_secured = '100'\ninterest_paid_indicator = 'No'\nFinancialChargeDetailsValidator.validate(amount_secured, interest_paid_indicator, '')\ncalls = [call(amount_secured, 'amount-secured', 'Amount originally secured', mock_error_builder(), summary_message='Amount is required', inline_message=\"If you don't know ...
<|body_start_0|> amount_secured = '100' interest_paid_indicator = 'No' FinancialChargeDetailsValidator.validate(amount_secured, interest_paid_indicator, '') calls = [call(amount_secured, 'amount-secured', 'Amount originally secured', mock_error_builder(), summary_message='Amount is requi...
TestFinancialChargeDetailsValidator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFinancialChargeDetailsValidator: def test_min_params_passed(self, mock_field_validator, mock_error_builder): """should pass the given parameter to the fieldset validator and call the expected validations""" <|body_0|> def test_max_params_passed(self, mock_field_validator...
stack_v2_sparse_classes_75kplus_train_007987
6,886
permissive
[ { "docstring": "should pass the given parameter to the fieldset validator and call the expected validations", "name": "test_min_params_passed", "signature": "def test_min_params_passed(self, mock_field_validator, mock_error_builder)" }, { "docstring": "should pass the given parameter to the fiel...
6
stack_v2_sparse_classes_30k_train_051242
Implement the Python class `TestFinancialChargeDetailsValidator` described below. Class description: Implement the TestFinancialChargeDetailsValidator class. Method signatures and docstrings: - def test_min_params_passed(self, mock_field_validator, mock_error_builder): should pass the given parameter to the fieldset ...
Implement the Python class `TestFinancialChargeDetailsValidator` described below. Class description: Implement the TestFinancialChargeDetailsValidator class. Method signatures and docstrings: - def test_min_params_passed(self, mock_field_validator, mock_error_builder): should pass the given parameter to the fieldset ...
d92446a9972ebbcd9a43a7a7444a528aa2f30bf7
<|skeleton|> class TestFinancialChargeDetailsValidator: def test_min_params_passed(self, mock_field_validator, mock_error_builder): """should pass the given parameter to the fieldset validator and call the expected validations""" <|body_0|> def test_max_params_passed(self, mock_field_validator...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestFinancialChargeDetailsValidator: def test_min_params_passed(self, mock_field_validator, mock_error_builder): """should pass the given parameter to the fieldset validator and call the expected validations""" amount_secured = '100' interest_paid_indicator = 'No' FinancialChar...
the_stack_v2_python_sparse
unit_tests/Add_land_charge/validation/test_financial_charge_details_validator.py
uk-gov-mirror/LandRegistry.maintain-frontend
train
0
2025d3b36c3d93ec16bf201f367666be402c1ec8
[ "conform = getattr(obj, '__conform__', None)\nif conform is not None:\n adapter = self._call_conform(conform)\n if adapter is not None:\n return adapter\nadapter = self.__adapt__(obj)\nif adapter is not None:\n return adapter\nelif alternate is not _marker:\n return alternate\nelse:\n raise Ty...
<|body_start_0|> conform = getattr(obj, '__conform__', None) if conform is not None: adapter = self._call_conform(conform) if adapter is not None: return adapter adapter = self.__adapt__(obj) if adapter is not None: return adapter ...
Base class that wants to be replaced with a C base :)
InterfaceBasePy
[ "Apache-2.0", "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterfaceBasePy: """Base class that wants to be replaced with a C base :)""" def __call__(self, obj, alternate=_marker): """Adapt an object to the interface""" <|body_0|> def __adapt__(self, obj): """Adapt an object to the reciever""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus_train_007988
20,297
permissive
[ { "docstring": "Adapt an object to the interface", "name": "__call__", "signature": "def __call__(self, obj, alternate=_marker)" }, { "docstring": "Adapt an object to the reciever", "name": "__adapt__", "signature": "def __adapt__(self, obj)" } ]
2
stack_v2_sparse_classes_30k_train_016799
Implement the Python class `InterfaceBasePy` described below. Class description: Base class that wants to be replaced with a C base :) Method signatures and docstrings: - def __call__(self, obj, alternate=_marker): Adapt an object to the interface - def __adapt__(self, obj): Adapt an object to the reciever
Implement the Python class `InterfaceBasePy` described below. Class description: Base class that wants to be replaced with a C base :) Method signatures and docstrings: - def __call__(self, obj, alternate=_marker): Adapt an object to the interface - def __adapt__(self, obj): Adapt an object to the reciever <|skeleto...
05dbd4575d01a213f3f4d69aa4968473f2536142
<|skeleton|> class InterfaceBasePy: """Base class that wants to be replaced with a C base :)""" def __call__(self, obj, alternate=_marker): """Adapt an object to the interface""" <|body_0|> def __adapt__(self, obj): """Adapt an object to the reciever""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InterfaceBasePy: """Base class that wants to be replaced with a C base :)""" def __call__(self, obj, alternate=_marker): """Adapt an object to the interface""" conform = getattr(obj, '__conform__', None) if conform is not None: adapter = self._call_conform(conform) ...
the_stack_v2_python_sparse
plugins/hg4idea/testData/bin/mercurial/thirdparty/zope/interface/interface.py
JetBrains/intellij-community
train
16,288
6ef5ce35065c087b6974e420484d7e25523a11c4
[ "config_dict = utils.read_config_dict('FlickrCommunicator')\nself.flickr = FlickrAPI(config_dict['api_key'], config_dict['api_secret'])\nself.app_name = config_dict['app_name']\ntoken, frob = self.flickr.get_token_part_one(perms='write')\nif not token:\n raw_input('Press ENTER after you authorized this program')...
<|body_start_0|> config_dict = utils.read_config_dict('FlickrCommunicator') self.flickr = FlickrAPI(config_dict['api_key'], config_dict['api_secret']) self.app_name = config_dict['app_name'] token, frob = self.flickr.get_token_part_one(perms='write') if not token: raw...
The interface to the Flickr API. Attributes: flickr: The FlickrAPI object that allows communication with Flickr services. app_name: The application name to be assoicated with the uploaded images.
FlickrCommunicator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlickrCommunicator: """The interface to the Flickr API. Attributes: flickr: The FlickrAPI object that allows communication with Flickr services. app_name: The application name to be assoicated with the uploaded images.""" def __init__(self): """Initializes the link between this app a...
stack_v2_sparse_classes_75kplus_train_007989
6,214
permissive
[ { "docstring": "Initializes the link between this app and Flickr API using stored configuration values. Due to the way the Flickr API authorizes, the first time a set of credentials are used on a given system, this must be initialized within a context that allows a browser window to open and username and passwo...
3
stack_v2_sparse_classes_30k_train_000852
Implement the Python class `FlickrCommunicator` described below. Class description: The interface to the Flickr API. Attributes: flickr: The FlickrAPI object that allows communication with Flickr services. app_name: The application name to be assoicated with the uploaded images. Method signatures and docstrings: - de...
Implement the Python class `FlickrCommunicator` described below. Class description: The interface to the Flickr API. Attributes: flickr: The FlickrAPI object that allows communication with Flickr services. app_name: The application name to be assoicated with the uploaded images. Method signatures and docstrings: - de...
19e44a017590e2d86e2e933d38a15a0d0b82a50a
<|skeleton|> class FlickrCommunicator: """The interface to the Flickr API. Attributes: flickr: The FlickrAPI object that allows communication with Flickr services. app_name: The application name to be assoicated with the uploaded images.""" def __init__(self): """Initializes the link between this app a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FlickrCommunicator: """The interface to the Flickr API. Attributes: flickr: The FlickrAPI object that allows communication with Flickr services. app_name: The application name to be assoicated with the uploaded images.""" def __init__(self): """Initializes the link between this app and Flickr API...
the_stack_v2_python_sparse
src/production_files/receivers/flickr_receiver.py
CraigBryan/pellinglab_twitter_microscope
train
0
8f67d59da3bc32ceb80cb28e394e6aca85cb7f3c
[ "if version:\n if version == 4:\n return Command.executeIp(logger, IpConstant.IPV4, IpOption.NEIGHBOUR, IpAction.SHOW)\n elif version == 6:\n return Command.executeIp(logger, IpConstant.IPV6, IpOption.NEIGHBOUR, IpAction.SHOW)\nrc = Command.executeIp(logger, IpOption.NEIGHBOUR, IpAction.SHOW)\nr...
<|body_start_0|> if version: if version == 4: return Command.executeIp(logger, IpConstant.IPV4, IpOption.NEIGHBOUR, IpAction.SHOW) elif version == 6: return Command.executeIp(logger, IpConstant.IPV6, IpOption.NEIGHBOUR, IpAction.SHOW) rc = Command....
IpNeighbour
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IpNeighbour: def showNeighbours(logger, version=None): """This function list neighbour entries Args: logger version - IPv4 or IPv6 as an integer, 4 or 6 Return: tuple (rc, stdout, stderr) Raise: None""" <|body_0|> def showNeighboursByDevice(logger, device, version=None): ...
stack_v2_sparse_classes_75kplus_train_007990
10,343
no_license
[ { "docstring": "This function list neighbour entries Args: logger version - IPv4 or IPv6 as an integer, 4 or 6 Return: tuple (rc, stdout, stderr) Raise: None", "name": "showNeighbours", "signature": "def showNeighbours(logger, version=None)" }, { "docstring": "This function list neighbour entrie...
2
stack_v2_sparse_classes_30k_train_028690
Implement the Python class `IpNeighbour` described below. Class description: Implement the IpNeighbour class. Method signatures and docstrings: - def showNeighbours(logger, version=None): This function list neighbour entries Args: logger version - IPv4 or IPv6 as an integer, 4 or 6 Return: tuple (rc, stdout, stderr) ...
Implement the Python class `IpNeighbour` described below. Class description: Implement the IpNeighbour class. Method signatures and docstrings: - def showNeighbours(logger, version=None): This function list neighbour entries Args: logger version - IPv4 or IPv6 as an integer, 4 or 6 Return: tuple (rc, stdout, stderr) ...
81bcc74fe7c0ca036ec483f634d7be0bab19a6d0
<|skeleton|> class IpNeighbour: def showNeighbours(logger, version=None): """This function list neighbour entries Args: logger version - IPv4 or IPv6 as an integer, 4 or 6 Return: tuple (rc, stdout, stderr) Raise: None""" <|body_0|> def showNeighboursByDevice(logger, device, version=None): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IpNeighbour: def showNeighbours(logger, version=None): """This function list neighbour entries Args: logger version - IPv4 or IPv6 as an integer, 4 or 6 Return: tuple (rc, stdout, stderr) Raise: None""" if version: if version == 4: return Command.executeIp(logger, I...
the_stack_v2_python_sparse
oscar/a/sys/net/lnx/neighbour.py
afeset/miner2-tools
train
0
93353e6ef5ef35255e4db3df24b7ce401b5b8e4b
[ "for profile in orm.Profile.objects.filter(school_staff=True).filter(code__isnull=True).select_related('user'):\n profile.code = generate_code(profile.user.username)\n profile.save()", "for profile in orm.Profile.objects.filter(school_staff=True).filter(code__isnull=False):\n profile.code = None\n pro...
<|body_start_0|> for profile in orm.Profile.objects.filter(school_staff=True).filter(code__isnull=True).select_related('user'): profile.code = generate_code(profile.user.username) profile.save() <|end_body_0|> <|body_start_1|> for profile in orm.Profile.objects.filter(school_sta...
Migration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|> <|body_start_0|> for profile in orm.Profile.objects.filter(school_s...
stack_v2_sparse_classes_75kplus_train_007991
5,844
no_license
[ { "docstring": "Write your forwards methods here.", "name": "forwards", "signature": "def forwards(self, orm)" }, { "docstring": "Write your backwards methods here.", "name": "backwards", "signature": "def backwards(self, orm)" } ]
2
stack_v2_sparse_classes_30k_train_003343
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here.
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here. <|skeleton|> class Migration: def forwards(self,...
ffa893d47aa8065c0f5809fe765fcde5772e31f6
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Migration: def forwards(self, orm): """Write your forwards methods here.""" for profile in orm.Profile.objects.filter(school_staff=True).filter(code__isnull=True).select_related('user'): profile.code = generate_code(profile.user.username) profile.save() def backwar...
the_stack_v2_python_sparse
portfoliyo/model/users/migrations/0007_populate_codes.py
denis-sukhoverkhov/portfoliyo
train
0
abcf12560d830e4cf2f98426d548045402898f50
[ "super(LSTMPredictionModel, self).__init__()\nself._encoder = tf.keras.layers.LSTM(num_units, name='encoder', dtype=self.dtype, return_state=True)\nself._decoder = tf.keras.layers.LSTM(num_units, name='decoder', dtype=self.dtype, return_sequences=True)\nself._mean_transform = tf.keras.layers.Dense(num_features, nam...
<|body_start_0|> super(LSTMPredictionModel, self).__init__() self._encoder = tf.keras.layers.LSTM(num_units, name='encoder', dtype=self.dtype, return_state=True) self._decoder = tf.keras.layers.LSTM(num_units, name='decoder', dtype=self.dtype, return_sequences=True) self._mean_transform ...
A simple encoder/decoder model using an LSTM. This model does not operate on its own, but rather is a plugin to `ARModel`. See `ARModel`'s constructor documentation (`prediction_model_factory`) for a usage example.
LSTMPredictionModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMPredictionModel: """A simple encoder/decoder model using an LSTM. This model does not operate on its own, but rather is a plugin to `ARModel`. See `ARModel`'s constructor documentation (`prediction_model_factory`) for a usage example.""" def __init__(self, num_features, input_window_size...
stack_v2_sparse_classes_75kplus_train_007992
38,336
permissive
[ { "docstring": "Construct the LSTM prediction model. Args: num_features: number of input features per time step. input_window_size: Number of past time steps of data to look at when doing the regression. output_window_size: Number of future time steps to predict. Note that setting it to > 1 empirically seems to...
2
stack_v2_sparse_classes_30k_train_022082
Implement the Python class `LSTMPredictionModel` described below. Class description: A simple encoder/decoder model using an LSTM. This model does not operate on its own, but rather is a plugin to `ARModel`. See `ARModel`'s constructor documentation (`prediction_model_factory`) for a usage example. Method signatures ...
Implement the Python class `LSTMPredictionModel` described below. Class description: A simple encoder/decoder model using an LSTM. This model does not operate on its own, but rather is a plugin to `ARModel`. See `ARModel`'s constructor documentation (`prediction_model_factory`) for a usage example. Method signatures ...
359acd5314462c05ef97f9a820d4ace876550c7e
<|skeleton|> class LSTMPredictionModel: """A simple encoder/decoder model using an LSTM. This model does not operate on its own, but rather is a plugin to `ARModel`. See `ARModel`'s constructor documentation (`prediction_model_factory`) for a usage example.""" def __init__(self, num_features, input_window_size...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LSTMPredictionModel: """A simple encoder/decoder model using an LSTM. This model does not operate on its own, but rather is a plugin to `ARModel`. See `ARModel`'s constructor documentation (`prediction_model_factory`) for a usage example.""" def __init__(self, num_features, input_window_size, output_wind...
the_stack_v2_python_sparse
tensorflow_estimator/python/estimator/canned/timeseries/ar_model.py
tensorflow/estimator
train
331
ecda838d960251a9ad3c4820c6750990d3eb2343
[ "if not head or not head.next:\n return head\nhead_next = self.reverseList(head.next)\nhead.next.next = head\nhead.next = None\nreturn head_next", "if not head:\n return None\nprev, cur = (None, head)\nwhile cur:\n third = cur.next\n cur.next = prev\n prev = cur\n cur = third\nreturn prev" ]
<|body_start_0|> if not head or not head.next: return head head_next = self.reverseList(head.next) head.next.next = head head.next = None return head_next <|end_body_0|> <|body_start_1|> if not head: return None prev, cur = (None, head) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head: ListNode) -> ListNode: """递归算法 :param head: :return:""" <|body_0|> def reverseList1(self, head: ListNode) -> ListNode: """迭代算法 :param head: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head or...
stack_v2_sparse_classes_75kplus_train_007993
1,694
no_license
[ { "docstring": "递归算法 :param head: :return:", "name": "reverseList", "signature": "def reverseList(self, head: ListNode) -> ListNode" }, { "docstring": "迭代算法 :param head: :return:", "name": "reverseList1", "signature": "def reverseList1(self, head: ListNode) -> ListNode" } ]
2
stack_v2_sparse_classes_30k_train_028817
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head: ListNode) -> ListNode: 递归算法 :param head: :return: - def reverseList1(self, head: ListNode) -> ListNode: 迭代算法 :param head: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head: ListNode) -> ListNode: 递归算法 :param head: :return: - def reverseList1(self, head: ListNode) -> ListNode: 迭代算法 :param head: :return: <|skeleton|> class...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def reverseList(self, head: ListNode) -> ListNode: """递归算法 :param head: :return:""" <|body_0|> def reverseList1(self, head: ListNode) -> ListNode: """迭代算法 :param head: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def reverseList(self, head: ListNode) -> ListNode: """递归算法 :param head: :return:""" if not head or not head.next: return head head_next = self.reverseList(head.next) head.next.next = head head.next = None return head_next def reverseLi...
the_stack_v2_python_sparse
datastructure/linked_list/ReverseList.py
yinhuax/leet_code
train
0
6686b9ffc6573f146a957b5eb063297d49c57622
[ "result = {'result': 'NG', 'content': ''}\nctrl_doc = CtrlDsDoc()\ndoc_data = ctrl_doc.get_ds_doc(doc_id)\nif doc_data:\n result['result'] = 'OK'\n result['content'] = doc_data\nelse:\n result['error'] = '该文档不存在!'\nreturn result", "data_json = request.get_json()\nresult = {'result': 'NG', 'error': ''}\nd...
<|body_start_0|> result = {'result': 'NG', 'content': ''} ctrl_doc = CtrlDsDoc() doc_data = ctrl_doc.get_ds_doc(doc_id) if doc_data: result['result'] = 'OK' result['content'] = doc_data else: result['error'] = '该文档不存在!' return result <|...
ApiNewDSDoc
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiNewDSDoc: def get(self, doc_id): """查看基本/详细设计信息 :param doc_id: :return:""" <|body_0|> def post(self): """新增设计文档 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {'result': 'NG', 'content': ''} ctrl_doc = CtrlDsDoc() ...
stack_v2_sparse_classes_75kplus_train_007994
31,026
no_license
[ { "docstring": "查看基本/详细设计信息 :param doc_id: :return:", "name": "get", "signature": "def get(self, doc_id)" }, { "docstring": "新增设计文档 :return:", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_052308
Implement the Python class `ApiNewDSDoc` described below. Class description: Implement the ApiNewDSDoc class. Method signatures and docstrings: - def get(self, doc_id): 查看基本/详细设计信息 :param doc_id: :return: - def post(self): 新增设计文档 :return:
Implement the Python class `ApiNewDSDoc` described below. Class description: Implement the ApiNewDSDoc class. Method signatures and docstrings: - def get(self, doc_id): 查看基本/详细设计信息 :param doc_id: :return: - def post(self): 新增设计文档 :return: <|skeleton|> class ApiNewDSDoc: def get(self, doc_id): """查看基本/详细...
64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11
<|skeleton|> class ApiNewDSDoc: def get(self, doc_id): """查看基本/详细设计信息 :param doc_id: :return:""" <|body_0|> def post(self): """新增设计文档 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ApiNewDSDoc: def get(self, doc_id): """查看基本/详细设计信息 :param doc_id: :return:""" result = {'result': 'NG', 'content': ''} ctrl_doc = CtrlDsDoc() doc_data = ctrl_doc.get_ds_doc(doc_id) if doc_data: result['result'] = 'OK' result['content'] = doc_data...
the_stack_v2_python_sparse
Source/collaboration_2/app/api_1_0/api_ds_doc.py
lsn1183/web_project
train
0
5adf9955f31264db3543ee2bfb31382d184bbb69
[ "try:\n ilp.solve(pulp.GLPK())\n assert round(pulp.value(ilp.objective), 0) == 5\nexcept pulp.solvers.PulpSolverError:\n pytest.fail(f'Solver not installed')", "try:\n ilp.solve(pulp.COIN())\n assert round(pulp.value(ilp.objective), 0) == 5\nexcept pulp.solvers.PulpSolverError:\n pytest.fail(f'S...
<|body_start_0|> try: ilp.solve(pulp.GLPK()) assert round(pulp.value(ilp.objective), 0) == 5 except pulp.solvers.PulpSolverError: pytest.fail(f'Solver not installed') <|end_body_0|> <|body_start_1|> try: ilp.solve(pulp.COIN()) assert r...
Test Installed Solvers.
TestSolver
[ "LicenseRef-scancode-proprietary-license", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSolver: """Test Installed Solvers.""" def test_glpk(self, ilp): """Test method for GLPK.""" <|body_0|> def test_cbc(self, ilp): """Test method for CBC.""" <|body_1|> def test_cplex(self, ilp): """Test method for CPLEX.""" <|body_2...
stack_v2_sparse_classes_75kplus_train_007995
1,770
permissive
[ { "docstring": "Test method for GLPK.", "name": "test_glpk", "signature": "def test_glpk(self, ilp)" }, { "docstring": "Test method for CBC.", "name": "test_cbc", "signature": "def test_cbc(self, ilp)" }, { "docstring": "Test method for CPLEX.", "name": "test_cplex", "sig...
5
stack_v2_sparse_classes_30k_train_016451
Implement the Python class `TestSolver` described below. Class description: Test Installed Solvers. Method signatures and docstrings: - def test_glpk(self, ilp): Test method for GLPK. - def test_cbc(self, ilp): Test method for CBC. - def test_cplex(self, ilp): Test method for CPLEX. - def test_gurobi(self, ilp): Test...
Implement the Python class `TestSolver` described below. Class description: Test Installed Solvers. Method signatures and docstrings: - def test_glpk(self, ilp): Test method for GLPK. - def test_cbc(self, ilp): Test method for CBC. - def test_cplex(self, ilp): Test method for CPLEX. - def test_gurobi(self, ilp): Test...
12f696633743825b34556180eed171649a26f05d
<|skeleton|> class TestSolver: """Test Installed Solvers.""" def test_glpk(self, ilp): """Test method for GLPK.""" <|body_0|> def test_cbc(self, ilp): """Test method for CBC.""" <|body_1|> def test_cplex(self, ilp): """Test method for CPLEX.""" <|body_2...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestSolver: """Test Installed Solvers.""" def test_glpk(self, ilp): """Test method for GLPK.""" try: ilp.solve(pulp.GLPK()) assert round(pulp.value(ilp.objective), 0) == 5 except pulp.solvers.PulpSolverError: pytest.fail(f'Solver not installed')...
the_stack_v2_python_sparse
check_installed_solvers.py
atomassi/mapping_distrinet
train
2
aad77fa08ebee5c88ed84b125e33fd88d8f566be
[ "query_db = TestDatabases.query.get(db_id)\nif not query_db:\n return api_result(code=400, message='db_id:{}数据不存在'.format(db_id))\nreturn api_result(code=200, message='操作成功', data=query_db.to_json())", "data = request.get_json()\nname = data.get('name')\ndb_type = data.get('db_type')\ndb_connection = data.get(...
<|body_start_0|> query_db = TestDatabases.query.get(db_id) if not query_db: return api_result(code=400, message='db_id:{}数据不存在'.format(db_id)) return api_result(code=200, message='操作成功', data=query_db.to_json()) <|end_body_0|> <|body_start_1|> data = request.get_json() ...
用例关联 db api GET: db详情 POST: db新增 PUT: db编辑 DELETE: db删除
CaseDBApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CaseDBApi: """用例关联 db api GET: db详情 POST: db新增 PUT: db编辑 DELETE: db删除""" def get(self, db_id): """db详情""" <|body_0|> def post(self): """db新增""" <|body_1|> def put(self): """db编辑""" <|body_2|> def delete(self): """db删除""" ...
stack_v2_sparse_classes_75kplus_train_007996
4,337
no_license
[ { "docstring": "db详情", "name": "get", "signature": "def get(self, db_id)" }, { "docstring": "db新增", "name": "post", "signature": "def post(self)" }, { "docstring": "db编辑", "name": "put", "signature": "def put(self)" }, { "docstring": "db删除", "name": "delete", ...
4
stack_v2_sparse_classes_30k_train_039485
Implement the Python class `CaseDBApi` described below. Class description: 用例关联 db api GET: db详情 POST: db新增 PUT: db编辑 DELETE: db删除 Method signatures and docstrings: - def get(self, db_id): db详情 - def post(self): db新增 - def put(self): db编辑 - def delete(self): db删除
Implement the Python class `CaseDBApi` described below. Class description: 用例关联 db api GET: db详情 POST: db新增 PUT: db编辑 DELETE: db删除 Method signatures and docstrings: - def get(self, db_id): db详情 - def post(self): db新增 - def put(self): db编辑 - def delete(self): db删除 <|skeleton|> class CaseDBApi: """用例关联 db api GET:...
df76812885d7d7f3a5269e3f7c652db6a9f3c3ad
<|skeleton|> class CaseDBApi: """用例关联 db api GET: db详情 POST: db新增 PUT: db编辑 DELETE: db删除""" def get(self, db_id): """db详情""" <|body_0|> def post(self): """db新增""" <|body_1|> def put(self): """db编辑""" <|body_2|> def delete(self): """db删除""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CaseDBApi: """用例关联 db api GET: db详情 POST: db新增 PUT: db编辑 DELETE: db删除""" def get(self, db_id): """db详情""" query_db = TestDatabases.query.get(db_id) if not query_db: return api_result(code=400, message='db_id:{}数据不存在'.format(db_id)) return api_result(code=200, m...
the_stack_v2_python_sparse
app/api/case_db_api/case_db_api.py
chengzizhen/ExileTestPlatformServer
train
0
0dc626c09d623946438c415ea71b35819902d38f
[ "image = imread(filename)\nself.scaled = image / 255\nif len(self.scaled.shape) == 3:\n self.brightness = self.scaled.mean(axis=2)\nelse:\n self.brightness = self.scaled\nself.m, self.n = np.shape(self.brightness)\nself.brightness = np.ravel(self.brightness)\nreturn\nraise NotImplementedError('Problem 3 Incom...
<|body_start_0|> image = imread(filename) self.scaled = image / 255 if len(self.scaled.shape) == 3: self.brightness = self.scaled.mean(axis=2) else: self.brightness = self.scaled self.m, self.n = np.shape(self.brightness) self.brightness = np.ravel...
Class for storing and segmenting images.
ImageSegmenter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageSegmenter: """Class for storing and segmenting images.""" def __init__(self, filename): """Read the image file. Store its brightness values as a flat array.""" <|body_0|> def show_original(self): """Display the original image.""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus_train_007997
9,707
no_license
[ { "docstring": "Read the image file. Store its brightness values as a flat array.", "name": "__init__", "signature": "def __init__(self, filename)" }, { "docstring": "Display the original image.", "name": "show_original", "signature": "def show_original(self)" }, { "docstring": "...
5
stack_v2_sparse_classes_30k_train_030090
Implement the Python class `ImageSegmenter` described below. Class description: Class for storing and segmenting images. Method signatures and docstrings: - def __init__(self, filename): Read the image file. Store its brightness values as a flat array. - def show_original(self): Display the original image. - def adja...
Implement the Python class `ImageSegmenter` described below. Class description: Class for storing and segmenting images. Method signatures and docstrings: - def __init__(self, filename): Read the image file. Store its brightness values as a flat array. - def show_original(self): Display the original image. - def adja...
9e0cc823f63868da93fbb6f56133da2b85c9094a
<|skeleton|> class ImageSegmenter: """Class for storing and segmenting images.""" def __init__(self, filename): """Read the image file. Store its brightness values as a flat array.""" <|body_0|> def show_original(self): """Display the original image.""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageSegmenter: """Class for storing and segmenting images.""" def __init__(self, filename): """Read the image file. Store its brightness values as a flat array.""" image = imread(filename) self.scaled = image / 255 if len(self.scaled.shape) == 3: self.brightne...
the_stack_v2_python_sparse
Mathematical_Coding/ImageSegmentation/image_segmentation.py
mgrose2/Coding_Projects
train
0
02928802ef1e91d95261f6fcd39e48517b3af1f3
[ "res = []\nfor q in queries:\n val = True\n start = 0\n for i in range(0, len(q)):\n if start < len(pattern) and q[i] == pattern[start]:\n start += 1\n continue\n if q[i].isupper():\n val = False\n break\n if start < len(pattern):\n val = ...
<|body_start_0|> res = [] for q in queries: val = True start = 0 for i in range(0, len(q)): if start < len(pattern) and q[i] == pattern[start]: start += 1 continue if q[i].isupper(): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def camelMatch(self, queries, pattern): """:type queries: List[str] :type pattern: str :rtype: List[bool] 根据条件判断,如果搜索对象是大写但不是模板的顺序则为False.""" <|body_0|> def camelMatch1(self, queries, pattern): """模式匹配的题,正则表达。""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_75kplus_train_007998
1,904
no_license
[ { "docstring": ":type queries: List[str] :type pattern: str :rtype: List[bool] 根据条件判断,如果搜索对象是大写但不是模板的顺序则为False.", "name": "camelMatch", "signature": "def camelMatch(self, queries, pattern)" }, { "docstring": "模式匹配的题,正则表达。", "name": "camelMatch1", "signature": "def camelMatch1(self, queri...
2
stack_v2_sparse_classes_30k_train_018771
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def camelMatch(self, queries, pattern): :type queries: List[str] :type pattern: str :rtype: List[bool] 根据条件判断,如果搜索对象是大写但不是模板的顺序则为False. - def camelMatch1(self, queries, pattern):...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def camelMatch(self, queries, pattern): :type queries: List[str] :type pattern: str :rtype: List[bool] 根据条件判断,如果搜索对象是大写但不是模板的顺序则为False. - def camelMatch1(self, queries, pattern):...
bad06f681d8d3f2b841cb3c8a969198b8643f864
<|skeleton|> class Solution: def camelMatch(self, queries, pattern): """:type queries: List[str] :type pattern: str :rtype: List[bool] 根据条件判断,如果搜索对象是大写但不是模板的顺序则为False.""" <|body_0|> def camelMatch1(self, queries, pattern): """模式匹配的题,正则表达。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def camelMatch(self, queries, pattern): """:type queries: List[str] :type pattern: str :rtype: List[bool] 根据条件判断,如果搜索对象是大写但不是模板的顺序则为False.""" res = [] for q in queries: val = True start = 0 for i in range(0, len(q)): if star...
the_stack_v2_python_sparse
1023_camelcase_matching.py
subicWang/leetcode_aotang
train
0
7e2841e5b537b7703a023a97c95afe11eba68076
[ "self.open_tag = open_tag\nself.close_tag = close_tag\nself.content = [content]\nif kwargs:\n self.open_tag = open_tag.strip('>')\n for key in kwargs:\n self.open_tag += ' {}=\"{}\"'.format(key, kwargs[key])\n self.open_tag += '>'", "if hasattr(content, 'render') and self.content:\n self.conten...
<|body_start_0|> self.open_tag = open_tag self.close_tag = close_tag self.content = [content] if kwargs: self.open_tag = open_tag.strip('>') for key in kwargs: self.open_tag += ' {}="{}"'.format(key, kwargs[key]) self.open_tag += '>' <|...
Parent class for all html elements to be created.
Element
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Element: """Parent class for all html elements to be created.""" def __init__(self, open_tag='<html>', close_tag='</html>', content=None, **kwargs): """Constructor for Element objects. :param open_tag="<html>": set opening tag parameter to html should none be given :param close_tag="...
stack_v2_sparse_classes_75kplus_train_007999
7,157
no_license
[ { "docstring": "Constructor for Element objects. :param open_tag=\"<html>\": set opening tag parameter to html should none be given :param close_tag=\"</html>\": set closing tag parameter to html should none be given :param content=None: set content value to NoneType if no content associated", "name": "__in...
3
stack_v2_sparse_classes_30k_train_025508
Implement the Python class `Element` described below. Class description: Parent class for all html elements to be created. Method signatures and docstrings: - def __init__(self, open_tag='<html>', close_tag='</html>', content=None, **kwargs): Constructor for Element objects. :param open_tag="<html>": set opening tag ...
Implement the Python class `Element` described below. Class description: Parent class for all html elements to be created. Method signatures and docstrings: - def __init__(self, open_tag='<html>', close_tag='</html>', content=None, **kwargs): Constructor for Element objects. :param open_tag="<html>": set opening tag ...
e298b1151dab639659d8dfa56f47bcb43dd3438f
<|skeleton|> class Element: """Parent class for all html elements to be created.""" def __init__(self, open_tag='<html>', close_tag='</html>', content=None, **kwargs): """Constructor for Element objects. :param open_tag="<html>": set opening tag parameter to html should none be given :param close_tag="...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Element: """Parent class for all html elements to be created.""" def __init__(self, open_tag='<html>', close_tag='</html>', content=None, **kwargs): """Constructor for Element objects. :param open_tag="<html>": set opening tag parameter to html should none be given :param close_tag="</html>": set...
the_stack_v2_python_sparse
students/ian_letourneau/Lesson07/html_render.py
UWPCE-PythonCert-ClassRepos/Self_Paced-Online
train
13