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
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
936d56e95df0eab69456189fd3c8ecc9f181c1d3
[ "for subkey in profile_list_key.GetSubkeys():\n profile_image_path = self._GetValueFromKey(subkey, 'ProfileImagePath')\n yield UserProfile(subkey.name, profile_image_path)", "profile_list_key = registry.GetKeyByPath(self._PROFILE_LIST_KEY_PATH)\nif profile_list_key:\n yield from self._CollectUserProfiles...
<|body_start_0|> for subkey in profile_list_key.GetSubkeys(): profile_image_path = self._GetValueFromKey(subkey, 'ProfileImagePath') yield UserProfile(subkey.name, profile_image_path) <|end_body_0|> <|body_start_1|> profile_list_key = registry.GetKeyByPath(self._PROFILE_LIST_KEY...
Windows user profiles collector.
UserProfilesCollector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProfilesCollector: """Windows user profiles collector.""" def _CollectUserProfiles(self, profile_list_key): """Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields: UserProfile: an user profile.""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_001600
1,644
permissive
[ { "docstring": "Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields: UserProfile: an user profile.", "name": "_CollectUserProfiles", "signature": "def _CollectUserProfiles(self, profile_list_key)" }, { "docstring": "Collects user profil...
2
stack_v2_sparse_classes_30k_train_002020
Implement the Python class `UserProfilesCollector` described below. Class description: Windows user profiles collector. Method signatures and docstrings: - def _CollectUserProfiles(self, profile_list_key): Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields:...
Implement the Python class `UserProfilesCollector` described below. Class description: Windows user profiles collector. Method signatures and docstrings: - def _CollectUserProfiles(self, profile_list_key): Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields:...
d149aff1b8ff97e1cc8d7416fc583b964bad4ccd
<|skeleton|> class UserProfilesCollector: """Windows user profiles collector.""" def _CollectUserProfiles(self, profile_list_key): """Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields: UserProfile: an user profile.""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserProfilesCollector: """Windows user profiles collector.""" def _CollectUserProfiles(self, profile_list_key): """Collects user profiles. Args: profile_list_key (dfwinreg.WinRegistryKey): profile list Windows Registry. Yields: UserProfile: an user profile.""" for subkey in profile_list_k...
the_stack_v2_python_sparse
winregrc/profiles.py
libyal/winreg-kb
train
129
96e68d825b1e5d873f2d22b5ab79d661ccdf56c2
[ "self._hass = hass\nself._store = Store[dict[str, dict[str, Union[bool, int]]]](hass, STORAGE_VERSION, STORAGE_KEY)\nself._prefs: dict[str, dict[str, bool | int]] | None = None", "if (prefs := (await self._store.async_load())) is None:\n prefs = {}\nself._prefs = prefs", "if preload_stream is not UNDEFINED:\...
<|body_start_0|> self._hass = hass self._store = Store[dict[str, dict[str, Union[bool, int]]]](hass, STORAGE_VERSION, STORAGE_KEY) self._prefs: dict[str, dict[str, bool | int]] | None = None <|end_body_0|> <|body_start_1|> if (prefs := (await self._store.async_load())) is None: ...
Handle camera preferences.
CameraPreferences
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CameraPreferences: """Handle camera preferences.""" def __init__(self, hass: HomeAssistant) -> None: """Initialize camera prefs.""" <|body_0|> async def async_initialize(self) -> None: """Finish initializing the preferences.""" <|body_1|> async def a...
stack_v2_sparse_classes_10k_train_001601
3,632
permissive
[ { "docstring": "Initialize camera prefs.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant) -> None" }, { "docstring": "Finish initializing the preferences.", "name": "async_initialize", "signature": "async def async_initialize(self) -> None" }, { "docstr...
4
stack_v2_sparse_classes_30k_train_006357
Implement the Python class `CameraPreferences` described below. Class description: Handle camera preferences. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant) -> None: Initialize camera prefs. - async def async_initialize(self) -> None: Finish initializing the preferences. - async def async...
Implement the Python class `CameraPreferences` described below. Class description: Handle camera preferences. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant) -> None: Initialize camera prefs. - async def async_initialize(self) -> None: Finish initializing the preferences. - async def async...
dcf68d768e4f628d038f1fdd6e40bad713fbc222
<|skeleton|> class CameraPreferences: """Handle camera preferences.""" def __init__(self, hass: HomeAssistant) -> None: """Initialize camera prefs.""" <|body_0|> async def async_initialize(self) -> None: """Finish initializing the preferences.""" <|body_1|> async def a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CameraPreferences: """Handle camera preferences.""" def __init__(self, hass: HomeAssistant) -> None: """Initialize camera prefs.""" self._hass = hass self._store = Store[dict[str, dict[str, Union[bool, int]]]](hass, STORAGE_VERSION, STORAGE_KEY) self._prefs: dict[str, dict...
the_stack_v2_python_sparse
homeassistant/components/camera/prefs.py
Adminiuga/home-assistant
train
5
b7e1020f922462a96c74de2426d8ae7d8a566592
[ "res = []\n\ndef dfs_preorder(node):\n if not node:\n return\n res.append(str(node.val))\n dfs_preorder(node.left)\n dfs_preorder(node.right)\ndfs_preorder(root)\nreturn '' if not res else '|'.join(res)", "def dfs_restore(lis):\n father = TreeNode(lis[0])\n length = len(lis)\n if lengt...
<|body_start_0|> res = [] def dfs_preorder(node): if not node: return res.append(str(node.val)) dfs_preorder(node.left) dfs_preorder(node.right) dfs_preorder(root) return '' if not res else '|'.join(res) <|end_body_0|> <|b...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] ...
stack_v2_sparse_classes_10k_train_001602
3,029
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_002775
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
ee59b82125f100970c842d5e1245287c484d6649
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" res = [] def dfs_preorder(node): if not node: return res.append(str(node.val)) dfs_preorder(node.left) dfs_preorder(node.right) ...
the_stack_v2_python_sparse
_CodeTopics/LeetCode/401-600/000449/WA--000449.py3
BIAOXYZ/variousCodes
train
0
34ae2a1749cc75de488c361eb89fe51d52d84d6a
[ "pygame.init()\nself.screen_width = 1200\nself.screen_height = 800\nself.screen = pygame.display.set_mode((self.screen_width, self.screen_height))\npygame.display.set_caption('Rain Drops')\nself.bg_color = (255, 255, 255)\nself.raindrops = pygame.sprite.Group()\nself._creat_raining()", "raindrop = RainDrop(self)\...
<|body_start_0|> pygame.init() self.screen_width = 1200 self.screen_height = 800 self.screen = pygame.display.set_mode((self.screen_width, self.screen_height)) pygame.display.set_caption('Rain Drops') self.bg_color = (255, 255, 255) self.raindrops = pygame.sprite....
Overall class for a raining screen.
RainDrops
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RainDrops: """Overall class for a raining screen.""" def __init__(self): """Initialize the game and background resources.""" <|body_0|> def _creat_raining(self): """Create a raining screen.""" <|body_1|> def _creat_raindrop(self, raindrop_number, row...
stack_v2_sparse_classes_10k_train_001603
3,365
no_license
[ { "docstring": "Initialize the game and background resources.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create a raining screen.", "name": "_creat_raining", "signature": "def _creat_raining(self)" }, { "docstring": "Create a raindrop and place in ...
4
stack_v2_sparse_classes_30k_train_004348
Implement the Python class `RainDrops` described below. Class description: Overall class for a raining screen. Method signatures and docstrings: - def __init__(self): Initialize the game and background resources. - def _creat_raining(self): Create a raining screen. - def _creat_raindrop(self, raindrop_number, row_num...
Implement the Python class `RainDrops` described below. Class description: Overall class for a raining screen. Method signatures and docstrings: - def __init__(self): Initialize the game and background resources. - def _creat_raining(self): Create a raining screen. - def _creat_raindrop(self, raindrop_number, row_num...
de8b257c1d69eb2a71dd95114f5f7adf58e00a53
<|skeleton|> class RainDrops: """Overall class for a raining screen.""" def __init__(self): """Initialize the game and background resources.""" <|body_0|> def _creat_raining(self): """Create a raining screen.""" <|body_1|> def _creat_raindrop(self, raindrop_number, row...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RainDrops: """Overall class for a raining screen.""" def __init__(self): """Initialize the game and background resources.""" pygame.init() self.screen_width = 1200 self.screen_height = 800 self.screen = pygame.display.set_mode((self.screen_width, self.screen_height...
the_stack_v2_python_sparse
ch12_tryityourslef/raindrops.py
thewchan/python_crash_course
train
0
26a0ae093e50ba557105e90de436f1302d44fac3
[ "self.conn = connection\nself.method_proto = MethodProtocol(self.conn)\nself.process_map = {'divide': self._process_divide}\nself.handlers = handlers", "name = self.method_proto.get_method_name()\n_process = self.process_map[name]\n_process()", "proto = DivideProtocol()\nargs = proto.args_decode(self.conn)\ntry...
<|body_start_0|> self.conn = connection self.method_proto = MethodProtocol(self.conn) self.process_map = {'divide': self._process_divide} self.handlers = handlers <|end_body_0|> <|body_start_1|> name = self.method_proto.get_method_name() _process = self.process_map[name]...
帮助服务器完成远端过程调用
ServerStub
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServerStub: """帮助服务器完成远端过程调用""" def __init__(self, connection, handlers): """:param connection: :param handlers:""" <|body_0|> def process(self): """当服务端接受了一个客户端的连接,建立好连接后,完成远端调用处理 :return:""" <|body_1|> def _process_divide(self): """处理除法的过程调...
stack_v2_sparse_classes_10k_train_001604
9,202
permissive
[ { "docstring": ":param connection: :param handlers:", "name": "__init__", "signature": "def __init__(self, connection, handlers)" }, { "docstring": "当服务端接受了一个客户端的连接,建立好连接后,完成远端调用处理 :return:", "name": "process", "signature": "def process(self)" }, { "docstring": "处理除法的过程调用 :return...
3
null
Implement the Python class `ServerStub` described below. Class description: 帮助服务器完成远端过程调用 Method signatures and docstrings: - def __init__(self, connection, handlers): :param connection: :param handlers: - def process(self): 当服务端接受了一个客户端的连接,建立好连接后,完成远端调用处理 :return: - def _process_divide(self): 处理除法的过程调用 :return:
Implement the Python class `ServerStub` described below. Class description: 帮助服务器完成远端过程调用 Method signatures and docstrings: - def __init__(self, connection, handlers): :param connection: :param handlers: - def process(self): 当服务端接受了一个客户端的连接,建立好连接后,完成远端调用处理 :return: - def _process_divide(self): 处理除法的过程调用 :return: <|s...
be120ce2bb94a8e8395630218985f5e51ae087d9
<|skeleton|> class ServerStub: """帮助服务器完成远端过程调用""" def __init__(self, connection, handlers): """:param connection: :param handlers:""" <|body_0|> def process(self): """当服务端接受了一个客户端的连接,建立好连接后,完成远端调用处理 :return:""" <|body_1|> def _process_divide(self): """处理除法的过程调...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ServerStub: """帮助服务器完成远端过程调用""" def __init__(self, connection, handlers): """:param connection: :param handlers:""" self.conn = connection self.method_proto = MethodProtocol(self.conn) self.process_map = {'divide': self._process_divide} self.handlers = handlers ...
the_stack_v2_python_sparse
KnowledgeMapping/grpc/services.py
nickliqian/keep_learning
train
8
1e15e54e6f32fd3b7a97542a8a025be3e74543fe
[ "if target <= 1:\n raise ValueError(f'Target iteration of ETA must be > 1, got {target}')\nself.targetIteration = target\nself._ti = None\nself._xi = None", "if self._ti is None:\n if current > 0:\n self._ti = time.time()\n self._xi = current\n return None\nif current <= self._xi:\n retu...
<|body_start_0|> if target <= 1: raise ValueError(f'Target iteration of ETA must be > 1, got {target}') self.targetIteration = target self._ti = None self._xi = None <|end_body_0|> <|body_start_1|> if self._ti is None: if current > 0: self...
! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterations but gives a good estimate for mostly stable durations. The start ...
ETA
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ETA: """! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterations but gives a good estimate for most...
stack_v2_sparse_classes_10k_train_001605
29,663
permissive
[ { "docstring": "!Initialize with a given target iteration number.", "name": "__init__", "signature": "def __init__(self, target)" }, { "docstring": "! Estimate the time of arrival given a current iteration. \\\\param current Iteration number the loop is currently at. \\\\returns - Estimated time...
3
stack_v2_sparse_classes_30k_train_000261
Implement the Python class `ETA` described below. Class description: ! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterat...
Implement the Python class `ETA` described below. Class description: ! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterat...
41557db1965bf3801bfadf9ece39ec1dab9b7660
<|skeleton|> class ETA: """! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterations but gives a good estimate for most...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ETA: """! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterations but gives a good estimate for mostly stable dur...
the_stack_v2_python_sparse
src/isle/cli.py
evanberkowitz/isle
train
3
6f2301e3e6bd43e8a82926349a880ca4b23fdc3b
[ "ts = int(datetime.now(timezone.utc).timestamp() * 1000)\nurl_suffix, _json = prepare_get_changes(ts)\nassert url_suffix == 'get_changes', f'prepare_get_changes\\n\\treturns url_suffix: {url_suffix}\\n\\tinstead url_suffix: get_changes'\nassert _json == {'last_update_ts': ts}", "url_suffix, iocs = prepare_enable_...
<|body_start_0|> ts = int(datetime.now(timezone.utc).timestamp() * 1000) url_suffix, _json = prepare_get_changes(ts) assert url_suffix == 'get_changes', f'prepare_get_changes\n\treturns url_suffix: {url_suffix}\n\tinstead url_suffix: get_changes' assert _json == {'last_update_ts': ts} <|...
TestPrepareCommands
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPrepareCommands: def test_prepare_get_changes(self): """Given: - get changes command Then: - Verify url and json format.""" <|body_0|> def test_prepare_enable_iocs(self): """Given: - enable iocs command Then: - Verify url and json format.""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_001606
41,271
permissive
[ { "docstring": "Given: - get changes command Then: - Verify url and json format.", "name": "test_prepare_get_changes", "signature": "def test_prepare_get_changes(self)" }, { "docstring": "Given: - enable iocs command Then: - Verify url and json format.", "name": "test_prepare_enable_iocs", ...
3
stack_v2_sparse_classes_30k_train_006368
Implement the Python class `TestPrepareCommands` described below. Class description: Implement the TestPrepareCommands class. Method signatures and docstrings: - def test_prepare_get_changes(self): Given: - get changes command Then: - Verify url and json format. - def test_prepare_enable_iocs(self): Given: - enable i...
Implement the Python class `TestPrepareCommands` described below. Class description: Implement the TestPrepareCommands class. Method signatures and docstrings: - def test_prepare_get_changes(self): Given: - get changes command Then: - Verify url and json format. - def test_prepare_enable_iocs(self): Given: - enable i...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestPrepareCommands: def test_prepare_get_changes(self): """Given: - get changes command Then: - Verify url and json format.""" <|body_0|> def test_prepare_enable_iocs(self): """Given: - enable iocs command Then: - Verify url and json format.""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestPrepareCommands: def test_prepare_get_changes(self): """Given: - get changes command Then: - Verify url and json format.""" ts = int(datetime.now(timezone.utc).timestamp() * 1000) url_suffix, _json = prepare_get_changes(ts) assert url_suffix == 'get_changes', f'prepare_get_...
the_stack_v2_python_sparse
Packs/CortexXDR/Integrations/XDR_iocs/XDR_iocs_test.py
demisto/content
train
1,023
abe8d3058ece639f5e75f8f22e0649d94d1399a5
[ "import numpy as np\nself.positions = np.array(positions)\nself.position_value = 1000 / self.positions\nself.num_trials = num_trials", "import numpy as np\np = 0.51\ncumu_ret = []\nfor i, position in enumerate(self.positions):\n position_return = 2 * self.position_value[i] * np.random.binomial(position, p)\n ...
<|body_start_0|> import numpy as np self.positions = np.array(positions) self.position_value = 1000 / self.positions self.num_trials = num_trials <|end_body_0|> <|body_start_1|> import numpy as np p = 0.51 cumu_ret = [] for i, position in enumerate(self.p...
Class represents a string of $1000 investments and their daily returns
investment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class investment: """Class represents a string of $1000 investments and their daily returns""" def __init__(self, positions=[1], num_trials=1): """Constructor for interval class inputs: positions: A list of integers of number of shares to buy. Each entry must be a factor of 1000. num_trial...
stack_v2_sparse_classes_10k_train_001607
1,980
no_license
[ { "docstring": "Constructor for interval class inputs: positions: A list of integers of number of shares to buy. Each entry must be a factor of 1000. num_trials: An integer representing the number of days to simulate investment", "name": "__init__", "signature": "def __init__(self, positions=[1], num_tr...
3
null
Implement the Python class `investment` described below. Class description: Class represents a string of $1000 investments and their daily returns Method signatures and docstrings: - def __init__(self, positions=[1], num_trials=1): Constructor for interval class inputs: positions: A list of integers of number of shar...
Implement the Python class `investment` described below. Class description: Class represents a string of $1000 investments and their daily returns Method signatures and docstrings: - def __init__(self, positions=[1], num_trials=1): Constructor for interval class inputs: positions: A list of integers of number of shar...
5b904060e8bced7f91547ad7f7819773a7450a1e
<|skeleton|> class investment: """Class represents a string of $1000 investments and their daily returns""" def __init__(self, positions=[1], num_trials=1): """Constructor for interval class inputs: positions: A list of integers of number of shares to buy. Each entry must be a factor of 1000. num_trial...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class investment: """Class represents a string of $1000 investments and their daily returns""" def __init__(self, positions=[1], num_trials=1): """Constructor for interval class inputs: positions: A list of integers of number of shares to buy. Each entry must be a factor of 1000. num_trials: An integer...
the_stack_v2_python_sparse
jt2276/investment_package/investment.py
ds-ga-1007/assignment8
train
1
caa0f6e81d8b6908bfa1eba5fbecc64271a56bd6
[ "hash_map = {}\nfor i, n in enumerate(nums):\n for d in range(t + 1):\n if n - d in hash_map and i - hash_map[abs(n - d)] <= k:\n return True\n elif n + d in hash_map and i - hash_map[n + d] <= k:\n return True\n hash_map[n] = i\nreturn False", "if k == 0:\n return Fal...
<|body_start_0|> hash_map = {} for i, n in enumerate(nums): for d in range(t + 1): if n - d in hash_map and i - hash_map[abs(n - d)] <= k: return True elif n + d in hash_map and i - hash_map[n + d] <= k: return True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate_TLE(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" ...
stack_v2_sparse_classes_10k_train_001608
3,134
no_license
[ { "docstring": ":type nums: List[int] :type k: int :type t: int :rtype: bool", "name": "containsNearbyAlmostDuplicate_TLE", "signature": "def containsNearbyAlmostDuplicate_TLE(self, nums, k, t)" }, { "docstring": ":type nums: List[int] :type k: int :type t: int :rtype: bool", "name": "contai...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate_TLE(self, nums, k, t): :type nums: List[int] :type k: int :type t: int :rtype: bool - def containsNearbyAlmostDuplicate(self, nums, k, t): :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate_TLE(self, nums, k, t): :type nums: List[int] :type k: int :type t: int :rtype: bool - def containsNearbyAlmostDuplicate(self, nums, k, t): :type...
2d5fa4cd696d5035ea8859befeadc5cc436959c9
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate_TLE(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def containsNearbyAlmostDuplicate_TLE(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" hash_map = {} for i, n in enumerate(nums): for d in range(t + 1): if n - d in hash_map and i - hash_map[abs(n - d)] <= k: ...
the_stack_v2_python_sparse
SourceCode/Python/Problem/00220.Contains Duplicate III.py
roger6blog/LeetCode
train
0
6565dd37f814dd602ed8b9dbf4480676f157da9f
[ "if rel.to not in self.admin_site._registry:\n for parent in rel.to.mro():\n if parent in self.admin_site._registry and hasattr(self.admin_site._registry[parent], '_child_admin_site'):\n return self.admin_site._registry[parent]._child_admin_site\nreturn self.admin_site", "db = kwargs.get('usi...
<|body_start_0|> if rel.to not in self.admin_site._registry: for parent in rel.to.mro(): if parent in self.admin_site._registry and hasattr(self.admin_site._registry[parent], '_child_admin_site'): return self.admin_site._registry[parent]._child_admin_site ...
Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field.
PolymorphicAdminRawIdFix
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PolymorphicAdminRawIdFix: """Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field.""" def _get_child_admin_site(self, rel): """Returns the separate AdminSite instance that django-polymorphic maintains for child models...
stack_v2_sparse_classes_10k_train_001609
9,643
permissive
[ { "docstring": "Returns the separate AdminSite instance that django-polymorphic maintains for child models. This admin site needs to be passed to the widget so that it passes the check of whether the field is pointing to a model that's registered in the admin. The hackiness of this implementation reflects the h...
3
stack_v2_sparse_classes_30k_val_000321
Implement the Python class `PolymorphicAdminRawIdFix` described below. Class description: Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field. Method signatures and docstrings: - def _get_child_admin_site(self, rel): Returns the separate AdminSite in...
Implement the Python class `PolymorphicAdminRawIdFix` described below. Class description: Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field. Method signatures and docstrings: - def _get_child_admin_site(self, rel): Returns the separate AdminSite in...
c507ea5b1864303732c53ad7c5800571fca5fa94
<|skeleton|> class PolymorphicAdminRawIdFix: """Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field.""" def _get_child_admin_site(self, rel): """Returns the separate AdminSite instance that django-polymorphic maintains for child models...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PolymorphicAdminRawIdFix: """Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field.""" def _get_child_admin_site(self, rel): """Returns the separate AdminSite instance that django-polymorphic maintains for child models. This admin ...
the_stack_v2_python_sparse
icekit/admin_tools/polymorphic.py
ic-labs/django-icekit
train
53
71b1c35f975605741dce944f7b662ab9660fa935
[ "super(EmailBackend, self).__init__(**kwargs)\nself.api_key = api_key if api_key is not None else getattr(settings, 'POSTMARK_API_KEY', None)\nif self.api_key is None:\n raise ImproperlyConfigured('POSTMARK API key must be set in Django settings file or passed to backend constructor.')\nself.default_sender = get...
<|body_start_0|> super(EmailBackend, self).__init__(**kwargs) self.api_key = api_key if api_key is not None else getattr(settings, 'POSTMARK_API_KEY', None) if self.api_key is None: raise ImproperlyConfigured('POSTMARK API key must be set in Django settings file or passed to backend ...
EmailBackend
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailBackend: def __init__(self, api_key=None, default_sender=None, **kwargs): """Initialize the backend.""" <|body_0|> def send_messages(self, email_messages): """Sends one or more EmailMessage objects and returns the number of email messages sent.""" <|body...
stack_v2_sparse_classes_10k_train_001610
39,873
no_license
[ { "docstring": "Initialize the backend.", "name": "__init__", "signature": "def __init__(self, api_key=None, default_sender=None, **kwargs)" }, { "docstring": "Sends one or more EmailMessage objects and returns the number of email messages sent.", "name": "send_messages", "signature": "d...
4
null
Implement the Python class `EmailBackend` described below. Class description: Implement the EmailBackend class. Method signatures and docstrings: - def __init__(self, api_key=None, default_sender=None, **kwargs): Initialize the backend. - def send_messages(self, email_messages): Sends one or more EmailMessage objects...
Implement the Python class `EmailBackend` described below. Class description: Implement the EmailBackend class. Method signatures and docstrings: - def __init__(self, api_key=None, default_sender=None, **kwargs): Initialize the backend. - def send_messages(self, email_messages): Sends one or more EmailMessage objects...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class EmailBackend: def __init__(self, api_key=None, default_sender=None, **kwargs): """Initialize the backend.""" <|body_0|> def send_messages(self, email_messages): """Sends one or more EmailMessage objects and returns the number of email messages sent.""" <|body...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EmailBackend: def __init__(self, api_key=None, default_sender=None, **kwargs): """Initialize the backend.""" super(EmailBackend, self).__init__(**kwargs) self.api_key = api_key if api_key is not None else getattr(settings, 'POSTMARK_API_KEY', None) if self.api_key is None: ...
the_stack_v2_python_sparse
repoData/themartorana-python-postmark/allPythonContent.py
aCoffeeYin/pyreco
train
0
35c7d123bbcd8384da5fccc413523aa6b531cd7d
[ "if pairs is None:\n pairs = []\nif redditors is None:\n redditors = []\nif subreddits is None:\n subreddits = []\nif things is None:\n things = []\nif not pairs + redditors + subreddits + things:\n msg = \"Either the 'pairs', 'redditors', 'subreddits', or 'things' parameters must be provided.\"\n ...
<|body_start_0|> if pairs is None: pairs = [] if redditors is None: redditors = [] if subreddits is None: subreddits = [] if things is None: things = [] if not pairs + redditors + subreddits + things: msg = "Either the '...
Provides methods to interact with moderator notes at a global level. .. note:: The authenticated user must be a moderator of the provided subreddit(s). For example, the latest note for u/spez in r/redditdev and r/test, and for u/bboe in r/redditdev can be iterated through like so: .. code-block:: python redditor = redd...
RedditModNotes
[ "GPL-3.0-only", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RedditModNotes: """Provides methods to interact with moderator notes at a global level. .. note:: The authenticated user must be a moderator of the provided subreddit(s). For example, the latest note for u/spez in r/redditdev and r/test, and for u/bboe in r/redditdev can be iterated through like ...
stack_v2_sparse_classes_10k_train_001611
25,425
permissive
[ { "docstring": "Get note(s) for each subreddit/user pair, or ``None`` if they don't have any. :param all_notes: Whether to return all notes or only the latest note for each subreddit/redditor pair (default: ``False``). .. note:: Setting this to ``True`` will result in a request for each unique subreddit/reddito...
2
stack_v2_sparse_classes_30k_train_005114
Implement the Python class `RedditModNotes` described below. Class description: Provides methods to interact with moderator notes at a global level. .. note:: The authenticated user must be a moderator of the provided subreddit(s). For example, the latest note for u/spez in r/redditdev and r/test, and for u/bboe in r/...
Implement the Python class `RedditModNotes` described below. Class description: Provides methods to interact with moderator notes at a global level. .. note:: The authenticated user must be a moderator of the provided subreddit(s). For example, the latest note for u/spez in r/redditdev and r/test, and for u/bboe in r/...
f1d5506b7a3df240f748e1b7749fd5636aa67b32
<|skeleton|> class RedditModNotes: """Provides methods to interact with moderator notes at a global level. .. note:: The authenticated user must be a moderator of the provided subreddit(s). For example, the latest note for u/spez in r/redditdev and r/test, and for u/bboe in r/redditdev can be iterated through like ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RedditModNotes: """Provides methods to interact with moderator notes at a global level. .. note:: The authenticated user must be a moderator of the provided subreddit(s). For example, the latest note for u/spez in r/redditdev and r/test, and for u/bboe in r/redditdev can be iterated through like so: .. code-b...
the_stack_v2_python_sparse
praw/models/mod_notes.py
praw-dev/praw
train
2,825
0314a088022a6428982143b4d6f403ecb1b5be49
[ "words = sentence.split()\ndict.sort(key=lambda x: (x, len(x)))\nfor i, word in enumerate(words):\n new_word = list(filter(lambda x: word.startswith(x), dict))\n if len(new_word) > 0:\n words[i] = new_word[0]\nreturn ' '.join(words)", "dict_set = set(dict)\n\ndef replace(word):\n \"\"\"\n ...
<|body_start_0|> words = sentence.split() dict.sort(key=lambda x: (x, len(x))) for i, word in enumerate(words): new_word = list(filter(lambda x: word.startswith(x), dict)) if len(new_word) > 0: words[i] = new_word[0] return ' '.join(words) <|end_bo...
Runtime: 84 ms, faster than 79.35% of Python3 online submissions for Replace Words. Memory Usage: 28.6 MB, less than 50.00% of Python3 online submissions for Replace Words.
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Runtime: 84 ms, faster than 79.35% of Python3 online submissions for Replace Words. Memory Usage: 28.6 MB, less than 50.00% of Python3 online submissions for Replace Words.""" def brute_force(self, dict: List[str], sentence: str) -> str: """Brute force solution that I co...
stack_v2_sparse_classes_10k_train_001612
3,247
no_license
[ { "docstring": "Brute force solution that I come up with Args: dict(list[str]): sentence(str): Returns: str:", "name": "brute_force", "signature": "def brute_force(self, dict: List[str], sentence: str) -> str" }, { "docstring": "Slightly better solution which runs in O(M + W^2) where M = len(dic...
3
null
Implement the Python class `Solution` described below. Class description: Runtime: 84 ms, faster than 79.35% of Python3 online submissions for Replace Words. Memory Usage: 28.6 MB, less than 50.00% of Python3 online submissions for Replace Words. Method signatures and docstrings: - def brute_force(self, dict: List[st...
Implement the Python class `Solution` described below. Class description: Runtime: 84 ms, faster than 79.35% of Python3 online submissions for Replace Words. Memory Usage: 28.6 MB, less than 50.00% of Python3 online submissions for Replace Words. Method signatures and docstrings: - def brute_force(self, dict: List[st...
01fe893ba2e37c9bda79e3081c556698f0b6d2f0
<|skeleton|> class Solution: """Runtime: 84 ms, faster than 79.35% of Python3 online submissions for Replace Words. Memory Usage: 28.6 MB, less than 50.00% of Python3 online submissions for Replace Words.""" def brute_force(self, dict: List[str], sentence: str) -> str: """Brute force solution that I co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: """Runtime: 84 ms, faster than 79.35% of Python3 online submissions for Replace Words. Memory Usage: 28.6 MB, less than 50.00% of Python3 online submissions for Replace Words.""" def brute_force(self, dict: List[str], sentence: str) -> str: """Brute force solution that I come up with Ar...
the_stack_v2_python_sparse
LeetCode/648_replace_words.py
KKosukeee/CodingQuestions
train
1
325e0d89af4778dd574ee997c3c67b58a1a5b2c0
[ "if len(parts) < 3:\n self.client.sendServerMessage('You must provide a username and a message.')\nelse:\n try:\n from_user = self.client.username.lower()\n to_user = parts[1].lower()\n mess = ' '.join(parts[2:])\n file = open('config/data/inbox.dat', 'r')\n messages = cPick...
<|body_start_0|> if len(parts) < 3: self.client.sendServerMessage('You must provide a username and a message.') else: try: from_user = self.client.username.lower() to_user = parts[1].lower() mess = ' '.join(parts[2:]) ...
OfflineMessPlugin
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfflineMessPlugin: def commandSendMessage(self, parts, fromloc, overriderank): """/s username message - Guest Aliases: sendmessage Sends an message to the users Inbox.""" <|body_0|> def commandCheckMessages(self, parts, fromloc, overriderank): """/inbox - Guest Check...
stack_v2_sparse_classes_10k_train_001613
3,110
permissive
[ { "docstring": "/s username message - Guest Aliases: sendmessage Sends an message to the users Inbox.", "name": "commandSendMessage", "signature": "def commandSendMessage(self, parts, fromloc, overriderank)" }, { "docstring": "/inbox - Guest Checks your Inbox of messages", "name": "commandCh...
3
stack_v2_sparse_classes_30k_train_000175
Implement the Python class `OfflineMessPlugin` described below. Class description: Implement the OfflineMessPlugin class. Method signatures and docstrings: - def commandSendMessage(self, parts, fromloc, overriderank): /s username message - Guest Aliases: sendmessage Sends an message to the users Inbox. - def commandC...
Implement the Python class `OfflineMessPlugin` described below. Class description: Implement the OfflineMessPlugin class. Method signatures and docstrings: - def commandSendMessage(self, parts, fromloc, overriderank): /s username message - Guest Aliases: sendmessage Sends an message to the users Inbox. - def commandC...
5482def8b50562fdbae980cda9b1708bfad8bffb
<|skeleton|> class OfflineMessPlugin: def commandSendMessage(self, parts, fromloc, overriderank): """/s username message - Guest Aliases: sendmessage Sends an message to the users Inbox.""" <|body_0|> def commandCheckMessages(self, parts, fromloc, overriderank): """/inbox - Guest Check...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OfflineMessPlugin: def commandSendMessage(self, parts, fromloc, overriderank): """/s username message - Guest Aliases: sendmessage Sends an message to the users Inbox.""" if len(parts) < 3: self.client.sendServerMessage('You must provide a username and a message.') else: ...
the_stack_v2_python_sparse
core/plugins/inbox.py
TheArchives/Nexus
train
1
14129a55aeaa36e67d6107888a1220ca73afc971
[ "if first_stage_features_stride != 16:\n raise ValueError('`first_stage_features_stride` must be 16.')\nsuper(FasterRCNNResnetKerasFeatureExtractor, self).__init__(is_training, first_stage_features_stride, batch_norm_trainable, weight_decay)\nself.classification_backbone = None\nself._variable_dict = {}\nself._r...
<|body_start_0|> if first_stage_features_stride != 16: raise ValueError('`first_stage_features_stride` must be 16.') super(FasterRCNNResnetKerasFeatureExtractor, self).__init__(is_training, first_stage_features_stride, batch_norm_trainable, weight_decay) self.classification_backbone ...
Faster R-CNN with Resnet feature extractor implementation.
FasterRCNNResnetKerasFeatureExtractor
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FasterRCNNResnetKerasFeatureExtractor: """Faster R-CNN with Resnet feature extractor implementation.""" def __init__(self, is_training, resnet_v1_base_model, resnet_v1_base_model_name, first_stage_features_stride=16, batch_norm_trainable=False, weight_decay=0.0): """Constructor. Args...
stack_v2_sparse_classes_10k_train_001614
9,440
permissive
[ { "docstring": "Constructor. Args: is_training: See base class. resnet_v1_base_model: base resnet v1 network to use. One of the resnet_v1.resnet_v1_{50,101,152} models. resnet_v1_base_model_name: model name under which to construct resnet v1. first_stage_features_stride: See base class. batch_norm_trainable: Se...
4
stack_v2_sparse_classes_30k_train_003888
Implement the Python class `FasterRCNNResnetKerasFeatureExtractor` described below. Class description: Faster R-CNN with Resnet feature extractor implementation. Method signatures and docstrings: - def __init__(self, is_training, resnet_v1_base_model, resnet_v1_base_model_name, first_stage_features_stride=16, batch_n...
Implement the Python class `FasterRCNNResnetKerasFeatureExtractor` described below. Class description: Faster R-CNN with Resnet feature extractor implementation. Method signatures and docstrings: - def __init__(self, is_training, resnet_v1_base_model, resnet_v1_base_model_name, first_stage_features_stride=16, batch_n...
6fc53292b1d3ce3c0340ce724c2c11c77e663d27
<|skeleton|> class FasterRCNNResnetKerasFeatureExtractor: """Faster R-CNN with Resnet feature extractor implementation.""" def __init__(self, is_training, resnet_v1_base_model, resnet_v1_base_model_name, first_stage_features_stride=16, batch_norm_trainable=False, weight_decay=0.0): """Constructor. Args...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FasterRCNNResnetKerasFeatureExtractor: """Faster R-CNN with Resnet feature extractor implementation.""" def __init__(self, is_training, resnet_v1_base_model, resnet_v1_base_model_name, first_stage_features_stride=16, batch_norm_trainable=False, weight_decay=0.0): """Constructor. Args: is_training...
the_stack_v2_python_sparse
models/research/object_detection/models/faster_rcnn_resnet_keras_feature_extractor.py
aboerzel/German_License_Plate_Recognition
train
34
2fc65772b90a27673e6d01d877fa8cb5bea60810
[ "if source == destination:\n return True\nuf = UnionFind(n)\nfor edge in edges:\n uf.union(edge[0], edge[1])\n if uf.connected(source, destination):\n return True\nreturn uf.connected(source, destination)", "if source == destination:\n return True\nedge_dict = defaultdict(list)\nfor edge in edg...
<|body_start_0|> if source == destination: return True uf = UnionFind(n) for edge in edges: uf.union(edge[0], edge[1]) if uf.connected(source, destination): return True return uf.connected(source, destination) <|end_body_0|> <|body_sta...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def validPath(self, n: int, edges: List[List[int]], source: int, destination: int) -> bool: """CREATED AT: 2022/1/28 25 / 25 test cases passed. Status: Accepted Runtime: 3405 ms, faster than 15.86% Memory Usage: 103.6 MB, less than 99.46% After add the code: >>> if uf.connected...
stack_v2_sparse_classes_10k_train_001615
4,213
permissive
[ { "docstring": "CREATED AT: 2022/1/28 25 / 25 test cases passed. Status: Accepted Runtime: 3405 ms, faster than 15.86% Memory Usage: 103.6 MB, less than 99.46% After add the code: >>> if uf.connected(source, destination): >>> return True 25 / 25 test cases passed. Status: Accepted Runtime: 1828 ms, faster than ...
2
stack_v2_sparse_classes_30k_train_003535
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validPath(self, n: int, edges: List[List[int]], source: int, destination: int) -> bool: CREATED AT: 2022/1/28 25 / 25 test cases passed. Status: Accepted Runtime: 3405 ms, fa...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validPath(self, n: int, edges: List[List[int]], source: int, destination: int) -> bool: CREATED AT: 2022/1/28 25 / 25 test cases passed. Status: Accepted Runtime: 3405 ms, fa...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def validPath(self, n: int, edges: List[List[int]], source: int, destination: int) -> bool: """CREATED AT: 2022/1/28 25 / 25 test cases passed. Status: Accepted Runtime: 3405 ms, faster than 15.86% Memory Usage: 103.6 MB, less than 99.46% After add the code: >>> if uf.connected...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def validPath(self, n: int, edges: List[List[int]], source: int, destination: int) -> bool: """CREATED AT: 2022/1/28 25 / 25 test cases passed. Status: Accepted Runtime: 3405 ms, faster than 15.86% Memory Usage: 103.6 MB, less than 99.46% After add the code: >>> if uf.connected(source, desti...
the_stack_v2_python_sparse
src/1971-FindIfPathExistsInGraph.py
Jiezhi/myleetcode
train
1
8058c6600ba73fb5f0bc8b295f4f1004cf54bdf3
[ "def update_receiver():\n self.req = MPI.nonblocking_receive(source=source, tag=tag)\nself.update_receiver = update_receiver\nself.update_receiver()", "try:\n msg_available, data = self.req.test()\nexcept _pickle.UnpicklingError as e:\n error_print('unpickling error in MPI (%s), recovering by assuming no...
<|body_start_0|> def update_receiver(): self.req = MPI.nonblocking_receive(source=source, tag=tag) self.update_receiver = update_receiver self.update_receiver() <|end_body_0|> <|body_start_1|> try: msg_available, data = self.req.test() except _pickle.Unpi...
Wraps a call to MPI's Comm.irecv. **NOT THREAD SAFE - use inside a mutex block!**
NonblockingMPIMessageReceiver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NonblockingMPIMessageReceiver: """Wraps a call to MPI's Comm.irecv. **NOT THREAD SAFE - use inside a mutex block!**""" def __init__(self, source, tag): """Parameters ---------- source : int Rank of message source process. tag : int Message tag.""" <|body_0|> def receive(...
stack_v2_sparse_classes_10k_train_001616
9,643
no_license
[ { "docstring": "Parameters ---------- source : int Rank of message source process. tag : int Message tag.", "name": "__init__", "signature": "def __init__(self, source, tag)" }, { "docstring": "Non-blocking receive message, if one is available. Returns ------- The received data, ``None`` if no d...
2
stack_v2_sparse_classes_30k_train_000914
Implement the Python class `NonblockingMPIMessageReceiver` described below. Class description: Wraps a call to MPI's Comm.irecv. **NOT THREAD SAFE - use inside a mutex block!** Method signatures and docstrings: - def __init__(self, source, tag): Parameters ---------- source : int Rank of message source process. tag :...
Implement the Python class `NonblockingMPIMessageReceiver` described below. Class description: Wraps a call to MPI's Comm.irecv. **NOT THREAD SAFE - use inside a mutex block!** Method signatures and docstrings: - def __init__(self, source, tag): Parameters ---------- source : int Rank of message source process. tag :...
858f2b673bedbec39fca9bdc9c825a3c2fefe513
<|skeleton|> class NonblockingMPIMessageReceiver: """Wraps a call to MPI's Comm.irecv. **NOT THREAD SAFE - use inside a mutex block!**""" def __init__(self, source, tag): """Parameters ---------- source : int Rank of message source process. tag : int Message tag.""" <|body_0|> def receive(...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NonblockingMPIMessageReceiver: """Wraps a call to MPI's Comm.irecv. **NOT THREAD SAFE - use inside a mutex block!**""" def __init__(self, source, tag): """Parameters ---------- source : int Rank of message source process. tag : int Message tag.""" def update_receiver(): self.r...
the_stack_v2_python_sparse
lib/tools.py
roguextech/DanyloMalyuta-explicit_hybrid_mpc
train
0
7a67e48b4680d4e2115c461925147065f73d1d10
[ "n = len(nums)\np = [1] * n\nq = [1] * n\nres = [1] * n\nfor i in range(1, n):\n p[i] = p[i - 1] * nums[i - 1]\nfor i in range(n - 2, -1, -1):\n q[i] = q[i + 1] * nums[i + 1]\nfor i in range(n):\n res[i] = p[i] * q[i]\nreturn res", "n = len(nums)\nres = [1] * n\nt = 1\nfor i in range(n):\n res[i] *= t...
<|body_start_0|> n = len(nums) p = [1] * n q = [1] * n res = [1] * n for i in range(1, n): p[i] = p[i - 1] * nums[i - 1] for i in range(n - 2, -1, -1): q[i] = q[i + 1] * nums[i + 1] for i in range(n): res[i] = p[i] * q[i] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def productExceptSelf(self, nums): """p[i] 除第i个元素的前缀积 q[i] 除第i个元素的后缀积 :type nums: List[int] :rtype: List[int]""" <|body_0|> def productExceptSelf2(self, nums): """使用常数空间实现 变量t 存储前缀积和后缀积 :param nums: :return:""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_10k_train_001617
1,559
no_license
[ { "docstring": "p[i] 除第i个元素的前缀积 q[i] 除第i个元素的后缀积 :type nums: List[int] :rtype: List[int]", "name": "productExceptSelf", "signature": "def productExceptSelf(self, nums)" }, { "docstring": "使用常数空间实现 变量t 存储前缀积和后缀积 :param nums: :return:", "name": "productExceptSelf2", "signature": "def produc...
2
stack_v2_sparse_classes_30k_train_002216
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums): p[i] 除第i个元素的前缀积 q[i] 除第i个元素的后缀积 :type nums: List[int] :rtype: List[int] - def productExceptSelf2(self, nums): 使用常数空间实现 变量t 存储前缀积和后缀积 :param num...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums): p[i] 除第i个元素的前缀积 q[i] 除第i个元素的后缀积 :type nums: List[int] :rtype: List[int] - def productExceptSelf2(self, nums): 使用常数空间实现 变量t 存储前缀积和后缀积 :param num...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def productExceptSelf(self, nums): """p[i] 除第i个元素的前缀积 q[i] 除第i个元素的后缀积 :type nums: List[int] :rtype: List[int]""" <|body_0|> def productExceptSelf2(self, nums): """使用常数空间实现 变量t 存储前缀积和后缀积 :param nums: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def productExceptSelf(self, nums): """p[i] 除第i个元素的前缀积 q[i] 除第i个元素的后缀积 :type nums: List[int] :rtype: List[int]""" n = len(nums) p = [1] * n q = [1] * n res = [1] * n for i in range(1, n): p[i] = p[i - 1] * nums[i - 1] for i in range(...
the_stack_v2_python_sparse
238_除自身以外数组的乘积.py
lovehhf/LeetCode
train
0
eb792235e8bd38f991766625fe5bceb95f9ed8df
[ "def backtrack(i, tmp_sum, tmp):\n if tmp_sum > target or i == n:\n return\n if tmp_sum == target:\n res.append(tmp)\n return\n backtrack(i, tmp_sum + candidates[i], tmp + [candidates[i]])\n backtrack(i + 1, tmp_sum, tmp)\nn = len(candidates)\nres = []\nbacktrack(0, 0, [])\nreturn r...
<|body_start_0|> def backtrack(i, tmp_sum, tmp): if tmp_sum > target or i == n: return if tmp_sum == target: res.append(tmp) return backtrack(i, tmp_sum + candidates[i], tmp + [candidates[i]]) backtrack(i + 1, tmp_su...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combinationSum1(self, candidates, target): """:type candidates: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def combinationSum(self, candidates, target): """:param candidates: :param target: :return:""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_10k_train_001618
1,401
no_license
[ { "docstring": ":type candidates: List[int] :type target: int :rtype: List[List[int]]", "name": "combinationSum1", "signature": "def combinationSum1(self, candidates, target)" }, { "docstring": ":param candidates: :param target: :return:", "name": "combinationSum", "signature": "def comb...
2
stack_v2_sparse_classes_30k_train_002199
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum1(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]] - def combinationSum(self, candidates, target): :param candid...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum1(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]] - def combinationSum(self, candidates, target): :param candid...
a91a758ab52d8615366a46b168181c04a92a793b
<|skeleton|> class Solution: def combinationSum1(self, candidates, target): """:type candidates: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def combinationSum(self, candidates, target): """:param candidates: :param target: :return:""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def combinationSum1(self, candidates, target): """:type candidates: List[int] :type target: int :rtype: List[List[int]]""" def backtrack(i, tmp_sum, tmp): if tmp_sum > target or i == n: return if tmp_sum == target: res.append(tm...
the_stack_v2_python_sparse
算法/39. 组合总和.py
Confucius-hui/LeetCode
train
0
d72d07557f329c79b4d38f1ddf419c1c2e139b74
[ "args = parser.parse_args()\ntry:\n if not all([args['platform_id'], args['vm_uuid']]):\n raise Exception('Parameter error')\n data = control.network_devices.get_network_by_vm_uuid(platform_id=args['platform_id'], vm_uuid=args['vm_uuid'])\nexcept Exception as e:\n return (set_return_val(False, [], s...
<|body_start_0|> args = parser.parse_args() try: if not all([args['platform_id'], args['vm_uuid']]): raise Exception('Parameter error') data = control.network_devices.get_network_by_vm_uuid(platform_id=args['platform_id'], vm_uuid=args['vm_uuid']) except E...
NetWorkManage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetWorkManage: def get(self): """获取vCenter vm_network_device 信息 --- tags: - vCenter network device parameters: - in: query name: platform_id type: integer required: true - in: query name: vm_uuid type: string required: true responses: 200: description: vCenter network device 信息 schema: p...
stack_v2_sparse_classes_10k_train_001619
7,551
no_license
[ { "docstring": "获取vCenter vm_network_device 信息 --- tags: - vCenter network device parameters: - in: query name: platform_id type: integer required: true - in: query name: vm_uuid type: string required: true responses: 200: description: vCenter network device 信息 schema: properties: ok: type: boolean description:...
3
stack_v2_sparse_classes_30k_train_004819
Implement the Python class `NetWorkManage` described below. Class description: Implement the NetWorkManage class. Method signatures and docstrings: - def get(self): 获取vCenter vm_network_device 信息 --- tags: - vCenter network device parameters: - in: query name: platform_id type: integer required: true - in: query name...
Implement the Python class `NetWorkManage` described below. Class description: Implement the NetWorkManage class. Method signatures and docstrings: - def get(self): 获取vCenter vm_network_device 信息 --- tags: - vCenter network device parameters: - in: query name: platform_id type: integer required: true - in: query name...
d25871dc66dfbd9f04e3d4d95843e39de286cfc8
<|skeleton|> class NetWorkManage: def get(self): """获取vCenter vm_network_device 信息 --- tags: - vCenter network device parameters: - in: query name: platform_id type: integer required: true - in: query name: vm_uuid type: string required: true responses: 200: description: vCenter network device 信息 schema: p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NetWorkManage: def get(self): """获取vCenter vm_network_device 信息 --- tags: - vCenter network device parameters: - in: query name: platform_id type: integer required: true - in: query name: vm_uuid type: string required: true responses: 200: description: vCenter network device 信息 schema: properties: ok:...
the_stack_v2_python_sparse
app/main/vcenter/apis/network_devices.py
zcl-organization/naguan
train
0
4bcea79345fde93851624c0606f74a16bfb70b07
[ "se = ''\nfor s in strs:\n se += str(len(s)) + ':' + s\nreturn se", "res = []\ni, j, length = (0, 0, len(s))\nwhile i < length:\n if s[j] == ':':\n num = int(s[i:j])\n res.append('' + s[j + 1:j + 1 + num])\n i = j + 1 + num\n j = j + 1 + num\n else:\n j += 1\nreturn res...
<|body_start_0|> se = '' for s in strs: se += str(len(s)) + ':' + s return se <|end_body_0|> <|body_start_1|> res = [] i, j, length = (0, 0, len(s)) while i < length: if s[j] == ':': num = int(s[i:j]) res.append('' ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k_train_001620
1,314
no_license
[ { "docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str", "name": "encode", "signature": "def encode(self, strs)" }, { "docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]", "name": "decode", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_004826
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
f2ea7165d40b392b8f8892ba7152438001900a4d
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" se = '' for s in strs: se += str(len(s)) + ':' + s return se def decode(self, s): """Decodes a single string to a list of strings. :type...
the_stack_v2_python_sparse
271-Encode_and_Decode_Strings.py
weichuntsai0217/leetcode
train
0
a9b624297274773b195611f20c5a4270800a9512
[ "super(PBAHpo, self).__init__(search_space, **kwargs)\nself.transformers = search_space.transformers\nself.operation_names = []\nfor operation, w_o in self.transformers.items():\n if w_o:\n self.operation_names.append(operation)\nnum_operation = len(self.operation_names)\nself.hpo = PBA(self.config.policy...
<|body_start_0|> super(PBAHpo, self).__init__(search_space, **kwargs) self.transformers = search_space.transformers self.operation_names = [] for operation, w_o in self.transformers.items(): if w_o: self.operation_names.append(operation) num_operation ...
An Hpo of PBA, inherit from HpoGenerator.
PBAHpo
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PBAHpo: """An Hpo of PBA, inherit from HpoGenerator.""" def __init__(self, search_space=None, **kwargs): """Init PBAHpo.""" <|body_0|> def search(self): """Search an id and hps from hpo.""" <|body_1|> def update(self, record): """Update curre...
stack_v2_sparse_classes_10k_train_001621
3,217
permissive
[ { "docstring": "Init PBAHpo.", "name": "__init__", "signature": "def __init__(self, search_space=None, **kwargs)" }, { "docstring": "Search an id and hps from hpo.", "name": "search", "signature": "def search(self)" }, { "docstring": "Update current performance into hpo score boa...
3
null
Implement the Python class `PBAHpo` described below. Class description: An Hpo of PBA, inherit from HpoGenerator. Method signatures and docstrings: - def __init__(self, search_space=None, **kwargs): Init PBAHpo. - def search(self): Search an id and hps from hpo. - def update(self, record): Update current performance ...
Implement the Python class `PBAHpo` described below. Class description: An Hpo of PBA, inherit from HpoGenerator. Method signatures and docstrings: - def __init__(self, search_space=None, **kwargs): Init PBAHpo. - def search(self): Search an id and hps from hpo. - def update(self, record): Update current performance ...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class PBAHpo: """An Hpo of PBA, inherit from HpoGenerator.""" def __init__(self, search_space=None, **kwargs): """Init PBAHpo.""" <|body_0|> def search(self): """Search an id and hps from hpo.""" <|body_1|> def update(self, record): """Update curre...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PBAHpo: """An Hpo of PBA, inherit from HpoGenerator.""" def __init__(self, search_space=None, **kwargs): """Init PBAHpo.""" super(PBAHpo, self).__init__(search_space, **kwargs) self.transformers = search_space.transformers self.operation_names = [] for operation, w...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/algorithms/data_augmentation/pba_hpo.py
Huawei-Ascend/modelzoo
train
1
a88599b1abb8c8040d31beee3841a532244550ed
[ "if len(nums) == 0:\n return 0\nnumSet = set(nums)\nlongestStreak = 1\nfor num in numSet:\n if num - 1 not in numSet:\n currentStreak = 1\n cur = num\n while cur + 1 in numSet:\n currentStreak += 1\n cur += 1\n longestStreak = max(currentStreak, longestStreak)...
<|body_start_0|> if len(nums) == 0: return 0 numSet = set(nums) longestStreak = 1 for num in numSet: if num - 1 not in numSet: currentStreak = 1 cur = num while cur + 1 in numSet: currentStreak +=...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestConsecutive2(self, nums: [[int]]) -> int: """official""" <|body_0|> def longestConsecutive(self, nums: [[int]]) -> int: """Personal""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums) == 0: return 0 ...
stack_v2_sparse_classes_10k_train_001622
3,941
no_license
[ { "docstring": "official", "name": "longestConsecutive2", "signature": "def longestConsecutive2(self, nums: [[int]]) -> int" }, { "docstring": "Personal", "name": "longestConsecutive", "signature": "def longestConsecutive(self, nums: [[int]]) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive2(self, nums: [[int]]) -> int: official - def longestConsecutive(self, nums: [[int]]) -> int: Personal
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive2(self, nums: [[int]]) -> int: official - def longestConsecutive(self, nums: [[int]]) -> int: Personal <|skeleton|> class Solution: def longestConsecu...
fe414fff98c5d49ea374e24ef50c0ee4f6c66be2
<|skeleton|> class Solution: def longestConsecutive2(self, nums: [[int]]) -> int: """official""" <|body_0|> def longestConsecutive(self, nums: [[int]]) -> int: """Personal""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestConsecutive2(self, nums: [[int]]) -> int: """official""" if len(nums) == 0: return 0 numSet = set(nums) longestStreak = 1 for num in numSet: if num - 1 not in numSet: currentStreak = 1 cur = nu...
the_stack_v2_python_sparse
Leetcode/128_LongestConsecutiveSequence/sol.py
salaschen/ACM
train
5
531cf53fd5626912a737ad87ac6f1c1f65b39711
[ "torch_and_transformers_import.check()\nsuper().__init__()\nself.devices, _ = initialize_device_settings(devices=devices, use_cuda=use_gpu, multi_gpu=False)\nif len(self.devices) > 1:\n logger.warning('Multiple devices are not supported in %s inference, using the first device %s.', self.__class__.__name__, self....
<|body_start_0|> torch_and_transformers_import.check() super().__init__() self.devices, _ = initialize_device_settings(devices=devices, use_cuda=use_gpu, multi_gpu=False) if len(self.devices) > 1: logger.warning('Multiple devices are not supported in %s inference, using the f...
A transformer-based model to generate captions for images using the Hugging Face's transformers framework. **Example** ```python image_file_paths = ["/path/to/images/apple.jpg", "/path/to/images/cat.jpg", ] # Generate captions documents = image_to_text.generate_captions(image_file_paths=image_file_paths) # Show results...
TransformersImageToText
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformersImageToText: """A transformer-based model to generate captions for images using the Hugging Face's transformers framework. **Example** ```python image_file_paths = ["/path/to/images/apple.jpg", "/path/to/images/cat.jpg", ] # Generate captions documents = image_to_text.generate_caption...
stack_v2_sparse_classes_10k_train_001623
8,732
permissive
[ { "docstring": "Load an Image-to-Text model from transformers. :param model_name_or_path: Directory of a saved model or the name of a public model. To find these models: 1. Visit [Hugging Face image to text models](https://huggingface.co/models?pipeline_tag=image-to-text).` 2. Open the model you want to check. ...
2
null
Implement the Python class `TransformersImageToText` described below. Class description: A transformer-based model to generate captions for images using the Hugging Face's transformers framework. **Example** ```python image_file_paths = ["/path/to/images/apple.jpg", "/path/to/images/cat.jpg", ] # Generate captions doc...
Implement the Python class `TransformersImageToText` described below. Class description: A transformer-based model to generate captions for images using the Hugging Face's transformers framework. **Example** ```python image_file_paths = ["/path/to/images/apple.jpg", "/path/to/images/cat.jpg", ] # Generate captions doc...
5f1256ac7e5734c2ea481e72cb7e02c34baf8c43
<|skeleton|> class TransformersImageToText: """A transformer-based model to generate captions for images using the Hugging Face's transformers framework. **Example** ```python image_file_paths = ["/path/to/images/apple.jpg", "/path/to/images/cat.jpg", ] # Generate captions documents = image_to_text.generate_caption...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TransformersImageToText: """A transformer-based model to generate captions for images using the Hugging Face's transformers framework. **Example** ```python image_file_paths = ["/path/to/images/apple.jpg", "/path/to/images/cat.jpg", ] # Generate captions documents = image_to_text.generate_captions(image_file_...
the_stack_v2_python_sparse
haystack/nodes/image_to_text/transformers.py
deepset-ai/haystack
train
10,599
c8143d7baa0c82403e5c71cec9afd15dcfe9cf1c
[ "super(Firewall, self).__init__()\nself.log = logger.setup_logging(self.__class__.__name__)\nself.schema_class = 'edge_firewall_schema.FirewallSchema'\nself.set_content_type('application/xml')\nself.set_accept_type('application/xml')\nself.auth_type = 'vsm'\nif edge is not None:\n self.set_connection(edge.get_co...
<|body_start_0|> super(Firewall, self).__init__() self.log = logger.setup_logging(self.__class__.__name__) self.schema_class = 'edge_firewall_schema.FirewallSchema' self.set_content_type('application/xml') self.set_accept_type('application/xml') self.auth_type = 'vsm' ...
Firewall
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Firewall: def __init__(self, edge=None, version=None): """Constructor to create Firewall object @param edge object on which Firewall has to be configured""" <|body_0|> def create(self, schema_object): """Client method to perform create operation @param schema_object ...
stack_v2_sparse_classes_10k_train_001624
5,236
no_license
[ { "docstring": "Constructor to create Firewall object @param edge object on which Firewall has to be configured", "name": "__init__", "signature": "def __init__(self, edge=None, version=None)" }, { "docstring": "Client method to perform create operation @param schema_object instance of BaseSchem...
2
null
Implement the Python class `Firewall` described below. Class description: Implement the Firewall class. Method signatures and docstrings: - def __init__(self, edge=None, version=None): Constructor to create Firewall object @param edge object on which Firewall has to be configured - def create(self, schema_object): Cl...
Implement the Python class `Firewall` described below. Class description: Implement the Firewall class. Method signatures and docstrings: - def __init__(self, edge=None, version=None): Constructor to create Firewall object @param edge object on which Firewall has to be configured - def create(self, schema_object): Cl...
5b55817c050b637e2747084290f6206d2e622938
<|skeleton|> class Firewall: def __init__(self, edge=None, version=None): """Constructor to create Firewall object @param edge object on which Firewall has to be configured""" <|body_0|> def create(self, schema_object): """Client method to perform create operation @param schema_object ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Firewall: def __init__(self, edge=None, version=None): """Constructor to create Firewall object @param edge object on which Firewall has to be configured""" super(Firewall, self).__init__() self.log = logger.setup_logging(self.__class__.__name__) self.schema_class = 'edge_firew...
the_stack_v2_python_sparse
SystemTesting/pylib/nsx/vsm/edge/firewall.py
Cloudxtreme/MyProject
train
0
e2e77b9bbaeeacff458e42b53d6f9bc550cd479d
[ "self.host = args['host']\nself.port = args['port']\nself.debug = args['debug']\ntemplate_folder = f'{T_SYSTEM_PATH}/remote_ui/www'\nstatic_folder = f'{template_folder}/static'\nself.app = Flask(__name__, template_folder=template_folder, static_folder=static_folder)\nself.remote_ui_dir = f'{dot_t_system_dir}/remote...
<|body_start_0|> self.host = args['host'] self.port = args['port'] self.debug = args['debug'] template_folder = f'{T_SYSTEM_PATH}/remote_ui/www' static_folder = f'{template_folder}/static' self.app = Flask(__name__, template_folder=template_folder, static_folder=static_fo...
Class to define a flask handler to T_System communication ability with html and js. This class provides necessary initiations and a function named :func:`t_system.remote_ui.RemoteUI.__set_app` for the using flask api to communications with html and js.
RemoteUI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteUI: """Class to define a flask handler to T_System communication ability with html and js. This class provides necessary initiations and a function named :func:`t_system.remote_ui.RemoteUI.__set_app` for the using flask api to communications with html and js.""" def __init__(self, args...
stack_v2_sparse_classes_10k_train_001625
4,779
permissive
[ { "docstring": "Initialization method of :class:`t_system.remote_ui.RemoteUI` class. Args: args: Command-line arguments.", "name": "__init__", "signature": "def __init__(self, args)" }, { "docstring": "Method to setting flask API.", "name": "__set_app", "signature": "def __set_app(self)"...
3
stack_v2_sparse_classes_30k_train_003511
Implement the Python class `RemoteUI` described below. Class description: Class to define a flask handler to T_System communication ability with html and js. This class provides necessary initiations and a function named :func:`t_system.remote_ui.RemoteUI.__set_app` for the using flask api to communications with html ...
Implement the Python class `RemoteUI` described below. Class description: Class to define a flask handler to T_System communication ability with html and js. This class provides necessary initiations and a function named :func:`t_system.remote_ui.RemoteUI.__set_app` for the using flask api to communications with html ...
4cf34572b8f8eac54d6c339f37aa72b6a13d8934
<|skeleton|> class RemoteUI: """Class to define a flask handler to T_System communication ability with html and js. This class provides necessary initiations and a function named :func:`t_system.remote_ui.RemoteUI.__set_app` for the using flask api to communications with html and js.""" def __init__(self, args...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RemoteUI: """Class to define a flask handler to T_System communication ability with html and js. This class provides necessary initiations and a function named :func:`t_system.remote_ui.RemoteUI.__set_app` for the using flask api to communications with html and js.""" def __init__(self, args): ""...
the_stack_v2_python_sparse
t_system/remote_ui/__main__.py
LookAtMe-Genius-Cameraman/T_System
train
9
b9cc3c939efb3892e7fd9018ebecfaeda662dc62
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the reach plan service. Reach Plan Service gives users information about audience size that can be reached through advertisement on YouTube. In particular, GenerateReachForecast provides estimated number of people of specified demographics that can be reached by an ad in a given market by a campai...
ReachPlanServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReachPlanServiceServicer: """Proto file describing the reach plan service. Reach Plan Service gives users information about audience size that can be reached through advertisement on YouTube. In particular, GenerateReachForecast provides estimated number of people of specified demographics that c...
stack_v2_sparse_classes_10k_train_001626
6,480
permissive
[ { "docstring": "Returns the list of plannable locations (for example, countries & DMAs).", "name": "ListPlannableLocations", "signature": "def ListPlannableLocations(self, request, context)" }, { "docstring": "Returns the list of per-location plannable YouTube ad formats with allowed targeting."...
4
stack_v2_sparse_classes_30k_train_001626
Implement the Python class `ReachPlanServiceServicer` described below. Class description: Proto file describing the reach plan service. Reach Plan Service gives users information about audience size that can be reached through advertisement on YouTube. In particular, GenerateReachForecast provides estimated number of ...
Implement the Python class `ReachPlanServiceServicer` described below. Class description: Proto file describing the reach plan service. Reach Plan Service gives users information about audience size that can be reached through advertisement on YouTube. In particular, GenerateReachForecast provides estimated number of ...
a5b6cede64f4d9912ae6ad26927a54e40448c9fe
<|skeleton|> class ReachPlanServiceServicer: """Proto file describing the reach plan service. Reach Plan Service gives users information about audience size that can be reached through advertisement on YouTube. In particular, GenerateReachForecast provides estimated number of people of specified demographics that c...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ReachPlanServiceServicer: """Proto file describing the reach plan service. Reach Plan Service gives users information about audience size that can be reached through advertisement on YouTube. In particular, GenerateReachForecast provides estimated number of people of specified demographics that can be reached...
the_stack_v2_python_sparse
google/ads/google_ads/v3/proto/services/reach_plan_service_pb2_grpc.py
fiboknacky/google-ads-python
train
0
eb88d9a2a51250acfd27b95ca518b61038b50039
[ "element_txt = self.find_element(*Locators.EMAIL_HUID_TEXTBOX)\nelement_txt.clear()\nelement_txt.send_keys(search_term)\nelement_button = self.find_element(*Locators.SEARCH_BUTTON)\nelement_button.submit()", "try:\n webelement = self.find_element(*Locators.USER_NOT_FOUND_MSG_DIV)\nexcept NoSuchElementException...
<|body_start_0|> element_txt = self.find_element(*Locators.EMAIL_HUID_TEXTBOX) element_txt.clear() element_txt.send_keys(search_term) element_button = self.find_element(*Locators.SEARCH_BUTTON) element_button.submit() <|end_body_0|> <|body_start_1|> try: webe...
List of services offered on the Search page of Manage People tool
FindUserPageObject
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindUserPageObject: """List of services offered on the Search page of Manage People tool""" def find_user(self, search_term): """This find_user function simulates the typing the search term (user) in the search page, looking for the search button and hitting submit to search""" ...
stack_v2_sparse_classes_10k_train_001627
1,471
no_license
[ { "docstring": "This find_user function simulates the typing the search term (user) in the search page, looking for the search button and hitting submit to search", "name": "find_user", "signature": "def find_user(self, search_term)" }, { "docstring": "Returns True if the user not found message ...
2
stack_v2_sparse_classes_30k_train_005520
Implement the Python class `FindUserPageObject` described below. Class description: List of services offered on the Search page of Manage People tool Method signatures and docstrings: - def find_user(self, search_term): This find_user function simulates the typing the search term (user) in the search page, looking fo...
Implement the Python class `FindUserPageObject` described below. Class description: List of services offered on the Search page of Manage People tool Method signatures and docstrings: - def find_user(self, search_term): This find_user function simulates the typing the search term (user) in the search page, looking fo...
6d20ee2c193ed69b29aaf3f1dd23be419153ca72
<|skeleton|> class FindUserPageObject: """List of services offered on the Search page of Manage People tool""" def find_user(self, search_term): """This find_user function simulates the typing the search term (user) in the search page, looking for the search button and hitting submit to search""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FindUserPageObject: """List of services offered on the Search page of Manage People tool""" def find_user(self, search_term): """This find_user function simulates the typing the search term (user) in the search page, looking for the search button and hitting submit to search""" element_tx...
the_stack_v2_python_sparse
selenium_tests/manage_people/page_objects/mp_find_user_page.py
Harvard-University-iCommons/canvas_manage_course
train
4
38603ef08b999a2ea644b28054d4b631ceac36f1
[ "if inst is None:\n return self\nname = Nature.singlestrand.name\nval = next((i for i in inst.bindings if i.nature == name), None)\nif val is None:\n return Binding(max(inst.positions) * self.SINGLE_STRAND_FACTOR, onrate=0.0, offrate=0.0, nature=Nature.singlestrand)\nreturn val", "val = _BindingsDescriptor....
<|body_start_0|> if inst is None: return self name = Nature.singlestrand.name val = next((i for i in inst.bindings if i.nature == name), None) if val is None: return Binding(max(inst.positions) * self.SINGLE_STRAND_FACTOR, onrate=0.0, offrate=0.0, nature=Nature.si...
_SingleStrandBinding
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _SingleStrandBinding: def __get__(self, inst, owner): """return the single strand binding""" <|body_0|> def __set__(self, inst, value): """set the single strand binding""" <|body_1|> <|end_skeleton|> <|body_start_0|> if inst is None: ret...
stack_v2_sparse_classes_10k_train_001628
26,924
no_license
[ { "docstring": "return the single strand binding", "name": "__get__", "signature": "def __get__(self, inst, owner)" }, { "docstring": "set the single strand binding", "name": "__set__", "signature": "def __set__(self, inst, value)" } ]
2
stack_v2_sparse_classes_30k_train_000683
Implement the Python class `_SingleStrandBinding` described below. Class description: Implement the _SingleStrandBinding class. Method signatures and docstrings: - def __get__(self, inst, owner): return the single strand binding - def __set__(self, inst, value): set the single strand binding
Implement the Python class `_SingleStrandBinding` described below. Class description: Implement the _SingleStrandBinding class. Method signatures and docstrings: - def __get__(self, inst, owner): return the single strand binding - def __set__(self, inst, value): set the single strand binding <|skeleton|> class _Sing...
f9534e4fff9775ff45d08d401de61015d4a69e76
<|skeleton|> class _SingleStrandBinding: def __get__(self, inst, owner): """return the single strand binding""" <|body_0|> def __set__(self, inst, value): """set the single strand binding""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _SingleStrandBinding: def __get__(self, inst, owner): """return the single strand binding""" if inst is None: return self name = Nature.singlestrand.name val = next((i for i in inst.bindings if i.nature == name), None) if val is None: return Bind...
the_stack_v2_python_sparse
src/simulator/bindings.py
depixusgenome/trackanalysis
train
0
a23d46dae8f7fa8e308afb94d8a8828e7accd9d7
[ "if not root:\n return None\n\ndef helper(root):\n if not root:\n return None\n if root.val == val:\n return root\n elif root.val > val:\n return helper(root.left)\n else:\n return helper(root.right)\nreturn helper(root)", "if not root:\n return None\nwhile root and r...
<|body_start_0|> if not root: return None def helper(root): if not root: return None if root.val == val: return root elif root.val > val: return helper(root.left) else: return hel...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchBST(self, root: TreeNode, val: int) -> TreeNode: """递归法""" <|body_0|> def searchBST_1(self, root: TreeNode, val: int) -> TreeNode: """迭代法""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return None ...
stack_v2_sparse_classes_10k_train_001629
1,373
no_license
[ { "docstring": "递归法", "name": "searchBST", "signature": "def searchBST(self, root: TreeNode, val: int) -> TreeNode" }, { "docstring": "迭代法", "name": "searchBST_1", "signature": "def searchBST_1(self, root: TreeNode, val: int) -> TreeNode" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchBST(self, root: TreeNode, val: int) -> TreeNode: 递归法 - def searchBST_1(self, root: TreeNode, val: int) -> TreeNode: 迭代法
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchBST(self, root: TreeNode, val: int) -> TreeNode: 递归法 - def searchBST_1(self, root: TreeNode, val: int) -> TreeNode: 迭代法 <|skeleton|> class Solution: def searchBST...
3508e1ce089131b19603c3206aab4cf43023bb19
<|skeleton|> class Solution: def searchBST(self, root: TreeNode, val: int) -> TreeNode: """递归法""" <|body_0|> def searchBST_1(self, root: TreeNode, val: int) -> TreeNode: """迭代法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def searchBST(self, root: TreeNode, val: int) -> TreeNode: """递归法""" if not root: return None def helper(root): if not root: return None if root.val == val: return root elif root.val > val: ...
the_stack_v2_python_sparse
algorithm/leetcode/tree/19-二叉搜索树中的搜索.py
lxconfig/UbuntuCode_bak
train
0
530891ce0e430c68f51c74ca3a736cbc18339c37
[ "current_collection_schema_version = feconf.CURRENT_COLLECTION_SCHEMA_VERSION\nfor version_num in range(1, current_collection_schema_version):\n self.assertTrue(hasattr(collection_domain.Collection, '_convert_collection_contents_v%s_dict_to_v%s_dict' % (version_num, version_num + 1)))\nself.assertFalse(hasattr(c...
<|body_start_0|> current_collection_schema_version = feconf.CURRENT_COLLECTION_SCHEMA_VERSION for version_num in range(1, current_collection_schema_version): self.assertTrue(hasattr(collection_domain.Collection, '_convert_collection_contents_v%s_dict_to_v%s_dict' % (version_num, version_num ...
Tests the presence of appropriate schema migration methods in the Collection domain object class.
SchemaMigrationMethodsUnitTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchemaMigrationMethodsUnitTests: """Tests the presence of appropriate schema migration methods in the Collection domain object class.""" def test_correct_collection_contents_schema_conversion_methods_exist(self) -> None: """Test that the right collection_contents schema conversion me...
stack_v2_sparse_classes_10k_train_001630
48,157
permissive
[ { "docstring": "Test that the right collection_contents schema conversion methods exist.", "name": "test_correct_collection_contents_schema_conversion_methods_exist", "signature": "def test_correct_collection_contents_schema_conversion_methods_exist(self) -> None" }, { "docstring": "Test that th...
2
stack_v2_sparse_classes_30k_train_006458
Implement the Python class `SchemaMigrationMethodsUnitTests` described below. Class description: Tests the presence of appropriate schema migration methods in the Collection domain object class. Method signatures and docstrings: - def test_correct_collection_contents_schema_conversion_methods_exist(self) -> None: Tes...
Implement the Python class `SchemaMigrationMethodsUnitTests` described below. Class description: Tests the presence of appropriate schema migration methods in the Collection domain object class. Method signatures and docstrings: - def test_correct_collection_contents_schema_conversion_methods_exist(self) -> None: Tes...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class SchemaMigrationMethodsUnitTests: """Tests the presence of appropriate schema migration methods in the Collection domain object class.""" def test_correct_collection_contents_schema_conversion_methods_exist(self) -> None: """Test that the right collection_contents schema conversion me...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SchemaMigrationMethodsUnitTests: """Tests the presence of appropriate schema migration methods in the Collection domain object class.""" def test_correct_collection_contents_schema_conversion_methods_exist(self) -> None: """Test that the right collection_contents schema conversion methods exist."...
the_stack_v2_python_sparse
core/domain/collection_domain_test.py
oppia/oppia
train
6,172
d433d513f2b8583146aa8a3ff64c06b3e1e2aa9a
[ "base.Action.__init__(self, self.__loadPlugin)\nself.__frame = frame\nself.__overlayList = overlayList\nself.__displayCtx = displayCtx", "lastDir = fslsettings.read('loadPluginLastDir')\nif lastDir is None:\n lastDir = os.getcwd()\nmsg = strings.messages[self, 'loadPlugin']\ndlg = wx.FileDialog(self.__frame, m...
<|body_start_0|> base.Action.__init__(self, self.__loadPlugin) self.__frame = frame self.__overlayList = overlayList self.__displayCtx = displayCtx <|end_body_0|> <|body_start_1|> lastDir = fslsettings.read('loadPluginLastDir') if lastDir is None: lastDir = o...
The :class:`LoadPluginAction` class is an :class:`.Action` which allows the user to load/install FSLeyes plugins - see the :mod:`.plugins` module.
LoadPluginAction
[ "BSD-3-Clause", "CC-BY-3.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadPluginAction: """The :class:`LoadPluginAction` class is an :class:`.Action` which allows the user to load/install FSLeyes plugins - see the :mod:`.plugins` module.""" def __init__(self, overlayList, displayCtx, frame): """Create a ``LoadPluginAction``. :arg overlayList: The :clas...
stack_v2_sparse_classes_10k_train_001631
2,921
permissive
[ { "docstring": "Create a ``LoadPluginAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The top-level :class:`.DisplayContext`. :arg overlayList: The :class:`.FSLeyesFrame`.", "name": "__init__", "signature": "def __init__(self, overlayList, displayCtx, frame)" }, { "docstri...
2
null
Implement the Python class `LoadPluginAction` described below. Class description: The :class:`LoadPluginAction` class is an :class:`.Action` which allows the user to load/install FSLeyes plugins - see the :mod:`.plugins` module. Method signatures and docstrings: - def __init__(self, overlayList, displayCtx, frame): C...
Implement the Python class `LoadPluginAction` described below. Class description: The :class:`LoadPluginAction` class is an :class:`.Action` which allows the user to load/install FSLeyes plugins - see the :mod:`.plugins` module. Method signatures and docstrings: - def __init__(self, overlayList, displayCtx, frame): C...
46ccb4fe2b2346eb57576247f49714032b61307a
<|skeleton|> class LoadPluginAction: """The :class:`LoadPluginAction` class is an :class:`.Action` which allows the user to load/install FSLeyes plugins - see the :mod:`.plugins` module.""" def __init__(self, overlayList, displayCtx, frame): """Create a ``LoadPluginAction``. :arg overlayList: The :clas...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LoadPluginAction: """The :class:`LoadPluginAction` class is an :class:`.Action` which allows the user to load/install FSLeyes plugins - see the :mod:`.plugins` module.""" def __init__(self, overlayList, displayCtx, frame): """Create a ``LoadPluginAction``. :arg overlayList: The :class:`.OverlayLi...
the_stack_v2_python_sparse
fsleyes/actions/loadplugin.py
sanjayankur31/fsleyes
train
1
e9859f15fc33064f436c41e178854d999408df69
[ "img = copy.deepcopy(cv2.cvtColor(src, cv2.COLOR_BGR2GRAY))\nsizes = range(5, 2 * scale + 5, 2)\nkernels = map(lambda x: cv2.getGaborKernel(ksize=(x, x), sigma=sigma, theta=direction, lambd=x, gamma=25.0 / x, psi=np.pi * 1 / 2), sizes)\nfor i, kernel in enumerate(kernels):\n kernels[i] = 1.0 * kernel / np.amax(k...
<|body_start_0|> img = copy.deepcopy(cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)) sizes = range(5, 2 * scale + 5, 2) kernels = map(lambda x: cv2.getGaborKernel(ksize=(x, x), sigma=sigma, theta=direction, lambd=x, gamma=25.0 / x, psi=np.pi * 1 / 2), sizes) for i, kernel in enumerate(kernels): ...
ViolaJones
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViolaJones: def vj_main(self, src, direction, scale, sigma, bias): """入力画像に複数のスケールのカーネルを用いてテンプレートマッチングを行う。 そもそもfilterlingじゃなくてTMにする? src: dst: seed scaleの数だけ返す psiは位相""" <|body_0|> def get_seed(self, vjmaps, thresh): """vjmapsから,種を選択する。 seed_imgとseed_listとそれぞれのscaleを...
stack_v2_sparse_classes_10k_train_001632
13,550
no_license
[ { "docstring": "入力画像に複数のスケールのカーネルを用いてテンプレートマッチングを行う。 そもそもfilterlingじゃなくてTMにする? src: dst: seed scaleの数だけ返す psiは位相", "name": "vj_main", "signature": "def vj_main(self, src, direction, scale, sigma, bias)" }, { "docstring": "vjmapsから,種を選択する。 seed_imgとseed_listとそれぞれのscaleを返す。 seed_img : seedにvjmapsの...
4
stack_v2_sparse_classes_30k_train_006047
Implement the Python class `ViolaJones` described below. Class description: Implement the ViolaJones class. Method signatures and docstrings: - def vj_main(self, src, direction, scale, sigma, bias): 入力画像に複数のスケールのカーネルを用いてテンプレートマッチングを行う。 そもそもfilterlingじゃなくてTMにする? src: dst: seed scaleの数だけ返す psiは位相 - def get_seed(self, v...
Implement the Python class `ViolaJones` described below. Class description: Implement the ViolaJones class. Method signatures and docstrings: - def vj_main(self, src, direction, scale, sigma, bias): 入力画像に複数のスケールのカーネルを用いてテンプレートマッチングを行う。 そもそもfilterlingじゃなくてTMにする? src: dst: seed scaleの数だけ返す psiは位相 - def get_seed(self, v...
1d5c534fbc7a5415c9b3f297b41f651e55d88c95
<|skeleton|> class ViolaJones: def vj_main(self, src, direction, scale, sigma, bias): """入力画像に複数のスケールのカーネルを用いてテンプレートマッチングを行う。 そもそもfilterlingじゃなくてTMにする? src: dst: seed scaleの数だけ返す psiは位相""" <|body_0|> def get_seed(self, vjmaps, thresh): """vjmapsから,種を選択する。 seed_imgとseed_listとそれぞれのscaleを...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ViolaJones: def vj_main(self, src, direction, scale, sigma, bias): """入力画像に複数のスケールのカーネルを用いてテンプレートマッチングを行う。 そもそもfilterlingじゃなくてTMにする? src: dst: seed scaleの数だけ返す psiは位相""" img = copy.deepcopy(cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)) sizes = range(5, 2 * scale + 5, 2) kernels = map(...
the_stack_v2_python_sparse
scripts/etc/small_rock_detection.py
DriesDries/shangri-la
train
0
e640b4d22203965090a28b3dd40e52ceca21f750
[ "n = len(s)\nif n < 4 or n > 12:\n return []\n\ndef backtrack(s, tmp):\n if len(s) == 0 and len(tmp) == 4:\n res.append('.'.join(tmp))\n return\n if len(tmp) < 4:\n for i in range(min(3, len(s))):\n p, n = (s[:i + 1], s[i + 1:])\n if p and 0 <= int(p) <= 255 and (...
<|body_start_0|> n = len(s) if n < 4 or n > 12: return [] def backtrack(s, tmp): if len(s) == 0 and len(tmp) == 4: res.append('.'.join(tmp)) return if len(tmp) < 4: for i in range(min(3, len(s))): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def restoreIpAddresses1(self, s): """思路:回溯法 1. 每一位ip地址最大只有三个字符,0~255 2. 总共分为四段 3. 长度大于1的字符串,首位不能为零,str(int(p)) == p判断 :type s: str :rtype: List[str]""" <|body_0|> def restoreIpAddresses2(self, s: str) -> List[str]: """说明:比上面效率高,不涉及到字符串的切分,不会产生新对象 @param s: ...
stack_v2_sparse_classes_10k_train_001633
2,043
no_license
[ { "docstring": "思路:回溯法 1. 每一位ip地址最大只有三个字符,0~255 2. 总共分为四段 3. 长度大于1的字符串,首位不能为零,str(int(p)) == p判断 :type s: str :rtype: List[str]", "name": "restoreIpAddresses1", "signature": "def restoreIpAddresses1(self, s)" }, { "docstring": "说明:比上面效率高,不涉及到字符串的切分,不会产生新对象 @param s: @return:", "name": "resto...
2
stack_v2_sparse_classes_30k_train_000220
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def restoreIpAddresses1(self, s): 思路:回溯法 1. 每一位ip地址最大只有三个字符,0~255 2. 总共分为四段 3. 长度大于1的字符串,首位不能为零,str(int(p)) == p判断 :type s: str :rtype: List[str] - def restoreIpAddresses2(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def restoreIpAddresses1(self, s): 思路:回溯法 1. 每一位ip地址最大只有三个字符,0~255 2. 总共分为四段 3. 长度大于1的字符串,首位不能为零,str(int(p)) == p判断 :type s: str :rtype: List[str] - def restoreIpAddresses2(self, ...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def restoreIpAddresses1(self, s): """思路:回溯法 1. 每一位ip地址最大只有三个字符,0~255 2. 总共分为四段 3. 长度大于1的字符串,首位不能为零,str(int(p)) == p判断 :type s: str :rtype: List[str]""" <|body_0|> def restoreIpAddresses2(self, s: str) -> List[str]: """说明:比上面效率高,不涉及到字符串的切分,不会产生新对象 @param s: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def restoreIpAddresses1(self, s): """思路:回溯法 1. 每一位ip地址最大只有三个字符,0~255 2. 总共分为四段 3. 长度大于1的字符串,首位不能为零,str(int(p)) == p判断 :type s: str :rtype: List[str]""" n = len(s) if n < 4 or n > 12: return [] def backtrack(s, tmp): if len(s) == 0 and len(tmp)...
the_stack_v2_python_sparse
LeetCode/回溯法/93. 复原IP地址.py
yiming1012/MyLeetCode
train
2
9d1db3091eabbdfdf66e5208a76530a480752331
[ "if not root:\n return None\nbt_root = TreeNode(root.val)\nbt_sub = map(self.encode, root.children)\nif bt_sub:\n for i in range(1, len(bt_sub)):\n bt_sub[i - 1].right = bt_sub[i]\n bt_root.left = bt_sub[0]\nreturn bt_root", "if not data:\n return None\np = data.left\nchildren = []\nwhile p:\n ...
<|body_start_0|> if not root: return None bt_root = TreeNode(root.val) bt_sub = map(self.encode, root.children) if bt_sub: for i in range(1, len(bt_sub)): bt_sub[i - 1].right = bt_sub[i] bt_root.left = bt_sub[0] return bt_root <...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" <|body_0|> def decode(self, data): """Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_001634
1,445
no_license
[ { "docstring": "Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode", "name": "encode", "signature": "def encode(self, root)" }, { "docstring": "Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node", "name": "decode", "signature": "def decode...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode - def decode(self, data): Decodes your binary tree to an n-ary tree. :type data: TreeN...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode - def decode(self, data): Decodes your binary tree to an n-ary tree. :type data: TreeN...
2722c0deafcd094ce64140a9a837b4027d29ed6f
<|skeleton|> class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" <|body_0|> def decode(self, data): """Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" if not root: return None bt_root = TreeNode(root.val) bt_sub = map(self.encode, root.children) if bt_sub: for i in range(1, len(bt_sub)...
the_stack_v2_python_sparse
431_deser_n_ary_bst_h/main.py
chao-shi/lclc
train
0
ea8ad6ff1c8eb443684dcf7e4ba8e560c1242348
[ "serializer = self.get_serializer_class(request.data)\nif serializer.is_valid():\n mp = serializer.save()\n res = self.get_rate_quote_results(mp)\n if res.status_code == 400:\n return response.Response(res.data, status=status.HTTP_400_BAD_REQUEST)\n uuid = res.data.get('request_uuid')\n self.r...
<|body_start_0|> serializer = self.get_serializer_class(request.data) if serializer.is_valid(): mp = serializer.save() res = self.get_rate_quote_results(mp) if res.status_code == 400: return response.Response(res.data, status=status.HTTP_400_BAD_REQUES...
View for handling requests for rate quotes. Creates `MortgageProfile` from inbound request data.
RateQuoteRequestView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RateQuoteRequestView: """View for handling requests for rate quotes. Creates `MortgageProfile` from inbound request data.""" def post(self, request, *args, **kwargs): """Takes a POST request from external partner websites to return rate quote results to the consumer portal. - Minimum...
stack_v2_sparse_classes_10k_train_001635
14,021
no_license
[ { "docstring": "Takes a POST request from external partner websites to return rate quote results to the consumer portal. - Minimum fields required:: * Purchase: kind, property_state, property_value, purchase_downpayment, credit_score, property_occupation * Refi: kind, property_state, property_value, property_oc...
2
stack_v2_sparse_classes_30k_train_002403
Implement the Python class `RateQuoteRequestView` described below. Class description: View for handling requests for rate quotes. Creates `MortgageProfile` from inbound request data. Method signatures and docstrings: - def post(self, request, *args, **kwargs): Takes a POST request from external partner websites to re...
Implement the Python class `RateQuoteRequestView` described below. Class description: View for handling requests for rate quotes. Creates `MortgageProfile` from inbound request data. Method signatures and docstrings: - def post(self, request, *args, **kwargs): Takes a POST request from external partner websites to re...
f1a8cd8268d032ea8321e1588e226da09925b7aa
<|skeleton|> class RateQuoteRequestView: """View for handling requests for rate quotes. Creates `MortgageProfile` from inbound request data.""" def post(self, request, *args, **kwargs): """Takes a POST request from external partner websites to return rate quote results to the consumer portal. - Minimum...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RateQuoteRequestView: """View for handling requests for rate quotes. Creates `MortgageProfile` from inbound request data.""" def post(self, request, *args, **kwargs): """Takes a POST request from external partner websites to return rate quote results to the consumer portal. - Minimum fields requi...
the_stack_v2_python_sparse
website/apps/mortgage_profiles/views.py
protoprojects/worksample
train
0
5b27f794883ed18b0c95360e6ea778cb50d750a2
[ "preorder = []\n\ndef traverse(root):\n if root is None:\n preorder.append('#')\n return\n preorder.append(root.val)\n traverse(root.left)\n traverse(root.right)\ntraverse(root)\nreturn ','.join([str(val) for val in preorder])", "if data == '':\n return None\npreorder = data.split(','...
<|body_start_0|> preorder = [] def traverse(root): if root is None: preorder.append('#') return preorder.append(root.val) traverse(root.left) traverse(root.right) traverse(root) return ','.join([str(val) for...
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_10k_train_001636
6,926
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
0821af55eca60084b503b5f751301048c55e4381
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" preorder = [] def traverse(root): if root is None: preorder.append('#') return preorder.append(root.val) trav...
the_stack_v2_python_sparse
Hard/LC297.py
shuowenwei/LeetCodePython
train
2
d8385f7be7a23757ba8bef74da256a154fe640f0
[ "try:\n output = subprocess.check_output([sys.executable, idf_py_path, '--version', '@file_args_expansion_inputs/args_a'], env=os.environ, stderr=subprocess.STDOUT).decode('utf-8', 'ignore')\n self.assertIn('Running: idf.py --version DAAA DBBB', output)\nexcept subprocess.CalledProcessError as e:\n self.fa...
<|body_start_0|> try: output = subprocess.check_output([sys.executable, idf_py_path, '--version', '@file_args_expansion_inputs/args_a'], env=os.environ, stderr=subprocess.STDOUT).decode('utf-8', 'ignore') self.assertIn('Running: idf.py --version DAAA DBBB', output) except subproc...
TestFileArgumentExpansion
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFileArgumentExpansion: def test_file_expansion(self): """Test @filename expansion functionality""" <|body_0|> def test_multiple_file_arguments(self): """Test multiple @filename arguments""" <|body_1|> def test_recursive_expansion(self): """Te...
stack_v2_sparse_classes_10k_train_001637
14,442
permissive
[ { "docstring": "Test @filename expansion functionality", "name": "test_file_expansion", "signature": "def test_file_expansion(self)" }, { "docstring": "Test multiple @filename arguments", "name": "test_multiple_file_arguments", "signature": "def test_multiple_file_arguments(self)" }, ...
5
stack_v2_sparse_classes_30k_train_004713
Implement the Python class `TestFileArgumentExpansion` described below. Class description: Implement the TestFileArgumentExpansion class. Method signatures and docstrings: - def test_file_expansion(self): Test @filename expansion functionality - def test_multiple_file_arguments(self): Test multiple @filename argument...
Implement the Python class `TestFileArgumentExpansion` described below. Class description: Implement the TestFileArgumentExpansion class. Method signatures and docstrings: - def test_file_expansion(self): Test @filename expansion functionality - def test_multiple_file_arguments(self): Test multiple @filename argument...
3befd5fff72aa6980514454a50233037718b611f
<|skeleton|> class TestFileArgumentExpansion: def test_file_expansion(self): """Test @filename expansion functionality""" <|body_0|> def test_multiple_file_arguments(self): """Test multiple @filename arguments""" <|body_1|> def test_recursive_expansion(self): """Te...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestFileArgumentExpansion: def test_file_expansion(self): """Test @filename expansion functionality""" try: output = subprocess.check_output([sys.executable, idf_py_path, '--version', '@file_args_expansion_inputs/args_a'], env=os.environ, stderr=subprocess.STDOUT).decode('utf-8', '...
the_stack_v2_python_sparse
tools/test_idf_py/test_idf_py.py
KollarRichard/esp-idf
train
1
de97932b394e3fda4fa7c784466d232c7704a599
[ "super().__init__()\nassert d_model % h == 0\nself.d_k = d_model // h\nself.h = h\nself.linears = clones(nn.Linear(d_model, d_model), 4)\nself.attention = ScaledDotProductAttention(dropout)\nself.attn = None", "if mask is not None:\n mask = mask.unsqueeze(1)\nnbatches = query.size(0)\nquery, key, value = [l(x)...
<|body_start_0|> super().__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.linears = clones(nn.Linear(d_model, d_model), 4) self.attention = ScaledDotProductAttention(dropout) self.attn = None <|end_body_0|> <|body_start_1|> if ma...
Compute 'Multi-Head Attention' When we calculate attentions, usually key and value are the same tensor. For self-attention, query, key, value are all the same tensor.
MultiHeadAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadAttention: """Compute 'Multi-Head Attention' When we calculate attentions, usually key and value are the same tensor. For self-attention, query, key, value are all the same tensor.""" def __init__(self, h, d_model, dropout=0.1): """:param h: number of heads :param d_model: h...
stack_v2_sparse_classes_10k_train_001638
38,467
no_license
[ { "docstring": ":param h: number of heads :param d_model: hidden size :param dropout: attention dropout rate", "name": "__init__", "signature": "def __init__(self, h, d_model, dropout=0.1)" }, { "docstring": ":param query: (batch_num, query_length, d_model) :param key: (batch_num, key_length, d_...
2
stack_v2_sparse_classes_30k_train_001632
Implement the Python class `MultiHeadAttention` described below. Class description: Compute 'Multi-Head Attention' When we calculate attentions, usually key and value are the same tensor. For self-attention, query, key, value are all the same tensor. Method signatures and docstrings: - def __init__(self, h, d_model, ...
Implement the Python class `MultiHeadAttention` described below. Class description: Compute 'Multi-Head Attention' When we calculate attentions, usually key and value are the same tensor. For self-attention, query, key, value are all the same tensor. Method signatures and docstrings: - def __init__(self, h, d_model, ...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class MultiHeadAttention: """Compute 'Multi-Head Attention' When we calculate attentions, usually key and value are the same tensor. For self-attention, query, key, value are all the same tensor.""" def __init__(self, h, d_model, dropout=0.1): """:param h: number of heads :param d_model: h...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MultiHeadAttention: """Compute 'Multi-Head Attention' When we calculate attentions, usually key and value are the same tensor. For self-attention, query, key, value are all the same tensor.""" def __init__(self, h, d_model, dropout=0.1): """:param h: number of heads :param d_model: hidden size :p...
the_stack_v2_python_sparse
generated/test_BangLiu_QANet_PyTorch.py
jansel/pytorch-jit-paritybench
train
35
0e45c25a2cb8f865b3ce3572bf3a7f3560265afd
[ "image_bytes = decoded_tensors[self._image_field_key]\nif self._decode_jpeg_only:\n image_shape = tf.image.extract_jpeg_shape(image_bytes)\n cropped_image = preprocess_ops.random_crop_image_v2(image_bytes, image_shape)\n image = tf.cond(tf.reduce_all(tf.equal(tf.shape(cropped_image), image_shape)), lambda:...
<|body_start_0|> image_bytes = decoded_tensors[self._image_field_key] if self._decode_jpeg_only: image_shape = tf.image.extract_jpeg_shape(image_bytes) cropped_image = preprocess_ops.random_crop_image_v2(image_bytes, image_shape) image = tf.cond(tf.reduce_all(tf.equal...
Parser to parse an image and its annotations into a dictionary of tensors.
Parser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parser: """Parser to parse an image and its annotations into a dictionary of tensors.""" def _parse_train_image(self, decoded_tensors): """Parses image data for training.""" <|body_0|> def _parse_eval_image(self, decoded_tensors): """Parses image data for evaluat...
stack_v2_sparse_classes_10k_train_001639
3,279
permissive
[ { "docstring": "Parses image data for training.", "name": "_parse_train_image", "signature": "def _parse_train_image(self, decoded_tensors)" }, { "docstring": "Parses image data for evaluation.", "name": "_parse_eval_image", "signature": "def _parse_eval_image(self, decoded_tensors)" }...
2
null
Implement the Python class `Parser` described below. Class description: Parser to parse an image and its annotations into a dictionary of tensors. Method signatures and docstrings: - def _parse_train_image(self, decoded_tensors): Parses image data for training. - def _parse_eval_image(self, decoded_tensors): Parses i...
Implement the Python class `Parser` described below. Class description: Parser to parse an image and its annotations into a dictionary of tensors. Method signatures and docstrings: - def _parse_train_image(self, decoded_tensors): Parses image data for training. - def _parse_eval_image(self, decoded_tensors): Parses i...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class Parser: """Parser to parse an image and its annotations into a dictionary of tensors.""" def _parse_train_image(self, decoded_tensors): """Parses image data for training.""" <|body_0|> def _parse_eval_image(self, decoded_tensors): """Parses image data for evaluat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Parser: """Parser to parse an image and its annotations into a dictionary of tensors.""" def _parse_train_image(self, decoded_tensors): """Parses image data for training.""" image_bytes = decoded_tensors[self._image_field_key] if self._decode_jpeg_only: image_shape = t...
the_stack_v2_python_sparse
official/projects/yolo/dataloaders/classification_input.py
jianzhnie/models
train
2
948477a8e4014073373895e877247c300ed3f03c
[ "super(ConvolutionalBoxPredictor, self).__init__(num_classes, box_code_size)\nself._num_predictions_list = num_predictions_list\nself._conv_hyperparams_fn = conv_hyperparams_fn\nself._kernel_size = kernel_size\nself._use_depthwise = use_depthwise", "box_encoding_predictions_list = []\nclass_score_predictions_list...
<|body_start_0|> super(ConvolutionalBoxPredictor, self).__init__(num_classes, box_code_size) self._num_predictions_list = num_predictions_list self._conv_hyperparams_fn = conv_hyperparams_fn self._kernel_size = kernel_size self._use_depthwise = use_depthwise <|end_body_0|> <|bod...
Convolutional box predictor. Note that this subclass of BoxPredictor predicts **ONE** set of box location encodings shared by **ALL** object classes as opposed to making predictions separately for **EACH** object class.
ConvolutionalBoxPredictor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvolutionalBoxPredictor: """Convolutional box predictor. Note that this subclass of BoxPredictor predicts **ONE** set of box location encodings shared by **ALL** object classes as opposed to making predictions separately for **EACH** object class.""" def __init__(self, num_classes, num_pre...
stack_v2_sparse_classes_10k_train_001640
12,500
no_license
[ { "docstring": "Constructor. Args: num_classes: int scalar, num of classes. num_predictions_list: a list of ints, num of anchor boxes per feature map cell. conv_hyperparams_fn: a callable that, when called, creates a dict holding arguments to `slim.arg_scope`. kernel_size: int scalar or int 2-tuple, kernel size...
2
stack_v2_sparse_classes_30k_train_006724
Implement the Python class `ConvolutionalBoxPredictor` described below. Class description: Convolutional box predictor. Note that this subclass of BoxPredictor predicts **ONE** set of box location encodings shared by **ALL** object classes as opposed to making predictions separately for **EACH** object class. Method ...
Implement the Python class `ConvolutionalBoxPredictor` described below. Class description: Convolutional box predictor. Note that this subclass of BoxPredictor predicts **ONE** set of box location encodings shared by **ALL** object classes as opposed to making predictions separately for **EACH** object class. Method ...
5a53e02c690632bcf140d1b17327959609aab395
<|skeleton|> class ConvolutionalBoxPredictor: """Convolutional box predictor. Note that this subclass of BoxPredictor predicts **ONE** set of box location encodings shared by **ALL** object classes as opposed to making predictions separately for **EACH** object class.""" def __init__(self, num_classes, num_pre...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConvolutionalBoxPredictor: """Convolutional box predictor. Note that this subclass of BoxPredictor predicts **ONE** set of box location encodings shared by **ALL** object classes as opposed to making predictions separately for **EACH** object class.""" def __init__(self, num_classes, num_predictions_list...
the_stack_v2_python_sparse
core/box_predictors.py
chao-ji/tf-detection
train
2
0bda9f6572a872c51895eb44ebea3c386176da9a
[ "self.analytical_params = analytical_params\nself.geographical_params = geogr_params\nself.deformational_params = deform_params\nself.anal_param_values = self.get_analytical_param_values()\narray_range, array_size, formula = self.anal_param_values\na_min, a_max, b_min, b_max = array_range\na_range, b_range = (a_max...
<|body_start_0|> self.analytical_params = analytical_params self.geographical_params = geogr_params self.deformational_params = deform_params self.anal_param_values = self.get_analytical_param_values() array_range, array_size, formula = self.anal_param_values a_min, a_max...
AnalyticGeosurface
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnalyticGeosurface: def __init__(self, analytical_params, geogr_params, deform_params): """:param analytical_params: :param geogr_params: :param deform_params:""" <|body_0|> def geosurface_center(self): """:return:""" <|body_1|> def geosurface_XYZ(self):...
stack_v2_sparse_classes_10k_train_001641
18,232
no_license
[ { "docstring": ":param analytical_params: :param geogr_params: :param deform_params:", "name": "__init__", "signature": "def __init__(self, analytical_params, geogr_params, deform_params)" }, { "docstring": ":return:", "name": "geosurface_center", "signature": "def geosurface_center(self...
6
stack_v2_sparse_classes_30k_train_002477
Implement the Python class `AnalyticGeosurface` described below. Class description: Implement the AnalyticGeosurface class. Method signatures and docstrings: - def __init__(self, analytical_params, geogr_params, deform_params): :param analytical_params: :param geogr_params: :param deform_params: - def geosurface_cent...
Implement the Python class `AnalyticGeosurface` described below. Class description: Implement the AnalyticGeosurface class. Method signatures and docstrings: - def __init__(self, analytical_params, geogr_params, deform_params): :param analytical_params: :param geogr_params: :param deform_params: - def geosurface_cent...
b07ab23400b4ff4151555c2e81392a7adf99fc33
<|skeleton|> class AnalyticGeosurface: def __init__(self, analytical_params, geogr_params, deform_params): """:param analytical_params: :param geogr_params: :param deform_params:""" <|body_0|> def geosurface_center(self): """:return:""" <|body_1|> def geosurface_XYZ(self):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AnalyticGeosurface: def __init__(self, analytical_params, geogr_params, deform_params): """:param analytical_params: :param geogr_params: :param deform_params:""" self.analytical_params = analytical_params self.geographical_params = geogr_params self.deformational_params = defo...
the_stack_v2_python_sparse
pygsf/spatial/vectorial/meshes.py
mauroalberti/qgSurf
train
5
f8b8ccda281ad161e3ecfb925c98a2e0f3bf53b1
[ "self._id = _id\nself.name = name\nself.active_doc = active_doc\nself.context = context\nself.docs = docs", "active_doc = None\nif self.active_doc is not None:\n active_doc = self.active_doc.to_dict(raw=False, with_details=True)\ndoclist = []\nfor doc in self.docs:\n doclist.append(doc.to_dict(raw=False, wi...
<|body_start_0|> self._id = _id self.name = name self.active_doc = active_doc self.context = context self.docs = docs <|end_body_0|> <|body_start_1|> active_doc = None if self.active_doc is not None: active_doc = self.active_doc.to_dict(raw=False, wit...
Object that wraps up an Arthur project. This is the server counterpart of js model's Project (and other models contained by it respectively e.g. ActiveDoc for this object's :attr:`active_doc` attribute, which is an instance of ArthurDocument).
ArthurProject
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArthurProject: """Object that wraps up an Arthur project. This is the server counterpart of js model's Project (and other models contained by it respectively e.g. ActiveDoc for this object's :attr:`active_doc` attribute, which is an instance of ArthurDocument).""" def __init__(self, name='',...
stack_v2_sparse_classes_10k_train_001642
3,250
permissive
[ { "docstring": "Initializes ArthurProject instance. Args: name: Name of project. active_doc(ArthurDocument): Currently active document. context(str): Context associated with this project. _id(ObjectId): ID of this project (for database keeping). # docs: List of ArthurDocuments.", "name": "__init__", "si...
4
stack_v2_sparse_classes_30k_train_004313
Implement the Python class `ArthurProject` described below. Class description: Object that wraps up an Arthur project. This is the server counterpart of js model's Project (and other models contained by it respectively e.g. ActiveDoc for this object's :attr:`active_doc` attribute, which is an instance of ArthurDocumen...
Implement the Python class `ArthurProject` described below. Class description: Object that wraps up an Arthur project. This is the server counterpart of js model's Project (and other models contained by it respectively e.g. ActiveDoc for this object's :attr:`active_doc` attribute, which is an instance of ArthurDocumen...
7a581104141ee5f556e058b1276b4087a2921dfc
<|skeleton|> class ArthurProject: """Object that wraps up an Arthur project. This is the server counterpart of js model's Project (and other models contained by it respectively e.g. ActiveDoc for this object's :attr:`active_doc` attribute, which is an instance of ArthurDocument).""" def __init__(self, name='',...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ArthurProject: """Object that wraps up an Arthur project. This is the server counterpart of js model's Project (and other models contained by it respectively e.g. ActiveDoc for this object's :attr:`active_doc` attribute, which is an instance of ArthurDocument).""" def __init__(self, name='', active_doc=N...
the_stack_v2_python_sparse
libs/arthur/project.py
jaycode/Arthur.workspace
train
0
9bd0318b8c7cb6488d0a0f286c27b140af0da0a0
[ "FeaturewiseDatasetMeasure.__init__(self)\nself.__datameasure = datameasure\nself.__noise = noise", "if not N.issubdtype(dataset.samples.dtype, N.float):\n dataset.setSamplesDType('float32')\nif __debug__:\n nfeatures = dataset.nfeatures\nsens_map = []\norig_measure = self.__datameasure(dataset)\nfor featur...
<|body_start_0|> FeaturewiseDatasetMeasure.__init__(self) self.__datameasure = datameasure self.__noise = noise <|end_body_0|> <|body_start_1|> if not N.issubdtype(dataset.samples.dtype, N.float): dataset.setSamplesDType('float32') if __debug__: nfeatures...
This is a `FeaturewiseDatasetMeasure` that uses a scalar `DatasetMeasure` and selective noise perturbation to compute a sensitivity map. First the scalar `DatasetMeasure` computed using the original dataset. Next the data measure is computed multiple times each with a single feature in the dataset perturbed by noise. T...
NoisePerturbationSensitivity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoisePerturbationSensitivity: """This is a `FeaturewiseDatasetMeasure` that uses a scalar `DatasetMeasure` and selective noise perturbation to compute a sensitivity map. First the scalar `DatasetMeasure` computed using the original dataset. Next the data measure is computed multiple times each wi...
stack_v2_sparse_classes_10k_train_001643
3,784
permissive
[ { "docstring": "Cheap initialization. Parameters datameasure: `Datameasure` that is used to quantify the effect of noise perturbation. noise: Functor to generate noise. The noise generator has to return an 1d array of n values when called the `size=n` keyword argument. This is the default interface of the rando...
2
stack_v2_sparse_classes_30k_train_003059
Implement the Python class `NoisePerturbationSensitivity` described below. Class description: This is a `FeaturewiseDatasetMeasure` that uses a scalar `DatasetMeasure` and selective noise perturbation to compute a sensitivity map. First the scalar `DatasetMeasure` computed using the original dataset. Next the data mea...
Implement the Python class `NoisePerturbationSensitivity` described below. Class description: This is a `FeaturewiseDatasetMeasure` that uses a scalar `DatasetMeasure` and selective noise perturbation to compute a sensitivity map. First the scalar `DatasetMeasure` computed using the original dataset. Next the data mea...
2a8fcaa57457c8994455144e9e69494d167204c4
<|skeleton|> class NoisePerturbationSensitivity: """This is a `FeaturewiseDatasetMeasure` that uses a scalar `DatasetMeasure` and selective noise perturbation to compute a sensitivity map. First the scalar `DatasetMeasure` computed using the original dataset. Next the data measure is computed multiple times each wi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NoisePerturbationSensitivity: """This is a `FeaturewiseDatasetMeasure` that uses a scalar `DatasetMeasure` and selective noise perturbation to compute a sensitivity map. First the scalar `DatasetMeasure` computed using the original dataset. Next the data measure is computed multiple times each with a single f...
the_stack_v2_python_sparse
mvpa/measures/noiseperturbation.py
gorlins/PyMVPA
train
0
a158856da0b29047561ea7615fea309c8e1ec63e
[ "AT_Data_Plotter.__init__(self, fluxes, xlabel, ylabel, idlabel)\nif not xlabel:\n self.plot_xlabel = '$t$'\nif not ylabel:\n self.plot_ylabel = self.__labels[fluxes[0].name]\nif not idlabel:\n self.plot_idlabel = self.data[0].name + ' : ' + self.data[0].calc_ids[0]\nself.lines = len(self.data) * [None]", ...
<|body_start_0|> AT_Data_Plotter.__init__(self, fluxes, xlabel, ylabel, idlabel) if not xlabel: self.plot_xlabel = '$t$' if not ylabel: self.plot_ylabel = self.__labels[fluxes[0].name] if not idlabel: self.plot_idlabel = self.data[0].name + ' : ' + sel...
Flux plotter
tdc_Fluxes_Plotter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tdc_Fluxes_Plotter: """Flux plotter""" def __init__(self, fluxes, xlabel=None, ylabel=None, idlabel=None): """fluxes -- list with fluxes to be plotted""" <|body_0|> def plot(self, ax, semilog=True, **kwargs): """semilog <True> if True make semilog plot: t-linear,...
stack_v2_sparse_classes_10k_train_001644
1,553
no_license
[ { "docstring": "fluxes -- list with fluxes to be plotted", "name": "__init__", "signature": "def __init__(self, fluxes, xlabel=None, ylabel=None, idlabel=None)" }, { "docstring": "semilog <True> if True make semilog plot: t-linear, f-log scale, if False make linear plot: t,f-linear", "name":...
2
null
Implement the Python class `tdc_Fluxes_Plotter` described below. Class description: Flux plotter Method signatures and docstrings: - def __init__(self, fluxes, xlabel=None, ylabel=None, idlabel=None): fluxes -- list with fluxes to be plotted - def plot(self, ax, semilog=True, **kwargs): semilog <True> if True make se...
Implement the Python class `tdc_Fluxes_Plotter` described below. Class description: Flux plotter Method signatures and docstrings: - def __init__(self, fluxes, xlabel=None, ylabel=None, idlabel=None): fluxes -- list with fluxes to be plotted - def plot(self, ax, semilog=True, **kwargs): semilog <True> if True make se...
775dc841b1d8538584c8c68a5f75ae997191e685
<|skeleton|> class tdc_Fluxes_Plotter: """Flux plotter""" def __init__(self, fluxes, xlabel=None, ylabel=None, idlabel=None): """fluxes -- list with fluxes to be plotted""" <|body_0|> def plot(self, ax, semilog=True, **kwargs): """semilog <True> if True make semilog plot: t-linear,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class tdc_Fluxes_Plotter: """Flux plotter""" def __init__(self, fluxes, xlabel=None, ylabel=None, idlabel=None): """fluxes -- list with fluxes to be plotted""" AT_Data_Plotter.__init__(self, fluxes, xlabel, ylabel, idlabel) if not xlabel: self.plot_xlabel = '$t$' if ...
the_stack_v2_python_sparse
Fluxes/tdc_fluxes_plotter.py
atimokhin/tdc_vis
train
0
fc1a0f521c4f55b68a385a0d806fa03b6f149374
[ "super().__init__(**kwargs)\nself.exists = exists\nself.startdir = startdir", "value = super()._validate(cfg, value)\nif not value:\n return value\nif not os.path.isabs(value) and self.startdir:\n value = os.path.abspath(os.path.expanduser(os.path.join(self.startdir, value)))\nif os.path.sep == '\\\\':\n ...
<|body_start_0|> super().__init__(**kwargs) self.exists = exists self.startdir = startdir <|end_body_0|> <|body_start_1|> value = super()._validate(cfg, value) if not value: return value if not os.path.isabs(value) and self.startdir: value = os.pa...
A field for representing a filename on disk.
FilenameField
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilenameField: """A field for representing a filename on disk.""" def __init__(self, *, exists: Optional[Union[bool, str]]=None, startdir: Optional[str]=None, **kwargs): """The *exists* parameter can be set to one of the following values: - ``None`` - don't check file's existence - `...
stack_v2_sparse_classes_10k_train_001645
2,849
permissive
[ { "docstring": "The *exists* parameter can be set to one of the following values: - ``None`` - don't check file's existence - ``False`` - validate that the filename does not exist - ``True`` - validate that the filename does exist - ``\"dir\"`` - validate that the filename is a directory that exists - ``\"file\...
2
stack_v2_sparse_classes_30k_train_003911
Implement the Python class `FilenameField` described below. Class description: A field for representing a filename on disk. Method signatures and docstrings: - def __init__(self, *, exists: Optional[Union[bool, str]]=None, startdir: Optional[str]=None, **kwargs): The *exists* parameter can be set to one of the follow...
Implement the Python class `FilenameField` described below. Class description: A field for representing a filename on disk. Method signatures and docstrings: - def __init__(self, *, exists: Optional[Union[bool, str]]=None, startdir: Optional[str]=None, **kwargs): The *exists* parameter can be set to one of the follow...
1499ff8f00a43a592571a10666823e125d5fbc49
<|skeleton|> class FilenameField: """A field for representing a filename on disk.""" def __init__(self, *, exists: Optional[Union[bool, str]]=None, startdir: Optional[str]=None, **kwargs): """The *exists* parameter can be set to one of the following values: - ``None`` - don't check file's existence - `...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FilenameField: """A field for representing a filename on disk.""" def __init__(self, *, exists: Optional[Union[bool, str]]=None, startdir: Optional[str]=None, **kwargs): """The *exists* parameter can be set to one of the following values: - ``None`` - don't check file's existence - ``False`` - va...
the_stack_v2_python_sparse
cincoconfig/fields/file_field.py
ameily/cincoconfig
train
6
bd9567adb5d9eea689f47afbbf8733a5aeb6d267
[ "self.end_time = end_time\nself.error_message = error_message\nself.execution_start_time_usecs = execution_start_time_usecs\nself.files_processed = files_processed\nself.map_done_time_usecs = map_done_time_usecs\nself.map_input_bytes = map_input_bytes\nself.mappers_spawned = mappers_spawned\nself.num_map_outputs = ...
<|body_start_0|> self.end_time = end_time self.error_message = error_message self.execution_start_time_usecs = execution_start_time_usecs self.files_processed = files_processed self.map_done_time_usecs = map_done_time_usecs self.map_input_bytes = map_input_bytes s...
Implementation of the 'MapReduceInstance_RunInfo' model. TODO: type description here. Attributes: end_time (long|int): Time when map redcue job completed. error_message (string): If this run failed, then error message for failure. execution_start_time_usecs (long|int): Time (in usecs) when job was picked up for executi...
MapReduceInstance_RunInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MapReduceInstance_RunInfo: """Implementation of the 'MapReduceInstance_RunInfo' model. TODO: type description here. Attributes: end_time (long|int): Time when map redcue job completed. error_message (string): If this run failed, then error message for failure. execution_start_time_usecs (long|int...
stack_v2_sparse_classes_10k_train_001646
6,787
permissive
[ { "docstring": "Constructor for the MapReduceInstance_RunInfo class", "name": "__init__", "signature": "def __init__(self, end_time=None, error_message=None, execution_start_time_usecs=None, files_processed=None, map_done_time_usecs=None, map_input_bytes=None, mappers_spawned=None, num_map_outputs=None,...
2
stack_v2_sparse_classes_30k_train_002611
Implement the Python class `MapReduceInstance_RunInfo` described below. Class description: Implementation of the 'MapReduceInstance_RunInfo' model. TODO: type description here. Attributes: end_time (long|int): Time when map redcue job completed. error_message (string): If this run failed, then error message for failur...
Implement the Python class `MapReduceInstance_RunInfo` described below. Class description: Implementation of the 'MapReduceInstance_RunInfo' model. TODO: type description here. Attributes: end_time (long|int): Time when map redcue job completed. error_message (string): If this run failed, then error message for failur...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class MapReduceInstance_RunInfo: """Implementation of the 'MapReduceInstance_RunInfo' model. TODO: type description here. Attributes: end_time (long|int): Time when map redcue job completed. error_message (string): If this run failed, then error message for failure. execution_start_time_usecs (long|int...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MapReduceInstance_RunInfo: """Implementation of the 'MapReduceInstance_RunInfo' model. TODO: type description here. Attributes: end_time (long|int): Time when map redcue job completed. error_message (string): If this run failed, then error message for failure. execution_start_time_usecs (long|int): Time (in u...
the_stack_v2_python_sparse
cohesity_management_sdk/models/map_reduce_instance_run_info.py
cohesity/management-sdk-python
train
24
03ffbfa0de3ec63b03a1a7b9f9545ab078637dec
[ "def adjmul(arr, i):\n ret = arr[i]\n if 0 < i:\n ret *= arr[i - 1]\n if i < len(arr) - 1:\n ret *= arr[i + 1]\n return ret\n\n@lru_cache(None)\ndef dp(nums):\n ret = 0\n for i in range(len(nums)):\n cur = adjmul(nums, i)\n sub = dp(tuple(nums[:i] + nums[i + 1:]))\n ...
<|body_start_0|> def adjmul(arr, i): ret = arr[i] if 0 < i: ret *= arr[i - 1] if i < len(arr) - 1: ret *= arr[i + 1] return ret @lru_cache(None) def dp(nums): ret = 0 for i in range(len(nums)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxCoins(self, nums: List[int]) -> int: """Brute-force TLE""" <|body_0|> def maxCoins(self, nums: List[int]) -> int: """Top-down DP, Recursive Time complexity: O(n^3) Space complexity: O(n^2)""" <|body_1|> def maxCoins(self, nums: List[int]...
stack_v2_sparse_classes_10k_train_001647
3,846
no_license
[ { "docstring": "Brute-force TLE", "name": "maxCoins", "signature": "def maxCoins(self, nums: List[int]) -> int" }, { "docstring": "Top-down DP, Recursive Time complexity: O(n^3) Space complexity: O(n^2)", "name": "maxCoins", "signature": "def maxCoins(self, nums: List[int]) -> int" }, ...
4
stack_v2_sparse_classes_30k_train_004148
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxCoins(self, nums: List[int]) -> int: Brute-force TLE - def maxCoins(self, nums: List[int]) -> int: Top-down DP, Recursive Time complexity: O(n^3) Space complexity: O(n^2) ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxCoins(self, nums: List[int]) -> int: Brute-force TLE - def maxCoins(self, nums: List[int]) -> int: Top-down DP, Recursive Time complexity: O(n^3) Space complexity: O(n^2) ...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def maxCoins(self, nums: List[int]) -> int: """Brute-force TLE""" <|body_0|> def maxCoins(self, nums: List[int]) -> int: """Top-down DP, Recursive Time complexity: O(n^3) Space complexity: O(n^2)""" <|body_1|> def maxCoins(self, nums: List[int]...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxCoins(self, nums: List[int]) -> int: """Brute-force TLE""" def adjmul(arr, i): ret = arr[i] if 0 < i: ret *= arr[i - 1] if i < len(arr) - 1: ret *= arr[i + 1] return ret @lru_cache(None) ...
the_stack_v2_python_sparse
leetcode/solved/312_Burst_Balloons/solution.py
sungminoh/algorithms
train
0
f84bebefba42d7b187dd3dbeb73ab1dd8690fbd2
[ "ld = cls()\nld.limit_keys = set(default_data.keys())\nld.update(default_data)\nreturn ld", "if key in self.limit_keys:\n self.data[key] = value\nelse:\n raise AttributeError('{}没有属性{}!'.format(getattr(getattr(self, '__class__'), '__name__'), key))" ]
<|body_start_0|> ld = cls() ld.limit_keys = set(default_data.keys()) ld.update(default_data) return ld <|end_body_0|> <|body_start_1|> if key in self.limit_keys: self.data[key] = value else: raise AttributeError('{}没有属性{}!'.format(getattr(getattr(...
限制了可选择key的字典 当使用`LimitDict.from_limit_keys(cls, default_data)`创建字典对象时, 将会使用default_data初始化字典对象,且字典对象只能修改现有key的值,不能添加新的key
LimitDict
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LimitDict: """限制了可选择key的字典 当使用`LimitDict.from_limit_keys(cls, default_data)`创建字典对象时, 将会使用default_data初始化字典对象,且字典对象只能修改现有key的值,不能添加新的key""" def from_limit_keys(cls, default_data): """使用default_data创建并初始化字典对象 Args: default_data:默认映射对象,用以创建并初始化当前对象 Returns: LimitDict:一个限制了key的LimitDict对...
stack_v2_sparse_classes_10k_train_001648
4,590
no_license
[ { "docstring": "使用default_data创建并初始化字典对象 Args: default_data:默认映射对象,用以创建并初始化当前对象 Returns: LimitDict:一个限制了key的LimitDict对象", "name": "from_limit_keys", "signature": "def from_limit_keys(cls, default_data)" }, { "docstring": "重写设置key->value的方法,当key在初始key集合中时,允许本次修改, 否则,抛出AttributeError Args: key: 键 ...
2
stack_v2_sparse_classes_30k_train_000636
Implement the Python class `LimitDict` described below. Class description: 限制了可选择key的字典 当使用`LimitDict.from_limit_keys(cls, default_data)`创建字典对象时, 将会使用default_data初始化字典对象,且字典对象只能修改现有key的值,不能添加新的key Method signatures and docstrings: - def from_limit_keys(cls, default_data): 使用default_data创建并初始化字典对象 Args: default_data:默...
Implement the Python class `LimitDict` described below. Class description: 限制了可选择key的字典 当使用`LimitDict.from_limit_keys(cls, default_data)`创建字典对象时, 将会使用default_data初始化字典对象,且字典对象只能修改现有key的值,不能添加新的key Method signatures and docstrings: - def from_limit_keys(cls, default_data): 使用default_data创建并初始化字典对象 Args: default_data:默...
3f6158a76adde1ad6c0d1bf9c8afd4d657c2a653
<|skeleton|> class LimitDict: """限制了可选择key的字典 当使用`LimitDict.from_limit_keys(cls, default_data)`创建字典对象时, 将会使用default_data初始化字典对象,且字典对象只能修改现有key的值,不能添加新的key""" def from_limit_keys(cls, default_data): """使用default_data创建并初始化字典对象 Args: default_data:默认映射对象,用以创建并初始化当前对象 Returns: LimitDict:一个限制了key的LimitDict对...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LimitDict: """限制了可选择key的字典 当使用`LimitDict.from_limit_keys(cls, default_data)`创建字典对象时, 将会使用default_data初始化字典对象,且字典对象只能修改现有key的值,不能添加新的key""" def from_limit_keys(cls, default_data): """使用default_data创建并初始化字典对象 Args: default_data:默认映射对象,用以创建并初始化当前对象 Returns: LimitDict:一个限制了key的LimitDict对象""" ...
the_stack_v2_python_sparse
00-ToolClass/requests_spider_model/item.py
liangqiu1015/ZSpider
train
0
4a49afe0dc80b5a7285413af6570fa8f57137faa
[ "self.name = name\nself.verbose_name = verbose_name or name.capitalize()\nself.icon = icon", "action = QtGui.QAction(parent)\naction.setData(self.name)\naction.setText(unicode(self.verbose_name))\naction.setIconVisibleInMenu(False)\nreturn action" ]
<|body_start_0|> self.name = name self.verbose_name = verbose_name or name.capitalize() self.icon = icon <|end_body_0|> <|body_start_1|> action = QtGui.QAction(parent) action.setData(self.name) action.setText(unicode(self.verbose_name)) action.setIconVisibleInMen...
A mode is a way in which an action can be triggered, a print action could be triggered as 'Export to PDF' or 'Export to Word'. None always represents the default mode. .. attribute:: name a string representing the mode to the developer and the authentication system. this name will be used in the :class:`GuiContext` .. ...
Mode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mode: """A mode is a way in which an action can be triggered, a print action could be triggered as 'Export to PDF' or 'Export to Word'. None always represents the default mode. .. attribute:: name a string representing the mode to the developer and the authentication system. this name will be use...
stack_v2_sparse_classes_10k_train_001649
14,016
no_license
[ { "docstring": ":param name: the name of the mode, as it will be passed to the gui_run and model_run method :param verbose_name: the name shown to the user :param icon: the icon of the mode", "name": "__init__", "signature": "def __init__(self, name, verbose_name=None, icon=None)" }, { "docstrin...
2
stack_v2_sparse_classes_30k_train_003786
Implement the Python class `Mode` described below. Class description: A mode is a way in which an action can be triggered, a print action could be triggered as 'Export to PDF' or 'Export to Word'. None always represents the default mode. .. attribute:: name a string representing the mode to the developer and the authe...
Implement the Python class `Mode` described below. Class description: A mode is a way in which an action can be triggered, a print action could be triggered as 'Export to PDF' or 'Export to Word'. None always represents the default mode. .. attribute:: name a string representing the mode to the developer and the authe...
13247b093d0916510110fad2bb08acc38998e7c6
<|skeleton|> class Mode: """A mode is a way in which an action can be triggered, a print action could be triggered as 'Export to PDF' or 'Export to Word'. None always represents the default mode. .. attribute:: name a string representing the mode to the developer and the authentication system. this name will be use...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Mode: """A mode is a way in which an action can be triggered, a print action could be triggered as 'Export to PDF' or 'Export to Word'. None always represents the default mode. .. attribute:: name a string representing the mode to the developer and the authentication system. this name will be used in the :cla...
the_stack_v2_python_sparse
pdf_ex/Lib/site-packages/camelot/admin/action/base.py
rustydigg918/gstr_extractor
train
1
d675ffb926b6f8f2fb131440c062b5fa10eee2f4
[ "super().__init__()\nchannels = [input_channel] + channel_list\nmodules = list()\nfor i in range(1, len(channels)):\n modules.append(DownConvBlock(in_channels=channels[i - 1], out_channels=channels[i]))\nself.conv = nn.Sequential(*modules)\nfactor = 2 ** len(channel_list)\nself.fc_size = int(channel_list[-1] * H...
<|body_start_0|> super().__init__() channels = [input_channel] + channel_list modules = list() for i in range(1, len(channels)): modules.append(DownConvBlock(in_channels=channels[i - 1], out_channels=channels[i])) self.conv = nn.Sequential(*modules) factor = 2...
Convolutional encoder for images datasets. Convolutions (with 3x3 kernel size, see DownConvBlock for details) followed by a FC network.
ConvEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvEncoder: """Convolutional encoder for images datasets. Convolutions (with 3x3 kernel size, see DownConvBlock for details) followed by a FC network.""" def __init__(self, H, W, input_channel, channel_list, hidden_dims, z_dim): """Init. Args: H(int): Height of the input data. W(int...
stack_v2_sparse_classes_10k_train_001650
10,936
no_license
[ { "docstring": "Init. Args: H(int): Height of the input data. W(int): Width of the input data input_channel(int): Number of channels in the input data. Typically 1 for grayscale and 3 for RGB. channel_list(List[int]): List of channels. Determines the number of convolutional layers and associated channels. ex: [...
2
stack_v2_sparse_classes_30k_train_002759
Implement the Python class `ConvEncoder` described below. Class description: Convolutional encoder for images datasets. Convolutions (with 3x3 kernel size, see DownConvBlock for details) followed by a FC network. Method signatures and docstrings: - def __init__(self, H, W, input_channel, channel_list, hidden_dims, z_...
Implement the Python class `ConvEncoder` described below. Class description: Convolutional encoder for images datasets. Convolutions (with 3x3 kernel size, see DownConvBlock for details) followed by a FC network. Method signatures and docstrings: - def __init__(self, H, W, input_channel, channel_list, hidden_dims, z_...
9027b529eaa4cf0a38f25512141810f92db99639
<|skeleton|> class ConvEncoder: """Convolutional encoder for images datasets. Convolutions (with 3x3 kernel size, see DownConvBlock for details) followed by a FC network.""" def __init__(self, H, W, input_channel, channel_list, hidden_dims, z_dim): """Init. Args: H(int): Height of the input data. W(int...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConvEncoder: """Convolutional encoder for images datasets. Convolutions (with 3x3 kernel size, see DownConvBlock for details) followed by a FC network.""" def __init__(self, H, W, input_channel, channel_list, hidden_dims, z_dim): """Init. Args: H(int): Height of the input data. W(int): Width of t...
the_stack_v2_python_sparse
grae/models/torch_modules.py
jakerhodes/GRAE
train
0
c67213ddfa85e3440729abd428f1349451e6cb87
[ "fake_users = []\nfor fake_email_and_name in base_test.FAKE_EMAILS_AND_NAMES:\n fake_user = models.User(email=fake_email_and_name['email'], name=fake_email_and_name['name'], is_key_revoked=False)\n fake_user.save()\n fake_users.append(fake_user)\nkey_string = key_distributor.KeyDistributor().make_key_strin...
<|body_start_0|> fake_users = [] for fake_email_and_name in base_test.FAKE_EMAILS_AND_NAMES: fake_user = models.User(email=fake_email_and_name['email'], name=fake_email_and_name['name'], is_key_revoked=False) fake_user.save() fake_users.append(fake_user) key_s...
Test key distributor class functionality.
KeyDistributorTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeyDistributorTest: """Test key distributor class functionality.""" def testUnrevokedUsersAreInKeyString(self): """Test unrevoked users are in key string..""" <|body_0|> def testRevokedUsersAreNotInKeyString(self): """Test revoked users are not in key string.."""...
stack_v2_sparse_classes_10k_train_001651
1,644
permissive
[ { "docstring": "Test unrevoked users are in key string..", "name": "testUnrevokedUsersAreInKeyString", "signature": "def testUnrevokedUsersAreInKeyString(self)" }, { "docstring": "Test revoked users are not in key string..", "name": "testRevokedUsersAreNotInKeyString", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_006254
Implement the Python class `KeyDistributorTest` described below. Class description: Test key distributor class functionality. Method signatures and docstrings: - def testUnrevokedUsersAreInKeyString(self): Test unrevoked users are in key string.. - def testRevokedUsersAreNotInKeyString(self): Test revoked users are n...
Implement the Python class `KeyDistributorTest` described below. Class description: Test key distributor class functionality. Method signatures and docstrings: - def testUnrevokedUsersAreInKeyString(self): Test unrevoked users are in key string.. - def testRevokedUsersAreNotInKeyString(self): Test revoked users are n...
a9efb83cfa3a5aa26bf3c4012ca0ef99b6e67829
<|skeleton|> class KeyDistributorTest: """Test key distributor class functionality.""" def testUnrevokedUsersAreInKeyString(self): """Test unrevoked users are in key string..""" <|body_0|> def testRevokedUsersAreNotInKeyString(self): """Test revoked users are not in key string.."""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KeyDistributorTest: """Test key distributor class functionality.""" def testUnrevokedUsersAreInKeyString(self): """Test unrevoked users are in key string..""" fake_users = [] for fake_email_and_name in base_test.FAKE_EMAILS_AND_NAMES: fake_user = models.User(email=fake...
the_stack_v2_python_sparse
ufo/services/key_distributor_test.py
UWNetworksLab/ufo-management-server-flask
train
0
b9fe8246c15827b213420b250eaf172812b6f949
[ "self.salt = salt\nself.forward_idx = 0\nself.idx = 0", "self.buffer = []\nfor _ in range(1000):\n hash_str = '{}{}'.format(self.salt, self.forward_idx).encode()\n self.buffer.append(md5(hash_str).hexdigest())\n self.forward_idx += 1", "self.buf_init()\nkeys = 0\nwhile keys != 64:\n res = find_in_a_...
<|body_start_0|> self.salt = salt self.forward_idx = 0 self.idx = 0 <|end_body_0|> <|body_start_1|> self.buffer = [] for _ in range(1000): hash_str = '{}{}'.format(self.salt, self.forward_idx).encode() self.buffer.append(md5(hash_str).hexdigest()) ...
KeyGetter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeyGetter: def __init__(self, salt): """initialize""" <|body_0|> def buf_init(self): """create 1000 hash values""" <|body_1|> def solve(self): """find the 64th key""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.salt = salt...
stack_v2_sparse_classes_10k_train_001652
1,803
no_license
[ { "docstring": "initialize", "name": "__init__", "signature": "def __init__(self, salt)" }, { "docstring": "create 1000 hash values", "name": "buf_init", "signature": "def buf_init(self)" }, { "docstring": "find the 64th key", "name": "solve", "signature": "def solve(self...
3
stack_v2_sparse_classes_30k_train_005186
Implement the Python class `KeyGetter` described below. Class description: Implement the KeyGetter class. Method signatures and docstrings: - def __init__(self, salt): initialize - def buf_init(self): create 1000 hash values - def solve(self): find the 64th key
Implement the Python class `KeyGetter` described below. Class description: Implement the KeyGetter class. Method signatures and docstrings: - def __init__(self, salt): initialize - def buf_init(self): create 1000 hash values - def solve(self): find the 64th key <|skeleton|> class KeyGetter: def __init__(self, s...
b1688431de1c5ab60659bc632c1a7131c3c7aad5
<|skeleton|> class KeyGetter: def __init__(self, salt): """initialize""" <|body_0|> def buf_init(self): """create 1000 hash values""" <|body_1|> def solve(self): """find the 64th key""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KeyGetter: def __init__(self, salt): """initialize""" self.salt = salt self.forward_idx = 0 self.idx = 0 def buf_init(self): """create 1000 hash values""" self.buffer = [] for _ in range(1000): hash_str = '{}{}'.format(self.salt, self.fo...
the_stack_v2_python_sparse
2016/14_01.py
yknot/adventOfCode
train
0
ffc28a2908f4ed09bc85be261ee0a873cace018b
[ "nums = list(set(nums))\nnums.sort()\nif len(nums) == 0:\n return 0\nprev, max_len, tmp_len = (nums[0], 1, 1)\nfor i in xrange(1, len(nums)):\n if nums[i] == prev + 1:\n tmp_len += 1\n prev = nums[i]\n else:\n tmp_len = 1\n prev = nums[i]\n max_len = max(max_len, tmp_len)\nre...
<|body_start_0|> nums = list(set(nums)) nums.sort() if len(nums) == 0: return 0 prev, max_len, tmp_len = (nums[0], 1, 1) for i in xrange(1, len(nums)): if nums[i] == prev + 1: tmp_len += 1 prev = nums[i] else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestConsecutive_2(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums = list(set(nums)) ...
stack_v2_sparse_classes_10k_train_001653
1,552
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "longestConsecutive_2", "signature": "def longestConsecutive_2(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "longestConsecutive", "signature": "def longestConsecutive(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_006198
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive_2(self, nums): :type nums: List[int] :rtype: int - def longestConsecutive(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive_2(self, nums): :type nums: List[int] :rtype: int - def longestConsecutive(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
0ca8983505ef5f694b68198742aaf50fc0b80e6b
<|skeleton|> class Solution: def longestConsecutive_2(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestConsecutive_2(self, nums): """:type nums: List[int] :rtype: int""" nums = list(set(nums)) nums.sort() if len(nums) == 0: return 0 prev, max_len, tmp_len = (nums[0], 1, 1) for i in xrange(1, len(nums)): if nums[i] == p...
the_stack_v2_python_sparse
leetcode 101-150/128. Longest Consecutive Sequence.py
raxxar1024/code_snippet
train
0
850f6b637d7e61d3ff78db91a8d5399b0597c28b
[ "self.arest = arest\nself._attr_name = f'{location.title()} {name.title()}'\nself._variable = variable\nself._attr_native_unit_of_measurement = unit_of_measurement\nself._renderer = renderer\nif pin is not None:\n request = requests.get(f'{resource}/mode/{pin}/i', timeout=10)\n if request.status_code != HTTPS...
<|body_start_0|> self.arest = arest self._attr_name = f'{location.title()} {name.title()}' self._variable = variable self._attr_native_unit_of_measurement = unit_of_measurement self._renderer = renderer if pin is not None: request = requests.get(f'{resource}/m...
Implementation of an aREST sensor for exposed variables.
ArestSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArestSensor: """Implementation of an aREST sensor for exposed variables.""" def __init__(self, arest, resource, location, name, variable=None, pin=None, unit_of_measurement=None, renderer=None): """Initialize the sensor.""" <|body_0|> def update(self) -> None: ""...
stack_v2_sparse_classes_10k_train_001654
6,651
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, arest, resource, location, name, variable=None, pin=None, unit_of_measurement=None, renderer=None)" }, { "docstring": "Get the latest data from aREST API.", "name": "update", "signature": "def u...
2
null
Implement the Python class `ArestSensor` described below. Class description: Implementation of an aREST sensor for exposed variables. Method signatures and docstrings: - def __init__(self, arest, resource, location, name, variable=None, pin=None, unit_of_measurement=None, renderer=None): Initialize the sensor. - def ...
Implement the Python class `ArestSensor` described below. Class description: Implementation of an aREST sensor for exposed variables. Method signatures and docstrings: - def __init__(self, arest, resource, location, name, variable=None, pin=None, unit_of_measurement=None, renderer=None): Initialize the sensor. - def ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ArestSensor: """Implementation of an aREST sensor for exposed variables.""" def __init__(self, arest, resource, location, name, variable=None, pin=None, unit_of_measurement=None, renderer=None): """Initialize the sensor.""" <|body_0|> def update(self) -> None: ""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ArestSensor: """Implementation of an aREST sensor for exposed variables.""" def __init__(self, arest, resource, location, name, variable=None, pin=None, unit_of_measurement=None, renderer=None): """Initialize the sensor.""" self.arest = arest self._attr_name = f'{location.title()}...
the_stack_v2_python_sparse
homeassistant/components/arest/sensor.py
home-assistant/core
train
35,501
d3100a2c8a3e8f2d20b3cf391a4385c249935fd2
[ "self.hp = nums\nheapq.heapify(self.hp)\nself.ind = k", "heapq.heappush(self.hp, val)\nwhile len(self.hp) > self.ind:\n heapq.heappop(self.hp)\nreturn self.hp[0]" ]
<|body_start_0|> self.hp = nums heapq.heapify(self.hp) self.ind = k <|end_body_0|> <|body_start_1|> heapq.heappush(self.hp, val) while len(self.hp) > self.ind: heapq.heappop(self.hp) return self.hp[0] <|end_body_1|>
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.hp = nums heapq.heapify(self.hp) self...
stack_v2_sparse_classes_10k_train_001655
1,066
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
null
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
ee59b82125f100970c842d5e1245287c484d6649
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.hp = nums heapq.heapify(self.hp) self.ind = k def add(self, val): """:type val: int :rtype: int""" heapq.heappush(self.hp, val) while len(self.hp) > self.ind: ...
the_stack_v2_python_sparse
_CodeTopics/LeetCode/601-800/000703/000703_algo2.py
BIAOXYZ/variousCodes
train
0
ea32cb1d053c5690dd9270b1d86c815d056c4336
[ "self.instance = instance\nself.schema = None\nif self.instance:\n self.schema = surveys.SurveySchema(self.instance.survey)", "for name, field in self.fields.items():\n renderer = self.renderers.get(name)\n if renderer:\n value = renderer(self.instance)\n else:\n value = getattr(self.ins...
<|body_start_0|> self.instance = instance self.schema = None if self.instance: self.schema = surveys.SurveySchema(self.instance.survey) <|end_body_0|> <|body_start_1|> for name, field in self.fields.items(): renderer = self.renderers.get(name) if rend...
A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.
SurveyRecordReadOnlyTemplate
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SurveyRecordReadOnlyTemplate: """A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.""" def __init__(self, instance=Non...
stack_v2_sparse_classes_10k_train_001656
9,668
permissive
[ { "docstring": "Constructor to initialize the model instance. The readonly template will be rendered for the data in this model instance.", "name": "__init__", "signature": "def __init__(self, instance=None)" }, { "docstring": "Iterates through the fields that were declared for this template. Yi...
4
stack_v2_sparse_classes_30k_test_000134
Implement the Python class `SurveyRecordReadOnlyTemplate` described below. Class description: A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model. ...
Implement the Python class `SurveyRecordReadOnlyTemplate` described below. Class description: A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model. ...
f581989f168189fa3a58c028eff327a16c03e438
<|skeleton|> class SurveyRecordReadOnlyTemplate: """A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.""" def __init__(self, instance=Non...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SurveyRecordReadOnlyTemplate: """A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.""" def __init__(self, instance=None): "...
the_stack_v2_python_sparse
app/soc/views/readonly_template.py
sambitgaan/nupic.son
train
0
2ffc85f667416e90328724a38c88dfb47342715a
[ "self.auth = auth\nself._group = group\nself._overall_situation = True if not group else False", "with connection.cursor() as cursor:\n cursor.execute(f'\\n SELECT makeup.face_uuid \\n FROM faceU_faceufacialmakeupmapping AS mapping \\n JOIN faceU_faceufacialmakeup A...
<|body_start_0|> self.auth = auth self._group = group self._overall_situation = True if not group else False <|end_body_0|> <|body_start_1|> with connection.cursor() as cursor: cursor.execute(f'\n SELECT makeup.face_uuid \n FROM faceU_faceufacia...
FaceUDistinguishLogic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaceUDistinguishLogic: def __init__(self, auth, group=0): """人脸识别逻辑 :param auth: :param group:""" <|body_0|> def to_face_uuid(self): """获取分组或全局成员脸谱uuid :return:""" <|body_1|> def from_face_uuid(self, face_uuid): """从uuid获取成员信息 :param face_uuid: :...
stack_v2_sparse_classes_10k_train_001657
1,765
no_license
[ { "docstring": "人脸识别逻辑 :param auth: :param group:", "name": "__init__", "signature": "def __init__(self, auth, group=0)" }, { "docstring": "获取分组或全局成员脸谱uuid :return:", "name": "to_face_uuid", "signature": "def to_face_uuid(self)" }, { "docstring": "从uuid获取成员信息 :param face_uuid: :r...
3
stack_v2_sparse_classes_30k_train_001510
Implement the Python class `FaceUDistinguishLogic` described below. Class description: Implement the FaceUDistinguishLogic class. Method signatures and docstrings: - def __init__(self, auth, group=0): 人脸识别逻辑 :param auth: :param group: - def to_face_uuid(self): 获取分组或全局成员脸谱uuid :return: - def from_face_uuid(self, face_...
Implement the Python class `FaceUDistinguishLogic` described below. Class description: Implement the FaceUDistinguishLogic class. Method signatures and docstrings: - def __init__(self, auth, group=0): 人脸识别逻辑 :param auth: :param group: - def to_face_uuid(self): 获取分组或全局成员脸谱uuid :return: - def from_face_uuid(self, face_...
7467cd66e1fc91f0b3a264f8fc9b93f22f09fe7b
<|skeleton|> class FaceUDistinguishLogic: def __init__(self, auth, group=0): """人脸识别逻辑 :param auth: :param group:""" <|body_0|> def to_face_uuid(self): """获取分组或全局成员脸谱uuid :return:""" <|body_1|> def from_face_uuid(self, face_uuid): """从uuid获取成员信息 :param face_uuid: :...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FaceUDistinguishLogic: def __init__(self, auth, group=0): """人脸识别逻辑 :param auth: :param group:""" self.auth = auth self._group = group self._overall_situation = True if not group else False def to_face_uuid(self): """获取分组或全局成员脸谱uuid :return:""" with connect...
the_stack_v2_python_sparse
FireHydrant/server/faceU/logic/distinguish.py
shoogoome/FireHydrant
train
4
434450a1c71925ea66525c121d373108f945a6bf
[ "if self.OPERATION in line:\n return True\nreturn False", "JUMP = len(output_ds)\noutput_ds.append('@SP')\noutput_ds.append('A=M')\noutput_ds.append('A=A-1')\noutput_ds.append('D=M')\noutput_ds.append('A=A-1')\noutput_ds.append('D=M-D')\noutput_ds.append('@JUMP' + str(JUMP))\noutput_ds.append('D;' + self.jump_...
<|body_start_0|> if self.OPERATION in line: return True return False <|end_body_0|> <|body_start_1|> JUMP = len(output_ds) output_ds.append('@SP') output_ds.append('A=M') output_ds.append('A=A-1') output_ds.append('D=M') output_ds.append('A=A-...
a parser that convert vm operation command to assembly
ConditionsOp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConditionsOp: """a parser that convert vm operation command to assembly""" def is_triggered(self, line): """:param line: an vm line :return: true if this line refer to given operation command""" <|body_0|> def parse(self, line, output_ds): """convert vm operation...
stack_v2_sparse_classes_10k_train_001658
1,331
no_license
[ { "docstring": ":param line: an vm line :return: true if this line refer to given operation command", "name": "is_triggered", "signature": "def is_triggered(self, line)" }, { "docstring": "convert vm operation command to assembly code :param output_ds: assembly commands output :param line: line ...
2
stack_v2_sparse_classes_30k_train_000051
Implement the Python class `ConditionsOp` described below. Class description: a parser that convert vm operation command to assembly Method signatures and docstrings: - def is_triggered(self, line): :param line: an vm line :return: true if this line refer to given operation command - def parse(self, line, output_ds):...
Implement the Python class `ConditionsOp` described below. Class description: a parser that convert vm operation command to assembly Method signatures and docstrings: - def is_triggered(self, line): :param line: an vm line :return: true if this line refer to given operation command - def parse(self, line, output_ds):...
2170c0fd15afc950a8f5ef2289716a01515daaaf
<|skeleton|> class ConditionsOp: """a parser that convert vm operation command to assembly""" def is_triggered(self, line): """:param line: an vm line :return: true if this line refer to given operation command""" <|body_0|> def parse(self, line, output_ds): """convert vm operation...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConditionsOp: """a parser that convert vm operation command to assembly""" def is_triggered(self, line): """:param line: an vm line :return: true if this line refer to given operation command""" if self.OPERATION in line: return True return False def parse(self, l...
the_stack_v2_python_sparse
projects/07/VMtranslator/ConditionsOp.py
DaniNem/N2T_Zilber_Neimark
train
0
35c2c329f9664f6092506b419c767a8ce6da89ad
[ "self.dev = dev\nself.metadata = metadata\nself.fs_type = get_filesystem_type(fs_stream)\nif self.fs_type == 'FAT':\n self.metadata.set_module('fat-cluster-allocator')\n self.fs = FATAllocator(fs_stream)\nelif self.fs_type == 'NTFS':\n self.metadata.set_module('ntfs-cluster-allocator')\n self.fs = NTFSA...
<|body_start_0|> self.dev = dev self.metadata = metadata self.fs_type = get_filesystem_type(fs_stream) if self.fs_type == 'FAT': self.metadata.set_module('fat-cluster-allocator') self.fs = FATAllocator(fs_stream) elif self.fs_type == 'NTFS': se...
This class wrapps the filesystem specific file cluster allocation implementations usage examples: >>> f = open('/dev/sdb1', 'rb+') >>> fs = ClusterAllocation(f) >>> m = Metadata("FileSlack") >>> filename = 'path/to/file/on/fs' to write something from stdin into slack: >>> fs.write(sys.stdin.buffer, m, filename) to read...
ClusterAllocation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterAllocation: """This class wrapps the filesystem specific file cluster allocation implementations usage examples: >>> f = open('/dev/sdb1', 'rb+') >>> fs = ClusterAllocation(f) >>> m = Metadata("FileSlack") >>> filename = 'path/to/file/on/fs' to write something from stdin into slack: >>> fs...
stack_v2_sparse_classes_10k_train_001659
5,289
permissive
[ { "docstring": ":param fs_stream: Stream of filesystem :param metadata: Metadata object", "name": "__init__", "signature": "def __init__(self, fs_stream: typ.BinaryIO, metadata: Metadata, dev: str=None)" }, { "docstring": "writes data from instream into additional allocated clusters of given fil...
5
stack_v2_sparse_classes_30k_train_007068
Implement the Python class `ClusterAllocation` described below. Class description: This class wrapps the filesystem specific file cluster allocation implementations usage examples: >>> f = open('/dev/sdb1', 'rb+') >>> fs = ClusterAllocation(f) >>> m = Metadata("FileSlack") >>> filename = 'path/to/file/on/fs' to write ...
Implement the Python class `ClusterAllocation` described below. Class description: This class wrapps the filesystem specific file cluster allocation implementations usage examples: >>> f = open('/dev/sdb1', 'rb+') >>> fs = ClusterAllocation(f) >>> m = Metadata("FileSlack") >>> filename = 'path/to/file/on/fs' to write ...
b602e90ddecb8e469a28e092da3ca7fec514e3dc
<|skeleton|> class ClusterAllocation: """This class wrapps the filesystem specific file cluster allocation implementations usage examples: >>> f = open('/dev/sdb1', 'rb+') >>> fs = ClusterAllocation(f) >>> m = Metadata("FileSlack") >>> filename = 'path/to/file/on/fs' to write something from stdin into slack: >>> fs...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ClusterAllocation: """This class wrapps the filesystem specific file cluster allocation implementations usage examples: >>> f = open('/dev/sdb1', 'rb+') >>> fs = ClusterAllocation(f) >>> m = Metadata("FileSlack") >>> filename = 'path/to/file/on/fs' to write something from stdin into slack: >>> fs.write(sys.st...
the_stack_v2_python_sparse
src/wrapper/cluster_allocation.py
VanirLab/weever
train
3
42914637a58c9b2509dc8d1e541b0a1aee3af026
[ "self.mhdr = mhdr\nself.appeui = appeui\nself.deveui = deveui\nself.devnonce = devnonce\nself.mic = mic", "if len(data) != 23:\n raise DecodeError()\nappeui, deveui, devnonce, mic = struct.unpack('<QQHL', data[1:])\nm = JoinRequestMessage(mhdr, appeui, deveui, devnonce, mic)\nreturn m", "data = self.mhdr.enc...
<|body_start_0|> self.mhdr = mhdr self.appeui = appeui self.deveui = deveui self.devnonce = devnonce self.mic = mic <|end_body_0|> <|body_start_1|> if len(data) != 23: raise DecodeError() appeui, deveui, devnonce, mic = struct.unpack('<QQHL', data[1:]...
A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. deveui (int): Global end device EUI. devnonce (int): Device nonce. mic (int): Message ...
JoinRequestMessage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JoinRequestMessage: """A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. deveui (int): Global end device EUI. dev...
stack_v2_sparse_classes_10k_train_001660
26,915
permissive
[ { "docstring": "JoinRequestMessage initialisation method.", "name": "__init__", "signature": "def __init__(self, mhdr, appeui, deveui, devnonce, mic)" }, { "docstring": "Create a MACJoinRequestMessage object from binary representation. Args: mhdr (MACHeader): MAC header object. data (str): UDP p...
3
stack_v2_sparse_classes_30k_train_005268
Implement the Python class `JoinRequestMessage` described below. Class description: A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. d...
Implement the Python class `JoinRequestMessage` described below. Class description: A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. d...
add5a1129296dca6db55b7980c0c1091f1ca80aa
<|skeleton|> class JoinRequestMessage: """A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. deveui (int): Global end device EUI. dev...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JoinRequestMessage: """A LoRa Join Request message. The join request message contains the AppEUI and DevEUI of the end device, followed by a Nonce of 2 octets (devnonce). Attributes: mhdr (MACHeader): MAC header object. appeui (int): Application identifer. deveui (int): Global end device EUI. devnonce (int): ...
the_stack_v2_python_sparse
floranet/lora/mac.py
chengzhongkai/floranet
train
0
31198dddcf37a5e74c2bb72d72354b75f9dfc8e1
[ "history_file = os.path.join(self.base_path, 'places.sqlite')\nwith io.open(history_file, mode='rb') as history_filedesc:\n history = firefox3_history.Firefox3History()\n entries = [x for x in history.Parse(history_filedesc)]\nself.assertLen(entries, 1)\ntry:\n dt1 = datetime.datetime(1970, 1, 1)\n dt1 ...
<|body_start_0|> history_file = os.path.join(self.base_path, 'places.sqlite') with io.open(history_file, mode='rb') as history_filedesc: history = firefox3_history.Firefox3History() entries = [x for x in history.Parse(history_filedesc)] self.assertLen(entries, 1) ...
Test parsing of Firefox 3 history files.
Firefox3HistoryTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Firefox3HistoryTest: """Test parsing of Firefox 3 history files.""" def testBasicParsing(self): """Test we can parse a standard file.""" <|body_0|> def testNewHistoryFile(self): """Tests reading of history files written by recent versions of Firefox.""" <...
stack_v2_sparse_classes_10k_train_001661
2,258
permissive
[ { "docstring": "Test we can parse a standard file.", "name": "testBasicParsing", "signature": "def testBasicParsing(self)" }, { "docstring": "Tests reading of history files written by recent versions of Firefox.", "name": "testNewHistoryFile", "signature": "def testNewHistoryFile(self)" ...
2
stack_v2_sparse_classes_30k_train_006943
Implement the Python class `Firefox3HistoryTest` described below. Class description: Test parsing of Firefox 3 history files. Method signatures and docstrings: - def testBasicParsing(self): Test we can parse a standard file. - def testNewHistoryFile(self): Tests reading of history files written by recent versions of ...
Implement the Python class `Firefox3HistoryTest` described below. Class description: Test parsing of Firefox 3 history files. Method signatures and docstrings: - def testBasicParsing(self): Test we can parse a standard file. - def testNewHistoryFile(self): Tests reading of history files written by recent versions of ...
44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6
<|skeleton|> class Firefox3HistoryTest: """Test parsing of Firefox 3 history files.""" def testBasicParsing(self): """Test we can parse a standard file.""" <|body_0|> def testNewHistoryFile(self): """Tests reading of history files written by recent versions of Firefox.""" <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Firefox3HistoryTest: """Test parsing of Firefox 3 history files.""" def testBasicParsing(self): """Test we can parse a standard file.""" history_file = os.path.join(self.base_path, 'places.sqlite') with io.open(history_file, mode='rb') as history_filedesc: history = fi...
the_stack_v2_python_sparse
grr/core/grr_response_core/lib/parsers/firefox3_history_test.py
google/grr
train
4,683
31b553c5b2974bcc10b05798119d3f925969d73f
[ "PowerSpectrumSeries.__init__(self, *args, **kwargs)\nif not isinstance(self.overlay, fslmelimage.MelodicImage):\n raise ValueError('Overlay is not a MelodicImage')\nself.varNorm = False\nself.disableProperty('varNorm')", "display = self.displayCtx.getDisplay(self.overlay)\nopts = display.opts\ncomponent = opt...
<|body_start_0|> PowerSpectrumSeries.__init__(self, *args, **kwargs) if not isinstance(self.overlay, fslmelimage.MelodicImage): raise ValueError('Overlay is not a MelodicImage') self.varNorm = False self.disableProperty('varNorm') <|end_body_0|> <|body_start_1|> disp...
The ``MelodicPowerSpectrumSeries`` class encapsulates the power spectrum of the time course for a single component of a :class:`.MelodicImage`. The component is dictated by the :attr:`.NiftiOpts.volume` property.
MelodicPowerSpectrumSeries
[ "BSD-3-Clause", "CC-BY-3.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MelodicPowerSpectrumSeries: """The ``MelodicPowerSpectrumSeries`` class encapsulates the power spectrum of the time course for a single component of a :class:`.MelodicImage`. The component is dictated by the :attr:`.NiftiOpts.volume` property.""" def __init__(self, *args, **kwargs): ...
stack_v2_sparse_classes_10k_train_001662
8,639
permissive
[ { "docstring": "Create a ``MelodicPowerSpectrumSeries``. All arguments are passed through to the :meth:`PowerSpectrumSeries.__init__` method.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Returns a label that can be used for this ``MelodicPowerSpectr...
3
null
Implement the Python class `MelodicPowerSpectrumSeries` described below. Class description: The ``MelodicPowerSpectrumSeries`` class encapsulates the power spectrum of the time course for a single component of a :class:`.MelodicImage`. The component is dictated by the :attr:`.NiftiOpts.volume` property. Method signat...
Implement the Python class `MelodicPowerSpectrumSeries` described below. Class description: The ``MelodicPowerSpectrumSeries`` class encapsulates the power spectrum of the time course for a single component of a :class:`.MelodicImage`. The component is dictated by the :attr:`.NiftiOpts.volume` property. Method signat...
46ccb4fe2b2346eb57576247f49714032b61307a
<|skeleton|> class MelodicPowerSpectrumSeries: """The ``MelodicPowerSpectrumSeries`` class encapsulates the power spectrum of the time course for a single component of a :class:`.MelodicImage`. The component is dictated by the :attr:`.NiftiOpts.volume` property.""" def __init__(self, *args, **kwargs): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MelodicPowerSpectrumSeries: """The ``MelodicPowerSpectrumSeries`` class encapsulates the power spectrum of the time course for a single component of a :class:`.MelodicImage`. The component is dictated by the :attr:`.NiftiOpts.volume` property.""" def __init__(self, *args, **kwargs): """Create a `...
the_stack_v2_python_sparse
fsleyes/plotting/powerspectrumseries.py
sanjayankur31/fsleyes
train
1
38015f58e2eabf83c5b2039dff28913ecd1e4fe3
[ "self.matrix = matrix\nself.zero = zero\nif vector is None:\n if vtype.lower() == 'rd':\n self.new = zeros(matrix.shape[0], dtype=dtype)\n self.new[:] = random.rand(matrix.shape[0])\n else:\n self.new = ones(matrix.shape[0], dtype=dtype)\n self.new[:] = self.new[:] / norm(self.new)\nel...
<|body_start_0|> self.matrix = matrix self.zero = zero if vector is None: if vtype.lower() == 'rd': self.new = zeros(matrix.shape[0], dtype=dtype) self.new[:] = random.rand(matrix.shape[0]) else: self.new = ones(matrix.shape...
The Lanczos algorithm to deal with csr-formed sparse Hermitian matrices. Attributes: matrix: csr_matrix The csr-formed sparse Hermitian matrix. zero: float The precision used to cut off the Lanczos iterations. new,old: 1D ndarray The new and old vectors updated in the Lanczos iterations. a,b: 1D list of floats The coef...
Lanczos
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Lanczos: """The Lanczos algorithm to deal with csr-formed sparse Hermitian matrices. Attributes: matrix: csr_matrix The csr-formed sparse Hermitian matrix. zero: float The precision used to cut off the Lanczos iterations. new,old: 1D ndarray The new and old vectors updated in the Lanczos iteratio...
stack_v2_sparse_classes_10k_train_001663
4,686
no_license
[ { "docstring": "Constructor. Parameters: matrix: csr_matrix The csr-formed sparse Hermitian matrix. vector: 1D ndarray,optional The initial vector to begin with the Lanczos iterations. It must be normalized already. vtype: string,optional A flag to tell what type of initial vectors to use when the parameter vec...
4
stack_v2_sparse_classes_30k_train_003066
Implement the Python class `Lanczos` described below. Class description: The Lanczos algorithm to deal with csr-formed sparse Hermitian matrices. Attributes: matrix: csr_matrix The csr-formed sparse Hermitian matrix. zero: float The precision used to cut off the Lanczos iterations. new,old: 1D ndarray The new and old ...
Implement the Python class `Lanczos` described below. Class description: The Lanczos algorithm to deal with csr-formed sparse Hermitian matrices. Attributes: matrix: csr_matrix The csr-formed sparse Hermitian matrix. zero: float The precision used to cut off the Lanczos iterations. new,old: 1D ndarray The new and old ...
c985d0e5c70b08ef396dd591180c493b60b268ee
<|skeleton|> class Lanczos: """The Lanczos algorithm to deal with csr-formed sparse Hermitian matrices. Attributes: matrix: csr_matrix The csr-formed sparse Hermitian matrix. zero: float The precision used to cut off the Lanczos iterations. new,old: 1D ndarray The new and old vectors updated in the Lanczos iteratio...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Lanczos: """The Lanczos algorithm to deal with csr-formed sparse Hermitian matrices. Attributes: matrix: csr_matrix The csr-formed sparse Hermitian matrix. zero: float The precision used to cut off the Lanczos iterations. new,old: 1D ndarray The new and old vectors updated in the Lanczos iterations. a,b: 1D l...
the_stack_v2_python_sparse
Core/BasicAlgorithm/LanczosPy.py
Farewell1989/Hamiltonian-Generator
train
0
e8936994808e6f1a18a7dabbcf92d1570ab6efee
[ "super(ParameterizedStrategy, self).__init__(network)\nself.matrix = FeatureMatrix(network)\nself.bound = bound\nself.label = None\nself.covered_count = None\nself.objective_covered = None\nself.strategy = np.random.uniform(-self.bound, self.bound, size=FeatureMatrix.TOTAL_FEATURES)", "scores = self.matrix.dot(se...
<|body_start_0|> super(ParameterizedStrategy, self).__init__(network) self.matrix = FeatureMatrix(network) self.bound = bound self.label = None self.covered_count = None self.objective_covered = None self.strategy = np.random.uniform(-self.bound, self.bound, size=...
A strategy that uses a parameterized selection strategy. Parameterized neuron selection strategy is a strategy that parameterized neurons and scores with a selection vector. Please see the following paper for more details: Effective White-Box Testing for Deep Neural Networks with Adaptive Neuron-Selection Strategy http...
ParameterizedStrategy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParameterizedStrategy: """A strategy that uses a parameterized selection strategy. Parameterized neuron selection strategy is a strategy that parameterized neurons and scores with a selection vector. Please see the following paper for more details: Effective White-Box Testing for Deep Neural Netw...
stack_v2_sparse_classes_10k_train_001664
17,144
permissive
[ { "docstring": "Create a parameterized strategy, and initialize its variables. Args: network: A wrapped Keras model with `adapt.Network`. bound: A floating point number indicates the absolute value of minimum and maximum bounds. Example: >>> from adapt import Network >>> from adapt.strategy import Parameterized...
4
null
Implement the Python class `ParameterizedStrategy` described below. Class description: A strategy that uses a parameterized selection strategy. Parameterized neuron selection strategy is a strategy that parameterized neurons and scores with a selection vector. Please see the following paper for more details: Effective...
Implement the Python class `ParameterizedStrategy` described below. Class description: A strategy that uses a parameterized selection strategy. Parameterized neuron selection strategy is a strategy that parameterized neurons and scores with a selection vector. Please see the following paper for more details: Effective...
0b801d2d2e828ac480d1097cb3bdd82b1e25c15b
<|skeleton|> class ParameterizedStrategy: """A strategy that uses a parameterized selection strategy. Parameterized neuron selection strategy is a strategy that parameterized neurons and scores with a selection vector. Please see the following paper for more details: Effective White-Box Testing for Deep Neural Netw...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ParameterizedStrategy: """A strategy that uses a parameterized selection strategy. Parameterized neuron selection strategy is a strategy that parameterized neurons and scores with a selection vector. Please see the following paper for more details: Effective White-Box Testing for Deep Neural Networks with Ada...
the_stack_v2_python_sparse
code/deep/ReMoS/CV_adv/DNNtest/strategy/adapt.py
jindongwang/transferlearning
train
12,773
17e8d4b0fe5ec5300eff2823bc2a05624f3c7c81
[ "if not hasattr(self, '_flask_secret'):\n token = str(self.random.randint(1, 1e+16))\n self._flask_secret = md5(token.encode('utf-8')).hexdigest()\nreturn self._flask_secret", "self.app_file = '{}.py'.format(self.app.split(':')[0])\nassert os.path.isfile(self.app_file), 'module must exist'\nif self.python_v...
<|body_start_0|> if not hasattr(self, '_flask_secret'): token = str(self.random.randint(1, 1e+16)) self._flask_secret = md5(token.encode('utf-8')).hexdigest() return self._flask_secret <|end_body_0|> <|body_start_1|> self.app_file = '{}.py'.format(self.app.split(':')[0])...
Class for python Flask web apps
FlaskApp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlaskApp: """Class for python Flask web apps""" def flask_secret(self): """Provides flask_secret on-demand with caching""" <|body_0|> def flask_setup(self): """Setup for flask apps""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not hasattr(s...
stack_v2_sparse_classes_10k_train_001665
9,323
permissive
[ { "docstring": "Provides flask_secret on-demand with caching", "name": "flask_secret", "signature": "def flask_secret(self)" }, { "docstring": "Setup for flask apps", "name": "flask_setup", "signature": "def flask_setup(self)" } ]
2
stack_v2_sparse_classes_30k_train_003518
Implement the Python class `FlaskApp` described below. Class description: Class for python Flask web apps Method signatures and docstrings: - def flask_secret(self): Provides flask_secret on-demand with caching - def flask_setup(self): Setup for flask apps
Implement the Python class `FlaskApp` described below. Class description: Class for python Flask web apps Method signatures and docstrings: - def flask_secret(self): Provides flask_secret on-demand with caching - def flask_setup(self): Setup for flask apps <|skeleton|> class FlaskApp: """Class for python Flask w...
468035038afe00c6e7842b7e68ec45355ee1a224
<|skeleton|> class FlaskApp: """Class for python Flask web apps""" def flask_secret(self): """Provides flask_secret on-demand with caching""" <|body_0|> def flask_setup(self): """Setup for flask apps""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FlaskApp: """Class for python Flask web apps""" def flask_secret(self): """Provides flask_secret on-demand with caching""" if not hasattr(self, '_flask_secret'): token = str(self.random.randint(1, 1e+16)) self._flask_secret = md5(token.encode('utf-8')).hexdigest() ...
the_stack_v2_python_sparse
picoCTF-shell/hacksport/problem.py
zxc135781/picoCTF
train
1
02e0e43e1231966465757a2095ded41fa8e41fc3
[ "if event_id in [4624, 4634, 4647]:\n return self.getEventData(event, 'TargetLogonId')\nreturn self.getEventData(event, 'LogonID')", "event_id = event.source.get('event_identifier')\nif event_id == 4624:\n account_name = self.getEventData(event, 'TargetUserName')\nelse:\n account_name = self.getEventData...
<|body_start_0|> if event_id in [4624, 4634, 4647]: return self.getEventData(event, 'TargetLogonId') return self.getEventData(event, 'LogonID') <|end_body_0|> <|body_start_1|> event_id = event.source.get('event_identifier') if event_id == 4624: account_name = sel...
Sessionizing sketch analyzer for logon sessions, where a session begins with a login event and ends with a logout or startup event.
LogonSessionizerSketchPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogonSessionizerSketchPlugin: """Sessionizing sketch analyzer for logon sessions, where a session begins with a login event and ends with a logout or startup event.""" def getLogonId(self, event, event_id): """Retrieves the logon ID for an event.""" <|body_0|> def getSes...
stack_v2_sparse_classes_10k_train_001666
7,451
permissive
[ { "docstring": "Retrieves the logon ID for an event.", "name": "getLogonId", "signature": "def getLogonId(self, event, event_id)" }, { "docstring": "Creates the session ID for an event.", "name": "getSessionId", "signature": "def getSessionId(self, event, session_num)" } ]
2
null
Implement the Python class `LogonSessionizerSketchPlugin` described below. Class description: Sessionizing sketch analyzer for logon sessions, where a session begins with a login event and ends with a logout or startup event. Method signatures and docstrings: - def getLogonId(self, event, event_id): Retrieves the log...
Implement the Python class `LogonSessionizerSketchPlugin` described below. Class description: Sessionizing sketch analyzer for logon sessions, where a session begins with a login event and ends with a logout or startup event. Method signatures and docstrings: - def getLogonId(self, event, event_id): Retrieves the log...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class LogonSessionizerSketchPlugin: """Sessionizing sketch analyzer for logon sessions, where a session begins with a login event and ends with a logout or startup event.""" def getLogonId(self, event, event_id): """Retrieves the logon ID for an event.""" <|body_0|> def getSes...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LogonSessionizerSketchPlugin: """Sessionizing sketch analyzer for logon sessions, where a session begins with a login event and ends with a logout or startup event.""" def getLogonId(self, event, event_id): """Retrieves the logon ID for an event.""" if event_id in [4624, 4634, 4647]: ...
the_stack_v2_python_sparse
timesketch/lib/analyzers/evtx_sessionizers.py
google/timesketch
train
2,263
a10f3896840863e9656d8ad04f0e9e7df978fbda
[ "end = len(nums) - 1\nif end < 0:\n return -1\nreturn self.search_with_rotated(nums, 0, end, target)", "if end < begin:\n return -1\nif end == begin:\n if nums[end] == target:\n return end\n else:\n return -1\nmid = begin + (end - begin) / 2\nif nums[mid] == target:\n return mid\nif n...
<|body_start_0|> end = len(nums) - 1 if end < 0: return -1 return self.search_with_rotated(nums, 0, end, target) <|end_body_0|> <|body_start_1|> if end < begin: return -1 if end == begin: if nums[end] == target: return end ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def search_with_rotated(self, nums, begin, end, target): """:param nums: :param begin: :param end: :param target: :return:""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_10k_train_001667
2,034
permissive
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "search", "signature": "def search(self, nums, target)" }, { "docstring": ":param nums: :param begin: :param end: :param target: :return:", "name": "search_with_rotated", "signature": "def search_with_rotated(s...
2
stack_v2_sparse_classes_30k_train_003341
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def search_with_rotated(self, nums, begin, end, target): :param nums: :param begin: :param e...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def search_with_rotated(self, nums, begin, end, target): :param nums: :param begin: :param e...
6ddba1f3b86c40639a8203cbc3373d52301c1b1f
<|skeleton|> class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def search_with_rotated(self, nums, begin, end, target): """:param nums: :param begin: :param end: :param target: :return:""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" end = len(nums) - 1 if end < 0: return -1 return self.search_with_rotated(nums, 0, end, target) def search_with_rotated(self, nums, begin, end, target): ...
the_stack_v2_python_sparse
algorithms/python/leetcode/SearchinRotatedSortedArray.py
ytjia/leetcode
train
0
c4a31fcb2b64d526fe57e54b478a02be5b571847
[ "w = SldPanel(None)\nyield w\nw.close()\nw = None", "assert isinstance(widget, QtWidgets.QWidget)\nassert widget.ui.editMolecularFormula.styleSheet() == ''\nassert widget.model.columnCount() == 1\nassert widget.model.rowCount() == 11\nassert widget.sizePolicy().Policy() == QtWidgets.QSizePolicy.Fixed", "widget....
<|body_start_0|> w = SldPanel(None) yield w w.close() w = None <|end_body_0|> <|body_start_1|> assert isinstance(widget, QtWidgets.QWidget) assert widget.ui.editMolecularFormula.styleSheet() == '' assert widget.model.columnCount() == 1 assert widget.model...
Test the SLDCalculator
SLDCalculatorTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SLDCalculatorTest: """Test the SLDCalculator""" def widget(self, qapp): """Create/Destroy the SLDCalculator""" <|body_0|> def testDefaults(self, widget): """Test the GUI in its default state""" <|body_1|> def testSimpleEntry(self, widget): ""...
stack_v2_sparse_classes_10k_train_001668
4,853
permissive
[ { "docstring": "Create/Destroy the SLDCalculator", "name": "widget", "signature": "def widget(self, qapp)" }, { "docstring": "Test the GUI in its default state", "name": "testDefaults", "signature": "def testDefaults(self, widget)" }, { "docstring": "Default compound calculations...
5
stack_v2_sparse_classes_30k_train_002699
Implement the Python class `SLDCalculatorTest` described below. Class description: Test the SLDCalculator Method signatures and docstrings: - def widget(self, qapp): Create/Destroy the SLDCalculator - def testDefaults(self, widget): Test the GUI in its default state - def testSimpleEntry(self, widget): Default compou...
Implement the Python class `SLDCalculatorTest` described below. Class description: Test the SLDCalculator Method signatures and docstrings: - def widget(self, qapp): Create/Destroy the SLDCalculator - def testDefaults(self, widget): Test the GUI in its default state - def testSimpleEntry(self, widget): Default compou...
55b1e9f6db58e33729f2a93b7dd1d8bf255b46f7
<|skeleton|> class SLDCalculatorTest: """Test the SLDCalculator""" def widget(self, qapp): """Create/Destroy the SLDCalculator""" <|body_0|> def testDefaults(self, widget): """Test the GUI in its default state""" <|body_1|> def testSimpleEntry(self, widget): ""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SLDCalculatorTest: """Test the SLDCalculator""" def widget(self, qapp): """Create/Destroy the SLDCalculator""" w = SldPanel(None) yield w w.close() w = None def testDefaults(self, widget): """Test the GUI in its default state""" assert isinstan...
the_stack_v2_python_sparse
src/sas/qtgui/Calculators/UnitTesting/SLDCalculatorTest.py
SasView/sasview
train
48
308a833a127afb963eaabb3a02a92313c3e05106
[ "docs = []\nfor i in range(len(inputs)):\n docs.append({'input': inputs[i], 'ground_truth': ground_truth_field[i], 'ground_truth_slots': ground_truth_slots[i], 'ground_truth_labels': ground_truth_labels[i], 'generated': generated_field[i], 'generated_slots': generated_slots[i], 'generated_labels': generated_labe...
<|body_start_0|> docs = [] for i in range(len(inputs)): docs.append({'input': inputs[i], 'ground_truth': ground_truth_field[i], 'ground_truth_slots': ground_truth_slots[i], 'ground_truth_labels': ground_truth_labels[i], 'generated': generated_field[i], 'generated_slots': generated_slots[i], ...
DialogueClassificationMetrics
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DialogueClassificationMetrics: def save_predictions(filename, generated_labels, generated_slots, ground_truth_labels, ground_truth_slots, generated_field, ground_truth_field, inputs): """Save predictions as a jsonl file Args: Each arg is a list of strings (all args have the same length)"...
stack_v2_sparse_classes_10k_train_001669
7,110
permissive
[ { "docstring": "Save predictions as a jsonl file Args: Each arg is a list of strings (all args have the same length)", "name": "save_predictions", "signature": "def save_predictions(filename, generated_labels, generated_slots, ground_truth_labels, ground_truth_slots, generated_field, ground_truth_field,...
3
null
Implement the Python class `DialogueClassificationMetrics` described below. Class description: Implement the DialogueClassificationMetrics class. Method signatures and docstrings: - def save_predictions(filename, generated_labels, generated_slots, ground_truth_labels, ground_truth_slots, generated_field, ground_truth...
Implement the Python class `DialogueClassificationMetrics` described below. Class description: Implement the DialogueClassificationMetrics class. Method signatures and docstrings: - def save_predictions(filename, generated_labels, generated_slots, ground_truth_labels, ground_truth_slots, generated_field, ground_truth...
c20a16ea8aa2a9d8e31a98eb22178ddb9d5935e7
<|skeleton|> class DialogueClassificationMetrics: def save_predictions(filename, generated_labels, generated_slots, ground_truth_labels, ground_truth_slots, generated_field, ground_truth_field, inputs): """Save predictions as a jsonl file Args: Each arg is a list of strings (all args have the same length)"...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DialogueClassificationMetrics: def save_predictions(filename, generated_labels, generated_slots, ground_truth_labels, ground_truth_slots, generated_field, ground_truth_field, inputs): """Save predictions as a jsonl file Args: Each arg is a list of strings (all args have the same length)""" doc...
the_stack_v2_python_sparse
nemo/collections/nlp/metrics/dialogue_metrics.py
NVIDIA/NeMo
train
7,957
86f97b8c054208f2634d85aefbfb0843e3b78bc1
[ "from evdev import InputDevice\nself.dev = InputDevice(device_descriptor)\nthreading.Thread.__init__(self)\nself.stopped = threading.Event()\nself.hass = hass\nself.key_value = key_value", "from evdev import categorize, ecodes\n_LOGGER.debug('KeyboardRemote interface started for %s', self.dev)\nself.dev.grab()\nw...
<|body_start_0|> from evdev import InputDevice self.dev = InputDevice(device_descriptor) threading.Thread.__init__(self) self.stopped = threading.Event() self.hass = hass self.key_value = key_value <|end_body_0|> <|body_start_1|> from evdev import categorize, eco...
This interfaces with the inputdevice using evdev.
KeyboardRemote
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeyboardRemote: """This interfaces with the inputdevice using evdev.""" def __init__(self, hass, device_descriptor, key_value): """Construct a KeyboardRemote interface object.""" <|body_0|> def run(self): """Main loop of the KeyboardRemote.""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_001670
3,867
permissive
[ { "docstring": "Construct a KeyboardRemote interface object.", "name": "__init__", "signature": "def __init__(self, hass, device_descriptor, key_value)" }, { "docstring": "Main loop of the KeyboardRemote.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_005623
Implement the Python class `KeyboardRemote` described below. Class description: This interfaces with the inputdevice using evdev. Method signatures and docstrings: - def __init__(self, hass, device_descriptor, key_value): Construct a KeyboardRemote interface object. - def run(self): Main loop of the KeyboardRemote.
Implement the Python class `KeyboardRemote` described below. Class description: This interfaces with the inputdevice using evdev. Method signatures and docstrings: - def __init__(self, hass, device_descriptor, key_value): Construct a KeyboardRemote interface object. - def run(self): Main loop of the KeyboardRemote. ...
ca0e92aba83de2fd6cb1cc4d14f3b4471f17cf3d
<|skeleton|> class KeyboardRemote: """This interfaces with the inputdevice using evdev.""" def __init__(self, hass, device_descriptor, key_value): """Construct a KeyboardRemote interface object.""" <|body_0|> def run(self): """Main loop of the KeyboardRemote.""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KeyboardRemote: """This interfaces with the inputdevice using evdev.""" def __init__(self, hass, device_descriptor, key_value): """Construct a KeyboardRemote interface object.""" from evdev import InputDevice self.dev = InputDevice(device_descriptor) threading.Thread.__ini...
the_stack_v2_python_sparse
homeassistant/components/keyboard_remote.py
Smart-Torvy/torvy-home-assistant
train
2
17f28dec79bd7e85c81a30a9f3c740a50eb9355c
[ "if not email:\n raise ValueError('Users must have an email')\nif not username:\n raise ValueError('Users must have an username')\nuser = self.model(username=username, email=email, password=password, last_name=last_name, first_name=first_name)\nuser.is_active = True\nuser.set_password(password)\nuser.save(usi...
<|body_start_0|> if not email: raise ValueError('Users must have an email') if not username: raise ValueError('Users must have an username') user = self.model(username=username, email=email, password=password, last_name=last_name, first_name=first_name) user.is_ac...
AuthUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthUserManager: def create_user(self, username, email, password, last_name, first_name): """ユーザ作成 :param username: ユーザID :param email: メールアドレス :param password: パスワード :param last_name: 苗字 :param first_name: 名前 :return: AuthUserオブジェクト""" <|body_0|> def create_superuser(self, ...
stack_v2_sparse_classes_10k_train_001671
31,843
no_license
[ { "docstring": "ユーザ作成 :param username: ユーザID :param email: メールアドレス :param password: パスワード :param last_name: 苗字 :param first_name: 名前 :return: AuthUserオブジェクト", "name": "create_user", "signature": "def create_user(self, username, email, password, last_name, first_name)" }, { "docstring": "スーパーユーザ作...
2
stack_v2_sparse_classes_30k_train_005841
Implement the Python class `AuthUserManager` described below. Class description: Implement the AuthUserManager class. Method signatures and docstrings: - def create_user(self, username, email, password, last_name, first_name): ユーザ作成 :param username: ユーザID :param email: メールアドレス :param password: パスワード :param last_name:...
Implement the Python class `AuthUserManager` described below. Class description: Implement the AuthUserManager class. Method signatures and docstrings: - def create_user(self, username, email, password, last_name, first_name): ユーザ作成 :param username: ユーザID :param email: メールアドレス :param password: パスワード :param last_name:...
ee51f79e8d5c68b40c2fbd96272bbe2cc657a849
<|skeleton|> class AuthUserManager: def create_user(self, username, email, password, last_name, first_name): """ユーザ作成 :param username: ユーザID :param email: メールアドレス :param password: パスワード :param last_name: 苗字 :param first_name: 名前 :return: AuthUserオブジェクト""" <|body_0|> def create_superuser(self, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AuthUserManager: def create_user(self, username, email, password, last_name, first_name): """ユーザ作成 :param username: ユーザID :param email: メールアドレス :param password: パスワード :param last_name: 苗字 :param first_name: 名前 :return: AuthUserオブジェクト""" if not email: raise ValueError('Users must ha...
the_stack_v2_python_sparse
account/models.py
adusu-masaomi/adusu-python-account
train
0
cf46d268daf11fc3cb0caeba175306d955a6c142
[ "for i in range(len(lists) - 1, -1, -1):\n if lists[i] is None:\n lists.pop(i)\nif len(lists) == 0:\n return lists\nwhile len(lists) > 1:\n newlist = [self.merge2Lists(lists[2 * i], lists[2 * i + 1]) for i in range(len(lists) / 2)]\n if len(lists) % 2 != 0:\n newlist.append(lists[-1])\n ...
<|body_start_0|> for i in range(len(lists) - 1, -1, -1): if lists[i] is None: lists.pop(i) if len(lists) == 0: return lists while len(lists) > 1: newlist = [self.merge2Lists(lists[2 * i], lists[2 * i + 1]) for i in range(len(lists) / 2)] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def merge2Lists(self, listA, listB): """:type lists: List[ListNode] :rtype: ListNode : merge two sorted lists and return a sorted list Node""" <|body_1|> <|...
stack_v2_sparse_classes_10k_train_001672
1,575
no_license
[ { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" }, { "docstring": ":type lists: List[ListNode] :rtype: ListNode : merge two sorted lists and return a sorted list Node", "name": "merge2Lists", "signature": "...
2
stack_v2_sparse_classes_30k_train_004206
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def merge2Lists(self, listA, listB): :type lists: List[ListNode] :rtype: ListNode : merge two sorted ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def merge2Lists(self, listA, listB): :type lists: List[ListNode] :rtype: ListNode : merge two sorted ...
59de9ba6620c64efbd2cc0aab8c22a82b2c0df21
<|skeleton|> class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def merge2Lists(self, listA, listB): """:type lists: List[ListNode] :rtype: ListNode : merge two sorted lists and return a sorted list Node""" <|body_1|> <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" for i in range(len(lists) - 1, -1, -1): if lists[i] is None: lists.pop(i) if len(lists) == 0: return lists while len(lists) > 1: newlis...
the_stack_v2_python_sparse
leet23.py
shach934/leetcode
train
0
8ae14875ee78da7ac0995182b40d52fc42f28300
[ "nums.sort(reverse=True)\nself.list = nums[0:k]\nself.max = k", "l = len(self.list)\nif l == self.max and val <= self.list[l - 1]:\n return self.list[l - 1]\nbinsert = False\nfor i in range(l):\n if val > self.list[i]:\n self.list.insert(i, val)\n binsert = True\n l += 1\n break\...
<|body_start_0|> nums.sort(reverse=True) self.list = nums[0:k] self.max = k <|end_body_0|> <|body_start_1|> l = len(self.list) if l == self.max and val <= self.list[l - 1]: return self.list[l - 1] binsert = False for i in range(l): if val ...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums.sort(reverse=True) self.list = nums[0:k] ...
stack_v2_sparse_classes_10k_train_001673
952
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_005118
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
7eb88f29ee518b599d6237ab5af64df76568d48b
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" nums.sort(reverse=True) self.list = nums[0:k] self.max = k def add(self, val): """:type val: int :rtype: int""" l = len(self.list) if l == self.max and val <= self.lis...
the_stack_v2_python_sparse
703. Kth Largest Element in a Stream.py
zhishu520/leetcode
train
0
e007d6c77071f56197af91fcaebf6256d188ed94
[ "self.data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True)\nself.data_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True)\nself.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(self.data_train)", "STE = tfds.deprecated.text.SubwordTex...
<|body_start_0|> self.data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True) self.data_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True) self.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(self.data_train) <|end_bo...
loads and preps a dataset for machine translation
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """loads and preps a dataset for machine translation""" def __init__(self): """creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to en tf.data.Dataset train split, loaded as_supervided data_valid, which contains the ted_hrlr_translate/pt t...
stack_v2_sparse_classes_10k_train_001674
2,046
no_license
[ { "docstring": "creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to en tf.data.Dataset train split, loaded as_supervided data_valid, which contains the ted_hrlr_translate/pt to_en tf.data.Dataset validate split, loaded as_supervided tokenizer_pt is the Portuguese tokenizer c...
2
null
Implement the Python class `Dataset` described below. Class description: loads and preps a dataset for machine translation Method signatures and docstrings: - def __init__(self): creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to en tf.data.Dataset train split, loaded as_supervid...
Implement the Python class `Dataset` described below. Class description: loads and preps a dataset for machine translation Method signatures and docstrings: - def __init__(self): creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to en tf.data.Dataset train split, loaded as_supervid...
5114f884241b3406940b00450d8c71f55d5d6a70
<|skeleton|> class Dataset: """loads and preps a dataset for machine translation""" def __init__(self): """creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to en tf.data.Dataset train split, loaded as_supervided data_valid, which contains the ted_hrlr_translate/pt t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Dataset: """loads and preps a dataset for machine translation""" def __init__(self): """creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to en tf.data.Dataset train split, loaded as_supervided data_valid, which contains the ted_hrlr_translate/pt to_en tf.data....
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/0-dataset.py
icculp/holbertonschool-machine_learning
train
0
4a0521e733d7580ef3eba6519f3e26a369b68637
[ "super().__init__()\nself.in_channels = in_channels\nself.out_channels = out_channels\nself.spherical_cheb_bn_1 = SphericalChebBN(in_channels, middle_channels, lap, kernel_size)\nself.spherical_cheb_bn_2 = SphericalChebBN(middle_channels, out_channels, lap, kernel_size)", "x = self.spherical_cheb_bn_1(x)\nx = sel...
<|body_start_0|> super().__init__() self.in_channels = in_channels self.out_channels = out_channels self.spherical_cheb_bn_1 = SphericalChebBN(in_channels, middle_channels, lap, kernel_size) self.spherical_cheb_bn_2 = SphericalChebBN(middle_channels, out_channels, lap, kernel_siz...
Building Block made of 2 Building Blocks (convolution, batchnorm, activation).
SphericalChebBN2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SphericalChebBN2: """Building Block made of 2 Building Blocks (convolution, batchnorm, activation).""" def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size): """Initialization. Args: in_channels (int): initial number of channels. middle_channels (int): midd...
stack_v2_sparse_classes_10k_train_001675
41,403
no_license
[ { "docstring": "Initialization. Args: in_channels (int): initial number of channels. middle_channels (int): middle number of channels. out_channels (int): output number of channels. lap (:obj:`torch.sparse.FloatTensor`): laplacian. kernel_size (int, optional): polynomial degree.", "name": "__init__", "s...
2
null
Implement the Python class `SphericalChebBN2` described below. Class description: Building Block made of 2 Building Blocks (convolution, batchnorm, activation). Method signatures and docstrings: - def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size): Initialization. Args: in_channels (int)...
Implement the Python class `SphericalChebBN2` described below. Class description: Building Block made of 2 Building Blocks (convolution, batchnorm, activation). Method signatures and docstrings: - def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size): Initialization. Args: in_channels (int)...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class SphericalChebBN2: """Building Block made of 2 Building Blocks (convolution, batchnorm, activation).""" def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size): """Initialization. Args: in_channels (int): initial number of channels. middle_channels (int): midd...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SphericalChebBN2: """Building Block made of 2 Building Blocks (convolution, batchnorm, activation).""" def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size): """Initialization. Args: in_channels (int): initial number of channels. middle_channels (int): middle number of ...
the_stack_v2_python_sparse
generated/test_deepsphere_deepsphere_pytorch.py
jansel/pytorch-jit-paritybench
train
35
f8af5200aa9b837458704b819b4f6fbfd83441d0
[ "def bisearch(lst, x, key=None):\n compare = key or (lambda a, b: a < b)\n l, r = (0, len(lst))\n while l < r:\n i = (l + r) // 2\n if compare(lst[i], x):\n l = i + 1\n else:\n r = i\n return l\ns = bisearch(intervals, newInterval, key=lambda a, b: a[1] < b[0])...
<|body_start_0|> def bisearch(lst, x, key=None): compare = key or (lambda a, b: a < b) l, r = (0, len(lst)) while l < r: i = (l + r) // 2 if compare(lst[i], x): l = i + 1 else: r = i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def insert(self, intervals, newInterval): """Aug 10, 2018 21:41""" <|body_0|> def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: """Aug 20, 2020 23:45""" <|body_1|> def insert(self, intervals: List[List[int...
stack_v2_sparse_classes_10k_train_001676
4,481
no_license
[ { "docstring": "Aug 10, 2018 21:41", "name": "insert", "signature": "def insert(self, intervals, newInterval)" }, { "docstring": "Aug 20, 2020 23:45", "name": "insert", "signature": "def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]" }, { "do...
4
stack_v2_sparse_classes_30k_test_000032
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insert(self, intervals, newInterval): Aug 10, 2018 21:41 - def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: Aug 20, 2020 23:45 - def i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insert(self, intervals, newInterval): Aug 10, 2018 21:41 - def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: Aug 20, 2020 23:45 - def i...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def insert(self, intervals, newInterval): """Aug 10, 2018 21:41""" <|body_0|> def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: """Aug 20, 2020 23:45""" <|body_1|> def insert(self, intervals: List[List[int...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def insert(self, intervals, newInterval): """Aug 10, 2018 21:41""" def bisearch(lst, x, key=None): compare = key or (lambda a, b: a < b) l, r = (0, len(lst)) while l < r: i = (l + r) // 2 if compare(lst[i], x): ...
the_stack_v2_python_sparse
leetcode/solved/57_Insert_Interval/solution.py
sungminoh/algorithms
train
0
2d2338edd7a7fa8e2c78baf903a06864fb9ab742
[ "self.serie = Series(serie_path)\nself.serie.get_instances_ordered()\nself.serie_data = self.serie.get_series_details()\nself.instance_uid_serie = self.serie.get_all_SOPInstanceIUD()\nself.matrix_size = self.serie.get_size_matrix()\nself.instances = self.serie.get_instances_ordered()\nself.image_position = self.ins...
<|body_start_0|> self.serie = Series(serie_path) self.serie.get_instances_ordered() self.serie_data = self.serie.get_series_details() self.instance_uid_serie = self.serie.get_all_SOPInstanceIUD() self.matrix_size = self.serie.get_size_matrix() self.instances = self.serie....
a class to build an ndarray mask from a RTSS File
MaskBuilder_RTSS
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaskBuilder_RTSS: """a class to build an ndarray mask from a RTSS File""" def __init__(self, rtss_path: str, serie_path: str): """constructor Args: rtss_path (str): [file path of RTSTRUCT dicom file] serie_path (str): [directory path of associated serie]""" <|body_0|> de...
stack_v2_sparse_classes_10k_train_001677
5,496
permissive
[ { "docstring": "constructor Args: rtss_path (str): [file path of RTSTRUCT dicom file] serie_path (str): [directory path of associated serie]", "name": "__init__", "signature": "def __init__(self, rtss_path: str, serie_path: str)" }, { "docstring": "check if every SOPInstanceUID from RTSTRUCT cor...
6
stack_v2_sparse_classes_30k_train_007152
Implement the Python class `MaskBuilder_RTSS` described below. Class description: a class to build an ndarray mask from a RTSS File Method signatures and docstrings: - def __init__(self, rtss_path: str, serie_path: str): constructor Args: rtss_path (str): [file path of RTSTRUCT dicom file] serie_path (str): [director...
Implement the Python class `MaskBuilder_RTSS` described below. Class description: a class to build an ndarray mask from a RTSS File Method signatures and docstrings: - def __init__(self, rtss_path: str, serie_path: str): constructor Args: rtss_path (str): [file path of RTSTRUCT dicom file] serie_path (str): [director...
56619b47877ad912d7fe33616d6596ce542705bb
<|skeleton|> class MaskBuilder_RTSS: """a class to build an ndarray mask from a RTSS File""" def __init__(self, rtss_path: str, serie_path: str): """constructor Args: rtss_path (str): [file path of RTSTRUCT dicom file] serie_path (str): [directory path of associated serie]""" <|body_0|> de...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MaskBuilder_RTSS: """a class to build an ndarray mask from a RTSS File""" def __init__(self, rtss_path: str, serie_path: str): """constructor Args: rtss_path (str): [file path of RTSTRUCT dicom file] serie_path (str): [directory path of associated serie]""" self.serie = Series(serie_path)...
the_stack_v2_python_sparse
dicom_to_cnn/model/segmentation/MaskBuilder_RTSS.py
wendyrvllr/Dicom-To-CNN
train
0
50286fddcb1510f97603ded61af83027e649e057
[ "self._name = name or 'eurodollar_futures'\nif (rate_term is None) == (maturity_date is None):\n msg = 'Error creating the EurodollarFutures contract. Either rate_term or maturity_date is required.'\n raise ValueError(msg)\nif rate_term is not None and maturity_date is not None:\n msg = 'Error creating the...
<|body_start_0|> self._name = name or 'eurodollar_futures' if (rate_term is None) == (maturity_date is None): msg = 'Error creating the EurodollarFutures contract. Either rate_term or maturity_date is required.' raise ValueError(msg) if rate_term is not None and maturity_...
Represents a collection of Eurodollar futures contracts. Interest rate futures are exchange traded futures contracts on Libor rates liquidly traded on exchanges such as Chicago Mercantile Exchange (CME) or London International Financial Futures and Options Exchange (LIFFE). Contracts on CME on a US Dollar spot Libor ra...
EurodollarFutures
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EurodollarFutures: """Represents a collection of Eurodollar futures contracts. Interest rate futures are exchange traded futures contracts on Libor rates liquidly traded on exchanges such as Chicago Mercantile Exchange (CME) or London International Financial Futures and Options Exchange (LIFFE). ...
stack_v2_sparse_classes_10k_train_001678
7,341
permissive
[ { "docstring": "Initialize the Eurodollar futures object. Args: expiry_date: A Rank 1 `DateTensor` specifying the dates on which the futures contracts expire. contract_notional: An optional scalar or Rank 1 `Tensor` of real dtype specifying the unit (or size) for the contract. For example for eurodollar futures...
2
null
Implement the Python class `EurodollarFutures` described below. Class description: Represents a collection of Eurodollar futures contracts. Interest rate futures are exchange traded futures contracts on Libor rates liquidly traded on exchanges such as Chicago Mercantile Exchange (CME) or London International Financial...
Implement the Python class `EurodollarFutures` described below. Class description: Represents a collection of Eurodollar futures contracts. Interest rate futures are exchange traded futures contracts on Libor rates liquidly traded on exchanges such as Chicago Mercantile Exchange (CME) or London International Financial...
0d3a2193c0f2d320b65e602cf01d7a617da484df
<|skeleton|> class EurodollarFutures: """Represents a collection of Eurodollar futures contracts. Interest rate futures are exchange traded futures contracts on Libor rates liquidly traded on exchanges such as Chicago Mercantile Exchange (CME) or London International Financial Futures and Options Exchange (LIFFE). ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EurodollarFutures: """Represents a collection of Eurodollar futures contracts. Interest rate futures are exchange traded futures contracts on Libor rates liquidly traded on exchanges such as Chicago Mercantile Exchange (CME) or London International Financial Futures and Options Exchange (LIFFE). Contracts on ...
the_stack_v2_python_sparse
tf_quant_finance/experimental/instruments/eurodollar_futures.py
google/tf-quant-finance
train
4,165
48647e0b097b5b723e16913789939961587f3db7
[ "super().__init__(*args, category=CATEGORY_ALARM_SYSTEM)\nstate = self.hass.states.get(self.entity_id)\nself._alarm_code = self.config.get(ATTR_CODE)\nsupported_states = state.attributes.get(ATTR_SUPPORTED_FEATURES, SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_ARM_NIGHT | SUPPORT_ALARM_TRIGGER)\n...
<|body_start_0|> super().__init__(*args, category=CATEGORY_ALARM_SYSTEM) state = self.hass.states.get(self.entity_id) self._alarm_code = self.config.get(ATTR_CODE) supported_states = state.attributes.get(ATTR_SUPPORTED_FEATURES, SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_A...
Generate an SecuritySystem accessory for an alarm control panel.
SecuritySystem
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecuritySystem: """Generate an SecuritySystem accessory for an alarm control panel.""" def __init__(self, *args): """Initialize a SecuritySystem accessory object.""" <|body_0|> def set_security_state(self, value): """Move security state to value if call came from...
stack_v2_sparse_classes_10k_train_001679
6,081
permissive
[ { "docstring": "Initialize a SecuritySystem accessory object.", "name": "__init__", "signature": "def __init__(self, *args)" }, { "docstring": "Move security state to value if call came from HomeKit.", "name": "set_security_state", "signature": "def set_security_state(self, value)" }, ...
3
stack_v2_sparse_classes_30k_train_000955
Implement the Python class `SecuritySystem` described below. Class description: Generate an SecuritySystem accessory for an alarm control panel. Method signatures and docstrings: - def __init__(self, *args): Initialize a SecuritySystem accessory object. - def set_security_state(self, value): Move security state to va...
Implement the Python class `SecuritySystem` described below. Class description: Generate an SecuritySystem accessory for an alarm control panel. Method signatures and docstrings: - def __init__(self, *args): Initialize a SecuritySystem accessory object. - def set_security_state(self, value): Move security state to va...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class SecuritySystem: """Generate an SecuritySystem accessory for an alarm control panel.""" def __init__(self, *args): """Initialize a SecuritySystem accessory object.""" <|body_0|> def set_security_state(self, value): """Move security state to value if call came from...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SecuritySystem: """Generate an SecuritySystem accessory for an alarm control panel.""" def __init__(self, *args): """Initialize a SecuritySystem accessory object.""" super().__init__(*args, category=CATEGORY_ALARM_SYSTEM) state = self.hass.states.get(self.entity_id) self._...
the_stack_v2_python_sparse
homeassistant/components/homekit/type_security_systems.py
BenWoodford/home-assistant
train
11
fc6ce3b5da8592f44271f6622bb653bbe1aba0c9
[ "super(SphericalBasisLayer, self).__init__()\nassert num_radial <= 64\nself.num_spherical = num_spherical\nself.num_radial = num_radial\nself.cutoff = cutoff\nself.envelope = Envelope(envelope_exponent)\nbessel_forms = bessel_basis(num_spherical, num_radial)\nsph_harm_forms = real_sph_harm(num_spherical)\nself.sph_...
<|body_start_0|> super(SphericalBasisLayer, self).__init__() assert num_radial <= 64 self.num_spherical = num_spherical self.num_radial = num_radial self.cutoff = cutoff self.envelope = Envelope(envelope_exponent) bessel_forms = bessel_basis(num_spherical, num_rad...
Spherical Basis Layer.
SphericalBasisLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SphericalBasisLayer: """Spherical Basis Layer.""" def __init__(self, num_spherical, num_radial, cutoff=5.0, envelope_exponent=5) -> None: """Initialize spherical basis layer. Args: num_spherical: number of spherical harmonics. num_radial: number of radial functions. cutoff: cutoff ra...
stack_v2_sparse_classes_10k_train_001680
34,044
permissive
[ { "docstring": "Initialize spherical basis layer. Args: num_spherical: number of spherical harmonics. num_radial: number of radial functions. cutoff: cutoff radius. envelope_exponent: envelope exponent.", "name": "__init__", "signature": "def __init__(self, num_spherical, num_radial, cutoff=5.0, envelop...
2
stack_v2_sparse_classes_30k_train_001061
Implement the Python class `SphericalBasisLayer` described below. Class description: Spherical Basis Layer. Method signatures and docstrings: - def __init__(self, num_spherical, num_radial, cutoff=5.0, envelope_exponent=5) -> None: Initialize spherical basis layer. Args: num_spherical: number of spherical harmonics. ...
Implement the Python class `SphericalBasisLayer` described below. Class description: Spherical Basis Layer. Method signatures and docstrings: - def __init__(self, num_spherical, num_radial, cutoff=5.0, envelope_exponent=5) -> None: Initialize spherical basis layer. Args: num_spherical: number of spherical harmonics. ...
0b69b7d5b261f2f9af3984793c1295b9b80cd01a
<|skeleton|> class SphericalBasisLayer: """Spherical Basis Layer.""" def __init__(self, num_spherical, num_radial, cutoff=5.0, envelope_exponent=5) -> None: """Initialize spherical basis layer. Args: num_spherical: number of spherical harmonics. num_radial: number of radial functions. cutoff: cutoff ra...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SphericalBasisLayer: """Spherical Basis Layer.""" def __init__(self, num_spherical, num_radial, cutoff=5.0, envelope_exponent=5) -> None: """Initialize spherical basis layer. Args: num_spherical: number of spherical harmonics. num_radial: number of radial functions. cutoff: cutoff radius. envelop...
the_stack_v2_python_sparse
src/gt4sd/frameworks/gflownet/ml/models/mxmnet.py
GT4SD/gt4sd-core
train
239
58a62510157ae8189fac9f571aea0fc80a19d56a
[ "Leaf.__init__(self, scope=scope)\nself.unique_vals = unique_vals\nself.mean = mean\nself.inverted_mean = inverted_mean\nself.square_mean = square_mean\nself.inverted_square_mean = inverted_square_mean\nself.prob_sum = prob_sum\nself.null_value_prob = null_value_prob", "col = self.scope[0]\nnumber_null_values = r...
<|body_start_0|> Leaf.__init__(self, scope=scope) self.unique_vals = unique_vals self.mean = mean self.inverted_mean = inverted_mean self.square_mean = square_mean self.inverted_square_mean = inverted_square_mean self.prob_sum = prob_sum self.null_value_pr...
IdentityNumericLeaf
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdentityNumericLeaf: def __init__(self, unique_vals, mean, inverted_mean, square_mean, inverted_square_mean, prob_sum, null_value_prob, scope=None): """Instead of histogram remember individual values. :param unique_vals: all possible values in leaf :param mean: mean of not null values :p...
stack_v2_sparse_classes_10k_train_001681
15,472
permissive
[ { "docstring": "Instead of histogram remember individual values. :param unique_vals: all possible values in leaf :param mean: mean of not null values :param inverted_mean: inverted mean of not null values :param square_mean: mean of squared not null values :param inverted_square_mean: mean of 1/squared not null...
2
stack_v2_sparse_classes_30k_train_002107
Implement the Python class `IdentityNumericLeaf` described below. Class description: Implement the IdentityNumericLeaf class. Method signatures and docstrings: - def __init__(self, unique_vals, mean, inverted_mean, square_mean, inverted_square_mean, prob_sum, null_value_prob, scope=None): Instead of histogram remembe...
Implement the Python class `IdentityNumericLeaf` described below. Class description: Implement the IdentityNumericLeaf class. Method signatures and docstrings: - def __init__(self, unique_vals, mean, inverted_mean, square_mean, inverted_square_mean, prob_sum, null_value_prob, scope=None): Instead of histogram remembe...
a8989bfadcf551ee1dee2aec57ef6b2709c9f85d
<|skeleton|> class IdentityNumericLeaf: def __init__(self, unique_vals, mean, inverted_mean, square_mean, inverted_square_mean, prob_sum, null_value_prob, scope=None): """Instead of histogram remember individual values. :param unique_vals: all possible values in leaf :param mean: mean of not null values :p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IdentityNumericLeaf: def __init__(self, unique_vals, mean, inverted_mean, square_mean, inverted_square_mean, prob_sum, null_value_prob, scope=None): """Instead of histogram remember individual values. :param unique_vals: all possible values in leaf :param mean: mean of not null values :param inverted_...
the_stack_v2_python_sparse
CardinalityEstimationTestbed/Synthetic/deepdb/deepdb_job_ranges/aqp_spn/aqp_leaves.py
TsinghuaDatabaseGroup/AI4DBCode
train
53
4dac33b2d008d235362c4a7055977c2ecf27fc2f
[ "study_id = root._get_study_id(info)\ninvited_by = Membership.objects.get(collaborator=root.node.id, study=study_id).invited_by\nreturn invited_by", "study_id = root._get_study_id(info)\njoined_on = Membership.objects.get(collaborator=root.node.id, study=study_id).joined_on\nreturn joined_on", "study_id = root....
<|body_start_0|> study_id = root._get_study_id(info) invited_by = Membership.objects.get(collaborator=root.node.id, study=study_id).invited_by return invited_by <|end_body_0|> <|body_start_1|> study_id = root._get_study_id(info) joined_on = Membership.objects.get(collaborator=ro...
Extends relay edges on study-collaborator relationships to include information from the 'Membership' through-table.
Edge
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Edge: """Extends relay edges on study-collaborator relationships to include information from the 'Membership' through-table.""" def resolve_invited_by(root, info, **kwargs): """Returns the user that invited this collaborator to the study.""" <|body_0|> def resolve_joined...
stack_v2_sparse_classes_10k_train_001682
5,435
permissive
[ { "docstring": "Returns the user that invited this collaborator to the study.", "name": "resolve_invited_by", "signature": "def resolve_invited_by(root, info, **kwargs)" }, { "docstring": "Returns the date the collaborator joined the study.", "name": "resolve_joined_on", "signature": "de...
4
stack_v2_sparse_classes_30k_train_000249
Implement the Python class `Edge` described below. Class description: Extends relay edges on study-collaborator relationships to include information from the 'Membership' through-table. Method signatures and docstrings: - def resolve_invited_by(root, info, **kwargs): Returns the user that invited this collaborator to...
Implement the Python class `Edge` described below. Class description: Extends relay edges on study-collaborator relationships to include information from the 'Membership' through-table. Method signatures and docstrings: - def resolve_invited_by(root, info, **kwargs): Returns the user that invited this collaborator to...
ba62b369e6464259ea92dbb9ba49876513f37fba
<|skeleton|> class Edge: """Extends relay edges on study-collaborator relationships to include information from the 'Membership' through-table.""" def resolve_invited_by(root, info, **kwargs): """Returns the user that invited this collaborator to the study.""" <|body_0|> def resolve_joined...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Edge: """Extends relay edges on study-collaborator relationships to include information from the 'Membership' through-table.""" def resolve_invited_by(root, info, **kwargs): """Returns the user that invited this collaborator to the study.""" study_id = root._get_study_id(info) inv...
the_stack_v2_python_sparse
creator/users/schema.py
kids-first/kf-api-study-creator
train
3
74df4ebd080ed135ec49785ba8ed8164e310451c
[ "dicom_file = DICOMImporter.open_dicom_file('test_dicom/test_dicom.dcm')\ndicom_pixel_arr = DICOMImporter.get_dicom_pixel_array(dicom_file)\nself.assertTrue(dicom_file, not None)\nself.assertFalse(dicom_pixel_arr.all(), None)", "dicom_file = DICOMImporter.open_dicom_file('test_dicom/test_dicom.dcm')\ndicom_pixel_...
<|body_start_0|> dicom_file = DICOMImporter.open_dicom_file('test_dicom/test_dicom.dcm') dicom_pixel_arr = DICOMImporter.get_dicom_pixel_array(dicom_file) self.assertTrue(dicom_file, not None) self.assertFalse(dicom_pixel_arr.all(), None) <|end_body_0|> <|body_start_1|> dicom_fi...
DataProcessingTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataProcessingTests: def test_dicom_importer(self): """Handles testing the dicom importer to ensure it's able to import the test file Preconditions: No test file has been loaded Postconditions: Test file has successfully been loaded""" <|body_0|> def test_contrast_adjust(sel...
stack_v2_sparse_classes_10k_train_001683
3,283
no_license
[ { "docstring": "Handles testing the dicom importer to ensure it's able to import the test file Preconditions: No test file has been loaded Postconditions: Test file has successfully been loaded", "name": "test_dicom_importer", "signature": "def test_dicom_importer(self)" }, { "docstring": "Handl...
4
stack_v2_sparse_classes_30k_train_006136
Implement the Python class `DataProcessingTests` described below. Class description: Implement the DataProcessingTests class. Method signatures and docstrings: - def test_dicom_importer(self): Handles testing the dicom importer to ensure it's able to import the test file Preconditions: No test file has been loaded Po...
Implement the Python class `DataProcessingTests` described below. Class description: Implement the DataProcessingTests class. Method signatures and docstrings: - def test_dicom_importer(self): Handles testing the dicom importer to ensure it's able to import the test file Preconditions: No test file has been loaded Po...
d665ca405bdf35fdb57f8149a10b90be82d8de22
<|skeleton|> class DataProcessingTests: def test_dicom_importer(self): """Handles testing the dicom importer to ensure it's able to import the test file Preconditions: No test file has been loaded Postconditions: Test file has successfully been loaded""" <|body_0|> def test_contrast_adjust(sel...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataProcessingTests: def test_dicom_importer(self): """Handles testing the dicom importer to ensure it's able to import the test file Preconditions: No test file has been loaded Postconditions: Test file has successfully been loaded""" dicom_file = DICOMImporter.open_dicom_file('test_dicom/tes...
the_stack_v2_python_sparse
BSSCSFramework/data_proc_tests.py
wezleysherman/TBI-NN-421
train
3
84b12c12cb1755b776b78536491abf9cd8c76c3c
[ "self.ami_creation_frequency = ami_creation_frequency\nself.create_ami_for_run = create_ami_for_run\nself.should_create_ami = should_create_ami\nself.volume_exclusion_params = volume_exclusion_params", "if dictionary is None:\n return None\nami_creation_frequency = dictionary.get('amiCreationFrequency')\ncreat...
<|body_start_0|> self.ami_creation_frequency = ami_creation_frequency self.create_ami_for_run = create_ami_for_run self.should_create_ami = should_create_ami self.volume_exclusion_params = volume_exclusion_params <|end_body_0|> <|body_start_1|> if dictionary is None: ...
Implementation of the 'AWSSnapshotManagerParams' model. TODO: type description here. Attributes: ami_creation_frequency (int): The frequency of AMI creation. This should be set if the option to create AMI is set. A value of n creates an AMI from the snapshots after every n runs. eg. n = 2 implies every alternate backup...
AWSSnapshotManagerParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AWSSnapshotManagerParams: """Implementation of the 'AWSSnapshotManagerParams' model. TODO: type description here. Attributes: ami_creation_frequency (int): The frequency of AMI creation. This should be set if the option to create AMI is set. A value of n creates an AMI from the snapshots after ev...
stack_v2_sparse_classes_10k_train_001684
3,025
permissive
[ { "docstring": "Constructor for the AWSSnapshotManagerParams class", "name": "__init__", "signature": "def __init__(self, ami_creation_frequency=None, create_ami_for_run=None, should_create_ami=None, volume_exclusion_params=None)" }, { "docstring": "Creates an instance of this model from a dicti...
2
null
Implement the Python class `AWSSnapshotManagerParams` described below. Class description: Implementation of the 'AWSSnapshotManagerParams' model. TODO: type description here. Attributes: ami_creation_frequency (int): The frequency of AMI creation. This should be set if the option to create AMI is set. A value of n cre...
Implement the Python class `AWSSnapshotManagerParams` described below. Class description: Implementation of the 'AWSSnapshotManagerParams' model. TODO: type description here. Attributes: ami_creation_frequency (int): The frequency of AMI creation. This should be set if the option to create AMI is set. A value of n cre...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AWSSnapshotManagerParams: """Implementation of the 'AWSSnapshotManagerParams' model. TODO: type description here. Attributes: ami_creation_frequency (int): The frequency of AMI creation. This should be set if the option to create AMI is set. A value of n creates an AMI from the snapshots after ev...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AWSSnapshotManagerParams: """Implementation of the 'AWSSnapshotManagerParams' model. TODO: type description here. Attributes: ami_creation_frequency (int): The frequency of AMI creation. This should be set if the option to create AMI is set. A value of n creates an AMI from the snapshots after every n runs. e...
the_stack_v2_python_sparse
cohesity_management_sdk/models/aws_snapshot_manager_params.py
cohesity/management-sdk-python
train
24
873a7db149246442ecbd1c41bbbc808d9401e44e
[ "if not root:\n return 0\nself.maxSum = root.val\nself._localMax(root)\nreturn self.maxSum", "if not root:\n return 0\nleftMax = self._localMax(root.left)\nrightMax = self._localMax(root.right)\nlocalMax = max(root.val, root.val + leftMax, root.val + rightMax)\nself.maxSum = max(localMax, root.val + leftMax...
<|body_start_0|> if not root: return 0 self.maxSum = root.val self._localMax(root) return self.maxSum <|end_body_0|> <|body_start_1|> if not root: return 0 leftMax = self._localMax(root.left) rightMax = self._localMax(root.right) l...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxPathSum(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def _localMax(self, root): """get the local max of node root""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return 0 self.maxSu...
stack_v2_sparse_classes_10k_train_001685
1,635
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "maxPathSum", "signature": "def maxPathSum(self, root)" }, { "docstring": "get the local max of node root", "name": "_localMax", "signature": "def _localMax(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxPathSum(self, root): :type root: TreeNode :rtype: int - def _localMax(self, root): get the local max of node root
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxPathSum(self, root): :type root: TreeNode :rtype: int - def _localMax(self, root): get the local max of node root <|skeleton|> class Solution: def maxPathSum(self, r...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def maxPathSum(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def _localMax(self, root): """get the local max of node root""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxPathSum(self, root): """:type root: TreeNode :rtype: int""" if not root: return 0 self.maxSum = root.val self._localMax(root) return self.maxSum def _localMax(self, root): """get the local max of node root""" if not root...
the_stack_v2_python_sparse
code124BinaryTreeMaximumPathSum.py
cybelewang/leetcode-python
train
0
320edffd4bd7252c7f2eec5876bee71f6db11886
[ "results = []\ndoc = photoshop.app.activeDocument\nfor task in tasks:\n item = task['item']\n output = task['output']\n errors = []\n progress_cb(0, 'Validating', task)\n if output['name'] == 'tif_output':\n pass\n elif output['name'] == 'export_groups':\n group_errors = self.__valid...
<|body_start_0|> results = [] doc = photoshop.app.activeDocument for task in tasks: item = task['item'] output = task['output'] errors = [] progress_cb(0, 'Validating', task) if output['name'] == 'tif_output': pass ...
Single hook that implements pre-publish functionality
PrePublishHook
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrePublishHook: """Single hook that implements pre-publish functionality""" def execute(self, tasks, work_template, progress_cb, **kwargs): """Main hook entry point :param tasks: List of tasks to be pre-published. Each task is be a dictionary containing the following keys: { item: Di...
stack_v2_sparse_classes_10k_train_001686
5,312
no_license
[ { "docstring": "Main hook entry point :param tasks: List of tasks to be pre-published. Each task is be a dictionary containing the following keys: { item: Dictionary This is the item returned by the scan hook { name: String description: String type: String other_params: Dictionary } output: Dictionary This is t...
2
stack_v2_sparse_classes_30k_train_004146
Implement the Python class `PrePublishHook` described below. Class description: Single hook that implements pre-publish functionality Method signatures and docstrings: - def execute(self, tasks, work_template, progress_cb, **kwargs): Main hook entry point :param tasks: List of tasks to be pre-published. Each task is ...
Implement the Python class `PrePublishHook` described below. Class description: Single hook that implements pre-publish functionality Method signatures and docstrings: - def execute(self, tasks, work_template, progress_cb, **kwargs): Main hook entry point :param tasks: List of tasks to be pre-published. Each task is ...
7a6d3bad242afba2e3670281a539985f8c673f46
<|skeleton|> class PrePublishHook: """Single hook that implements pre-publish functionality""" def execute(self, tasks, work_template, progress_cb, **kwargs): """Main hook entry point :param tasks: List of tasks to be pre-published. Each task is be a dictionary containing the following keys: { item: Di...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrePublishHook: """Single hook that implements pre-publish functionality""" def execute(self, tasks, work_template, progress_cb, **kwargs): """Main hook entry point :param tasks: List of tasks to be pre-published. Each task is be a dictionary containing the following keys: { item: Dictionary This...
the_stack_v2_python_sparse
hooks/secondary_pre_publish_photoshopOutputs.py
AardmanCGI/aardtemplate
train
3
a184c10bc5a33f14401a45ca96bc88c0ee033b86
[ "try:\n resp = Node().get_data_by_node_id(node_id)\n return masked_json_template(resp, 200)\nexcept:\n abort(400, 'Input unrecognizable.')", "try:\n resp = Node().delete_data_by_node_id(node_id)\n return masked_json_template(resp, 200)\nexcept:\n abort(400, 'Input unrecognizable.')" ]
<|body_start_0|> try: resp = Node().get_data_by_node_id(node_id) return masked_json_template(resp, 200) except: abort(400, 'Input unrecognizable.') <|end_body_0|> <|body_start_1|> try: resp = Node().delete_data_by_node_id(node_id) retu...
NodeFindRoute
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeFindRoute: def get(self, node_id): """Get Node data by Node ID""" <|body_0|> def delete(self, node_id): """Delete Node data by Node ID""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: resp = Node().get_data_by_node_id(node_id) ...
stack_v2_sparse_classes_10k_train_001687
4,218
permissive
[ { "docstring": "Get Node data by Node ID", "name": "get", "signature": "def get(self, node_id)" }, { "docstring": "Delete Node data by Node ID", "name": "delete", "signature": "def delete(self, node_id)" } ]
2
stack_v2_sparse_classes_30k_train_002384
Implement the Python class `NodeFindRoute` described below. Class description: Implement the NodeFindRoute class. Method signatures and docstrings: - def get(self, node_id): Get Node data by Node ID - def delete(self, node_id): Delete Node data by Node ID
Implement the Python class `NodeFindRoute` described below. Class description: Implement the NodeFindRoute class. Method signatures and docstrings: - def get(self, node_id): Get Node data by Node ID - def delete(self, node_id): Delete Node data by Node ID <|skeleton|> class NodeFindRoute: def get(self, node_id)...
100fca0d2dd9b0b2ab2fa5974d8126af35ddcfd1
<|skeleton|> class NodeFindRoute: def get(self, node_id): """Get Node data by Node ID""" <|body_0|> def delete(self, node_id): """Delete Node data by Node ID""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NodeFindRoute: def get(self, node_id): """Get Node data by Node ID""" try: resp = Node().get_data_by_node_id(node_id) return masked_json_template(resp, 200) except: abort(400, 'Input unrecognizable.') def delete(self, node_id): """Delete...
the_stack_v2_python_sparse
app/controllers/api/node/node.py
ardihikaru/api-dashboard-5g-dive
train
0
13066b6179d3ad277d4f3bbcdc494fd56ff5debe
[ "endpoint = self.base_url + '/authorize'\nbody = {'user_auth': {'client_id': base.getid(consumer), 'scopes': scopes}}\nresponse, body = self.client.post(endpoint, body=body, redirect=redirect)\nredirect_uri = response.headers.get('Location')\nparsed = urlparse.urlparse(redirect_uri)\nquery = dict(urlparse.parse_qsl...
<|body_start_0|> endpoint = self.base_url + '/authorize' body = {'user_auth': {'client_id': base.getid(consumer), 'scopes': scopes}} response, body = self.client.post(endpoint, body=body, redirect=redirect) redirect_uri = response.headers.get('Location') parsed = urlparse.urlpars...
Manager class for manipulating identity OAuth authorization codes.
AuthorizationCodeManager
[ "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthorizationCodeManager: """Manager class for manipulating identity OAuth authorization codes.""" def authorize(self, consumer, scopes, redirect=False): """Authorize a Consumer for certain scopes, getting an authorization code. The way the provider (Keystone) will return the code is...
stack_v2_sparse_classes_10k_train_001688
4,893
permissive
[ { "docstring": "Authorize a Consumer for certain scopes, getting an authorization code. The way the provider (Keystone) will return the code is in the header, as an HTTP redirection: 'Location': 'https://foo.com/welcome_back?code=somerandomstring&state=xyz' Utilize Identity API operation: POST /OS-OAUTH2/author...
2
stack_v2_sparse_classes_30k_train_001331
Implement the Python class `AuthorizationCodeManager` described below. Class description: Manager class for manipulating identity OAuth authorization codes. Method signatures and docstrings: - def authorize(self, consumer, scopes, redirect=False): Authorize a Consumer for certain scopes, getting an authorization code...
Implement the Python class `AuthorizationCodeManager` described below. Class description: Manager class for manipulating identity OAuth authorization codes. Method signatures and docstrings: - def authorize(self, consumer, scopes, redirect=False): Authorize a Consumer for certain scopes, getting an authorization code...
e1c18ffc181de3a28dccae3bd4f3a08a3ed3d090
<|skeleton|> class AuthorizationCodeManager: """Manager class for manipulating identity OAuth authorization codes.""" def authorize(self, consumer, scopes, redirect=False): """Authorize a Consumer for certain scopes, getting an authorization code. The way the provider (Keystone) will return the code is...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AuthorizationCodeManager: """Manager class for manipulating identity OAuth authorization codes.""" def authorize(self, consumer, scopes, redirect=False): """Authorize a Consumer for certain scopes, getting an authorization code. The way the provider (Keystone) will return the code is in the heade...
the_stack_v2_python_sparse
keystoneclient/v3/contrib/oauth2/authorization_codes.py
hmunfru/python-keystoneclient
train
0
abf0dbb97e52fe803cc6fa486118c4b4bbc653d4
[ "self._scope = ('%s/' % name if name else '') + 'HashTableIndexer'\nwith tf.name_scope(self._scope):\n self._key_to_index = tf.lookup.experimental.DenseHashTable(key_dtype=key_dtype, value_dtype=tf.int32, default_value=-1, empty_key=empty_key, deleted_key=deleted_key)\n self._max_index = max_index", "with t...
<|body_start_0|> self._scope = ('%s/' % name if name else '') + 'HashTableIndexer' with tf.name_scope(self._scope): self._key_to_index = tf.lookup.experimental.DenseHashTable(key_dtype=key_dtype, value_dtype=tf.int32, default_value=-1, empty_key=empty_key, deleted_key=deleted_key) ...
Using a hash table, maps sparse keys to dense integer indices. The main method is get_or_create_index(self, key), which allocates (or fetches if exists) an integer index, in [0, max_index), to each `key`. The indices are created sequentially: The first key would receive the index 0, the second 1, etc.
HashTableIndexer
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HashTableIndexer: """Using a hash table, maps sparse keys to dense integer indices. The main method is get_or_create_index(self, key), which allocates (or fetches if exists) an integer index, in [0, max_index), to each `key`. The indices are created sequentially: The first key would receive the i...
stack_v2_sparse_classes_10k_train_001689
8,366
permissive
[ { "docstring": "Creates an instance. Args: max_index: An integer, all keys will be mapped to indices will be in the interval [0, max_index). Trying to insert more keys will raise an exception. key_dtype: Type of the key. empty_key: A key that denotes \"no key\". deleted_key: A key that denotes a deleted key. na...
2
stack_v2_sparse_classes_30k_train_001378
Implement the Python class `HashTableIndexer` described below. Class description: Using a hash table, maps sparse keys to dense integer indices. The main method is get_or_create_index(self, key), which allocates (or fetches if exists) an integer index, in [0, max_index), to each `key`. The indices are created sequenti...
Implement the Python class `HashTableIndexer` described below. Class description: Using a hash table, maps sparse keys to dense integer indices. The main method is get_or_create_index(self, key), which allocates (or fetches if exists) an integer index, in [0, max_index), to each `key`. The indices are created sequenti...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class HashTableIndexer: """Using a hash table, maps sparse keys to dense integer indices. The main method is get_or_create_index(self, key), which allocates (or fetches if exists) an integer index, in [0, max_index), to each `key`. The indices are created sequentially: The first key would receive the i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HashTableIndexer: """Using a hash table, maps sparse keys to dense integer indices. The main method is get_or_create_index(self, key), which allocates (or fetches if exists) an integer index, in [0, max_index), to each `key`. The indices are created sequentially: The first key would receive the index 0, the s...
the_stack_v2_python_sparse
depth_and_motion_learning/intrinsics_utils.py
Jimmy-INL/google-research
train
1
00caa4a1925c26b087b2375c382d02818aa00af0
[ "obsolete_content = []\nobsolete_translation_suggestion_error_report: List[Dict[str, Union[str, List[Dict[str, str]]]]] = []\ntranslatable_content_ids = exploration.get_translatable_content_ids()\nfor suggestion in suggestions:\n suggestion_change = suggestion.change_cmd\n if not suggestion_change['content_id...
<|body_start_0|> obsolete_content = [] obsolete_translation_suggestion_error_report: List[Dict[str, Union[str, List[Dict[str, str]]]]] = [] translatable_content_ids = exploration.get_translatable_content_ids() for suggestion in suggestions: suggestion_change = suggestion.chan...
Audits translation suggestions for missing content IDs.
AuditTranslationSuggestionsWithMissingContentIdJob
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuditTranslationSuggestionsWithMissingContentIdJob: """Audits translation suggestions for missing content IDs.""" def _report_suggestions_with_missing_content_ids(suggestions: List[suggestion_models.GeneralSuggestionModel], exploration: exp_domain.Exploration) -> List[Dict[str, Union[str, Li...
stack_v2_sparse_classes_10k_train_001690
11,707
permissive
[ { "docstring": "Audits translation suggestion models for missing content IDs. Reports the following for each exploration: - exploration ID - list of missing content IDs and corresponding state names. Args: suggestions: list(GeneralSuggestionModel). A list of translation suggestion models corresponding to the gi...
2
stack_v2_sparse_classes_30k_train_003080
Implement the Python class `AuditTranslationSuggestionsWithMissingContentIdJob` described below. Class description: Audits translation suggestions for missing content IDs. Method signatures and docstrings: - def _report_suggestions_with_missing_content_ids(suggestions: List[suggestion_models.GeneralSuggestionModel], ...
Implement the Python class `AuditTranslationSuggestionsWithMissingContentIdJob` described below. Class description: Audits translation suggestions for missing content IDs. Method signatures and docstrings: - def _report_suggestions_with_missing_content_ids(suggestions: List[suggestion_models.GeneralSuggestionModel], ...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class AuditTranslationSuggestionsWithMissingContentIdJob: """Audits translation suggestions for missing content IDs.""" def _report_suggestions_with_missing_content_ids(suggestions: List[suggestion_models.GeneralSuggestionModel], exploration: exp_domain.Exploration) -> List[Dict[str, Union[str, Li...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AuditTranslationSuggestionsWithMissingContentIdJob: """Audits translation suggestions for missing content IDs.""" def _report_suggestions_with_missing_content_ids(suggestions: List[suggestion_models.GeneralSuggestionModel], exploration: exp_domain.Exploration) -> List[Dict[str, Union[str, List[Dict[str, ...
the_stack_v2_python_sparse
core/jobs/batch_jobs/rejecting_suggestion_for_invalid_content_ids_jobs.py
oppia/oppia
train
6,172
e569d7770f6d5efbb5c419fc5b8a3dc056908dac
[ "super(Pix2PixModel, self).__init__(opt)\nself.netG = define_G(input_nc=opt.A_nc, output_nc=self.opt.B_nc, ngf=self.opt.ngf, device=self.opt.device, num_downs=opt.n_downG, norm_type=self.opt.norm_type, use_dropout=not self.opt.no_dropout, init_gain=self.opt.init_gain, affine=not self.opt.no_affine)\nif not self.opt...
<|body_start_0|> super(Pix2PixModel, self).__init__(opt) self.netG = define_G(input_nc=opt.A_nc, output_nc=self.opt.B_nc, ngf=self.opt.ngf, device=self.opt.device, num_downs=opt.n_downG, norm_type=self.opt.norm_type, use_dropout=not self.opt.no_dropout, init_gain=self.opt.init_gain, affine=not self.opt....
Pix2PixModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pix2PixModel: def __init__(self, opt): """モデル,ロス,オプティマイザーに関する初期化 Args: opt (Namespace): オプション""" <|body_0|> def __call__(self, data_dict): """forward してloss を計算. Parameters ---------- data_dict : dict of nn.Tensor 学習データ.キーは "A"(入力), "B"(出力). Returns ------- losses : ...
stack_v2_sparse_classes_10k_train_001691
4,641
no_license
[ { "docstring": "モデル,ロス,オプティマイザーに関する初期化 Args: opt (Namespace): オプション", "name": "__init__", "signature": "def __init__(self, opt)" }, { "docstring": "forward してloss を計算. Parameters ---------- data_dict : dict of nn.Tensor 学習データ.キーは \"A\"(入力), \"B\"(出力). Returns ------- losses : 各loss の Loss. Each ...
2
stack_v2_sparse_classes_30k_train_004226
Implement the Python class `Pix2PixModel` described below. Class description: Implement the Pix2PixModel class. Method signatures and docstrings: - def __init__(self, opt): モデル,ロス,オプティマイザーに関する初期化 Args: opt (Namespace): オプション - def __call__(self, data_dict): forward してloss を計算. Parameters ---------- data_dict : dict o...
Implement the Python class `Pix2PixModel` described below. Class description: Implement the Pix2PixModel class. Method signatures and docstrings: - def __init__(self, opt): モデル,ロス,オプティマイザーに関する初期化 Args: opt (Namespace): オプション - def __call__(self, data_dict): forward してloss を計算. Parameters ---------- data_dict : dict o...
3e4cfd28bb9ef0fd3bb9ed64c435d183236a0b72
<|skeleton|> class Pix2PixModel: def __init__(self, opt): """モデル,ロス,オプティマイザーに関する初期化 Args: opt (Namespace): オプション""" <|body_0|> def __call__(self, data_dict): """forward してloss を計算. Parameters ---------- data_dict : dict of nn.Tensor 学習データ.キーは "A"(入力), "B"(出力). Returns ------- losses : ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Pix2PixModel: def __init__(self, opt): """モデル,ロス,オプティマイザーに関する初期化 Args: opt (Namespace): オプション""" super(Pix2PixModel, self).__init__(opt) self.netG = define_G(input_nc=opt.A_nc, output_nc=self.opt.B_nc, ngf=self.opt.ngf, device=self.opt.device, num_downs=opt.n_downG, norm_type=self.opt....
the_stack_v2_python_sparse
models/pix2pix_model.py
haru-256/pix2pix.pytorch
train
1
4733cceed5f5e562b2c330358c115c8da883b44e
[ "similarities = sequences.new_zeros((cluster_centers_count, cluster_centers_count), dtype=torch.float)\noccurred_seqs = sequence_occurrences > 0\nif not occurred_seqs.any():\n return similarities\nsequences = sequences[occurred_seqs]\nsequence_occurrences = sequence_occurrences[occurred_seqs]\nsimilarities_flat ...
<|body_start_0|> similarities = sequences.new_zeros((cluster_centers_count, cluster_centers_count), dtype=torch.float) occurred_seqs = sequence_occurrences > 0 if not occurred_seqs.any(): return similarities sequences = sequences[occurred_seqs] sequence_occurrences = ...
ClusterUtils
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterUtils: def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor: """Compute cluster centers similarities. Args: cluster_centers_count: number of cluster centers sequences: tensor[sequences_count, sequence_len...
stack_v2_sparse_classes_10k_train_001692
38,858
permissive
[ { "docstring": "Compute cluster centers similarities. Args: cluster_centers_count: number of cluster centers sequences: tensor[sequences_count, sequence_length] = cluster_center_id sequence_occurrences: tensor[sequences_count] = number_of_occurrences Returns: tensor[cluster_centers_count, cluster_centers_count]...
2
stack_v2_sparse_classes_30k_train_007201
Implement the Python class `ClusterUtils` described below. Class description: Implement the ClusterUtils class. Method signatures and docstrings: - def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor: Compute cluster centers similarities. A...
Implement the Python class `ClusterUtils` described below. Class description: Implement the ClusterUtils class. Method signatures and docstrings: - def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor: Compute cluster centers similarities. A...
81d72b82ec96948c26d292d709f18c9c77a17ba4
<|skeleton|> class ClusterUtils: def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor: """Compute cluster centers similarities. Args: cluster_centers_count: number of cluster centers sequences: tensor[sequences_count, sequence_len...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ClusterUtils: def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor: """Compute cluster centers similarities. Args: cluster_centers_count: number of cluster centers sequences: tensor[sequences_count, sequence_length] = cluster...
the_stack_v2_python_sparse
torchsim/gui/observers/cluster_observer.py
andreofner/torchsim
train
0
de3dcbe1344a2854353b66b096dfa04183d250c4
[ "self.safe_update(**kwargs)\nif butler is not None:\n self.log.warn('Ignoring butler')\nfor key, val in data.items():\n data[key] = val.replace('biasoscorr_sum.fits', 'biasoscorr_stats.fits')\nif not self.config.skip:\n outtable = vstack_tables(data, tablename='biasoscorr_stats')\ndtables = TableDict()\ndt...
<|body_start_0|> self.safe_update(**kwargs) if butler is not None: self.log.warn('Ignoring butler') for key, val in data.items(): data[key] = val.replace('biasoscorr_sum.fits', 'biasoscorr_stats.fits') if not self.config.skip: outtable = vstack_tables(...
Summarize the results for the analysis correlation between imaging and overscan regions
CorrelWRTOscanSummaryTask
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CorrelWRTOscanSummaryTask: """Summarize the results for the analysis correlation between imaging and overscan regions""" def extract(self, butler, data, **kwargs): """Make a summry table Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other struct...
stack_v2_sparse_classes_10k_train_001693
13,638
permissive
[ { "docstring": "Make a summry table Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) contain the input data kwargs Used to override default configuration Returns ------- dtables : `TableDict` The resulting data", "name": "extract", "signature": "def e...
2
stack_v2_sparse_classes_30k_train_000929
Implement the Python class `CorrelWRTOscanSummaryTask` described below. Class description: Summarize the results for the analysis correlation between imaging and overscan regions Method signatures and docstrings: - def extract(self, butler, data, **kwargs): Make a summry table Parameters ---------- butler : `Butler` ...
Implement the Python class `CorrelWRTOscanSummaryTask` described below. Class description: Summarize the results for the analysis correlation between imaging and overscan regions Method signatures and docstrings: - def extract(self, butler, data, **kwargs): Make a summry table Parameters ---------- butler : `Butler` ...
28418284fdaf2b2fb0afbeccd4324f7ad3e676c8
<|skeleton|> class CorrelWRTOscanSummaryTask: """Summarize the results for the analysis correlation between imaging and overscan regions""" def extract(self, butler, data, **kwargs): """Make a summry table Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other struct...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CorrelWRTOscanSummaryTask: """Summarize the results for the analysis correlation between imaging and overscan regions""" def extract(self, butler, data, **kwargs): """Make a summry table Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) contain ...
the_stack_v2_python_sparse
python/lsst/eo_utils/bias/correl_wrt_oscan.py
lsst-camera-dh/EO-utilities
train
2
0ff9f8dfcf09bba3409b5ba26f36bddc5e147438
[ "logging.warn('%s is still experimental', self.__class__.__name__)\nsitecol = readinput.get_site_collection(self.oqparam)\nself.datastore['sitecol'] = self.sitecol = sitecol\nself.csm = get_composite_source_model(self.oqparam)\nself.gsims_by_grp = {grp.id: self.csm.info.get_gsims(grp.id) for sm in self.csm.source_m...
<|body_start_0|> logging.warn('%s is still experimental', self.__class__.__name__) sitecol = readinput.get_site_collection(self.oqparam) self.datastore['sitecol'] = self.sitecol = sitecol self.csm = get_composite_source_model(self.oqparam) self.gsims_by_grp = {grp.id: self.csm.in...
UCERF classical calculator.
UcerfPSHACalculator
[ "AGPL-3.0-only", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UcerfPSHACalculator: """UCERF classical calculator.""" def pre_execute(self): """parse the logic tree and source model input""" <|body_0|> def execute(self): """Run in parallel `core_task(sources, sitecol, monitor)`, by parallelizing on the sources according to t...
stack_v2_sparse_classes_10k_train_001694
8,230
permissive
[ { "docstring": "parse the logic tree and source model input", "name": "pre_execute", "signature": "def pre_execute(self)" }, { "docstring": "Run in parallel `core_task(sources, sitecol, monitor)`, by parallelizing on the sources according to their weight and tectonic region type.", "name": "...
2
stack_v2_sparse_classes_30k_train_001147
Implement the Python class `UcerfPSHACalculator` described below. Class description: UCERF classical calculator. Method signatures and docstrings: - def pre_execute(self): parse the logic tree and source model input - def execute(self): Run in parallel `core_task(sources, sitecol, monitor)`, by parallelizing on the s...
Implement the Python class `UcerfPSHACalculator` described below. Class description: UCERF classical calculator. Method signatures and docstrings: - def pre_execute(self): parse the logic tree and source model input - def execute(self): Run in parallel `core_task(sources, sitecol, monitor)`, by parallelizing on the s...
0da9ba5a575360081715e8b90c71d4b16c6687c8
<|skeleton|> class UcerfPSHACalculator: """UCERF classical calculator.""" def pre_execute(self): """parse the logic tree and source model input""" <|body_0|> def execute(self): """Run in parallel `core_task(sources, sitecol, monitor)`, by parallelizing on the sources according to t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UcerfPSHACalculator: """UCERF classical calculator.""" def pre_execute(self): """parse the logic tree and source model input""" logging.warn('%s is still experimental', self.__class__.__name__) sitecol = readinput.get_site_collection(self.oqparam) self.datastore['sitecol']...
the_stack_v2_python_sparse
openquake/calculators/ucerf_classical.py
GFZ-Centre-for-Early-Warning/shakyground
train
1
bf4ca549cec0eefcc8df7d96e98d7a0933000892
[ "super(SenderAddressAPITestCase, cls).setUpTestData()\ncls.localconfig.parameters.set_value('enable_admin_limits', False, app='limits')\ncls.localconfig.save()\nfactories.populate_database()\ncls.sa1 = factories.SenderAddressFactory(address='test@domain.ext', mailbox__user__username='user@test.com', mailbox__addres...
<|body_start_0|> super(SenderAddressAPITestCase, cls).setUpTestData() cls.localconfig.parameters.set_value('enable_admin_limits', False, app='limits') cls.localconfig.save() factories.populate_database() cls.sa1 = factories.SenderAddressFactory(address='test@domain.ext', mailbox_...
Check SenderAddress API.
SenderAddressAPITestCase
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SenderAddressAPITestCase: """Check SenderAddress API.""" def setUpTestData(cls): """Create test data.""" <|body_0|> def test_list(self): """Retrieve a list of sender addresses.""" <|body_1|> def test_create(self): """Create a new sender addre...
stack_v2_sparse_classes_10k_train_001695
33,144
permissive
[ { "docstring": "Create test data.", "name": "setUpTestData", "signature": "def setUpTestData(cls)" }, { "docstring": "Retrieve a list of sender addresses.", "name": "test_list", "signature": "def test_list(self)" }, { "docstring": "Create a new sender addresses.", "name": "te...
6
stack_v2_sparse_classes_30k_train_001394
Implement the Python class `SenderAddressAPITestCase` described below. Class description: Check SenderAddress API. Method signatures and docstrings: - def setUpTestData(cls): Create test data. - def test_list(self): Retrieve a list of sender addresses. - def test_create(self): Create a new sender addresses. - def tes...
Implement the Python class `SenderAddressAPITestCase` described below. Class description: Check SenderAddress API. Method signatures and docstrings: - def setUpTestData(cls): Create test data. - def test_list(self): Retrieve a list of sender addresses. - def test_create(self): Create a new sender addresses. - def tes...
df699aab0799ec1725b6b89be38e56285821c889
<|skeleton|> class SenderAddressAPITestCase: """Check SenderAddress API.""" def setUpTestData(cls): """Create test data.""" <|body_0|> def test_list(self): """Retrieve a list of sender addresses.""" <|body_1|> def test_create(self): """Create a new sender addre...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SenderAddressAPITestCase: """Check SenderAddress API.""" def setUpTestData(cls): """Create test data.""" super(SenderAddressAPITestCase, cls).setUpTestData() cls.localconfig.parameters.set_value('enable_admin_limits', False, app='limits') cls.localconfig.save() fac...
the_stack_v2_python_sparse
modoboa/admin/api/v1/tests.py
modoboa/modoboa
train
2,201
6a809bd3315be49bdedc90ede2e165d0b3d87ed8
[ "Action.__init__(self, p_game_state)\nassert isinstance(p_player_id, int)\nassert PLAYER_PER_TEAM >= p_player_id >= 0\nassert isinstance(p_force, (int, float))\nassert KICK_MAX_SPD >= p_force >= 0\nself.player_id = p_player_id\nself.force = p_force\nself.target = target\nself.speed_pose = Pose()", "target = self....
<|body_start_0|> Action.__init__(self, p_game_state) assert isinstance(p_player_id, int) assert PLAYER_PER_TEAM >= p_player_id >= 0 assert isinstance(p_force, (int, float)) assert KICK_MAX_SPD >= p_force >= 0 self.player_id = p_player_id self.force = p_force ...
Action Kick: Actionne le kick du robot Méthodes : exec(self): Retourne la position actuelle et une force de kick Attributs (en plus de ceux de Action): player_id : L'identifiant du joueur qui doit frapper la balle
Kick
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Kick: """Action Kick: Actionne le kick du robot Méthodes : exec(self): Retourne la position actuelle et une force de kick Attributs (en plus de ceux de Action): player_id : L'identifiant du joueur qui doit frapper la balle""" def __init__(self, p_game_state, p_player_id, p_force, target=Pose...
stack_v2_sparse_classes_10k_train_001696
2,199
permissive
[ { "docstring": ":param p_game_state: L'état courant du jeu. :param p_player_id: Identifiant du joueur qui frappe la balle :param p_force: force du kicker (float entre 0 et 1)", "name": "__init__", "signature": "def __init__(self, p_game_state, p_player_id, p_force, target=Pose())" }, { "docstrin...
2
stack_v2_sparse_classes_30k_train_004163
Implement the Python class `Kick` described below. Class description: Action Kick: Actionne le kick du robot Méthodes : exec(self): Retourne la position actuelle et une force de kick Attributs (en plus de ceux de Action): player_id : L'identifiant du joueur qui doit frapper la balle Method signatures and docstrings: ...
Implement the Python class `Kick` described below. Class description: Action Kick: Actionne le kick du robot Méthodes : exec(self): Retourne la position actuelle et une force de kick Attributs (en plus de ceux de Action): player_id : L'identifiant du joueur qui doit frapper la balle Method signatures and docstrings: ...
7e20de8b2213d9b9b46be16d6b4800d767da1b00
<|skeleton|> class Kick: """Action Kick: Actionne le kick du robot Méthodes : exec(self): Retourne la position actuelle et une force de kick Attributs (en plus de ceux de Action): player_id : L'identifiant du joueur qui doit frapper la balle""" def __init__(self, p_game_state, p_player_id, p_force, target=Pose...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Kick: """Action Kick: Actionne le kick du robot Méthodes : exec(self): Retourne la position actuelle et une force de kick Attributs (en plus de ceux de Action): player_id : L'identifiant du joueur qui doit frapper la balle""" def __init__(self, p_game_state, p_player_id, p_force, target=Pose()): ...
the_stack_v2_python_sparse
ai/STA/Action/Kick.py
etibuteau/StrategyIA
train
0
9596e639c0134c1d7b9729800a712ba6c60ac25c
[ "n = len(w)\nself.sums = [0] * n\nself.sums[0] = w[0]\nfor i in range(1, n):\n self.sums[i] = self.sums[i - 1] + w[i]", "p = random.randint(1, self.sums[-1])\nl, r = (0, len(self.sums) - 1)\nwhile l < r:\n mid = l + r >> 1\n if self.sums[mid] >= p:\n r = mid\n else:\n l = mid + 1\nreturn...
<|body_start_0|> n = len(w) self.sums = [0] * n self.sums[0] = w[0] for i in range(1, n): self.sums[i] = self.sums[i - 1] + w[i] <|end_body_0|> <|body_start_1|> p = random.randint(1, self.sums[-1]) l, r = (0, len(self.sums) - 1) while l < r: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(w) self.sums = [0] * n self.sums[0] = w[0] for i in range(1, n):...
stack_v2_sparse_classes_10k_train_001697
1,013
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
stack_v2_sparse_classes_30k_train_003645
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
692bf0e5aab402d55463274e99ab4d0ed56ce64c
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" n = len(w) self.sums = [0] * n self.sums[0] = w[0] for i in range(1, n): self.sums[i] = self.sums[i - 1] + w[i] def pickIndex(self): """:rtype: int""" p = random.randint(1, self.s...
the_stack_v2_python_sparse
528-random_pick_with_weight.py
WweiL/LeetCode
train
0
9fb86ebe3ca0bc2e40dc831f0a0507f6da6702e6
[ "B, nfeatures, nsample = idx.size()\n_, C, N = features.size()\nctx.for_backwards = (idx, N)\nreturn _ext.group_points(features, idx)", "idx, N = ctx.for_backwards\ngrad_features = _ext.group_points_grad(grad_out.contiguous(), idx, N)\nreturn (grad_features, None)" ]
<|body_start_0|> B, nfeatures, nsample = idx.size() _, C, N = features.size() ctx.for_backwards = (idx, N) return _ext.group_points(features, idx) <|end_body_0|> <|body_start_1|> idx, N = ctx.for_backwards grad_features = _ext.group_points_grad(grad_out.contiguous(), idx...
GroupingOperation
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupingOperation: def forward(ctx, features, idx): """Parameters ---------- features : torch.Tensor (B, C, N) tensor of features to group idx : torch.Tensor (B, npoint, nsample) tensor containing the indicies of features to group with Returns ------- torch.Tensor (B, C, npoint, nsample)...
stack_v2_sparse_classes_10k_train_001698
15,763
permissive
[ { "docstring": "Parameters ---------- features : torch.Tensor (B, C, N) tensor of features to group idx : torch.Tensor (B, npoint, nsample) tensor containing the indicies of features to group with Returns ------- torch.Tensor (B, C, npoint, nsample) tensor", "name": "forward", "signature": "def forward(...
2
stack_v2_sparse_classes_30k_train_001091
Implement the Python class `GroupingOperation` described below. Class description: Implement the GroupingOperation class. Method signatures and docstrings: - def forward(ctx, features, idx): Parameters ---------- features : torch.Tensor (B, C, N) tensor of features to group idx : torch.Tensor (B, npoint, nsample) ten...
Implement the Python class `GroupingOperation` described below. Class description: Implement the GroupingOperation class. Method signatures and docstrings: - def forward(ctx, features, idx): Parameters ---------- features : torch.Tensor (B, C, N) tensor of features to group idx : torch.Tensor (B, npoint, nsample) ten...
c0eecf2223c3c28d048d816fd239c118b8568dcf
<|skeleton|> class GroupingOperation: def forward(ctx, features, idx): """Parameters ---------- features : torch.Tensor (B, C, N) tensor of features to group idx : torch.Tensor (B, npoint, nsample) tensor containing the indicies of features to group with Returns ------- torch.Tensor (B, C, npoint, nsample)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GroupingOperation: def forward(ctx, features, idx): """Parameters ---------- features : torch.Tensor (B, C, N) tensor of features to group idx : torch.Tensor (B, npoint, nsample) tensor containing the indicies of features to group with Returns ------- torch.Tensor (B, C, npoint, nsample) tensor""" ...
the_stack_v2_python_sparse
pointcloud/pointnet2/utils/pointnet2_utils.py
WangLi2019Gt/qpu_code
train
0
4115cc4b29eae6f262d230434e474bdce80a47d2
[ "result = Fragment()\nchild_frags = self.runtime.render_children(self, context=context)\nresult.add_resources(child_frags)\nresult.add_content('<div class=\"unit-xblock vertical\">')\nfor frag in child_frags:\n result.add_content(frag.content)\nresult.add_content('</div>')\nreturn result", "xblock_body = super...
<|body_start_0|> result = Fragment() child_frags = self.runtime.render_children(self, context=context) result.add_resources(child_frags) result.add_content('<div class="unit-xblock vertical">') for frag in child_frags: result.add_content(frag.content) result.a...
Unit XBlock: An XBlock which groups related XBlocks together. This is like the "vertical" block in principle, but this version is explicitly designed to not contain LMS-related logic, like vertical does. The application which renders XBlocks and/or the runtime should manage things like bookmarks, completion tracking, e...
UnitBlock
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnitBlock: """Unit XBlock: An XBlock which groups related XBlocks together. This is like the "vertical" block in principle, but this version is explicitly designed to not contain LMS-related logic, like vertical does. The application which renders XBlocks and/or the runtime should manage things l...
stack_v2_sparse_classes_10k_train_001699
2,633
permissive
[ { "docstring": "Provide default student view.", "name": "student_view", "signature": "def student_view(self, context=None)" }, { "docstring": "Return dictionary prepared with module content and type for indexing, so that the contents of this block can be found in free-text searches.", "name"...
2
null
Implement the Python class `UnitBlock` described below. Class description: Unit XBlock: An XBlock which groups related XBlocks together. This is like the "vertical" block in principle, but this version is explicitly designed to not contain LMS-related logic, like vertical does. The application which renders XBlocks an...
Implement the Python class `UnitBlock` described below. Class description: Unit XBlock: An XBlock which groups related XBlocks together. This is like the "vertical" block in principle, but this version is explicitly designed to not contain LMS-related logic, like vertical does. The application which renders XBlocks an...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class UnitBlock: """Unit XBlock: An XBlock which groups related XBlocks together. This is like the "vertical" block in principle, but this version is explicitly designed to not contain LMS-related logic, like vertical does. The application which renders XBlocks and/or the runtime should manage things l...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UnitBlock: """Unit XBlock: An XBlock which groups related XBlocks together. This is like the "vertical" block in principle, but this version is explicitly designed to not contain LMS-related logic, like vertical does. The application which renders XBlocks and/or the runtime should manage things like bookmarks...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/lib/xmodule/xmodule/unit_block.py
luque/better-ways-of-thinking-about-software
train
3