blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
22b92e34cb8bf252142bc752fa9155bd5338d960
[ "enctypeValues = ['multipart/form-data', 'application/x-www-form-urlencoded']\nif enctype not in enctypeValues:\n raise ArgumentError('Class Form. method not in %s' % enctypeValues)\nmethodValues = ['post', 'get']\nif method not in methodValues:\n raise ArgumentError('Class Form. method not in %s' % methodVal...
<|body_start_0|> enctypeValues = ['multipart/form-data', 'application/x-www-form-urlencoded'] if enctype not in enctypeValues: raise ArgumentError('Class Form. method not in %s' % enctypeValues) methodValues = ['post', 'get'] if method not in methodValues: raise A...
Model for a *form tag* `<form></form>` in HTML language
Form
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Form: """Model for a *form tag* `<form></form>` in HTML language""" def __init__(self, content, action, enctype='multipart/form-data', method='post', _id='', classtype=''): """Form class initializer. :parameters: - `content`: Content of the form. Usually with text and input elements ...
stack_v2_sparse_classes_75kplus_train_004400
10,222
no_license
[ { "docstring": "Form class initializer. :parameters: - `content`: Content of the form. Usually with text and input elements inside. *(string).* - `action`: Indicates the URL which processes the form data. *(string).* - `enctype`: Type of codification: \"multipart/form-data\" or \"application/x-www-form-urlencod...
2
stack_v2_sparse_classes_30k_train_022543
Implement the Python class `Form` described below. Class description: Model for a *form tag* `<form></form>` in HTML language Method signatures and docstrings: - def __init__(self, content, action, enctype='multipart/form-data', method='post', _id='', classtype=''): Form class initializer. :parameters: - `content`: C...
Implement the Python class `Form` described below. Class description: Model for a *form tag* `<form></form>` in HTML language Method signatures and docstrings: - def __init__(self, content, action, enctype='multipart/form-data', method='post', _id='', classtype=''): Form class initializer. :parameters: - `content`: C...
5e86cfca61df47a59afdda4722953b8acf019290
<|skeleton|> class Form: """Model for a *form tag* `<form></form>` in HTML language""" def __init__(self, content, action, enctype='multipart/form-data', method='post', _id='', classtype=''): """Form class initializer. :parameters: - `content`: Content of the form. Usually with text and input elements ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Form: """Model for a *form tag* `<form></form>` in HTML language""" def __init__(self, content, action, enctype='multipart/form-data', method='post', _id='', classtype=''): """Form class initializer. :parameters: - `content`: Content of the form. Usually with text and input elements inside. *(str...
the_stack_v2_python_sparse
cgi-bin/module_Web.py
jose-pulido/WPBSS
train
0
94613be4e16a63d810e2e3eba72cca1fb763254f
[ "try:\n import unstructured\nexcept ImportError:\n raise ValueError('unstructured package not found, please install it with `pip install unstructured`')\nself.urls = urls", "from unstructured.partition.html import partition_html\ndocs: List[Document] = list()\nfor url in self.urls:\n elements = partition...
<|body_start_0|> try: import unstructured except ImportError: raise ValueError('unstructured package not found, please install it with `pip install unstructured`') self.urls = urls <|end_body_0|> <|body_start_1|> from unstructured.partition.html import partition_...
Loader that uses unstructured to load HTML files.
UnstructuredURLLoader
[ "LicenseRef-scancode-generic-cla", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnstructuredURLLoader: """Loader that uses unstructured to load HTML files.""" def __init__(self, urls: List[str]): """Initialize with file path.""" <|body_0|> def load(self) -> List[Document]: """Load file.""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_75kplus_train_004401
1,059
permissive
[ { "docstring": "Initialize with file path.", "name": "__init__", "signature": "def __init__(self, urls: List[str])" }, { "docstring": "Load file.", "name": "load", "signature": "def load(self) -> List[Document]" } ]
2
null
Implement the Python class `UnstructuredURLLoader` described below. Class description: Loader that uses unstructured to load HTML files. Method signatures and docstrings: - def __init__(self, urls: List[str]): Initialize with file path. - def load(self) -> List[Document]: Load file.
Implement the Python class `UnstructuredURLLoader` described below. Class description: Loader that uses unstructured to load HTML files. Method signatures and docstrings: - def __init__(self, urls: List[str]): Initialize with file path. - def load(self) -> List[Document]: Load file. <|skeleton|> class UnstructuredUR...
b8f29af7f3c24cf3a4554bebfa2053064467fbdb
<|skeleton|> class UnstructuredURLLoader: """Loader that uses unstructured to load HTML files.""" def __init__(self, urls: List[str]): """Initialize with file path.""" <|body_0|> def load(self) -> List[Document]: """Load file.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnstructuredURLLoader: """Loader that uses unstructured to load HTML files.""" def __init__(self, urls: List[str]): """Initialize with file path.""" try: import unstructured except ImportError: raise ValueError('unstructured package not found, please instal...
the_stack_v2_python_sparse
langchain/document_loaders/url.py
microsoft/MM-REACT
train
705
e092232d2590065e5006df17a75f70e39d5a04ad
[ "s = self[sector]\ns.terrain = terrain\ns.OnStateChange()\nself.OnSignal(TerrainChangeSignal(self.mediums, sector, terrain))", "name, value = resource\ns = self[sector]\nif not value:\n if name in s.resources:\n del s.resources[name]\n else:\n return\nelse:\n s.resources[name] = value" ]
<|body_start_0|> s = self[sector] s.terrain = terrain s.OnStateChange() self.OnSignal(TerrainChangeSignal(self.mediums, sector, terrain)) <|end_body_0|> <|body_start_1|> name, value = resource s = self[sector] if not value: if name in s.resources: ...
A space describing a world made up of sectors that include terrain.
TerrainSpace
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TerrainSpace: """A space describing a world made up of sectors that include terrain.""" def SetTerrain(self, sector, terrain): """Set the terrain for the given sector.""" <|body_0|> def SetResource(self, sector, resource): """Set the specified resource for this s...
stack_v2_sparse_classes_75kplus_train_004402
4,551
no_license
[ { "docstring": "Set the terrain for the given sector.", "name": "SetTerrain", "signature": "def SetTerrain(self, sector, terrain)" }, { "docstring": "Set the specified resource for this sector. The resource argument is a (name, value) pair describing the resource.", "name": "SetResource", ...
2
stack_v2_sparse_classes_30k_train_050492
Implement the Python class `TerrainSpace` described below. Class description: A space describing a world made up of sectors that include terrain. Method signatures and docstrings: - def SetTerrain(self, sector, terrain): Set the terrain for the given sector. - def SetResource(self, sector, resource): Set the specifie...
Implement the Python class `TerrainSpace` described below. Class description: A space describing a world made up of sectors that include terrain. Method signatures and docstrings: - def SetTerrain(self, sector, terrain): Set the terrain for the given sector. - def SetResource(self, sector, resource): Set the specifie...
1e68c771cf041a6951d1c853dd20f99a4b5e7eb5
<|skeleton|> class TerrainSpace: """A space describing a world made up of sectors that include terrain.""" def SetTerrain(self, sector, terrain): """Set the terrain for the given sector.""" <|body_0|> def SetResource(self, sector, resource): """Set the specified resource for this s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TerrainSpace: """A space describing a world made up of sectors that include terrain.""" def SetTerrain(self, sector, terrain): """Set the terrain for the given sector.""" s = self[sector] s.terrain = terrain s.OnStateChange() self.OnSignal(TerrainChangeSignal(self....
the_stack_v2_python_sparse
simulation/space.py
gregr/uriel
train
0
09ff974d03ba24a1dcb439dca17d475edb2ab07b
[ "entity_normalizer_kwargs = _resolve_kwargs(kwargs=entity_normalizer_kwargs, default_kwargs=self.default_entity_normalizer_kwargs)\nentity_initializer_kwargs = self._update_embedding_init_with_default(entity_initializer_kwargs, embedding_dim=embedding_dim)\nrelation_initializer_kwargs = self._update_embedding_init_...
<|body_start_0|> entity_normalizer_kwargs = _resolve_kwargs(kwargs=entity_normalizer_kwargs, default_kwargs=self.default_entity_normalizer_kwargs) entity_initializer_kwargs = self._update_embedding_init_with_default(entity_initializer_kwargs, embedding_dim=embedding_dim) relation_initializer_kwa...
An implementation of PairRE from [chao2020]_. --- citation: author: Chao year: 2020 link: http://arxiv.org/abs/2011.03798 github: alipay/KnowledgeGraphEmbeddingsViaPairedRelationVectors_PairRE
PairRE
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PairRE: """An implementation of PairRE from [chao2020]_. --- citation: author: Chao year: 2020 link: http://arxiv.org/abs/2011.03798 github: alipay/KnowledgeGraphEmbeddingsViaPairedRelationVectors_PairRE""" def __init__(self, embedding_dim: int=200, p: int=1, power_norm: bool=False, entity_i...
stack_v2_sparse_classes_75kplus_train_004403
6,053
permissive
[ { "docstring": "Initialize PairRE via the :class:`pykeen.nn.modules.PairREInteraction` interaction. :param embedding_dim: The entity embedding dimension $d$. :param p: The $l_p$ norm. :param power_norm: Should the power norm be used? :param entity_initializer: Entity initializer function. Defaults to :func:`tor...
2
stack_v2_sparse_classes_30k_train_027066
Implement the Python class `PairRE` described below. Class description: An implementation of PairRE from [chao2020]_. --- citation: author: Chao year: 2020 link: http://arxiv.org/abs/2011.03798 github: alipay/KnowledgeGraphEmbeddingsViaPairedRelationVectors_PairRE Method signatures and docstrings: - def __init__(self...
Implement the Python class `PairRE` described below. Class description: An implementation of PairRE from [chao2020]_. --- citation: author: Chao year: 2020 link: http://arxiv.org/abs/2011.03798 github: alipay/KnowledgeGraphEmbeddingsViaPairedRelationVectors_PairRE Method signatures and docstrings: - def __init__(self...
5ff3597b18ab9a220e34361d3c3f262060811df1
<|skeleton|> class PairRE: """An implementation of PairRE from [chao2020]_. --- citation: author: Chao year: 2020 link: http://arxiv.org/abs/2011.03798 github: alipay/KnowledgeGraphEmbeddingsViaPairedRelationVectors_PairRE""" def __init__(self, embedding_dim: int=200, p: int=1, power_norm: bool=False, entity_i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PairRE: """An implementation of PairRE from [chao2020]_. --- citation: author: Chao year: 2020 link: http://arxiv.org/abs/2011.03798 github: alipay/KnowledgeGraphEmbeddingsViaPairedRelationVectors_PairRE""" def __init__(self, embedding_dim: int=200, p: int=1, power_norm: bool=False, entity_initializer: H...
the_stack_v2_python_sparse
src/pykeen/models/unimodal/pair_re.py
pykeen/pykeen
train
1,308
398253504327c08288967facfe3c44659d6f8290
[ "queue = []\nans = ''\nif not root:\n return ''\nqueue.append(root)\nans += str(root.val) + ','\nwhile queue:\n temp = ''\n n = len(queue)\n for i in range(n):\n cur = queue.pop()\n if cur.left:\n queue.insert(0, cur.left)\n temp += str(cur.left.val) + ','\n if...
<|body_start_0|> queue = [] ans = '' if not root: return '' queue.append(root) ans += str(root.val) + ',' while queue: temp = '' n = len(queue) for i in range(n): cur = queue.pop() if cur.left...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_004404
2,026
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_026989
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:...
75bee27348969605805b059c7a42a5c5fa14165c
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" queue = [] ans = '' if not root: return '' queue.append(root) ans += str(root.val) + ',' while queue: temp = '' ...
the_stack_v2_python_sparse
SerializeDeserializeBinaryTree.py
ilovequant/Practise
train
0
86951d6db83ab5f1900c3e52c12cae259b1c6310
[ "super(CriticMlp, self).__init__()\nself.fc1 = nn.Linear(state_dim, 400)\nself.ln1 = nn.LayerNorm(400)\nself.fc2 = nn.Linear(400 + action_dim, 300)\nself.ln2 = nn.LayerNorm(300)\nself.fc3 = nn.Linear(300, 1)\nfan_in, _ = nn.init._calculate_fan_in_and_fan_out(self.fc1.weight)\nnn.init.uniform_(self.fc1.weight, -1 / ...
<|body_start_0|> super(CriticMlp, self).__init__() self.fc1 = nn.Linear(state_dim, 400) self.ln1 = nn.LayerNorm(400) self.fc2 = nn.Linear(400 + action_dim, 300) self.ln2 = nn.LayerNorm(300) self.fc3 = nn.Linear(300, 1) fan_in, _ = nn.init._calculate_fan_in_and_fan...
Represents a Critic in the Actor to Critic Model.
CriticMlp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CriticMlp: """Represents a Critic in the Actor to Critic Model.""" def __init__(self, state_dim, action_dim): """Initialise layers. Args: state_dim (int) : Number of state inputs action_dim (int) : Number of action ouputs""" <|body_0|> def forward(self, state_batch, acti...
stack_v2_sparse_classes_75kplus_train_004405
13,450
no_license
[ { "docstring": "Initialise layers. Args: state_dim (int) : Number of state inputs action_dim (int) : Number of action ouputs", "name": "__init__", "signature": "def __init__(self, state_dim, action_dim)" }, { "docstring": "Generate Q-values for the batch of states and actions pairs. Args: state_...
2
stack_v2_sparse_classes_30k_train_054323
Implement the Python class `CriticMlp` described below. Class description: Represents a Critic in the Actor to Critic Model. Method signatures and docstrings: - def __init__(self, state_dim, action_dim): Initialise layers. Args: state_dim (int) : Number of state inputs action_dim (int) : Number of action ouputs - def...
Implement the Python class `CriticMlp` described below. Class description: Represents a Critic in the Actor to Critic Model. Method signatures and docstrings: - def __init__(self, state_dim, action_dim): Initialise layers. Args: state_dim (int) : Number of state inputs action_dim (int) : Number of action ouputs - def...
6dcb04e79f776fc780b843208e2c689578c94bb3
<|skeleton|> class CriticMlp: """Represents a Critic in the Actor to Critic Model.""" def __init__(self, state_dim, action_dim): """Initialise layers. Args: state_dim (int) : Number of state inputs action_dim (int) : Number of action ouputs""" <|body_0|> def forward(self, state_batch, acti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CriticMlp: """Represents a Critic in the Actor to Critic Model.""" def __init__(self, state_dim, action_dim): """Initialise layers. Args: state_dim (int) : Number of state inputs action_dim (int) : Number of action ouputs""" super(CriticMlp, self).__init__() self.fc1 = nn.Linear(s...
the_stack_v2_python_sparse
retina_reinforcement_sim/src/model/models.py
lewisboyd/MsciProject
train
0
47f5d1cb9357edc3b7fc15a405224fd3656c8f65
[ "with pytest.raises(rname.InvalidResourceName) as e:\n rname.ResourceName.from_string('RJ45::1')\nassert 'unknown interface type' in e.exconly()\nwith pytest.raises(rname.InvalidResourceName) as e:\n rname.ResourceName.from_string('PXI::1')\nassert 'not provided and default not found' in e.exconly()\ntry:\n ...
<|body_start_0|> with pytest.raises(rname.InvalidResourceName) as e: rname.ResourceName.from_string('RJ45::1') assert 'unknown interface type' in e.exconly() with pytest.raises(rname.InvalidResourceName) as e: rname.ResourceName.from_string('PXI::1') assert 'not p...
Test error handling in ResourceName. This exercise creating a resource name from parts too which is hence not tested explicitely.
TestResourceName
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestResourceName: """Test error handling in ResourceName. This exercise creating a resource name from parts too which is hence not tested explicitely.""" def test_creation_from_string(self): """Test error handling when creating a name from a string.""" <|body_0|> def tes...
stack_v2_sparse_classes_75kplus_train_004406
19,643
permissive
[ { "docstring": "Test error handling when creating a name from a string.", "name": "test_creation_from_string", "signature": "def test_creation_from_string(self)" }, { "docstring": "Test error handling when creating a name from a kwargs.", "name": "test_creation_from_kwargs", "signature":...
3
null
Implement the Python class `TestResourceName` described below. Class description: Test error handling in ResourceName. This exercise creating a resource name from parts too which is hence not tested explicitely. Method signatures and docstrings: - def test_creation_from_string(self): Test error handling when creating...
Implement the Python class `TestResourceName` described below. Class description: Test error handling in ResourceName. This exercise creating a resource name from parts too which is hence not tested explicitely. Method signatures and docstrings: - def test_creation_from_string(self): Test error handling when creating...
071fa6d5a8e7703f1b38d4c0b0cccd0952a5972f
<|skeleton|> class TestResourceName: """Test error handling in ResourceName. This exercise creating a resource name from parts too which is hence not tested explicitely.""" def test_creation_from_string(self): """Test error handling when creating a name from a string.""" <|body_0|> def tes...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestResourceName: """Test error handling in ResourceName. This exercise creating a resource name from parts too which is hence not tested explicitely.""" def test_creation_from_string(self): """Test error handling when creating a name from a string.""" with pytest.raises(rname.InvalidReso...
the_stack_v2_python_sparse
pyvisa/testsuite/test_rname.py
pyvisa/pyvisa
train
543
d304209db64e239dcc2e929deeade4e5b4cd0ed0
[ "if not (key and secret and url and method):\n raise ValueError('invalid oauth parameters')\nself.key = key\nself.secret = secret\nself.url = url\nself.method = method", "url = self.url.format(account=account)\nargs = {'oauth_consumer_key': _penc(self.key), 'oauth_nonce': sha1(urandom(64)).hexdigest(), 'oauth_...
<|body_start_0|> if not (key and secret and url and method): raise ValueError('invalid oauth parameters') self.key = key self.secret = secret self.url = url self.method = method <|end_body_0|> <|body_start_1|> url = self.url.format(account=account) ar...
Two-legged OAuth implementation for Gmail IMAP.
OAuth
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OAuth: """Two-legged OAuth implementation for Gmail IMAP.""" def __init__(self, key, secret, url, method='GET'): """Set authentication parameters.""" <|body_0|> def __call__(self, account): """Create a request string for OAuth authentication.""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_004407
1,940
permissive
[ { "docstring": "Set authentication parameters.", "name": "__init__", "signature": "def __init__(self, key, secret, url, method='GET')" }, { "docstring": "Create a request string for OAuth authentication.", "name": "__call__", "signature": "def __call__(self, account)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_015714
Implement the Python class `OAuth` described below. Class description: Two-legged OAuth implementation for Gmail IMAP. Method signatures and docstrings: - def __init__(self, key, secret, url, method='GET'): Set authentication parameters. - def __call__(self, account): Create a request string for OAuth authentication....
Implement the Python class `OAuth` described below. Class description: Two-legged OAuth implementation for Gmail IMAP. Method signatures and docstrings: - def __init__(self, key, secret, url, method='GET'): Set authentication parameters. - def __call__(self, account): Create a request string for OAuth authentication....
1344069a175afbca0593e4460d99889a2acf86d8
<|skeleton|> class OAuth: """Two-legged OAuth implementation for Gmail IMAP.""" def __init__(self, key, secret, url, method='GET'): """Set authentication parameters.""" <|body_0|> def __call__(self, account): """Create a request string for OAuth authentication.""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OAuth: """Two-legged OAuth implementation for Gmail IMAP.""" def __init__(self, key, secret, url, method='GET'): """Set authentication parameters.""" if not (key and secret and url and method): raise ValueError('invalid oauth parameters') self.key = key self.se...
the_stack_v2_python_sparse
_gmdb/oauth.py
uncleweb/gmdb
train
0
c46cda41b8b6df08f4eb6c1361b73d1d3a58440c
[ "n = len(prices)\ndp = [[0 for _ in range(n)] for _ in range(n)]\nfor i in range(n):\n lowest = prices[i]\n highest = 0\n for j in range(i + 1, n):\n if prices[j] < lowest:\n lowest = prices[j]\n dp[i][j] = dp[i][j - 1]\n elif prices[j] - lowest > highest:\n d...
<|body_start_0|> n = len(prices) dp = [[0 for _ in range(n)] for _ in range(n)] for i in range(n): lowest = prices[i] highest = 0 for j in range(i + 1, n): if prices[j] < lowest: lowest = prices[j] dp[i][...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit_recursive(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> def maxProfit_helper(self, prices): """:type prices: List[int]...
stack_v2_sparse_classes_75kplus_train_004408
3,405
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit_recursive", "signature": "def maxProfit_recursive(self, prices)" }, { "docstring": ":t...
3
stack_v2_sparse_classes_30k_train_051650
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit_recursive(self, prices): :type prices: List[int] :rtype: int - def maxProfit_helper(self, prices)...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit_recursive(self, prices): :type prices: List[int] :rtype: int - def maxProfit_helper(self, prices)...
db7bfb7cff5d3220ee9e60121bd19439ddaff453
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit_recursive(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> def maxProfit_helper(self, prices): """:type prices: List[int]...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" n = len(prices) dp = [[0 for _ in range(n)] for _ in range(n)] for i in range(n): lowest = prices[i] highest = 0 for j in range(i + 1, n): if pri...
the_stack_v2_python_sparse
leetcod/dp/p309.py
gaoshang1999/Python
train
0
281a223781a05162c4508365a2779e2786b005de
[ "self.sprite_sheet = prepare_game.GFX['game_text']\nself.coin_total = game_labels[c.COIN_TOTAL]\nself.time = 401\nself.current_time = 0\nself.total_lives = game_labels[c.LIVES]\nself.top_score = game_labels[c.TOP_SCORE]\nself.state = state\nself.special_state = None\nself.game_labels = game_labels\nself.images_dict...
<|body_start_0|> self.sprite_sheet = prepare_game.GFX['game_text'] self.coin_total = game_labels[c.COIN_TOTAL] self.time = 401 self.current_time = 0 self.total_lives = game_labels[c.LIVES] self.top_score = game_labels[c.TOP_SCORE] self.state = state self.s...
OverheadLabels2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OverheadLabels2: def __init__(self, game_labels, state): """Initializes the state with all the variables needed""" <|body_0|> def info_labels(self): """Creates the labels that describe each variable""" <|body_1|> <|end_skeleton|> <|body_start_0|> se...
stack_v2_sparse_classes_75kplus_train_004409
24,153
no_license
[ { "docstring": "Initializes the state with all the variables needed", "name": "__init__", "signature": "def __init__(self, game_labels, state)" }, { "docstring": "Creates the labels that describe each variable", "name": "info_labels", "signature": "def info_labels(self)" } ]
2
stack_v2_sparse_classes_30k_test_000127
Implement the Python class `OverheadLabels2` described below. Class description: Implement the OverheadLabels2 class. Method signatures and docstrings: - def __init__(self, game_labels, state): Initializes the state with all the variables needed - def info_labels(self): Creates the labels that describe each variable
Implement the Python class `OverheadLabels2` described below. Class description: Implement the OverheadLabels2 class. Method signatures and docstrings: - def __init__(self, game_labels, state): Initializes the state with all the variables needed - def info_labels(self): Creates the labels that describe each variable ...
15b49b5a5d422754b805642c13c7082e0dae57b7
<|skeleton|> class OverheadLabels2: def __init__(self, game_labels, state): """Initializes the state with all the variables needed""" <|body_0|> def info_labels(self): """Creates the labels that describe each variable""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OverheadLabels2: def __init__(self, game_labels, state): """Initializes the state with all the variables needed""" self.sprite_sheet = prepare_game.GFX['game_text'] self.coin_total = game_labels[c.COIN_TOTAL] self.time = 401 self.current_time = 0 self.total_live...
the_stack_v2_python_sparse
TRABAJO_FINAL_GRUPO_7/Code/Classes/labels.py
alexandresegura/is2_2018_1
train
1
f5852c6002000b09254755af4f99c0e40c45bf9e
[ "super(TcpQuery, self).__init__()\nself._request_mbap = TcpMbap()\nself._response_mbap = TcpMbap()", "if TcpQuery._last_transaction_id < 65535:\n TcpQuery._last_transaction_id += 1\nelse:\n TcpQuery._last_transaction_id = 0\nreturn TcpQuery._last_transaction_id", "if slave < 0 or slave > 255:\n raise I...
<|body_start_0|> super(TcpQuery, self).__init__() self._request_mbap = TcpMbap() self._response_mbap = TcpMbap() <|end_body_0|> <|body_start_1|> if TcpQuery._last_transaction_id < 65535: TcpQuery._last_transaction_id += 1 else: TcpQuery._last_transaction_...
Subclass of a Query. Adds the Modbus TCP specific part of the protocol
TcpQuery
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TcpQuery: """Subclass of a Query. Adds the Modbus TCP specific part of the protocol""" def __init__(self): """Constructor""" <|body_0|> def _get_transaction_id(self): """returns an identifier for the query""" <|body_1|> def build_request(self, pdu, s...
stack_v2_sparse_classes_75kplus_train_004410
14,499
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "returns an identifier for the query", "name": "_get_transaction_id", "signature": "def _get_transaction_id(self)" }, { "docstring": "Add the Modbus TCP part to the request", ...
6
stack_v2_sparse_classes_30k_train_001096
Implement the Python class `TcpQuery` described below. Class description: Subclass of a Query. Adds the Modbus TCP specific part of the protocol Method signatures and docstrings: - def __init__(self): Constructor - def _get_transaction_id(self): returns an identifier for the query - def build_request(self, pdu, slave...
Implement the Python class `TcpQuery` described below. Class description: Subclass of a Query. Adds the Modbus TCP specific part of the protocol Method signatures and docstrings: - def __init__(self): Constructor - def _get_transaction_id(self): returns an identifier for the query - def build_request(self, pdu, slave...
a5aeb1238b26c1af55cf3a82787ed347dff1fb86
<|skeleton|> class TcpQuery: """Subclass of a Query. Adds the Modbus TCP specific part of the protocol""" def __init__(self): """Constructor""" <|body_0|> def _get_transaction_id(self): """returns an identifier for the query""" <|body_1|> def build_request(self, pdu, s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TcpQuery: """Subclass of a Query. Adds the Modbus TCP specific part of the protocol""" def __init__(self): """Constructor""" super(TcpQuery, self).__init__() self._request_mbap = TcpMbap() self._response_mbap = TcpMbap() def _get_transaction_id(self): """retur...
the_stack_v2_python_sparse
external/modbus_tk/modbus_tk/modbus_tcp.py
intel/intel-device-resource-mgt-lib
train
2
a8fc46e817f96e4a28116e21595a47200ee57e35
[ "for project_id, backend_services in resource_from_api.iteritems():\n for backend_service in backend_services:\n yield {'project_id': project_id, 'id': backend_service.get('id'), 'creation_timestamp': parser.format_timestamp(backend_service.get('creationTimestamp'), self.MYSQL_DATETIME_FORMAT), 'name': ba...
<|body_start_0|> for project_id, backend_services in resource_from_api.iteritems(): for backend_service in backend_services: yield {'project_id': project_id, 'id': backend_service.get('id'), 'creation_timestamp': parser.format_timestamp(backend_service.get('creationTimestamp'), self....
Load compute backend services for all projects.
LoadBackendServicesPipeline
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadBackendServicesPipeline: """Load compute backend services for all projects.""" def _transform(self, resource_from_api): """Create an iterator of backend services to load into database. Args: resource_from_api (dict): Forwarding rules, keyed by project id, from GCP API. Yields: it...
stack_v2_sparse_classes_75kplus_train_004411
4,698
permissive
[ { "docstring": "Create an iterator of backend services to load into database. Args: resource_from_api (dict): Forwarding rules, keyed by project id, from GCP API. Yields: iterator: backend service properties in a dict.", "name": "_transform", "signature": "def _transform(self, resource_from_api)" }, ...
3
stack_v2_sparse_classes_30k_train_005327
Implement the Python class `LoadBackendServicesPipeline` described below. Class description: Load compute backend services for all projects. Method signatures and docstrings: - def _transform(self, resource_from_api): Create an iterator of backend services to load into database. Args: resource_from_api (dict): Forwar...
Implement the Python class `LoadBackendServicesPipeline` described below. Class description: Load compute backend services for all projects. Method signatures and docstrings: - def _transform(self, resource_from_api): Create an iterator of backend services to load into database. Args: resource_from_api (dict): Forwar...
a6a1aa7464cda2ad5948e3e8876eb8dded5e2514
<|skeleton|> class LoadBackendServicesPipeline: """Load compute backend services for all projects.""" def _transform(self, resource_from_api): """Create an iterator of backend services to load into database. Args: resource_from_api (dict): Forwarding rules, keyed by project id, from GCP API. Yields: it...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoadBackendServicesPipeline: """Load compute backend services for all projects.""" def _transform(self, resource_from_api): """Create an iterator of backend services to load into database. Args: resource_from_api (dict): Forwarding rules, keyed by project id, from GCP API. Yields: iterator: backe...
the_stack_v2_python_sparse
google/cloud/security/inventory/pipelines/load_backend_services_pipeline.py
shimizu19691210/forseti-security
train
1
3689bf0c54111fac5dc042896ee8ab02759b5ec8
[ "self.temperature = np.array([[280.06, 279.97, 279.9], [280.15, 280.03, 279.96], [280.25, 280.33, 280.27]])\nself.orography = np.array([[174.67, 179.87, 188.46], [155.84, 169.58, 185.05], [134.9, 144.0, 157.89]])\nself.land_sea_mask = ~np.zeros_like(self.temperature, dtype=bool)", "expected_out = -0.0076500577467...
<|body_start_0|> self.temperature = np.array([[280.06, 279.97, 279.9], [280.15, 280.03, 279.96], [280.25, 280.33, 280.27]]) self.orography = np.array([[174.67, 179.87, 188.46], [155.84, 169.58, 185.05], [134.9, 144.0, 157.89]]) self.land_sea_mask = ~np.zeros_like(self.temperature, dtype=bool) <|...
Test the _calc_lapse_rate function.
Test__calc_lapse_rate
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__calc_lapse_rate: """Test the _calc_lapse_rate function.""" def setUp(self): """Sets up arrays.""" <|body_0|> def test_returns_expected_values(self): """Test that the function returns expected lapse rate.""" <|body_1|> def test_handles_nan(self)...
stack_v2_sparse_classes_75kplus_train_004412
24,615
permissive
[ { "docstring": "Sets up arrays.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test that the function returns expected lapse rate.", "name": "test_returns_expected_values", "signature": "def test_returns_expected_values(self)" }, { "docstring": "Test that th...
4
stack_v2_sparse_classes_30k_train_049763
Implement the Python class `Test__calc_lapse_rate` described below. Class description: Test the _calc_lapse_rate function. Method signatures and docstrings: - def setUp(self): Sets up arrays. - def test_returns_expected_values(self): Test that the function returns expected lapse rate. - def test_handles_nan(self): Te...
Implement the Python class `Test__calc_lapse_rate` described below. Class description: Test the _calc_lapse_rate function. Method signatures and docstrings: - def setUp(self): Sets up arrays. - def test_returns_expected_values(self): Test that the function returns expected lapse rate. - def test_handles_nan(self): Te...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__calc_lapse_rate: """Test the _calc_lapse_rate function.""" def setUp(self): """Sets up arrays.""" <|body_0|> def test_returns_expected_values(self): """Test that the function returns expected lapse rate.""" <|body_1|> def test_handles_nan(self)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test__calc_lapse_rate: """Test the _calc_lapse_rate function.""" def setUp(self): """Sets up arrays.""" self.temperature = np.array([[280.06, 279.97, 279.9], [280.15, 280.03, 279.96], [280.25, 280.33, 280.27]]) self.orography = np.array([[174.67, 179.87, 188.46], [155.84, 169.58, ...
the_stack_v2_python_sparse
improver_tests/lapse_rate/test_LapseRate.py
metoppv/improver
train
101
fe699ee0cbe2831fdfd71707a98ae51fba00b641
[ "logging.info('## SETUP METHOD ##')\nlogging.info('# Initializing the webdriver.')\nself.ffprofile = self.create_ffprofile()\nself.driver = webdriver.Firefox(self.ffprofile)\nself.driver.maximize_window()\nself.driver.implicitly_wait(5)\nself.driver.get('http://the-internet.herokuapp.com/')", "logging.info('## TE...
<|body_start_0|> logging.info('## SETUP METHOD ##') logging.info('# Initializing the webdriver.') self.ffprofile = self.create_ffprofile() self.driver = webdriver.Firefox(self.ffprofile) self.driver.maximize_window() self.driver.implicitly_wait(5) self.driver.get(...
This class is for instantiating web driver instances.
DriverManagerFirefox
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DriverManagerFirefox: """This class is for instantiating web driver instances.""" def setUp(self): """This method is to instantiate the web driver instance.""" <|body_0|> def tearDown(self): """This is teardown method. It is to capture the screenshots for failed ...
stack_v2_sparse_classes_75kplus_train_004413
3,946
permissive
[ { "docstring": "This method is to instantiate the web driver instance.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "This is teardown method. It is to capture the screenshots for failed test cases, & to remove web driver object.", "name": "tearDown", "signature": "...
4
stack_v2_sparse_classes_30k_train_044241
Implement the Python class `DriverManagerFirefox` described below. Class description: This class is for instantiating web driver instances. Method signatures and docstrings: - def setUp(self): This method is to instantiate the web driver instance. - def tearDown(self): This is teardown method. It is to capture the sc...
Implement the Python class `DriverManagerFirefox` described below. Class description: This class is for instantiating web driver instances. Method signatures and docstrings: - def setUp(self): This method is to instantiate the web driver instance. - def tearDown(self): This is teardown method. It is to capture the sc...
65513cb85eccb1ae3fae4ac3625d0e6878720ec8
<|skeleton|> class DriverManagerFirefox: """This class is for instantiating web driver instances.""" def setUp(self): """This method is to instantiate the web driver instance.""" <|body_0|> def tearDown(self): """This is teardown method. It is to capture the screenshots for failed ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DriverManagerFirefox: """This class is for instantiating web driver instances.""" def setUp(self): """This method is to instantiate the web driver instance.""" logging.info('## SETUP METHOD ##') logging.info('# Initializing the webdriver.') self.ffprofile = self.create_ffp...
the_stack_v2_python_sparse
attic/2019/contributions-2019/open/mudaliar-yptu/PWAF/utility/drivermanager.py
Agriad/devops-course
train
0
9fc2e2d2a04916ed2e683e2c2e320ee2092d3296
[ "if not nums1 or not nums2:\n return\nfor i in range(len(nums2)):\n nums1[m + i] = nums2[i]\n\ndef _sort_once(nums, left, right):\n x = left\n y = right\n pivot = nums[left]\n while x < y:\n while x < y and nums[y] >= pivot:\n y -= 1\n nums[x] = nums[y]\n while x < ...
<|body_start_0|> if not nums1 or not nums2: return for i in range(len(nums2)): nums1[m + i] = nums2[i] def _sort_once(nums, left, right): x = left y = right pivot = nums[left] while x < y: while x < y and nu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge(self, nums1: 'List[int]', m: int, nums2: 'List[int]', n: int) -> None: """先合并,在使用快速排序 执行用时 : 60 ms, 在Merge Sorted Array的Python3提交中击败了49.81% 的用户 内存消耗 : 12.9 MB, 在Merge Sorted Array的Python3提交中击败了99.08% 的用户""" <|body_0|> def merge1(self, nums1: 'List[int]', ...
stack_v2_sparse_classes_75kplus_train_004414
4,411
no_license
[ { "docstring": "先合并,在使用快速排序 执行用时 : 60 ms, 在Merge Sorted Array的Python3提交中击败了49.81% 的用户 内存消耗 : 12.9 MB, 在Merge Sorted Array的Python3提交中击败了99.08% 的用户", "name": "merge", "signature": "def merge(self, nums1: 'List[int]', m: int, nums2: 'List[int]', n: int) -> None" }, { "docstring": "先合并,在使用 sort 排序",...
3
stack_v2_sparse_classes_30k_train_030036
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, nums1: 'List[int]', m: int, nums2: 'List[int]', n: int) -> None: 先合并,在使用快速排序 执行用时 : 60 ms, 在Merge Sorted Array的Python3提交中击败了49.81% 的用户 内存消耗 : 12.9 MB, 在Merge Sort...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, nums1: 'List[int]', m: int, nums2: 'List[int]', n: int) -> None: 先合并,在使用快速排序 执行用时 : 60 ms, 在Merge Sorted Array的Python3提交中击败了49.81% 的用户 内存消耗 : 12.9 MB, 在Merge Sort...
7bca9dc8ec211be15c12f89bffbb680d639f87bf
<|skeleton|> class Solution: def merge(self, nums1: 'List[int]', m: int, nums2: 'List[int]', n: int) -> None: """先合并,在使用快速排序 执行用时 : 60 ms, 在Merge Sorted Array的Python3提交中击败了49.81% 的用户 内存消耗 : 12.9 MB, 在Merge Sorted Array的Python3提交中击败了99.08% 的用户""" <|body_0|> def merge1(self, nums1: 'List[int]', ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def merge(self, nums1: 'List[int]', m: int, nums2: 'List[int]', n: int) -> None: """先合并,在使用快速排序 执行用时 : 60 ms, 在Merge Sorted Array的Python3提交中击败了49.81% 的用户 内存消耗 : 12.9 MB, 在Merge Sorted Array的Python3提交中击败了99.08% 的用户""" if not nums1 or not nums2: return for i in rang...
the_stack_v2_python_sparse
python/leetcode/88-merge-sorted-array.py
wxnacy/study
train
18
4d9c5447d5c09557490f1a6f16236ecb19bf0b34
[ "self.distinct_tags = [MagicMock(id=1), MagicMock(id=2), MagicMock(id=3)]\nself.profiles = [MagicMock(tags=MagicMock(), id=2), MagicMock(tags=MagicMock(), id=3)]\nself.social_link = MagicMock(spec=SocialLink, account=MagicMock(spec=SocialAccount, expert=MagicMock(spec=Expert, userbase=MagicMock(id=1), id=1)), exper...
<|body_start_0|> self.distinct_tags = [MagicMock(id=1), MagicMock(id=2), MagicMock(id=3)] self.profiles = [MagicMock(tags=MagicMock(), id=2), MagicMock(tags=MagicMock(), id=3)] self.social_link = MagicMock(spec=SocialLink, account=MagicMock(spec=SocialAccount, expert=MagicMock(spec=Expert, userb...
Test case for PushFeeds
TestPushFeeds
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPushFeeds: """Test case for PushFeeds""" def setUp(self): """SetUp method for test case""" <|body_0|> def test_push_feeds_to_streamfeed(self, mock_expert_publish_content, mock_parent_tags): """test case for method push_feeds_to_streamfeed""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_004415
20,391
no_license
[ { "docstring": "SetUp method for test case", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "test case for method push_feeds_to_streamfeed", "name": "test_push_feeds_to_streamfeed", "signature": "def test_push_feeds_to_streamfeed(self, mock_expert_publish_content, mock...
4
stack_v2_sparse_classes_30k_train_030123
Implement the Python class `TestPushFeeds` described below. Class description: Test case for PushFeeds Method signatures and docstrings: - def setUp(self): SetUp method for test case - def test_push_feeds_to_streamfeed(self, mock_expert_publish_content, mock_parent_tags): test case for method push_feeds_to_streamfeed...
Implement the Python class `TestPushFeeds` described below. Class description: Test case for PushFeeds Method signatures and docstrings: - def setUp(self): SetUp method for test case - def test_push_feeds_to_streamfeed(self, mock_expert_publish_content, mock_parent_tags): test case for method push_feeds_to_streamfeed...
248a7b406686c0c98e944319a6eca08485104f5d
<|skeleton|> class TestPushFeeds: """Test case for PushFeeds""" def setUp(self): """SetUp method for test case""" <|body_0|> def test_push_feeds_to_streamfeed(self, mock_expert_publish_content, mock_parent_tags): """test case for method push_feeds_to_streamfeed""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestPushFeeds: """Test case for PushFeeds""" def setUp(self): """SetUp method for test case""" self.distinct_tags = [MagicMock(id=1), MagicMock(id=2), MagicMock(id=3)] self.profiles = [MagicMock(tags=MagicMock(), id=2), MagicMock(tags=MagicMock(), id=3)] self.social_link =...
the_stack_v2_python_sparse
common/feeds/tests.py
skshivammahajan/DRFChat
train
0
cf60a72e9f7da153f5650032477df0d3dd978f3f
[ "google.logging_utils.config_root()\nself.revision = revision\nself.instrumented = False\nself.tools_path = tools_path\nself.src_path = src_path\nself._dir = None", "if self.instrumented:\n logging.error('Binaries already instrumented')\n return None\ncoverage_file = None\nif IsWindows():\n counters_comm...
<|body_start_0|> google.logging_utils.config_root() self.revision = revision self.instrumented = False self.tools_path = tools_path self.src_path = src_path self._dir = None <|end_body_0|> <|body_start_1|> if self.instrumented: logging.error('Binaries...
Class to set up and generate code coverage. This class contains methods that are useful to set up the environment for code coverage. Attributes: instrumented: A boolean indicating if all the binaries have been instrumented.
Coverage
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Coverage: """Class to set up and generate code coverage. This class contains methods that are useful to set up the environment for code coverage. Attributes: instrumented: A boolean indicating if all the binaries have been instrumented.""" def __init__(self, revision, src_path=None, tools_pa...
stack_v2_sparse_classes_75kplus_train_004416
11,129
permissive
[ { "docstring": "Init method for the Coverage class. Args: revision: Revision number of the Chromium source tree. src_path: Location of the Chromium source base. tools_path: Location of the Visual Studio Team Tools. (Win32 only)", "name": "__init__", "signature": "def __init__(self, revision, src_path=No...
4
stack_v2_sparse_classes_30k_train_027546
Implement the Python class `Coverage` described below. Class description: Class to set up and generate code coverage. This class contains methods that are useful to set up the environment for code coverage. Attributes: instrumented: A boolean indicating if all the binaries have been instrumented. Method signatures an...
Implement the Python class `Coverage` described below. Class description: Class to set up and generate code coverage. This class contains methods that are useful to set up the environment for code coverage. Attributes: instrumented: A boolean indicating if all the binaries have been instrumented. Method signatures an...
008c4fef2676506869a0404239da31e83fd6ccc7
<|skeleton|> class Coverage: """Class to set up and generate code coverage. This class contains methods that are useful to set up the environment for code coverage. Attributes: instrumented: A boolean indicating if all the binaries have been instrumented.""" def __init__(self, revision, src_path=None, tools_pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Coverage: """Class to set up and generate code coverage. This class contains methods that are useful to set up the environment for code coverage. Attributes: instrumented: A boolean indicating if all the binaries have been instrumented.""" def __init__(self, revision, src_path=None, tools_path=None): ...
the_stack_v2_python_sparse
tools/code_coverage/coverage.py
bluebellzhy/chromium
train
1
55f6714df37a95aa36b4a9532332a4ad551913b0
[ "super().__init__()\nassert 0 <= p <= 1\nassert num_feature_masks >= 0\nassert num_frame_masks >= 0\nassert features_mask_size > 0\nassert frames_mask_size > 0\nself.time_warp_factor = time_warp_factor\nself.num_feature_masks = num_feature_masks\nself.features_mask_size = features_mask_size\nself.num_frame_masks = ...
<|body_start_0|> super().__init__() assert 0 <= p <= 1 assert num_feature_masks >= 0 assert num_frame_masks >= 0 assert features_mask_size > 0 assert frames_mask_size > 0 self.time_warp_factor = time_warp_factor self.num_feature_masks = num_feature_masks ...
SpecAugment performs three augmentations: - time warping of the feature matrix - masking of ranges of features (frequency bands) - masking of ranges of frames (time) The current implementation works with batches, but processes each example separately in a loop rather than simultaneously to achieve different augmentatio...
SpecAugment
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpecAugment: """SpecAugment performs three augmentations: - time warping of the feature matrix - masking of ranges of features (frequency bands) - masking of ranges of frames (time) The current implementation works with batches, but processes each example separately in a loop rather than simultan...
stack_v2_sparse_classes_75kplus_train_004417
12,729
permissive
[ { "docstring": "SpecAugment's constructor. :param time_warp_factor: parameter for the time warping; larger values mean more warping. Set to ``None``, or less than ``1``, to disable. :param num_feature_masks: how many feature masks should be applied. Set to ``0`` to disable. :param features_mask_size: the width ...
3
null
Implement the Python class `SpecAugment` described below. Class description: SpecAugment performs three augmentations: - time warping of the feature matrix - masking of ranges of features (frequency bands) - masking of ranges of frames (time) The current implementation works with batches, but processes each example se...
Implement the Python class `SpecAugment` described below. Class description: SpecAugment performs three augmentations: - time warping of the feature matrix - masking of ranges of features (frequency bands) - masking of ranges of frames (time) The current implementation works with batches, but processes each example se...
85a5c8e9d9827f457ba33432bfe37f44ca28365a
<|skeleton|> class SpecAugment: """SpecAugment performs three augmentations: - time warping of the feature matrix - masking of ranges of features (frequency bands) - masking of ranges of frames (time) The current implementation works with batches, but processes each example separately in a loop rather than simultan...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpecAugment: """SpecAugment performs three augmentations: - time warping of the feature matrix - masking of ranges of features (frequency bands) - masking of ranges of frames (time) The current implementation works with batches, but processes each example separately in a loop rather than simultaneously to ach...
the_stack_v2_python_sparse
lhotse/dataset/signal_transforms.py
jimbozhang/lhotse
train
1
ad7a0a193f93085ba27fd20c467c53c2236b9266
[ "if not email:\n raise ValueError('The given email must be set')\nemail = self.normalize_email(email)\nusername = self.model.normalize_username(username)\nuser = self.model(username=username, email=email, **extra_fields)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "extra_fields.setde...
<|body_start_0|> if not email: raise ValueError('The given email must be set') email = self.normalize_email(email) username = self.model.normalize_username(username) user = self.model(username=username, email=email, **extra_fields) user.set_password(password) ...
CustomUserManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomUserManager: def _create_user(self, username, email, password, **extra_fields): """Require email address to be set.""" <|body_0|> def create_superuser(self, email, password, username=None, **extra_fields): """Make username optional.""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus_train_004418
4,400
permissive
[ { "docstring": "Require email address to be set.", "name": "_create_user", "signature": "def _create_user(self, username, email, password, **extra_fields)" }, { "docstring": "Make username optional.", "name": "create_superuser", "signature": "def create_superuser(self, email, password, u...
2
stack_v2_sparse_classes_30k_train_034907
Implement the Python class `CustomUserManager` described below. Class description: Implement the CustomUserManager class. Method signatures and docstrings: - def _create_user(self, username, email, password, **extra_fields): Require email address to be set. - def create_superuser(self, email, password, username=None,...
Implement the Python class `CustomUserManager` described below. Class description: Implement the CustomUserManager class. Method signatures and docstrings: - def _create_user(self, username, email, password, **extra_fields): Require email address to be set. - def create_superuser(self, email, password, username=None,...
afa2da651ef9046ea39c044a65bdd88d814838b4
<|skeleton|> class CustomUserManager: def _create_user(self, username, email, password, **extra_fields): """Require email address to be set.""" <|body_0|> def create_superuser(self, email, password, username=None, **extra_fields): """Make username optional.""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomUserManager: def _create_user(self, username, email, password, **extra_fields): """Require email address to be set.""" if not email: raise ValueError('The given email must be set') email = self.normalize_email(email) username = self.model.normalize_username(us...
the_stack_v2_python_sparse
app/users/models.py
tadasant/strand-api
train
1
7295db4d665754eab420ec071cb3549fdba4c3b2
[ "_user = '-' + tools.as_filename(user) if user else ''\nself.filename = config.datafilepath(f'pywikibot{_user}.lwp')\ntry:\n super().load(*args, **kwargs)\nexcept (cookiejar.LoadError, FileNotFoundError):\n debug(f'Loading cookies for user {user} failed.')\nelse:\n debug(f'Loaded cookies for user {user} fr...
<|body_start_0|> _user = '-' + tools.as_filename(user) if user else '' self.filename = config.datafilepath(f'pywikibot{_user}.lwp') try: super().load(*args, **kwargs) except (cookiejar.LoadError, FileNotFoundError): debug(f'Loading cookies for user {user} failed.'...
CookieJar which create the filename and checks file permissions. .. versionadded:: 8.0
PywikibotCookieJar
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PywikibotCookieJar: """CookieJar which create the filename and checks file permissions. .. versionadded:: 8.0""" def load(self, user: str='', *args, **kwargs) -> None: """Loads cookies from a file. Insert the account name to the cookie filename, set the instance`s filename and load t...
stack_v2_sparse_classes_75kplus_train_004419
19,541
permissive
[ { "docstring": "Loads cookies from a file. Insert the account name to the cookie filename, set the instance`s filename and load the cookies. :param user: account name to be part of the cookie filename.", "name": "load", "signature": "def load(self, user: str='', *args, **kwargs) -> None" }, { "d...
2
null
Implement the Python class `PywikibotCookieJar` described below. Class description: CookieJar which create the filename and checks file permissions. .. versionadded:: 8.0 Method signatures and docstrings: - def load(self, user: str='', *args, **kwargs) -> None: Loads cookies from a file. Insert the account name to th...
Implement the Python class `PywikibotCookieJar` described below. Class description: CookieJar which create the filename and checks file permissions. .. versionadded:: 8.0 Method signatures and docstrings: - def load(self, user: str='', *args, **kwargs) -> None: Loads cookies from a file. Insert the account name to th...
5c01e6bfcd328bc6eae643e661f1a0ae57612808
<|skeleton|> class PywikibotCookieJar: """CookieJar which create the filename and checks file permissions. .. versionadded:: 8.0""" def load(self, user: str='', *args, **kwargs) -> None: """Loads cookies from a file. Insert the account name to the cookie filename, set the instance`s filename and load t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PywikibotCookieJar: """CookieJar which create the filename and checks file permissions. .. versionadded:: 8.0""" def load(self, user: str='', *args, **kwargs) -> None: """Loads cookies from a file. Insert the account name to the cookie filename, set the instance`s filename and load the cookies. :...
the_stack_v2_python_sparse
pywikibot/comms/http.py
wikimedia/pywikibot
train
432
dc4be14d2d66dac55f33e7bb47a38e6dac681354
[ "super(SiteOrder, self).__init__(parent)\nself.parent = parent\nself.resize(400, 300)\nself.list_site = list_site\nself.populate(self.list_site)", "mainLayout = QtGui.QGridLayout(self)\nself.list_site = QtGui.QListWidget()\nfor i in list_site:\n item = QtGui.QListWidgetItem(i)\n self.list_site.addItem(item)...
<|body_start_0|> super(SiteOrder, self).__init__(parent) self.parent = parent self.resize(400, 300) self.list_site = list_site self.populate(self.list_site) <|end_body_0|> <|body_start_1|> mainLayout = QtGui.QGridLayout(self) self.list_site = QtGui.QListWidget() ...
display playing list
SiteOrder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SiteOrder: """display playing list""" def __init__(self, list_site, parent=None): """initialisation""" <|body_0|> def populate(self, list_site): """create layout""" <|body_1|> def moveUp(self): """up is clicked""" <|body_2|> def ...
stack_v2_sparse_classes_75kplus_train_004420
2,368
no_license
[ { "docstring": "initialisation", "name": "__init__", "signature": "def __init__(self, list_site, parent=None)" }, { "docstring": "create layout", "name": "populate", "signature": "def populate(self, list_site)" }, { "docstring": "up is clicked", "name": "moveUp", "signatu...
5
stack_v2_sparse_classes_30k_train_005470
Implement the Python class `SiteOrder` described below. Class description: display playing list Method signatures and docstrings: - def __init__(self, list_site, parent=None): initialisation - def populate(self, list_site): create layout - def moveUp(self): up is clicked - def moveDown(self): down is clicked - def sa...
Implement the Python class `SiteOrder` described below. Class description: display playing list Method signatures and docstrings: - def __init__(self, list_site, parent=None): initialisation - def populate(self, list_site): create layout - def moveUp(self): up is clicked - def moveDown(self): down is clicked - def sa...
a24b3e4e8acbd4da9ba4c83bf96c0b2d2a2cca9c
<|skeleton|> class SiteOrder: """display playing list""" def __init__(self, list_site, parent=None): """initialisation""" <|body_0|> def populate(self, list_site): """create layout""" <|body_1|> def moveUp(self): """up is clicked""" <|body_2|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SiteOrder: """display playing list""" def __init__(self, list_site, parent=None): """initialisation""" super(SiteOrder, self).__init__(parent) self.parent = parent self.resize(400, 300) self.list_site = list_site self.populate(self.list_site) def popul...
the_stack_v2_python_sparse
gui/menusiteorder.py
sensini42/flvdown
train
0
8efb0e14597bbb9653723ddf2ee062aeaca6c49d
[ "parser.add_argument('subscription', nargs='+', help='One or more subscriptions to create.')\nparser.add_argument('--topic', required=True, help='The name of the topic from which this subscription is receiving messages. Each subscription is attached to a single topic.')\nparser.add_argument('--topic-project', defau...
<|body_start_0|> parser.add_argument('subscription', nargs='+', help='One or more subscriptions to create.') parser.add_argument('--topic', required=True, help='The name of the topic from which this subscription is receiving messages. Each subscription is attached to a single topic.') parser.add...
Creates one or more Cloud Pub/Sub subscriptions. Creates one or more Cloud Pub/Sub subscriptions for a given topic. The new subscription defaults to a PULL subscription unless a push endpoint is specified.
Create
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Create: """Creates one or more Cloud Pub/Sub subscriptions. Creates one or more Cloud Pub/Sub subscriptions for a given topic. The new subscription defaults to a PULL subscription unless a push endpoint is specified.""" def Args(parser): """Registers flags for this command.""" ...
stack_v2_sparse_classes_75kplus_train_004421
4,149
permissive
[ { "docstring": "Registers flags for this command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this command invocation. Returns: A 2-tuple ...
3
stack_v2_sparse_classes_30k_train_003820
Implement the Python class `Create` described below. Class description: Creates one or more Cloud Pub/Sub subscriptions. Creates one or more Cloud Pub/Sub subscriptions for a given topic. The new subscription defaults to a PULL subscription unless a push endpoint is specified. Method signatures and docstrings: - def ...
Implement the Python class `Create` described below. Class description: Creates one or more Cloud Pub/Sub subscriptions. Creates one or more Cloud Pub/Sub subscriptions for a given topic. The new subscription defaults to a PULL subscription unless a push endpoint is specified. Method signatures and docstrings: - def ...
1f9b424c40a87b46656fc9f5e2e9c81895c7e614
<|skeleton|> class Create: """Creates one or more Cloud Pub/Sub subscriptions. Creates one or more Cloud Pub/Sub subscriptions for a given topic. The new subscription defaults to a PULL subscription unless a push endpoint is specified.""" def Args(parser): """Registers flags for this command.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Create: """Creates one or more Cloud Pub/Sub subscriptions. Creates one or more Cloud Pub/Sub subscriptions for a given topic. The new subscription defaults to a PULL subscription unless a push endpoint is specified.""" def Args(parser): """Registers flags for this command.""" parser.add_...
the_stack_v2_python_sparse
google-cloud-sdk/lib/googlecloudsdk/surface/pubsub/subscriptions/create.py
twistedpair/google-cloud-sdk
train
58
60e4265de925264bd28dd173ee95d1bb24b61860
[ "self.X_val = X_val\nself.Y_val = Y_val\nself.p = np.shape(self.X_val)[1]\nself.b = b\nself.n_jobs = n_jobs\nself.n_classes = n_classes", "primitive_idx = list(range(self.p))\nfeature_combinations = []\nfor comb in itertools.combinations(primitive_idx, cardinality):\n feature_combinations.append(comb)\nreturn ...
<|body_start_0|> self.X_val = X_val self.Y_val = Y_val self.p = np.shape(self.X_val)[1] self.b = b self.n_jobs = n_jobs self.n_classes = n_classes <|end_body_0|> <|body_start_1|> primitive_idx = list(range(self.p)) feature_combinations = [] for co...
A class to synthesize heuristics from primitives and validation labels
Synthesizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Synthesizer: """A class to synthesize heuristics from primitives and validation labels""" def __init__(self, X_val, Y_val, n_classes, b=0.5, n_jobs=4): """Initialize Synthesizer object b: class prior of most likely class beta: threshold to decide whether to abstain or label for heuri...
stack_v2_sparse_classes_75kplus_train_004422
5,326
permissive
[ { "docstring": "Initialize Synthesizer object b: class prior of most likely class beta: threshold to decide whether to abstain or label for heuristics", "name": "__init__", "signature": "def __init__(self, X_val, Y_val, n_classes, b=0.5, n_jobs=4)" }, { "docstring": "Create a list of primitive i...
6
stack_v2_sparse_classes_30k_train_022009
Implement the Python class `Synthesizer` described below. Class description: A class to synthesize heuristics from primitives and validation labels Method signatures and docstrings: - def __init__(self, X_val, Y_val, n_classes, b=0.5, n_jobs=4): Initialize Synthesizer object b: class prior of most likely class beta: ...
Implement the Python class `Synthesizer` described below. Class description: A class to synthesize heuristics from primitives and validation labels Method signatures and docstrings: - def __init__(self, X_val, Y_val, n_classes, b=0.5, n_jobs=4): Initialize Synthesizer object b: class prior of most likely class beta: ...
8dc539f38b70c10922a8dedce4654e7eaf95b099
<|skeleton|> class Synthesizer: """A class to synthesize heuristics from primitives and validation labels""" def __init__(self, X_val, Y_val, n_classes, b=0.5, n_jobs=4): """Initialize Synthesizer object b: class prior of most likely class beta: threshold to decide whether to abstain or label for heuri...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Synthesizer: """A class to synthesize heuristics from primitives and validation labels""" def __init__(self, X_val, Y_val, n_classes, b=0.5, n_jobs=4): """Initialize Synthesizer object b: class prior of most likely class beta: threshold to decide whether to abstain or label for heuristics""" ...
the_stack_v2_python_sparse
program_synthesis/synthesizer.py
jgonsior/reef
train
0
7c27759445faf330fb4ce6dcfcf783e17fbf6914
[ "if type(obj) != sidecarclient.v2.client.Client:\n raise exception.NotSupported('Not an instance of sidecarclient.')\nself._obj = obj", "self._obj.authenticate()\nheaders = {'X-Auth-Token': self._obj.authenticated_token}\nurl = self._obj.sidecar_url\ndata = self._obj.http.get(url, headers)\nresult = []\nfor ve...
<|body_start_0|> if type(obj) != sidecarclient.v2.client.Client: raise exception.NotSupported('Not an instance of sidecarclient.') self._obj = obj <|end_body_0|> <|body_start_1|> self._obj.authenticate() headers = {'X-Auth-Token': self._obj.authenticated_token} url =...
class to connect to version service
VersionsHttp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersionsHttp: """class to connect to version service""" def __init__(self, obj): """# | Initialization function to connect to version api # | # | Arguments: # | <obj>: instance of sidecarclient.v2.client.Client: # | # | Returns: None""" <|body_0|> def list(self): ...
stack_v2_sparse_classes_75kplus_train_004423
3,022
no_license
[ { "docstring": "# | Initialization function to connect to version api # | # | Arguments: # | <obj>: instance of sidecarclient.v2.client.Client: # | # | Returns: None", "name": "__init__", "signature": "def __init__(self, obj)" }, { "docstring": "# | Function to list the versions # | # | Argument...
2
null
Implement the Python class `VersionsHttp` described below. Class description: class to connect to version service Method signatures and docstrings: - def __init__(self, obj): # | Initialization function to connect to version api # | # | Arguments: # | <obj>: instance of sidecarclient.v2.client.Client: # | # | Returns...
Implement the Python class `VersionsHttp` described below. Class description: class to connect to version service Method signatures and docstrings: - def __init__(self, obj): # | Initialization function to connect to version api # | # | Arguments: # | <obj>: instance of sidecarclient.v2.client.Client: # | # | Returns...
b9bf4b6a8aebfe127244369f5d59412f9f913ec1
<|skeleton|> class VersionsHttp: """class to connect to version service""" def __init__(self, obj): """# | Initialization function to connect to version api # | # | Arguments: # | <obj>: instance of sidecarclient.v2.client.Client: # | # | Returns: None""" <|body_0|> def list(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VersionsHttp: """class to connect to version service""" def __init__(self, obj): """# | Initialization function to connect to version api # | # | Arguments: # | <obj>: instance of sidecarclient.v2.client.Client: # | # | Returns: None""" if type(obj) != sidecarclient.v2.client.Client: ...
the_stack_v2_python_sparse
python-sidecarclient/sidecarclient/v2/versions.py
binoymvas/rallyboard
train
0
b07a0bf81931f815f463491ffff90fedaf381742
[ "ui = os.path.join(_config.get_data_path(), 'ui', 'SeleccionAlumnos.ui')\nif not os.path.exists(ui):\n ui = None\nif stand_alone:\n top_widget = 'seleccion_alumnos'\nelse:\n top_widget = 'sw_scroller'\nView.__init__(self, builder=ui, parent=parent, top=top_widget)\nreturn", "res = self['seleccion_alumnos...
<|body_start_0|> ui = os.path.join(_config.get_data_path(), 'ui', 'SeleccionAlumnos.ui') if not os.path.exists(ui): ui = None if stand_alone: top_widget = 'seleccion_alumnos' else: top_widget = 'sw_scroller' View.__init__(self, builder=ui, pare...
BancoView handles only the graphical representation of the application. The widgets set is loaded from a glade file. Public methods: run()
SeleccionAlumnosView
[ "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SeleccionAlumnosView: """BancoView handles only the graphical representation of the application. The widgets set is loaded from a glade file. Public methods: run()""" def __init__(self, parent=None, stand_alone=True): """Constructor for AlumnoView reads a graphical representation of ...
stack_v2_sparse_classes_75kplus_train_004424
1,559
permissive
[ { "docstring": "Constructor for AlumnoView reads a graphical representation of the view from a glade file. parent: The name of the window that spawned this one stand_alone: If true, this view is a window unto itself. If not, it is embedded in another window.", "name": "__init__", "signature": "def __ini...
2
stack_v2_sparse_classes_30k_train_029844
Implement the Python class `SeleccionAlumnosView` described below. Class description: BancoView handles only the graphical representation of the application. The widgets set is loaded from a glade file. Public methods: run() Method signatures and docstrings: - def __init__(self, parent=None, stand_alone=True): Constr...
Implement the Python class `SeleccionAlumnosView` described below. Class description: BancoView handles only the graphical representation of the application. The widgets set is loaded from a glade file. Public methods: run() Method signatures and docstrings: - def __init__(self, parent=None, stand_alone=True): Constr...
1ec22552a3bd3e46dd3d647d007424f5a355f0ff
<|skeleton|> class SeleccionAlumnosView: """BancoView handles only the graphical representation of the application. The widgets set is loaded from a glade file. Public methods: run()""" def __init__(self, parent=None, stand_alone=True): """Constructor for AlumnoView reads a graphical representation of ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SeleccionAlumnosView: """BancoView handles only the graphical representation of the application. The widgets set is loaded from a glade file. Public methods: run()""" def __init__(self, parent=None, stand_alone=True): """Constructor for AlumnoView reads a graphical representation of the view from...
the_stack_v2_python_sparse
gestionacademia/views/seleccionalumnos_view.py
jonlatorre/gestionacademia
train
1
b7b0d77b10ec7cba0911310c7ef4ff76b4dbfc75
[ "parser = make_paged_search_parser()\nargs = parser.parse_args()\nif args['limit'] is None:\n limit = 4\nelse:\n limit = args['limit']\nif args['name'] is not None:\n customers, total_count = models.Customer.load_by_name(args['name'], args['page'], limit)\nelse:\n customers, total_count = models.Custome...
<|body_start_0|> parser = make_paged_search_parser() args = parser.parse_args() if args['limit'] is None: limit = 4 else: limit = args['limit'] if args['name'] is not None: customers, total_count = models.Customer.load_by_name(args['name'], arg...
Operations related to the list of customers.
CustomerList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomerList: """Operations related to the list of customers.""" def get(self): """Get the list of all customers, possibly filtered by name""" <|body_0|> def post(self): """Create a new customer""" <|body_1|> <|end_skeleton|> <|body_start_0|> pa...
stack_v2_sparse_classes_75kplus_train_004425
3,912
no_license
[ { "docstring": "Get the list of all customers, possibly filtered by name", "name": "get", "signature": "def get(self)" }, { "docstring": "Create a new customer", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_013293
Implement the Python class `CustomerList` described below. Class description: Operations related to the list of customers. Method signatures and docstrings: - def get(self): Get the list of all customers, possibly filtered by name - def post(self): Create a new customer
Implement the Python class `CustomerList` described below. Class description: Operations related to the list of customers. Method signatures and docstrings: - def get(self): Get the list of all customers, possibly filtered by name - def post(self): Create a new customer <|skeleton|> class CustomerList: """Operat...
ab874354e94e789fbea090f29e507fca2223284d
<|skeleton|> class CustomerList: """Operations related to the list of customers.""" def get(self): """Get the list of all customers, possibly filtered by name""" <|body_0|> def post(self): """Create a new customer""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomerList: """Operations related to the list of customers.""" def get(self): """Get the list of all customers, possibly filtered by name""" parser = make_paged_search_parser() args = parser.parse_args() if args['limit'] is None: limit = 4 else: ...
the_stack_v2_python_sparse
app/apis/customer_api.py
TheWinch/flask-tuto
train
0
dfa701858419849bdcd76451123b7b224635bba0
[ "if crn is None:\n raise ValueError('crn must be provided')\nif zone_id is None:\n raise ValueError('zone_id must be provided')\nauthenticator = get_authenticator_from_environment(service_name)\nservice = cls(crn, zone_id, authenticator)\nservice.configure_service(service_name)\nreturn service", "if crn is ...
<|body_start_0|> if crn is None: raise ValueError('crn must be provided') if zone_id is None: raise ValueError('zone_id must be provided') authenticator = get_authenticator_from_environment(service_name) service = cls(crn, zone_id, authenticator) service.c...
The Security Events API V1 service.
SecurityEventsApiV1
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecurityEventsApiV1: """The Security Events API V1 service.""" def new_instance(cls, crn: str, zone_id: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'SecurityEventsApiV1': """Return a new client for the Security Events API service using the specified parameters and external config...
stack_v2_sparse_classes_75kplus_train_004426
39,687
permissive
[ { "docstring": "Return a new client for the Security Events API service using the specified parameters and external configuration. :param str crn: Full url-encoded cloud resource name (CRN) of resource instance. :param str zone_id: zone identifier.", "name": "new_instance", "signature": "def new_instanc...
3
stack_v2_sparse_classes_30k_train_001318
Implement the Python class `SecurityEventsApiV1` described below. Class description: The Security Events API V1 service. Method signatures and docstrings: - def new_instance(cls, crn: str, zone_id: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'SecurityEventsApiV1': Return a new client for the Security Events API s...
Implement the Python class `SecurityEventsApiV1` described below. Class description: The Security Events API V1 service. Method signatures and docstrings: - def new_instance(cls, crn: str, zone_id: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'SecurityEventsApiV1': Return a new client for the Security Events API s...
7eed5185f1e93a57e43d0d7a1e83ee8c708179e0
<|skeleton|> class SecurityEventsApiV1: """The Security Events API V1 service.""" def new_instance(cls, crn: str, zone_id: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'SecurityEventsApiV1': """Return a new client for the Security Events API service using the specified parameters and external config...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SecurityEventsApiV1: """The Security Events API V1 service.""" def new_instance(cls, crn: str, zone_id: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'SecurityEventsApiV1': """Return a new client for the Security Events API service using the specified parameters and external configuration. :par...
the_stack_v2_python_sparse
ibm_cloud_networking_services/security_events_api_v1.py
mauriceDevsM/networking-python-sdk
train
0
6b2c4143a80df5931e14f92675e9c4bdb2ab2741
[ "super(Transformer, self).__init__()\nself.embedding = fc_block(input_dim, output_dim, activation=activation)\nself.act = activation\nlayers = []\ndims = [output_dim] + [output_dim] * layer_num\nself.dropout = nn.Dropout(dropout_ratio)\nfor i in range(layer_num):\n layers.append(TransformerLayer(dims[i], head_di...
<|body_start_0|> super(Transformer, self).__init__() self.embedding = fc_block(input_dim, output_dim, activation=activation) self.act = activation layers = [] dims = [output_dim] + [output_dim] * layer_num self.dropout = nn.Dropout(dropout_ratio) for i in range(la...
Overview: Transformer implementation .. note:: For details refer to Attention is all you need: http://arxiv.org/abs/1706.03762
Transformer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transformer: """Overview: Transformer implementation .. note:: For details refer to Attention is all you need: http://arxiv.org/abs/1706.03762""" def __init__(self, input_dim: int, head_dim: int=128, hidden_dim: int=1024, output_dim: int=256, head_num: int=2, mlp_num: int=2, layer_num: int=3...
stack_v2_sparse_classes_75kplus_train_004427
8,556
permissive
[ { "docstring": "Overview: Init transformer Arguments: - input_dim (:obj:`int`): dimension of input - head_dim (:obj:`int`): dimension of each head - hidden_dim (:obj:`int`): dimension of hidden layer in mlp - output_dim (:obj:`int`): dimension of output - head_num (:obj:`int`): number of heads for multihead att...
2
stack_v2_sparse_classes_30k_train_037748
Implement the Python class `Transformer` described below. Class description: Overview: Transformer implementation .. note:: For details refer to Attention is all you need: http://arxiv.org/abs/1706.03762 Method signatures and docstrings: - def __init__(self, input_dim: int, head_dim: int=128, hidden_dim: int=1024, ou...
Implement the Python class `Transformer` described below. Class description: Overview: Transformer implementation .. note:: For details refer to Attention is all you need: http://arxiv.org/abs/1706.03762 Method signatures and docstrings: - def __init__(self, input_dim: int, head_dim: int=128, hidden_dim: int=1024, ou...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class Transformer: """Overview: Transformer implementation .. note:: For details refer to Attention is all you need: http://arxiv.org/abs/1706.03762""" def __init__(self, input_dim: int, head_dim: int=128, hidden_dim: int=1024, output_dim: int=256, head_num: int=2, mlp_num: int=2, layer_num: int=3...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Transformer: """Overview: Transformer implementation .. note:: For details refer to Attention is all you need: http://arxiv.org/abs/1706.03762""" def __init__(self, input_dim: int, head_dim: int=128, hidden_dim: int=1024, output_dim: int=256, head_num: int=2, mlp_num: int=2, layer_num: int=3, dropout_rat...
the_stack_v2_python_sparse
ding/torch_utils/network/transformer.py
shengxuesun/DI-engine
train
1
52b6c9907bd0c6c7db3b7d0b4b5111ca160427e3
[ "if not connections:\n raise ImproperlyConfigured('No defined connections, you need to specify at least one host.')\nself.connection_opts = connections\nself.connections = [c for c, opts in connections]\nself.orig_connections = tuple(self.connections)\nself.dead = PriorityQueue(len(self.connections))\nself.dead_...
<|body_start_0|> if not connections: raise ImproperlyConfigured('No defined connections, you need to specify at least one host.') self.connection_opts = connections self.connections = [c for c, opts in connections] self.orig_connections = tuple(self.connections) self....
Container holding the :class:`~elasticsearch.Connection` instances, managing the selection process (via a :class:`~elasticsearch.ConnectionSelector`) and dead connections. It's only interactions are with the :class:`~elasticsearch.Transport` class that drives all the actions within `ConnectionPool`. Initially connectio...
ConnectionPool
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConnectionPool: """Container holding the :class:`~elasticsearch.Connection` instances, managing the selection process (via a :class:`~elasticsearch.ConnectionSelector`) and dead connections. It's only interactions are with the :class:`~elasticsearch.Transport` class that drives all the actions wi...
stack_v2_sparse_classes_75kplus_train_004428
9,607
permissive
[ { "docstring": ":arg connections: list of tuples containing the :class:`~elasticsearch.Connection` instance and it's options :arg dead_timeout: number of seconds a connection should be retired for after a failure, increases on consecutive failures :arg timeout_cutoff: number of consecutive failures after which ...
5
null
Implement the Python class `ConnectionPool` described below. Class description: Container holding the :class:`~elasticsearch.Connection` instances, managing the selection process (via a :class:`~elasticsearch.ConnectionSelector`) and dead connections. It's only interactions are with the :class:`~elasticsearch.Transpor...
Implement the Python class `ConnectionPool` described below. Class description: Container holding the :class:`~elasticsearch.Connection` instances, managing the selection process (via a :class:`~elasticsearch.ConnectionSelector`) and dead connections. It's only interactions are with the :class:`~elasticsearch.Transpor...
7336c99c15f567db99f96394847f988e44851f9c
<|skeleton|> class ConnectionPool: """Container holding the :class:`~elasticsearch.Connection` instances, managing the selection process (via a :class:`~elasticsearch.ConnectionSelector`) and dead connections. It's only interactions are with the :class:`~elasticsearch.Transport` class that drives all the actions wi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConnectionPool: """Container holding the :class:`~elasticsearch.Connection` instances, managing the selection process (via a :class:`~elasticsearch.ConnectionSelector`) and dead connections. It's only interactions are with the :class:`~elasticsearch.Transport` class that drives all the actions within `Connect...
the_stack_v2_python_sparse
pkg/elastic-migration/elasticsearch1/connection_pool.py
control-center/serviced
train
94
52675f11717727d927da5c6306067d5337b50a78
[ "shape = tensor.get_shape()\naxis_to_shard = [s > partition_info.max_dim_size for s in shape]\nsplit_sizes_per_dim = []\nfor sharded, dim in zip(axis_to_shard, shape):\n dim = int(dim)\n split_sizes_per_dim.append([dim])\n if sharded:\n split_sizes = []\n num_shards = dim // partition_info.pa...
<|body_start_0|> shape = tensor.get_shape() axis_to_shard = [s > partition_info.max_dim_size for s in shape] split_sizes_per_dim = [] for sharded, dim in zip(axis_to_shard, shape): dim = int(dim) split_sizes_per_dim.append([dim]) if sharded: ...
Shards Tensor's across its axis. In cases of TPUs, these partitions are zero cost, and does not involve data movement.
TensorPartitioner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TensorPartitioner: """Shards Tensor's across its axis. In cases of TPUs, these partitions are zero cost, and does not involve data movement.""" def partition_metadata(cls, tensor, partition_info): """Returns metadata required for partitioning and reforming tensors. Args: tensor: Tens...
stack_v2_sparse_classes_75kplus_train_004429
27,917
permissive
[ { "docstring": "Returns metadata required for partitioning and reforming tensors. Args: tensor: Tensor to partition. partition_info: Partitioning info. Returns: split_sizes_per_dim and num_splits_per_dim.", "name": "partition_metadata", "signature": "def partition_metadata(cls, tensor, partition_info)" ...
3
stack_v2_sparse_classes_30k_train_015310
Implement the Python class `TensorPartitioner` described below. Class description: Shards Tensor's across its axis. In cases of TPUs, these partitions are zero cost, and does not involve data movement. Method signatures and docstrings: - def partition_metadata(cls, tensor, partition_info): Returns metadata required f...
Implement the Python class `TensorPartitioner` described below. Class description: Shards Tensor's across its axis. In cases of TPUs, these partitions are zero cost, and does not involve data movement. Method signatures and docstrings: - def partition_metadata(cls, tensor, partition_info): Returns metadata required f...
c00a74b260fcf6ba11199cc4a340c127d6616479
<|skeleton|> class TensorPartitioner: """Shards Tensor's across its axis. In cases of TPUs, these partitions are zero cost, and does not involve data movement.""" def partition_metadata(cls, tensor, partition_info): """Returns metadata required for partitioning and reforming tensors. Args: tensor: Tens...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TensorPartitioner: """Shards Tensor's across its axis. In cases of TPUs, these partitions are zero cost, and does not involve data movement.""" def partition_metadata(cls, tensor, partition_info): """Returns metadata required for partitioning and reforming tensors. Args: tensor: Tensor to partiti...
the_stack_v2_python_sparse
lingvo/core/distributed_shampoo.py
tensorflow/lingvo
train
2,963
1c98db9cb028c5e321b2b1e8c3fddf3ae72dd1a7
[ "for col_index in range(len(self._table.col_names) + 1):\n self._stream.write(self.renderer.define_col_header(col_index, self.style))\nself._stream.write('<thead>\\n<row>\\n')\nself._stream.write('<entry></entry>\\n')\nfor col_name in self._table.col_names:\n self._stream.write(self.renderer.render_col_cell(c...
<|body_start_0|> for col_index in range(len(self._table.col_names) + 1): self._stream.write(self.renderer.define_col_header(col_index, self.style)) self._stream.write('<thead>\n<row>\n') self._stream.write('<entry></entry>\n') for col_name in self._table.col_names: ...
Defines an implementation of TableWriter to write a table in Docbook
DocbookTableWriter
[ "GPL-2.0-only", "GPL-1.0-or-later", "MIT", "LGPL-2.0-or-later", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DocbookTableWriter: """Defines an implementation of TableWriter to write a table in Docbook""" def _write_headers(self): """Writes col headers""" <|body_0|> def _write_body(self): """Writes the table body""" <|body_1|> def write_table(self, title='')...
stack_v2_sparse_classes_75kplus_train_004430
31,408
permissive
[ { "docstring": "Writes col headers", "name": "_write_headers", "signature": "def _write_headers(self)" }, { "docstring": "Writes the table body", "name": "_write_body", "signature": "def _write_body(self)" }, { "docstring": "Writes the table", "name": "write_table", "sign...
3
null
Implement the Python class `DocbookTableWriter` described below. Class description: Defines an implementation of TableWriter to write a table in Docbook Method signatures and docstrings: - def _write_headers(self): Writes col headers - def _write_body(self): Writes the table body - def write_table(self, title=''): Wr...
Implement the Python class `DocbookTableWriter` described below. Class description: Defines an implementation of TableWriter to write a table in Docbook Method signatures and docstrings: - def _write_headers(self): Writes col headers - def _write_body(self): Writes the table body - def write_table(self, title=''): Wr...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class DocbookTableWriter: """Defines an implementation of TableWriter to write a table in Docbook""" def _write_headers(self): """Writes col headers""" <|body_0|> def _write_body(self): """Writes the table body""" <|body_1|> def write_table(self, title='')...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DocbookTableWriter: """Defines an implementation of TableWriter to write a table in Docbook""" def _write_headers(self): """Writes col headers""" for col_index in range(len(self._table.col_names) + 1): self._stream.write(self.renderer.define_col_header(col_index, self.style)) ...
the_stack_v2_python_sparse
third_party/logilab/logilab/common/table.py
chromium/chromium
train
17,408
ea1ae3cc888dfda6f49cce7de88b363d1696cdbb
[ "self.a = a\nself.b = b\nself.c = c\nself.d = d", "v = self.c\nu = self.d\ni = 0\nmonitor = {'v': [], 'u': []}\nfor t in range(int(time / dt)):\n du = self.a * (self.b * v - u)\n u += du * dt\n monitor['u'].append(u)\n dv = 0.04 * v ** 2 + 5 * v + 140 - u + inputs[t]\n v += dv * dt\n monitor['v'...
<|body_start_0|> self.a = a self.b = b self.c = c self.d = d <|end_body_0|> <|body_start_1|> v = self.c u = self.d i = 0 monitor = {'v': [], 'u': []} for t in range(int(time / dt)): du = self.a * (self.b * v - u) u += du * ...
Izhikevich
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Izhikevich: def __init__(self, a, b, c, d): """Izhikevich neuron model :param a: uのスケーリング係数 :param b: vに対するuの感受性度合い :param c: 静止膜電位 :param d: 発火後の膜電位が落ち着くまでを司る係数""" <|body_0|> def calc(self, inputs, time=300, dt=0.5, tci=10): """膜電位(Membrane potential) v と回復変数(Recove...
stack_v2_sparse_classes_75kplus_train_004431
2,825
permissive
[ { "docstring": "Izhikevich neuron model :param a: uのスケーリング係数 :param b: vに対するuの感受性度合い :param c: 静止膜電位 :param d: 発火後の膜電位が落ち着くまでを司る係数", "name": "__init__", "signature": "def __init__(self, a, b, c, d)" }, { "docstring": "膜電位(Membrane potential) v と回復変数(Recovery variable) u を計算する :param inputs: :par...
2
stack_v2_sparse_classes_30k_train_022124
Implement the Python class `Izhikevich` described below. Class description: Implement the Izhikevich class. Method signatures and docstrings: - def __init__(self, a, b, c, d): Izhikevich neuron model :param a: uのスケーリング係数 :param b: vに対するuの感受性度合い :param c: 静止膜電位 :param d: 発火後の膜電位が落ち着くまでを司る係数 - def calc(self, inputs, ti...
Implement the Python class `Izhikevich` described below. Class description: Implement the Izhikevich class. Method signatures and docstrings: - def __init__(self, a, b, c, d): Izhikevich neuron model :param a: uのスケーリング係数 :param b: vに対するuの感受性度合い :param c: 静止膜電位 :param d: 発火後の膜電位が落ち着くまでを司る係数 - def calc(self, inputs, ti...
e26e7ce2bbebaa35ad3e325c09f05c334d753049
<|skeleton|> class Izhikevich: def __init__(self, a, b, c, d): """Izhikevich neuron model :param a: uのスケーリング係数 :param b: vに対するuの感受性度合い :param c: 静止膜電位 :param d: 発火後の膜電位が落ち着くまでを司る係数""" <|body_0|> def calc(self, inputs, time=300, dt=0.5, tci=10): """膜電位(Membrane potential) v と回復変数(Recove...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Izhikevich: def __init__(self, a, b, c, d): """Izhikevich neuron model :param a: uのスケーリング係数 :param b: vに対するuの感受性度合い :param c: 静止膜電位 :param d: 発火後の膜電位が落ち着くまでを司る係数""" self.a = a self.b = b self.c = c self.d = d def calc(self, inputs, time=300, dt=0.5, tci=10): ...
the_stack_v2_python_sparse
codes/s3-4_IZH.py
ttt496/snn_from_scratch
train
0
bea0d5a6205c1636270eccea38224e80648d6941
[ "super(DecoderLayer, self).__init__()\nself.size = size\nself.self_attn = self_attn\nself.src_attn = src_attn\nself.feed_forward = feed_forward\nself.sublayer = clones(SublayerConnection(size, dropout), 3)", "m = memory\n'\\n 将x传入第一个子层结构,第一个子层结构的输入分别是x和self_attn函数,因为是自注意力机制,所以Q,K,V相等\\n target_mask是...
<|body_start_0|> super(DecoderLayer, self).__init__() self.size = size self.self_attn = self_attn self.src_attn = src_attn self.feed_forward = feed_forward self.sublayer = clones(SublayerConnection(size, dropout), 3) <|end_body_0|> <|body_start_1|> m = memory ...
DecoderLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderLayer: def __init__(self, size, self_attn, src_attn, feed_forward, dropout): """:param size: 词嵌入的维度大小 :param self_attn: 多头自注意力对象,Q=K=V :param src_attn: 多头注意力对象,Q!=K=V :param feed_forward: 前馈全连接层对象 :param dropout: 置0比率""" <|body_0|> def forward(self, x, memory, source_...
stack_v2_sparse_classes_75kplus_train_004432
15,718
no_license
[ { "docstring": ":param size: 词嵌入的维度大小 :param self_attn: 多头自注意力对象,Q=K=V :param src_attn: 多头注意力对象,Q!=K=V :param feed_forward: 前馈全连接层对象 :param dropout: 置0比率", "name": "__init__", "signature": "def __init__(self, size, self_attn, src_attn, feed_forward, dropout)" }, { "docstring": ":param x: 上一层输入 :...
2
stack_v2_sparse_classes_30k_train_007739
Implement the Python class `DecoderLayer` described below. Class description: Implement the DecoderLayer class. Method signatures and docstrings: - def __init__(self, size, self_attn, src_attn, feed_forward, dropout): :param size: 词嵌入的维度大小 :param self_attn: 多头自注意力对象,Q=K=V :param src_attn: 多头注意力对象,Q!=K=V :param feed_f...
Implement the Python class `DecoderLayer` described below. Class description: Implement the DecoderLayer class. Method signatures and docstrings: - def __init__(self, size, self_attn, src_attn, feed_forward, dropout): :param size: 词嵌入的维度大小 :param self_attn: 多头自注意力对象,Q=K=V :param src_attn: 多头注意力对象,Q!=K=V :param feed_f...
9d1f87a51eea48314d454f84c486d29352eb5b13
<|skeleton|> class DecoderLayer: def __init__(self, size, self_attn, src_attn, feed_forward, dropout): """:param size: 词嵌入的维度大小 :param self_attn: 多头自注意力对象,Q=K=V :param src_attn: 多头注意力对象,Q!=K=V :param feed_forward: 前馈全连接层对象 :param dropout: 置0比率""" <|body_0|> def forward(self, x, memory, source_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DecoderLayer: def __init__(self, size, self_attn, src_attn, feed_forward, dropout): """:param size: 词嵌入的维度大小 :param self_attn: 多头自注意力对象,Q=K=V :param src_attn: 多头注意力对象,Q!=K=V :param feed_forward: 前馈全连接层对象 :param dropout: 置0比率""" super(DecoderLayer, self).__init__() self.size = size ...
the_stack_v2_python_sparse
DeepLearning/Transformer/transformer.py
pxz97/AlgorithmsByPython
train
1
858f150665dd962cd11925133091c9ab8f6712c3
[ "self.facts = facts_string\nself.obj_type_map = obj_type_map\nself.domain_name = domain_name\nself.problem_name = problem_name", "ori_obj_name = object_name\nif object_name:\n object_name = object_name.upper()\n for obj in self.obj_type_map.keys():\n if obj.upper() == object_name:\n ori_ob...
<|body_start_0|> self.facts = facts_string self.obj_type_map = obj_type_map self.domain_name = domain_name self.problem_name = problem_name <|end_body_0|> <|body_start_1|> ori_obj_name = object_name if object_name: object_name = object_name.upper() ...
PddlFactsRepresentation
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PddlFactsRepresentation: def __init__(self, facts_string, obj_type_map, domain_name, problem_name): """This is the representation of the pddl facts file (not completed yet.) :param facts_string: The facts file content as string. :param obj_type_map: A map, containing all objects with the...
stack_v2_sparse_classes_75kplus_train_004433
1,824
permissive
[ { "docstring": "This is the representation of the pddl facts file (not completed yet.) :param facts_string: The facts file content as string. :param obj_type_map: A map, containing all objects with their types. :param domain_name: The name of the domain the facts file is for. :param problem_name: The name of th...
2
stack_v2_sparse_classes_30k_train_031570
Implement the Python class `PddlFactsRepresentation` described below. Class description: Implement the PddlFactsRepresentation class. Method signatures and docstrings: - def __init__(self, facts_string, obj_type_map, domain_name, problem_name): This is the representation of the pddl facts file (not completed yet.) :p...
Implement the Python class `PddlFactsRepresentation` described below. Class description: Implement the PddlFactsRepresentation class. Method signatures and docstrings: - def __init__(self, facts_string, obj_type_map, domain_name, problem_name): This is the representation of the pddl facts file (not completed yet.) :p...
9d004c76aa6f54c992a2f3f00b9dd98f9fb4e498
<|skeleton|> class PddlFactsRepresentation: def __init__(self, facts_string, obj_type_map, domain_name, problem_name): """This is the representation of the pddl facts file (not completed yet.) :param facts_string: The facts file content as string. :param obj_type_map: A map, containing all objects with the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PddlFactsRepresentation: def __init__(self, facts_string, obj_type_map, domain_name, problem_name): """This is the representation of the pddl facts file (not completed yet.) :param facts_string: The facts file content as string. :param obj_type_map: A map, containing all objects with their types. :par...
the_stack_v2_python_sparse
source/rafcontpp/model/pddl_facts_representation.py
DLR-RM/rafcon-task-planner-plugin
train
1
b6880a38e4b3c47987ace83bf5be200767f17ec0
[ "self.name = name\nself.type = type\nself.label = label\nself.desc = desc\nself.default = default", "para = OrderedDict()\npara[self.TYPE] = self.type\nif self.type:\n para[self.TYPE] = self.type\nif self.desc:\n para[self.DESCRIPTION] = self.desc\nif self.default:\n para[self.DEFAULT] = self.default\nif...
<|body_start_0|> self.name = name self.type = type self.label = label self.desc = desc self.default = default <|end_body_0|> <|body_start_1|> para = OrderedDict() para[self.TYPE] = self.type if self.type: para[self.TYPE] = self.type if...
HOT Parameter Attr
Parameter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parameter: """HOT Parameter Attr""" def __init__(self, name, type, label=None, desc=None, default=None): """Init a HOT parameter""" <|body_0|> def get_output_dict(self): """Output a parameter as a nested dict""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_75kplus_train_004434
6,215
no_license
[ { "docstring": "Init a HOT parameter", "name": "__init__", "signature": "def __init__(self, name, type, label=None, desc=None, default=None)" }, { "docstring": "Output a parameter as a nested dict", "name": "get_output_dict", "signature": "def get_output_dict(self)" } ]
2
stack_v2_sparse_classes_30k_train_048234
Implement the Python class `Parameter` described below. Class description: HOT Parameter Attr Method signatures and docstrings: - def __init__(self, name, type, label=None, desc=None, default=None): Init a HOT parameter - def get_output_dict(self): Output a parameter as a nested dict
Implement the Python class `Parameter` described below. Class description: HOT Parameter Attr Method signatures and docstrings: - def __init__(self, name, type, label=None, desc=None, default=None): Init a HOT parameter - def get_output_dict(self): Output a parameter as a nested dict <|skeleton|> class Parameter: ...
103d9ffb67e98c6e912a5861b73ad0f06d9df80c
<|skeleton|> class Parameter: """HOT Parameter Attr""" def __init__(self, name, type, label=None, desc=None, default=None): """Init a HOT parameter""" <|body_0|> def get_output_dict(self): """Output a parameter as a nested dict""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Parameter: """HOT Parameter Attr""" def __init__(self, name, type, label=None, desc=None, default=None): """Init a HOT parameter""" self.name = name self.type = type self.label = label self.desc = desc self.default = default def get_output_dict(self): ...
the_stack_v2_python_sparse
sfc-ostack/sfcostack/hot.py
stevelorenz/sfc-ostack
train
4
23b81196b37b607013b6e1852735717c50722f2a
[ "sum_nnz = 0\nsum_total = 0\nfor name, mod in model.named_modules():\n if not isinstance(mod, nn.Conv2d):\n continue\n nnz, total = SparsityCalculator.get_sparsity(mod, threshold=threshold, level=level)\n sum_nnz += nnz\n sum_total += total\nreturn float(sum_nnz) / sum_total", "assert isinstanc...
<|body_start_0|> sum_nnz = 0 sum_total = 0 for name, mod in model.named_modules(): if not isinstance(mod, nn.Conv2d): continue nnz, total = SparsityCalculator.get_sparsity(mod, threshold=threshold, level=level) sum_nnz += nnz sum_to...
SparsityCalculator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparsityCalculator: def get_model_sparsity(model, threshold=1e-05, level=None): """Compute the total sparsity of a model""" <|body_0|> def get_sparsity(mod, threshold=1e-05, level=None): """Compute the sparsity of a module.""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_75kplus_train_004435
7,819
permissive
[ { "docstring": "Compute the total sparsity of a model", "name": "get_model_sparsity", "signature": "def get_model_sparsity(model, threshold=1e-05, level=None)" }, { "docstring": "Compute the sparsity of a module.", "name": "get_sparsity", "signature": "def get_sparsity(mod, threshold=1e-...
2
stack_v2_sparse_classes_30k_train_053447
Implement the Python class `SparsityCalculator` described below. Class description: Implement the SparsityCalculator class. Method signatures and docstrings: - def get_model_sparsity(model, threshold=1e-05, level=None): Compute the total sparsity of a model - def get_sparsity(mod, threshold=1e-05, level=None): Comput...
Implement the Python class `SparsityCalculator` described below. Class description: Implement the SparsityCalculator class. Method signatures and docstrings: - def get_model_sparsity(model, threshold=1e-05, level=None): Compute the total sparsity of a model - def get_sparsity(mod, threshold=1e-05, level=None): Comput...
f81c417d3754102c902bd153809130e12607bd7d
<|skeleton|> class SparsityCalculator: def get_model_sparsity(model, threshold=1e-05, level=None): """Compute the total sparsity of a model""" <|body_0|> def get_sparsity(mod, threshold=1e-05, level=None): """Compute the sparsity of a module.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SparsityCalculator: def get_model_sparsity(model, threshold=1e-05, level=None): """Compute the total sparsity of a model""" sum_nnz = 0 sum_total = 0 for name, mod in model.named_modules(): if not isinstance(mod, nn.Conv2d): continue nnz,...
the_stack_v2_python_sparse
evaluation/iccv19/profiling/profile_sparse_mobilenet.py
kumasento/gconv-prune
train
10
754b88db1faad91f1e753b5f1d54e74183ec3b24
[ "left, right = (0, len(nums) - 1)\nwhile left <= right:\n mid = left + (right - left) // 2\n if nums[mid] < target:\n left += 1\n else:\n right = mid - 1\nreturn left", "left, right = (0, len(nums) - 1)\nwhile left <= right:\n mid = left + (right - left) // 2\n if nums[mid] == target:...
<|body_start_0|> left, right = (0, len(nums) - 1) while left <= right: mid = left + (right - left) // 2 if nums[mid] < target: left += 1 else: right = mid - 1 return left <|end_body_0|> <|body_start_1|> left, right = (0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchInsert(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def searchInsert_v2(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> def searchInsert_v3(self, n...
stack_v2_sparse_classes_75kplus_train_004436
2,458
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "searchInsert", "signature": "def searchInsert(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "searchInsert_v2", "signature": "def searchInsert_v2(self, nu...
3
stack_v2_sparse_classes_30k_train_013092
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def searchInsert_v2(self, nums, target): :type nums: List[int] :type target: int :rtyp...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def searchInsert_v2(self, nums, target): :type nums: List[int] :type target: int :rtyp...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def searchInsert(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def searchInsert_v2(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> def searchInsert_v3(self, n...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def searchInsert(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" left, right = (0, len(nums) - 1) while left <= right: mid = left + (right - left) // 2 if nums[mid] < target: left += 1 else: ...
the_stack_v2_python_sparse
src/lt_35.py
oxhead/CodingYourWay
train
0
eac81484174d4413508eb46c751fcbbdf228176a
[ "self.dice = Dice()\nself.money = 100\nself.interface = interface\nself.hi_scores = hi_scores\nself.played_once = False", "while self.money >= 10 and self.interface.wantToPlay():\n self.playRound()\nif self.played_once and self.hi_scores.is_top_ten(self.money):\n self.interface.enter_score(self.money)\nself...
<|body_start_0|> self.dice = Dice() self.money = 100 self.interface = interface self.hi_scores = hi_scores self.played_once = False <|end_body_0|> <|body_start_1|> while self.money >= 10 and self.interface.wantToPlay(): self.playRound() if self.played...
Play dice poker
PokerApp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PokerApp: """Play dice poker""" def __init__(self, interface, hi_scores): """Initialize dice, money, and interface (could be text or GUI) :param interface: obj -> interface object :param hi_scores: obj -> high scores object""" <|body_0|> def run(self): """Runs ga...
stack_v2_sparse_classes_75kplus_train_004437
1,931
no_license
[ { "docstring": "Initialize dice, money, and interface (could be text or GUI) :param interface: obj -> interface object :param hi_scores: obj -> high scores object", "name": "__init__", "signature": "def __init__(self, interface, hi_scores)" }, { "docstring": "Runs game continuously until quit or...
4
stack_v2_sparse_classes_30k_train_052651
Implement the Python class `PokerApp` described below. Class description: Play dice poker Method signatures and docstrings: - def __init__(self, interface, hi_scores): Initialize dice, money, and interface (could be text or GUI) :param interface: obj -> interface object :param hi_scores: obj -> high scores object - d...
Implement the Python class `PokerApp` described below. Class description: Play dice poker Method signatures and docstrings: - def __init__(self, interface, hi_scores): Initialize dice, money, and interface (could be text or GUI) :param interface: obj -> interface object :param hi_scores: obj -> high scores object - d...
6588c0ebfa932fbae7eec11c20270e4a8e969377
<|skeleton|> class PokerApp: """Play dice poker""" def __init__(self, interface, hi_scores): """Initialize dice, money, and interface (could be text or GUI) :param interface: obj -> interface object :param hi_scores: obj -> high scores object""" <|body_0|> def run(self): """Runs ga...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PokerApp: """Play dice poker""" def __init__(self, interface, hi_scores): """Initialize dice, money, and interface (could be text or GUI) :param interface: obj -> interface object :param hi_scores: obj -> high scores object""" self.dice = Dice() self.money = 100 self.inter...
the_stack_v2_python_sparse
Chapter12/U12_Ex01_DicePoker/pokerapp.py
billm79/COOP2018
train
3
c9a663c85bab3e44f79a3548d2329cc05a1271a0
[ "filter_parser = reqparse.RequestParser(bundle_errors=True)\nfilter_parser.add_argument('last_pk', type=int, default=0, location='args')\nfilter_parser.add_argument('limit_num', type=int, default=20, location='args')\nfilter_parser_args = filter_parser.parse_args()\ndata = get_inventory_limit_rows_by_last_id(**filt...
<|body_start_0|> filter_parser = reqparse.RequestParser(bundle_errors=True) filter_parser.add_argument('last_pk', type=int, default=0, location='args') filter_parser.add_argument('limit_num', type=int, default=20, location='args') filter_parser_args = filter_parser.parse_args() d...
InventoryListResource
InventoryListResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InventoryListResource: """InventoryListResource""" def get(self): """Example: curl http://0.0.0.0:5000/bearings/inventories curl http://0.0.0.0:5000/bearings/inventories?last_pk=2&limit_num=2 :return:""" <|body_0|> def post(self): """Example: curl http://0.0.0.0:...
stack_v2_sparse_classes_75kplus_train_004438
5,543
permissive
[ { "docstring": "Example: curl http://0.0.0.0:5000/bearings/inventories curl http://0.0.0.0:5000/bearings/inventories?last_pk=2&limit_num=2 :return:", "name": "get", "signature": "def get(self)" }, { "docstring": "Example: curl http://0.0.0.0:5000/bearings/inventories -H \"Content-Type: applicati...
2
stack_v2_sparse_classes_30k_val_001090
Implement the Python class `InventoryListResource` described below. Class description: InventoryListResource Method signatures and docstrings: - def get(self): Example: curl http://0.0.0.0:5000/bearings/inventories curl http://0.0.0.0:5000/bearings/inventories?last_pk=2&limit_num=2 :return: - def post(self): Example:...
Implement the Python class `InventoryListResource` described below. Class description: InventoryListResource Method signatures and docstrings: - def get(self): Example: curl http://0.0.0.0:5000/bearings/inventories curl http://0.0.0.0:5000/bearings/inventories?last_pk=2&limit_num=2 :return: - def post(self): Example:...
6ef54f3f7efbbaff6169e963dcf45ab25e11e593
<|skeleton|> class InventoryListResource: """InventoryListResource""" def get(self): """Example: curl http://0.0.0.0:5000/bearings/inventories curl http://0.0.0.0:5000/bearings/inventories?last_pk=2&limit_num=2 :return:""" <|body_0|> def post(self): """Example: curl http://0.0.0.0:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InventoryListResource: """InventoryListResource""" def get(self): """Example: curl http://0.0.0.0:5000/bearings/inventories curl http://0.0.0.0:5000/bearings/inventories?last_pk=2&limit_num=2 :return:""" filter_parser = reqparse.RequestParser(bundle_errors=True) filter_parser.add_...
the_stack_v2_python_sparse
web_api/bearings/resources/inventory.py
zhanghe06/flask_restful
train
2
5d9f5c27ef0f9d544442a5badcfeb063303af604
[ "mins = total_data() / 60\nhours = mins / 60\nnum_sources = len(amounts_recorded_by_device())\naverage_mins = mins / num_sources\naverage_hours = hours / num_sources\nreport = f'{hours:0.1f} hours total across {num_sources} sources - {average_hours:0.1f} hours (or {average_mins:0.0f}) mins per source on average.'\n...
<|body_start_0|> mins = total_data() / 60 hours = mins / 60 num_sources = len(amounts_recorded_by_device()) average_mins = mins / num_sources average_hours = hours / num_sources report = f'{hours:0.1f} hours total across {num_sources} sources - {average_hours:0.1f} hours ...
NoiseActions
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoiseActions: def report_noise_recorded() -> None: """Pop a notification showing the total amount of noise recorded.""" <|body_0|> def delete_last_noise_recording() -> None: """Delete the previous recording session (across all devices).""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus_train_004439
20,408
permissive
[ { "docstring": "Pop a notification showing the total amount of noise recorded.", "name": "report_noise_recorded", "signature": "def report_noise_recorded() -> None" }, { "docstring": "Delete the previous recording session (across all devices).", "name": "delete_last_noise_recording", "si...
2
stack_v2_sparse_classes_30k_train_022202
Implement the Python class `NoiseActions` described below. Class description: Implement the NoiseActions class. Method signatures and docstrings: - def report_noise_recorded() -> None: Pop a notification showing the total amount of noise recorded. - def delete_last_noise_recording() -> None: Delete the previous recor...
Implement the Python class `NoiseActions` described below. Class description: Implement the NoiseActions class. Method signatures and docstrings: - def report_noise_recorded() -> None: Pop a notification showing the total amount of noise recorded. - def delete_last_noise_recording() -> None: Delete the previous recor...
b5c1ec10207a66a04226abe865d694e3786dc30d
<|skeleton|> class NoiseActions: def report_noise_recorded() -> None: """Pop a notification showing the total amount of noise recorded.""" <|body_0|> def delete_last_noise_recording() -> None: """Delete the previous recording session (across all devices).""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NoiseActions: def report_noise_recorded() -> None: """Pop a notification showing the total amount of noise recorded.""" mins = total_data() / 60 hours = mins / 60 num_sources = len(amounts_recorded_by_device()) average_mins = mins / num_sources average_hours = h...
the_stack_v2_python_sparse
plugins/noise_recorder/noise_recorder.py
jcaw/talon_config
train
12
f92a88048a86e2361562e7306f88b32e983ab158
[ "if nums == []:\n return False\ntemp_count_0 = nums[-1]\ntemp_count_1 = min(nums)\nfor i in nums[:-1][::-1]:\n if i < temp_count_0:\n temp_count_1 = max(temp_count_1, i)\n if i > temp_count_0:\n temp_count_0 = i\n if i < temp_count_1:\n return True\nreturn False", "import sys\nif ...
<|body_start_0|> if nums == []: return False temp_count_0 = nums[-1] temp_count_1 = min(nums) for i in nums[:-1][::-1]: if i < temp_count_0: temp_count_1 = max(temp_count_1, i) if i > temp_count_0: temp_count_0 = i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def increasingTriplet(self, nums): """:type nums: List[int] :rtype: bool 42ms""" <|body_0|> def increasingTriplet_1(self, nums): """:type nums: List[int] :rtype: bool 35ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> if nums == []: ...
stack_v2_sparse_classes_75kplus_train_004440
1,462
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool 42ms", "name": "increasingTriplet", "signature": "def increasingTriplet(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool 35ms", "name": "increasingTriplet_1", "signature": "def increasingTriplet_1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_008048
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool 42ms - def increasingTriplet_1(self, nums): :type nums: List[int] :rtype: bool 35ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool 42ms - def increasingTriplet_1(self, nums): :type nums: List[int] :rtype: bool 35ms <|skeleton|> class Solu...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def increasingTriplet(self, nums): """:type nums: List[int] :rtype: bool 42ms""" <|body_0|> def increasingTriplet_1(self, nums): """:type nums: List[int] :rtype: bool 35ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def increasingTriplet(self, nums): """:type nums: List[int] :rtype: bool 42ms""" if nums == []: return False temp_count_0 = nums[-1] temp_count_1 = min(nums) for i in nums[:-1][::-1]: if i < temp_count_0: temp_count_1 = ...
the_stack_v2_python_sparse
IncreasingTripletSubsequence_MID_334.py
953250587/leetcode-python
train
2
6b44378f47e655cdd2e2de840859fccd852eb3df
[ "self._config = None\nif data_type:\n self._config = SimilarityScorerConfig(index_name, data_type)\nsuper().__init__(index_name, sketch_id, timeline_id=timeline_id)", "if not self._config:\n return 'No data_type specified.'\nevents = self.event_stream(query_string=self._config.query, return_fields=[self._co...
<|body_start_0|> self._config = None if data_type: self._config = SimilarityScorerConfig(index_name, data_type) super().__init__(index_name, sketch_id, timeline_id=timeline_id) <|end_body_0|> <|body_start_1|> if not self._config: return 'No data_type specified.' ...
Score events based on Jaccard distance.
SimilarityScorer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimilarityScorer: """Score events based on Jaccard distance.""" def __init__(self, index_name, sketch_id, timeline_id=None, data_type=None): """Initializes a similarity scorer. Args: index_name: OpenSearch index name. sketch_id: The ID of the sketch. timeline_id: The ID of the timeli...
stack_v2_sparse_classes_75kplus_train_004441
5,064
permissive
[ { "docstring": "Initializes a similarity scorer. Args: index_name: OpenSearch index name. sketch_id: The ID of the sketch. timeline_id: The ID of the timeline. data_type: Name of the data_type.", "name": "__init__", "signature": "def __init__(self, index_name, sketch_id, timeline_id=None, data_type=None...
2
stack_v2_sparse_classes_30k_train_018179
Implement the Python class `SimilarityScorer` described below. Class description: Score events based on Jaccard distance. Method signatures and docstrings: - def __init__(self, index_name, sketch_id, timeline_id=None, data_type=None): Initializes a similarity scorer. Args: index_name: OpenSearch index name. sketch_id...
Implement the Python class `SimilarityScorer` described below. Class description: Score events based on Jaccard distance. Method signatures and docstrings: - def __init__(self, index_name, sketch_id, timeline_id=None, data_type=None): Initializes a similarity scorer. Args: index_name: OpenSearch index name. sketch_id...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class SimilarityScorer: """Score events based on Jaccard distance.""" def __init__(self, index_name, sketch_id, timeline_id=None, data_type=None): """Initializes a similarity scorer. Args: index_name: OpenSearch index name. sketch_id: The ID of the sketch. timeline_id: The ID of the timeli...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimilarityScorer: """Score events based on Jaccard distance.""" def __init__(self, index_name, sketch_id, timeline_id=None, data_type=None): """Initializes a similarity scorer. Args: index_name: OpenSearch index name. sketch_id: The ID of the sketch. timeline_id: The ID of the timeline. data_type...
the_stack_v2_python_sparse
timesketch/lib/analyzers/similarity_scorer.py
google/timesketch
train
2,263
12c83a88cd59c8e8470f7c0f785c369cbe4cffbe
[ "Message.__init__(self, text)\nself.message_text = text\nself.valid_words = Message.get_valid_words(self)", "mins = 0\nmaxs = 26\nshift_tracker = 0\nmax_word = 0\npossible_shift = range(mins, maxs + 1)\nfor shift_guess in possible_shift:\n word_len = 0\n decrypt_guess = Message.apply_shift(self, shift_guess...
<|body_start_0|> Message.__init__(self, text) self.message_text = text self.valid_words = Message.get_valid_words(self) <|end_body_0|> <|body_start_1|> mins = 0 maxs = 26 shift_tracker = 0 max_word = 0 possible_shift = range(mins, maxs + 1) for sh...
CiphertextMessage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CiphertextMessage: def __init__(self, text): """Initializes a CiphertextMessage object text (string): the message's text a CiphertextMessage object has two attributes: self.message_text (string, determined by input text) self.valid_words (list, determined using helper function load_words...
stack_v2_sparse_classes_75kplus_train_004442
10,981
no_license
[ { "docstring": "Initializes a CiphertextMessage object text (string): the message's text a CiphertextMessage object has two attributes: self.message_text (string, determined by input text) self.valid_words (list, determined using helper function load_words)", "name": "__init__", "signature": "def __init...
2
stack_v2_sparse_classes_30k_train_017258
Implement the Python class `CiphertextMessage` described below. Class description: Implement the CiphertextMessage class. Method signatures and docstrings: - def __init__(self, text): Initializes a CiphertextMessage object text (string): the message's text a CiphertextMessage object has two attributes: self.message_t...
Implement the Python class `CiphertextMessage` described below. Class description: Implement the CiphertextMessage class. Method signatures and docstrings: - def __init__(self, text): Initializes a CiphertextMessage object text (string): the message's text a CiphertextMessage object has two attributes: self.message_t...
76605aa26fbf2c80ca7cf59307904021a403a787
<|skeleton|> class CiphertextMessage: def __init__(self, text): """Initializes a CiphertextMessage object text (string): the message's text a CiphertextMessage object has two attributes: self.message_text (string, determined by input text) self.valid_words (list, determined using helper function load_words...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CiphertextMessage: def __init__(self, text): """Initializes a CiphertextMessage object text (string): the message's text a CiphertextMessage object has two attributes: self.message_text (string, determined by input text) self.valid_words (list, determined using helper function load_words)""" M...
the_stack_v2_python_sparse
week5/ProblemSet5/ps6.py
EnthusiasticTeslim/MIT6.00.1x
train
0
42e73af0a8a0595994a59e3400f84348ec0959e1
[ "try:\n encounter: models.Encounter = models.Encounter.create_from_json(data=request.data, patient_profile=request.user.patient_profile)\nexcept custom_exceptions.DataForNewEncounterNotProvidedException as e:\n return response.Response(data=e.get_response_format(), status=status.HTTP_400_BAD_REQUEST)\nseriali...
<|body_start_0|> try: encounter: models.Encounter = models.Encounter.create_from_json(data=request.data, patient_profile=request.user.patient_profile) except custom_exceptions.DataForNewEncounterNotProvidedException as e: return response.Response(data=e.get_response_format(), sta...
Endpoints for Encounter objects.
EncountersEndpoint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncountersEndpoint: """Endpoints for Encounter objects.""" def post(self, request: Request) -> response.Response: """Adds a new encounter for the user.""" <|body_0|> def put(self, request: Request) -> response.Response: """Updates an existing encounter.""" ...
stack_v2_sparse_classes_75kplus_train_004443
14,860
no_license
[ { "docstring": "Adds a new encounter for the user.", "name": "post", "signature": "def post(self, request: Request) -> response.Response" }, { "docstring": "Updates an existing encounter.", "name": "put", "signature": "def put(self, request: Request) -> response.Response" }, { "d...
3
stack_v2_sparse_classes_30k_train_019092
Implement the Python class `EncountersEndpoint` described below. Class description: Endpoints for Encounter objects. Method signatures and docstrings: - def post(self, request: Request) -> response.Response: Adds a new encounter for the user. - def put(self, request: Request) -> response.Response: Updates an existing...
Implement the Python class `EncountersEndpoint` described below. Class description: Endpoints for Encounter objects. Method signatures and docstrings: - def post(self, request: Request) -> response.Response: Adds a new encounter for the user. - def put(self, request: Request) -> response.Response: Updates an existing...
b6d757895132b9b3c8c6682c11efadf993d5905b
<|skeleton|> class EncountersEndpoint: """Endpoints for Encounter objects.""" def post(self, request: Request) -> response.Response: """Adds a new encounter for the user.""" <|body_0|> def put(self, request: Request) -> response.Response: """Updates an existing encounter.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EncountersEndpoint: """Endpoints for Encounter objects.""" def post(self, request: Request) -> response.Response: """Adds a new encounter for the user.""" try: encounter: models.Encounter = models.Encounter.create_from_json(data=request.data, patient_profile=request.user.patie...
the_stack_v2_python_sparse
main/model_api.py
kalolad1/cosmos
train
0
20537586c6018a6cec0a153a8e5597f63eff6a9a
[ "result = {}\nargs = PROPERTY_PUT_PARSER.parse_args()\ncurrent_app.logger.info(args)\nsection = args.get(self.section).upper()\nmodules = section.split('.')\nsubmodule = None\nif len(modules) > 1:\n submodule = modules[1]\nconfigurators = CPI_INSTANCE.get_configurators(modules[0], submodule)\nif len(configurator...
<|body_start_0|> result = {} args = PROPERTY_PUT_PARSER.parse_args() current_app.logger.info(args) section = args.get(self.section).upper() modules = section.split('.') submodule = None if len(modules) > 1: submodule = modules[1] configurators ...
restful api for configurator, in order to provide the method of put and get
Configurator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Configurator: """restful api for configurator, in order to provide the method of put and get""" def put(self): """calling cpi set method to set the value of the given key :param section: The section of the cpi :param key: the key to be set :param value: the value of the given key :re...
stack_v2_sparse_classes_75kplus_train_004444
5,109
no_license
[ { "docstring": "calling cpi set method to set the value of the given key :param section: The section of the cpi :param key: the key to be set :param value: the value of the given key :returns status: the status return by the cpi set method :returns value: the message return by the cpi set method", "name": "...
3
stack_v2_sparse_classes_30k_train_020987
Implement the Python class `Configurator` described below. Class description: restful api for configurator, in order to provide the method of put and get Method signatures and docstrings: - def put(self): calling cpi set method to set the value of the given key :param section: The section of the cpi :param key: the k...
Implement the Python class `Configurator` described below. Class description: restful api for configurator, in order to provide the method of put and get Method signatures and docstrings: - def put(self): calling cpi set method to set the value of the given key :param section: The section of the cpi :param key: the k...
12c0ade407a991f7d11b854d4f587b1764bbc4f5
<|skeleton|> class Configurator: """restful api for configurator, in order to provide the method of put and get""" def put(self): """calling cpi set method to set the value of the given key :param section: The section of the cpi :param key: the key to be set :param value: the value of the given key :re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Configurator: """restful api for configurator, in order to provide the method of put and get""" def put(self): """calling cpi set method to set the value of the given key :param section: The section of the cpi :param key: the key to be set :param value: the value of the given key :returns status:...
the_stack_v2_python_sparse
analysis/atuned/configurator.py
openeuler-mirror/A-Tune
train
18
92c3f123aa79d81f22cbc44f0b9f32226c50d24a
[ "super().__init__()\nself._set_data_loc()\nself.interconnect = check_and_format_interconnect(interconnect)\nself._build_network()", "top_dirname = os.path.dirname(__file__)\ndata_loc = os.path.join(top_dirname, 'data')\nif os.path.isdir(data_loc) is False:\n raise IOError('%s directory not found' % data_loc)\n...
<|body_start_0|> super().__init__() self._set_data_loc() self.interconnect = check_and_format_interconnect(interconnect) self._build_network() <|end_body_0|> <|body_start_1|> top_dirname = os.path.dirname(__file__) data_loc = os.path.join(top_dirname, 'data') if ...
TAMU network. :param str/list interconnect: interconnect name(s).
TAMU
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TAMU: """TAMU network. :param str/list interconnect: interconnect name(s).""" def __init__(self, interconnect): """Constructor.""" <|body_0|> def _set_data_loc(self): """Sets data location. :raises IOError: if directory does not exist.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_004445
4,188
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, interconnect)" }, { "docstring": "Sets data location. :raises IOError: if directory does not exist.", "name": "_set_data_loc", "signature": "def _set_data_loc(self)" }, { "docstring": "Build netwo...
4
stack_v2_sparse_classes_30k_train_044380
Implement the Python class `TAMU` described below. Class description: TAMU network. :param str/list interconnect: interconnect name(s). Method signatures and docstrings: - def __init__(self, interconnect): Constructor. - def _set_data_loc(self): Sets data location. :raises IOError: if directory does not exist. - def ...
Implement the Python class `TAMU` described below. Class description: TAMU network. :param str/list interconnect: interconnect name(s). Method signatures and docstrings: - def __init__(self, interconnect): Constructor. - def _set_data_loc(self): Sets data location. :raises IOError: if directory does not exist. - def ...
2fa9fb907fd55a96ffd3d584614b47af79a0bda8
<|skeleton|> class TAMU: """TAMU network. :param str/list interconnect: interconnect name(s).""" def __init__(self, interconnect): """Constructor.""" <|body_0|> def _set_data_loc(self): """Sets data location. :raises IOError: if directory does not exist.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TAMU: """TAMU network. :param str/list interconnect: interconnect name(s).""" def __init__(self, interconnect): """Constructor.""" super().__init__() self._set_data_loc() self.interconnect = check_and_format_interconnect(interconnect) self._build_network() def...
the_stack_v2_python_sparse
powersimdata/network/usa_tamu/model.py
abhinavgairola/PowerSimData
train
0
5503910e27f95c1467b63509bf58b58756f84fd0
[ "super().__init__(keys=keys, grad=grad, output_size=output_size, adjust_size=adjust_size, interpolation_mode=interpolation_mode, padding_mode=padding_mode, align_corners=align_corners, reverse_order=reverse_order, per_sample=per_sample, **kwargs)\nself.register_sampler('scale', scale)\nself.register_sampler('rotati...
<|body_start_0|> super().__init__(keys=keys, grad=grad, output_size=output_size, adjust_size=adjust_size, interpolation_mode=interpolation_mode, padding_mode=padding_mode, align_corners=align_corners, reverse_order=reverse_order, per_sample=per_sample, **kwargs) self.register_sampler('scale', scale) ...
Class performing a basic Affine Transformation on a given sample dict. The transformation will be applied to all the dict-entries specified in :attr:`keys`.
BaseAffine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseAffine: """Class performing a basic Affine Transformation on a given sample dict. The transformation will be applied to all the dict-entries specified in :attr:`keys`.""" def __init__(self, scale: Optional[AffineParamType]=None, rotation: Optional[AffineParamType]=None, translation: Opti...
stack_v2_sparse_classes_75kplus_train_004446
32,610
permissive
[ { "docstring": "Args: scale: the scale factor(s). Supported are: * a single parameter (as float or int), which will be replicated for all dimensions and batch samples * a parameter per dimension, which will be replicated for all batch samples * None will be treated as a scaling factor of 1 rotation: the rotatio...
3
stack_v2_sparse_classes_30k_train_036776
Implement the Python class `BaseAffine` described below. Class description: Class performing a basic Affine Transformation on a given sample dict. The transformation will be applied to all the dict-entries specified in :attr:`keys`. Method signatures and docstrings: - def __init__(self, scale: Optional[AffineParamTyp...
Implement the Python class `BaseAffine` described below. Class description: Class performing a basic Affine Transformation on a given sample dict. The transformation will be applied to all the dict-entries specified in :attr:`keys`. Method signatures and docstrings: - def __init__(self, scale: Optional[AffineParamTyp...
ab6fbcfe7215c2a5b8e401b70909f6a32d0d167b
<|skeleton|> class BaseAffine: """Class performing a basic Affine Transformation on a given sample dict. The transformation will be applied to all the dict-entries specified in :attr:`keys`.""" def __init__(self, scale: Optional[AffineParamType]=None, rotation: Optional[AffineParamType]=None, translation: Opti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseAffine: """Class performing a basic Affine Transformation on a given sample dict. The transformation will be applied to all the dict-entries specified in :attr:`keys`.""" def __init__(self, scale: Optional[AffineParamType]=None, rotation: Optional[AffineParamType]=None, translation: Optional[AffinePa...
the_stack_v2_python_sparse
rising/transforms/affine.py
PhoenixDL/rising
train
318
09a14e54f163fa58acb6911b81fb11fccad20ff7
[ "if str(x) == str(x)[::-1]:\n return True\nelse:\n return False", "if x < 0 or (x % 10 == 0 and x != 0):\n return False\ni = 0\nwhile x > i:\n i = i * 10 + x % 10\n x /= 10\nreturn x == i or x == i / 10" ]
<|body_start_0|> if str(x) == str(x)[::-1]: return True else: return False <|end_body_0|> <|body_start_1|> if x < 0 or (x % 10 == 0 and x != 0): return False i = 0 while x > i: i = i * 10 + x % 10 x /= 10 return...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindromes(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if str(x) == str(x)[::-1]: return True else:...
stack_v2_sparse_classes_75kplus_train_004447
744
no_license
[ { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" }, { "docstring": ":type x: int :rtype: bool", "name": "isPalindromes", "signature": "def isPalindromes(self, x)" } ]
2
stack_v2_sparse_classes_30k_val_002438
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindromes(self, x): :type x: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindromes(self, x): :type x: int :rtype: bool <|skeleton|> class Solution: def isPalindrome(self, x): ...
069bb0b751ef7f469036b9897436eb5d138ffa24
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindromes(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" if str(x) == str(x)[::-1]: return True else: return False def isPalindromes(self, x): """:type x: int :rtype: bool""" if x < 0 or (x % 10 == 0 and x != 0): retu...
the_stack_v2_python_sparse
算法/4、回文数.py
RichieSong/algorithm
train
0
eb61a572d5d41d547d9f89df1da2564d6dd7aedb
[ "datetime_no_ms = dateparser.parse(self.DATE_NO_MS)\nassert f'{self.DATE_NO_MS[:-1]}.000000Z' == convert_datetime_to_iso_str(datetime_no_ms)\ndatetime_with_ms = dateparser.parse(self.DATE_WITH_MS)\nassert self.DATE_WITH_MS == convert_datetime_to_iso_str(datetime_with_ms)", "incident = message_to_incident(self.MOC...
<|body_start_0|> datetime_no_ms = dateparser.parse(self.DATE_NO_MS) assert f'{self.DATE_NO_MS[:-1]}.000000Z' == convert_datetime_to_iso_str(datetime_no_ms) datetime_with_ms = dateparser.parse(self.DATE_WITH_MS) assert self.DATE_WITH_MS == convert_datetime_to_iso_str(datetime_with_ms) <|e...
TestHelperFunctions
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestHelperFunctions: def test_convert_datetime_to_iso_str(self): """Given: - date with ms - date without ms When: - we want the publish_time in str Then: - convert_datetime_to_iso_str should convert the dates to the same string""" <|body_0|> def test_message_to_incident(self...
stack_v2_sparse_classes_75kplus_train_004448
29,040
permissive
[ { "docstring": "Given: - date with ms - date without ms When: - we want the publish_time in str Then: - convert_datetime_to_iso_str should convert the dates to the same string", "name": "test_convert_datetime_to_iso_str", "signature": "def test_convert_datetime_to_iso_str(self)" }, { "docstring"...
2
stack_v2_sparse_classes_30k_train_014986
Implement the Python class `TestHelperFunctions` described below. Class description: Implement the TestHelperFunctions class. Method signatures and docstrings: - def test_convert_datetime_to_iso_str(self): Given: - date with ms - date without ms When: - we want the publish_time in str Then: - convert_datetime_to_iso_...
Implement the Python class `TestHelperFunctions` described below. Class description: Implement the TestHelperFunctions class. Method signatures and docstrings: - def test_convert_datetime_to_iso_str(self): Given: - date with ms - date without ms When: - we want the publish_time in str Then: - convert_datetime_to_iso_...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestHelperFunctions: def test_convert_datetime_to_iso_str(self): """Given: - date with ms - date without ms When: - we want the publish_time in str Then: - convert_datetime_to_iso_str should convert the dates to the same string""" <|body_0|> def test_message_to_incident(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestHelperFunctions: def test_convert_datetime_to_iso_str(self): """Given: - date with ms - date without ms When: - we want the publish_time in str Then: - convert_datetime_to_iso_str should convert the dates to the same string""" datetime_no_ms = dateparser.parse(self.DATE_NO_MS) asse...
the_stack_v2_python_sparse
Packs/GooglePubSub/Integrations/GooglePubSub/GooglePubSub_test.py
demisto/content
train
1,023
e8e47fe37aa29ea307ff5dd4d9c47611792268c6
[ "if debug.DrawOutlines and hasattr(self, 'shape'):\n for line in self.shape.lines:\n surface.draw_aaline((0, 0, 0), line.p, line.q)\nelse:\n surface.blit(self)", "if isinstance(image, pygame.Surface):\n self.image = image\nelse:\n self.image = pygame.image.load(image)\nBlitables.append(self)\ns...
<|body_start_0|> if debug.DrawOutlines and hasattr(self, 'shape'): for line in self.shape.lines: surface.draw_aaline((0, 0, 0), line.p, line.q) else: surface.blit(self) <|end_body_0|> <|body_start_1|> if isinstance(image, pygame.Surface): self...
Blitables are objects with an image.
Blitable
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Blitable: """Blitables are objects with an image.""" def draw(self, surface): """Blits the blitable to the specified surface.""" <|body_0|> def __init__(self, image, **kwargs): """Instanciate a blitable with an image (required, can be str or pygame Surface).""" ...
stack_v2_sparse_classes_75kplus_train_004449
8,105
no_license
[ { "docstring": "Blits the blitable to the specified surface.", "name": "draw", "signature": "def draw(self, surface)" }, { "docstring": "Instanciate a blitable with an image (required, can be str or pygame Surface).", "name": "__init__", "signature": "def __init__(self, image, **kwargs)"...
2
stack_v2_sparse_classes_30k_val_002211
Implement the Python class `Blitable` described below. Class description: Blitables are objects with an image. Method signatures and docstrings: - def draw(self, surface): Blits the blitable to the specified surface. - def __init__(self, image, **kwargs): Instanciate a blitable with an image (required, can be str or ...
Implement the Python class `Blitable` described below. Class description: Blitables are objects with an image. Method signatures and docstrings: - def draw(self, surface): Blits the blitable to the specified surface. - def __init__(self, image, **kwargs): Instanciate a blitable with an image (required, can be str or ...
48ccd228f68f6cdc929c0fbaa57fac2ec35b7c88
<|skeleton|> class Blitable: """Blitables are objects with an image.""" def draw(self, surface): """Blits the blitable to the specified surface.""" <|body_0|> def __init__(self, image, **kwargs): """Instanciate a blitable with an image (required, can be str or pygame Surface).""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Blitable: """Blitables are objects with an image.""" def draw(self, surface): """Blits the blitable to the specified surface.""" if debug.DrawOutlines and hasattr(self, 'shape'): for line in self.shape.lines: surface.draw_aaline((0, 0, 0), line.p, line.q) ...
the_stack_v2_python_sparse
src/entity.py
Darthfett/A-Priori-Physics-System
train
0
c07a401830d632ef7bafa71e103416f0a42c3819
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UnifiedRoleManagementPolicy()", "from .entity import Entity\nfrom .identity import Identity\nfrom .unified_role_management_policy_rule import UnifiedRoleManagementPolicyRule\nfrom .entity import Entity\nfrom .identity import Identity\n...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UnifiedRoleManagementPolicy() <|end_body_0|> <|body_start_1|> from .entity import Entity from .identity import Identity from .unified_role_management_policy_rule import UnifiedRo...
UnifiedRoleManagementPolicy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnifiedRoleManagementPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleManagementPolicy: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value a...
stack_v2_sparse_classes_75kplus_train_004450
5,220
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: UnifiedRoleManagementPolicy", "name": "create_from_discriminator_value", "signature": "def create_from_discr...
3
stack_v2_sparse_classes_30k_train_050513
Implement the Python class `UnifiedRoleManagementPolicy` described below. Class description: Implement the UnifiedRoleManagementPolicy class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleManagementPolicy: Creates a new instance of the appr...
Implement the Python class `UnifiedRoleManagementPolicy` described below. Class description: Implement the UnifiedRoleManagementPolicy class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleManagementPolicy: Creates a new instance of the appr...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UnifiedRoleManagementPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleManagementPolicy: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnifiedRoleManagementPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleManagementPolicy: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ...
the_stack_v2_python_sparse
msgraph/generated/models/unified_role_management_policy.py
microsoftgraph/msgraph-sdk-python
train
135
bee011f41b39500698f577c9c2057a317c5f5c45
[ "if job == 'sheet':\n login_url = self.sheet_url + '/login'\nelse:\n login_url = self.trade_url + '/login'\nlogin_data = {'userName': 'admin', 'password': '123456'}\nlogin_response = requests.post(url=login_url, data=login_data, headers=self.headers)\nresp_code = json.loads(login_response.content)['code']\nif...
<|body_start_0|> if job == 'sheet': login_url = self.sheet_url + '/login' else: login_url = self.trade_url + '/login' login_data = {'userName': 'admin', 'password': '123456'} login_response = requests.post(url=login_url, data=login_data, headers=self.headers) ...
sheet 19 批量定时监控 18 每日红包平台充值优惠券差错对账 17 用户登录统计 12 随机立减数据统计 11 线下清算扣款费用通知回调trade 9 每日订单对账执行器 8 线下扣款清算文件生成 7 联机扣款数据统计 6 线下扣款清算结果文件读取 5 黑名单推送trade 4 未支付订单统计 3 优惠券活动数据统计 2 支付及退款数据统计 1 运营数据统计` trade 20 应用监控数据更新 15 重试清除超时未取消接送机订单 14 退款定时任务 13 查询订单支付状态 12 交易端-强制扣款 11 删除失败及执行成功的任务 10 红包平台优惠券下发 9 下发优惠券 8 查询进行中的活动 6 接送机超时取消 3 网约车-...
XXLJob
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XXLJob: """sheet 19 批量定时监控 18 每日红包平台充值优惠券差错对账 17 用户登录统计 12 随机立减数据统计 11 线下清算扣款费用通知回调trade 9 每日订单对账执行器 8 线下扣款清算文件生成 7 联机扣款数据统计 6 线下扣款清算结果文件读取 5 黑名单推送trade 4 未支付订单统计 3 优惠券活动数据统计 2 支付及退款数据统计 1 运营数据统计` trade 20 应用监控数据更新 15 重试清除超时未取消接送机订单 14 退款定时任务 13 查询订单支付状态 12 交易端-强制扣款 11 删除失败及执行成功的任务 10 红包平台优惠券下发 9...
stack_v2_sparse_classes_75kplus_train_004451
4,045
permissive
[ { "docstring": "调度平台登录 :param job: :return:", "name": "login", "signature": "def login(self, job)" }, { "docstring": "修改执行器 :param sheet_ip: :param trade_ip: :param sheet_job: :return:", "name": "edit_config", "signature": "def edit_config(self, sheet_ip='192.168.0.48:9003', trade_ip='19...
3
stack_v2_sparse_classes_30k_train_000872
Implement the Python class `XXLJob` described below. Class description: sheet 19 批量定时监控 18 每日红包平台充值优惠券差错对账 17 用户登录统计 12 随机立减数据统计 11 线下清算扣款费用通知回调trade 9 每日订单对账执行器 8 线下扣款清算文件生成 7 联机扣款数据统计 6 线下扣款清算结果文件读取 5 黑名单推送trade 4 未支付订单统计 3 优惠券活动数据统计 2 支付及退款数据统计 1 运营数据统计` trade 20 应用监控数据更新 15 重试清除超时未取消接送机订单 14 退款定时任务 13 查询订单支付状态 12 ...
Implement the Python class `XXLJob` described below. Class description: sheet 19 批量定时监控 18 每日红包平台充值优惠券差错对账 17 用户登录统计 12 随机立减数据统计 11 线下清算扣款费用通知回调trade 9 每日订单对账执行器 8 线下扣款清算文件生成 7 联机扣款数据统计 6 线下扣款清算结果文件读取 5 黑名单推送trade 4 未支付订单统计 3 优惠券活动数据统计 2 支付及退款数据统计 1 运营数据统计` trade 20 应用监控数据更新 15 重试清除超时未取消接送机订单 14 退款定时任务 13 查询订单支付状态 12 ...
7e91570fccafa69881be09a1eccb6dfa15ed9039
<|skeleton|> class XXLJob: """sheet 19 批量定时监控 18 每日红包平台充值优惠券差错对账 17 用户登录统计 12 随机立减数据统计 11 线下清算扣款费用通知回调trade 9 每日订单对账执行器 8 线下扣款清算文件生成 7 联机扣款数据统计 6 线下扣款清算结果文件读取 5 黑名单推送trade 4 未支付订单统计 3 优惠券活动数据统计 2 支付及退款数据统计 1 运营数据统计` trade 20 应用监控数据更新 15 重试清除超时未取消接送机订单 14 退款定时任务 13 查询订单支付状态 12 交易端-强制扣款 11 删除失败及执行成功的任务 10 红包平台优惠券下发 9...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class XXLJob: """sheet 19 批量定时监控 18 每日红包平台充值优惠券差错对账 17 用户登录统计 12 随机立减数据统计 11 线下清算扣款费用通知回调trade 9 每日订单对账执行器 8 线下扣款清算文件生成 7 联机扣款数据统计 6 线下扣款清算结果文件读取 5 黑名单推送trade 4 未支付订单统计 3 优惠券活动数据统计 2 支付及退款数据统计 1 运营数据统计` trade 20 应用监控数据更新 15 重试清除超时未取消接送机订单 14 退款定时任务 13 查询订单支付状态 12 交易端-强制扣款 11 删除失败及执行成功的任务 10 红包平台优惠券下发 9 下发优惠券 8 查询进行...
the_stack_v2_python_sparse
httpTest/ApiManager/utils/XXL_job.py
dufuhaoo/httptest
train
0
49f2e174fbf2637c804b32be6ad184a0cbf75946
[ "self.population = None\nself.this_chain = None\nself.other_chains = None\nreturn super().__init__(vars, shared, blocked)", "self.population = population\nself.this_chain = chain_index\nself.other_chains = [c for c in range(len(population)) if c != chain_index]\nif not len(self.other_chains) > 1:\n raise Value...
<|body_start_0|> self.population = None self.this_chain = None self.other_chains = None return super().__init__(vars, shared, blocked) <|end_body_0|> <|body_start_1|> self.population = population self.this_chain = chain_index self.other_chains = [c for c in range...
Version of ArrayStepShared that allows samplers to access the states of other chains in the population. Works by linking a list of Points that is updated as the chains are iterated.
PopulationArrayStepShared
[ "Apache-2.0", "AFL-2.1", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PopulationArrayStepShared: """Version of ArrayStepShared that allows samplers to access the states of other chains in the population. Works by linking a list of Points that is updated as the chains are iterated.""" def __init__(self, vars, shared, blocked=True): """Parameters -------...
stack_v2_sparse_classes_75kplus_train_004452
7,034
permissive
[ { "docstring": "Parameters ---------- vars: list of sampling value variables shared: dict of PyTensor variable -> shared variable blocked: Boolean (default True)", "name": "__init__", "signature": "def __init__(self, vars, shared, blocked=True)" }, { "docstring": "Links the sampler to the popula...
2
stack_v2_sparse_classes_30k_train_023624
Implement the Python class `PopulationArrayStepShared` described below. Class description: Version of ArrayStepShared that allows samplers to access the states of other chains in the population. Works by linking a list of Points that is updated as the chains are iterated. Method signatures and docstrings: - def __ini...
Implement the Python class `PopulationArrayStepShared` described below. Class description: Version of ArrayStepShared that allows samplers to access the states of other chains in the population. Works by linking a list of Points that is updated as the chains are iterated. Method signatures and docstrings: - def __ini...
ddd1d4bf05a72895c67265f541585ae02bd338a3
<|skeleton|> class PopulationArrayStepShared: """Version of ArrayStepShared that allows samplers to access the states of other chains in the population. Works by linking a list of Points that is updated as the chains are iterated.""" def __init__(self, vars, shared, blocked=True): """Parameters -------...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PopulationArrayStepShared: """Version of ArrayStepShared that allows samplers to access the states of other chains in the population. Works by linking a list of Points that is updated as the chains are iterated.""" def __init__(self, vars, shared, blocked=True): """Parameters ---------- vars: lis...
the_stack_v2_python_sparse
pymc/step_methods/arraystep.py
pymc-devs/pymc
train
1,046
f5a1bf7403a1b01e4b5e7f8b1a6d0700442e1fed
[ "self._autojoin = autojoin_\nself._path = path\ntry:\n self._party = zk.Party(path, id_)\nexcept (ConnectionLoss, SessionExpiredError):\n raise ZkNoConnection from None\nself.autojoin()", "try:\n self._party.join()\nexcept (ConnectionLoss, SessionExpiredError):\n raise ZkNoConnection from None", "if...
<|body_start_0|> self._autojoin = autojoin_ self._path = path try: self._party = zk.Party(path, id_) except (ConnectionLoss, SessionExpiredError): raise ZkNoConnection from None self.autojoin() <|end_body_0|> <|body_start_1|> try: self...
A wrapper for a `Kazoo Party <https://kazoo.readthedocs.org/en/latest/api/recipe/party.html>`_.
ZkParty
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZkParty: """A wrapper for a `Kazoo Party <https://kazoo.readthedocs.org/en/latest/api/recipe/party.html>`_.""" def __init__(self, zk, path, id_, autojoin_): """:param zk: A kazoo instance :param str path: The absolute path of the party :param str id_: The service id value to use in t...
stack_v2_sparse_classes_75kplus_train_004453
2,514
permissive
[ { "docstring": ":param zk: A kazoo instance :param str path: The absolute path of the party :param str id_: The service id value to use in the party :param bool autojoin_: Join the party automatically :raises: ZkNoConnection: if there's no connection to ZK.", "name": "__init__", "signature": "def __init...
4
stack_v2_sparse_classes_30k_train_049900
Implement the Python class `ZkParty` described below. Class description: A wrapper for a `Kazoo Party <https://kazoo.readthedocs.org/en/latest/api/recipe/party.html>`_. Method signatures and docstrings: - def __init__(self, zk, path, id_, autojoin_): :param zk: A kazoo instance :param str path: The absolute path of t...
Implement the Python class `ZkParty` described below. Class description: A wrapper for a `Kazoo Party <https://kazoo.readthedocs.org/en/latest/api/recipe/party.html>`_. Method signatures and docstrings: - def __init__(self, zk, path, id_, autojoin_): :param zk: A kazoo instance :param str path: The absolute path of t...
06f3f0b82dc8a535ce8b0a128282af00a8425a06
<|skeleton|> class ZkParty: """A wrapper for a `Kazoo Party <https://kazoo.readthedocs.org/en/latest/api/recipe/party.html>`_.""" def __init__(self, zk, path, id_, autojoin_): """:param zk: A kazoo instance :param str path: The absolute path of the party :param str id_: The service id value to use in t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZkParty: """A wrapper for a `Kazoo Party <https://kazoo.readthedocs.org/en/latest/api/recipe/party.html>`_.""" def __init__(self, zk, path, id_, autojoin_): """:param zk: A kazoo instance :param str path: The absolute path of the party :param str id_: The service id value to use in the party :par...
the_stack_v2_python_sparse
lib/zk/party.py
marcoeilers/scion
train
1
f6861e465a630b41e2cd743c3acf6c571cafac03
[ "dp = [float('inf')] * (amount + 1)\ndp[0] = 0\nfor coin in coins:\n for x in range(coin, amount + 1):\n dp[x] = min(dp[x], dp[x - coin] + 1)\nreturn dp[amount] if dp[amount] != float('inf') else -1", "dp = [amount + 1] * (amount + 1)\ndp[0] = 0\nfor i in range(amount + 1):\n for coin in coins:\n ...
<|body_start_0|> dp = [float('inf')] * (amount + 1) dp[0] = 0 for coin in coins: for x in range(coin, amount + 1): dp[x] = min(dp[x], dp[x - coin] + 1) return dp[amount] if dp[amount] != float('inf') else -1 <|end_body_0|> <|body_start_1|> dp = [amoun...
OfficialSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfficialSolution: def coin_change(self, coins: List[int], amount: int) -> int: """动态规划 - 至下而上。""" <|body_0|> def coin_change_2(self, coins: List[int], amount: int) -> int: """动态规划(自底向上)。 1. base case。 amount 为 0 时,所需硬币数量为 0。 2. 状态。 amount。 3. 选择。 coins。 4. dp 数组/方程。 ...
stack_v2_sparse_classes_75kplus_train_004454
3,539
no_license
[ { "docstring": "动态规划 - 至下而上。", "name": "coin_change", "signature": "def coin_change(self, coins: List[int], amount: int) -> int" }, { "docstring": "动态规划(自底向上)。 1. base case。 amount 为 0 时,所需硬币数量为 0。 2. 状态。 amount。 3. 选择。 coins。 4. dp 数组/方程。 dp[n] = 凑成金额 n 最少需要多少硬币。", "name": "coin_change_2", ...
2
null
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def coin_change(self, coins: List[int], amount: int) -> int: 动态规划 - 至下而上。 - def coin_change_2(self, coins: List[int], amount: int) -> int: 动态规划(自底向上)。 1. base cas...
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def coin_change(self, coins: List[int], amount: int) -> int: 动态规划 - 至下而上。 - def coin_change_2(self, coins: List[int], amount: int) -> int: 动态规划(自底向上)。 1. base cas...
6932d69353b94ec824dd0ddc86a92453f6673232
<|skeleton|> class OfficialSolution: def coin_change(self, coins: List[int], amount: int) -> int: """动态规划 - 至下而上。""" <|body_0|> def coin_change_2(self, coins: List[int], amount: int) -> int: """动态规划(自底向上)。 1. base case。 amount 为 0 时,所需硬币数量为 0。 2. 状态。 amount。 3. 选择。 coins。 4. dp 数组/方程。 ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OfficialSolution: def coin_change(self, coins: List[int], amount: int) -> int: """动态规划 - 至下而上。""" dp = [float('inf')] * (amount + 1) dp[0] = 0 for coin in coins: for x in range(coin, amount + 1): dp[x] = min(dp[x], dp[x - coin] + 1) return dp...
the_stack_v2_python_sparse
0322_coin-change.py
Nigirimeshi/leetcode
train
0
f166dde05c4a9e67334a5886995788809efade81
[ "user = self.get_current_user()\nif user:\n feature_ids = notifier.FeatureStar.get_user_stars(user.email())\nelse:\n feature_ids = []\ndata = {'featureIds': feature_ids}\nreturn data", "feature = self.get_specified_feature()\nstarred = self.get_bool_param('starred', default=True)\nuser = self.get_current_us...
<|body_start_0|> user = self.get_current_user() if user: feature_ids = notifier.FeatureStar.get_user_stars(user.email()) else: feature_ids = [] data = {'featureIds': feature_ids} return data <|end_body_0|> <|body_start_1|> feature = self.get_speci...
Users can star a feature by clicking a star icon. The client-side has logic to toggle the star icon. When a user has starred a feature, they will be sent notification emails about changes to that feature.
StarsAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StarsAPI: """Users can star a feature by clicking a star icon. The client-side has logic to toggle the star icon. When a user has starred a feature, they will be sent notification emails about changes to that feature.""" def do_get(self, **kwargs): """Return a list of all starred fea...
stack_v2_sparse_classes_75kplus_train_004455
1,719
permissive
[ { "docstring": "Return a list of all starred feature IDs for the signed-in user.", "name": "do_get", "signature": "def do_get(self, **kwargs)" }, { "docstring": "Set or clear a star on the specified feature.", "name": "do_post", "signature": "def do_post(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_001455
Implement the Python class `StarsAPI` described below. Class description: Users can star a feature by clicking a star icon. The client-side has logic to toggle the star icon. When a user has starred a feature, they will be sent notification emails about changes to that feature. Method signatures and docstrings: - def...
Implement the Python class `StarsAPI` described below. Class description: Users can star a feature by clicking a star icon. The client-side has logic to toggle the star icon. When a user has starred a feature, they will be sent notification emails about changes to that feature. Method signatures and docstrings: - def...
17f9886d064da5bda84006d5866077727646fff2
<|skeleton|> class StarsAPI: """Users can star a feature by clicking a star icon. The client-side has logic to toggle the star icon. When a user has starred a feature, they will be sent notification emails about changes to that feature.""" def do_get(self, **kwargs): """Return a list of all starred fea...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StarsAPI: """Users can star a feature by clicking a star icon. The client-side has logic to toggle the star icon. When a user has starred a feature, they will be sent notification emails about changes to that feature.""" def do_get(self, **kwargs): """Return a list of all starred feature IDs for ...
the_stack_v2_python_sparse
api/stars_api.py
GoogleChrome/chromium-dashboard
train
574
d90dd151e51e79badec0aaa67470bb5c62e6428b
[ "if isinstance(request, rest_framework.request.Request):\n return request.data\nreturn super(DRFAuthenticatedGraphQLView, self).parse_body(request)", "view = super(DRFAuthenticatedGraphQLView, cls).as_view(*args, **kwargs)\nview = permission_classes((AllowAny,))(view)\nview = authentication_classes(api_setting...
<|body_start_0|> if isinstance(request, rest_framework.request.Request): return request.data return super(DRFAuthenticatedGraphQLView, self).parse_body(request) <|end_body_0|> <|body_start_1|> view = super(DRFAuthenticatedGraphQLView, cls).as_view(*args, **kwargs) view = per...
GRAPH-QL View that utilizes authentication from Django Rest Framework
DRFAuthenticatedGraphQLView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DRFAuthenticatedGraphQLView: """GRAPH-QL View that utilizes authentication from Django Rest Framework""" def parse_body(self, request): """Parses Request Data for use in graph-ql""" <|body_0|> def as_view(cls, *args, **kwargs): """Set DRF attributes in the view""...
stack_v2_sparse_classes_75kplus_train_004456
4,981
permissive
[ { "docstring": "Parses Request Data for use in graph-ql", "name": "parse_body", "signature": "def parse_body(self, request)" }, { "docstring": "Set DRF attributes in the view", "name": "as_view", "signature": "def as_view(cls, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_020806
Implement the Python class `DRFAuthenticatedGraphQLView` described below. Class description: GRAPH-QL View that utilizes authentication from Django Rest Framework Method signatures and docstrings: - def parse_body(self, request): Parses Request Data for use in graph-ql - def as_view(cls, *args, **kwargs): Set DRF att...
Implement the Python class `DRFAuthenticatedGraphQLView` described below. Class description: GRAPH-QL View that utilizes authentication from Django Rest Framework Method signatures and docstrings: - def parse_body(self, request): Parses Request Data for use in graph-ql - def as_view(cls, *args, **kwargs): Set DRF att...
6b080039398fb4099a34335317d649dd67783f63
<|skeleton|> class DRFAuthenticatedGraphQLView: """GRAPH-QL View that utilizes authentication from Django Rest Framework""" def parse_body(self, request): """Parses Request Data for use in graph-ql""" <|body_0|> def as_view(cls, *args, **kwargs): """Set DRF attributes in the view""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DRFAuthenticatedGraphQLView: """GRAPH-QL View that utilizes authentication from Django Rest Framework""" def parse_body(self, request): """Parses Request Data for use in graph-ql""" if isinstance(request, rest_framework.request.Request): return request.data return supe...
the_stack_v2_python_sparse
accounts/views.py
daniel-waruo/e-commerse-api
train
6
cdab7e660458d302bc8dc48dea2b22e78182398a
[ "self._device_id = device_id\nself._attr_entity_category = entity_category\nself._attr_name = name\nself._attr_unique_id = unique_id\nself._switch_entity_id = switch_entity_id", "if (state := self.hass.states.get(self._switch_entity_id)) is None or state.state == STATE_UNAVAILABLE:\n self._attr_available = Fal...
<|body_start_0|> self._device_id = device_id self._attr_entity_category = entity_category self._attr_name = name self._attr_unique_id = unique_id self._switch_entity_id = switch_entity_id <|end_body_0|> <|body_start_1|> if (state := self.hass.states.get(self._switch_enti...
Represents a Switch as a X.
BaseEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseEntity: """Represents a Switch as a X.""" def __init__(self, name: str, switch_entity_id: str, unique_id: str | None, device_id: str | None=None, entity_category: EntityCategory | None=None) -> None: """Initialize Light Switch.""" <|body_0|> def async_state_changed_l...
stack_v2_sparse_classes_75kplus_train_004457
3,534
permissive
[ { "docstring": "Initialize Light Switch.", "name": "__init__", "signature": "def __init__(self, name: str, switch_entity_id: str, unique_id: str | None, device_id: str | None=None, entity_category: EntityCategory | None=None) -> None" }, { "docstring": "Handle child updates.", "name": "async...
3
stack_v2_sparse_classes_30k_val_002659
Implement the Python class `BaseEntity` described below. Class description: Represents a Switch as a X. Method signatures and docstrings: - def __init__(self, name: str, switch_entity_id: str, unique_id: str | None, device_id: str | None=None, entity_category: EntityCategory | None=None) -> None: Initialize Light Swi...
Implement the Python class `BaseEntity` described below. Class description: Represents a Switch as a X. Method signatures and docstrings: - def __init__(self, name: str, switch_entity_id: str, unique_id: str | None, device_id: str | None=None, entity_category: EntityCategory | None=None) -> None: Initialize Light Swi...
bfa315be51371a1b63e04342a0b275a57ae148bd
<|skeleton|> class BaseEntity: """Represents a Switch as a X.""" def __init__(self, name: str, switch_entity_id: str, unique_id: str | None, device_id: str | None=None, entity_category: EntityCategory | None=None) -> None: """Initialize Light Switch.""" <|body_0|> def async_state_changed_l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseEntity: """Represents a Switch as a X.""" def __init__(self, name: str, switch_entity_id: str, unique_id: str | None, device_id: str | None=None, entity_category: EntityCategory | None=None) -> None: """Initialize Light Switch.""" self._device_id = device_id self._attr_entity_...
the_stack_v2_python_sparse
homeassistant/components/switch_as_x/entity.py
bdraco/home-assistant
train
13
65d88785f79bd16f39bfc2dad2f2d76f92978334
[ "super(Encoder, self).__init__()\nself.hidden_dim = hidden_dim // 2 if bidir else hidden_dim\nself.n_layers = n_layers * 2 if bidir else n_layers\nself.bidir = bidir\nself.lstm = nn.LSTM(embedding_dim, self.hidden_dim, n_layers, dropout=dropout, bidirectional=bidir)\nself.h0 = Parameter(torch.zeros(1), requires_gra...
<|body_start_0|> super(Encoder, self).__init__() self.hidden_dim = hidden_dim // 2 if bidir else hidden_dim self.n_layers = n_layers * 2 if bidir else n_layers self.bidir = bidir self.lstm = nn.LSTM(embedding_dim, self.hidden_dim, n_layers, dropout=dropout, bidirectional=bidir) ...
Encoder class for Pointer-Net
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Encoder class for Pointer-Net""" def __init__(self, embedding_dim, hidden_dim, n_layers, dropout, bidir): """Initiate Encoder :param Tensor embedding_dim: Number of embbeding channels :param int hidden_dim: Number of hidden units for the LSTM :param int n_layers: Number o...
stack_v2_sparse_classes_75kplus_train_004458
12,775
no_license
[ { "docstring": "Initiate Encoder :param Tensor embedding_dim: Number of embbeding channels :param int hidden_dim: Number of hidden units for the LSTM :param int n_layers: Number of layers for LSTMs :param float dropout: Float between 0-1 :param bool bidir: Bidirectional", "name": "__init__", "signature"...
3
stack_v2_sparse_classes_30k_train_045860
Implement the Python class `Encoder` described below. Class description: Encoder class for Pointer-Net Method signatures and docstrings: - def __init__(self, embedding_dim, hidden_dim, n_layers, dropout, bidir): Initiate Encoder :param Tensor embedding_dim: Number of embbeding channels :param int hidden_dim: Number o...
Implement the Python class `Encoder` described below. Class description: Encoder class for Pointer-Net Method signatures and docstrings: - def __init__(self, embedding_dim, hidden_dim, n_layers, dropout, bidir): Initiate Encoder :param Tensor embedding_dim: Number of embbeding channels :param int hidden_dim: Number o...
86a480b9196053cee9a3287e023dd12a13bb5df8
<|skeleton|> class Encoder: """Encoder class for Pointer-Net""" def __init__(self, embedding_dim, hidden_dim, n_layers, dropout, bidir): """Initiate Encoder :param Tensor embedding_dim: Number of embbeding channels :param int hidden_dim: Number of hidden units for the LSTM :param int n_layers: Number o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Encoder: """Encoder class for Pointer-Net""" def __init__(self, embedding_dim, hidden_dim, n_layers, dropout, bidir): """Initiate Encoder :param Tensor embedding_dim: Number of embbeding channels :param int hidden_dim: Number of hidden units for the LSTM :param int n_layers: Number of layers for ...
the_stack_v2_python_sparse
PointerNet.py
EleanorHYW/Rerank
train
0
c3376f63f04f936342947faf956e68576df9e031
[ "if len(nums) <= 1:\n return [nums]\nnum_copy = nums.copy()\nret = []\nfor i, num in enumerate(nums):\n num_copy.pop(i)\n for r in self.permute(num_copy):\n ret.append([num] + r)\n num_copy.insert(i, num)\nreturn ret", "if len(nums) == 1:\n return [nums]\npre_ret = self.permute(nums[1:])\nre...
<|body_start_0|> if len(nums) <= 1: return [nums] num_copy = nums.copy() ret = [] for i, num in enumerate(nums): num_copy.pop(i) for r in self.permute(num_copy): ret.append([num] + r) num_copy.insert(i, num) return r...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permute2(self, nums: List[int]) -> List[List[int]]: """AC: 04/20/2022 14:09 Runtime: 54 ms, faster than 53.41% Memory Usage: 14.1 MB, less than 60.27% 1 <= nums.length <= 6 -10 <= nums[i] <= 10 All the integers of nums are unique.""" <|body_0|> def permute(self...
stack_v2_sparse_classes_75kplus_train_004459
2,014
permissive
[ { "docstring": "AC: 04/20/2022 14:09 Runtime: 54 ms, faster than 53.41% Memory Usage: 14.1 MB, less than 60.27% 1 <= nums.length <= 6 -10 <= nums[i] <= 10 All the integers of nums are unique.", "name": "permute2", "signature": "def permute2(self, nums: List[int]) -> List[List[int]]" }, { "docstr...
2
stack_v2_sparse_classes_30k_train_017720
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute2(self, nums: List[int]) -> List[List[int]]: AC: 04/20/2022 14:09 Runtime: 54 ms, faster than 53.41% Memory Usage: 14.1 MB, less than 60.27% 1 <= nums.length <= 6 -10 ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute2(self, nums: List[int]) -> List[List[int]]: AC: 04/20/2022 14:09 Runtime: 54 ms, faster than 53.41% Memory Usage: 14.1 MB, less than 60.27% 1 <= nums.length <= 6 -10 ...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def permute2(self, nums: List[int]) -> List[List[int]]: """AC: 04/20/2022 14:09 Runtime: 54 ms, faster than 53.41% Memory Usage: 14.1 MB, less than 60.27% 1 <= nums.length <= 6 -10 <= nums[i] <= 10 All the integers of nums are unique.""" <|body_0|> def permute(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def permute2(self, nums: List[int]) -> List[List[int]]: """AC: 04/20/2022 14:09 Runtime: 54 ms, faster than 53.41% Memory Usage: 14.1 MB, less than 60.27% 1 <= nums.length <= 6 -10 <= nums[i] <= 10 All the integers of nums are unique.""" if len(nums) <= 1: return [nums] ...
the_stack_v2_python_sparse
src/46-Permutations.py
Jiezhi/myleetcode
train
1
0950c0a24497879c17bc72802b627d0fffe2d15e
[ "if n < 2:\n return 1\ndp = [0] * (n + 1)\ndp[0], dp[1] = (1, 1)\nfor i in range(2, n + 1):\n dp[i] = dp[i - 1] + dp[i - 2]\nreturn dp[n]", "if n < 2:\n return n\na, b, sum = (1, 1, 0)\nfor _ in range(2, n + 1):\n sum = a + b\n a = b\n b = sum\nreturn sum" ]
<|body_start_0|> if n < 2: return 1 dp = [0] * (n + 1) dp[0], dp[1] = (1, 1) for i in range(2, n + 1): dp[i] = dp[i - 1] + dp[i - 2] return dp[n] <|end_body_0|> <|body_start_1|> if n < 2: return n a, b, sum = (1, 1, 0) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs(self, n: int) -> int: """递归方程:f(n) = f(n-1) + f(n-2),n >= 2""" <|body_0|> def climbStairs1(self, n: int) -> int: """空间复杂度:O(1)""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 2: return 1 dp = [0] ...
stack_v2_sparse_classes_75kplus_train_004460
1,471
permissive
[ { "docstring": "递归方程:f(n) = f(n-1) + f(n-2),n >= 2", "name": "climbStairs", "signature": "def climbStairs(self, n: int) -> int" }, { "docstring": "空间复杂度:O(1)", "name": "climbStairs1", "signature": "def climbStairs1(self, n: int) -> int" } ]
2
stack_v2_sparse_classes_30k_train_002416
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n: int) -> int: 递归方程:f(n) = f(n-1) + f(n-2),n >= 2 - def climbStairs1(self, n: int) -> int: 空间复杂度:O(1)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n: int) -> int: 递归方程:f(n) = f(n-1) + f(n-2),n >= 2 - def climbStairs1(self, n: int) -> int: 空间复杂度:O(1) <|skeleton|> class Solution: def climbStairs(se...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def climbStairs(self, n: int) -> int: """递归方程:f(n) = f(n-1) + f(n-2),n >= 2""" <|body_0|> def climbStairs1(self, n: int) -> int: """空间复杂度:O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def climbStairs(self, n: int) -> int: """递归方程:f(n) = f(n-1) + f(n-2),n >= 2""" if n < 2: return 1 dp = [0] * (n + 1) dp[0], dp[1] = (1, 1) for i in range(2, n + 1): dp[i] = dp[i - 1] + dp[i - 2] return dp[n] def climbStairs...
the_stack_v2_python_sparse
70-climbing-stairs.py
yuenliou/leetcode
train
0
74843c6faf6579dc0c046e1f93774b12c8614a57
[ "self.access_token_type = 'access_token'\nself.device_authorization_endpoint = device_authorization_endpoint\nself.code_challenge_method = code_challenge_method\nsuper(OidcDeviceAuthorization, self).__init__(auth_url=auth_url, identity_provider=identity_provider, protocol=protocol, client_id=client_id, client_secre...
<|body_start_0|> self.access_token_type = 'access_token' self.device_authorization_endpoint = device_authorization_endpoint self.code_challenge_method = code_challenge_method super(OidcDeviceAuthorization, self).__init__(auth_url=auth_url, identity_provider=identity_provider, protocol=pr...
Implementation for OAuth 2.0 Device Authorization Grant.
OidcDeviceAuthorization
[ "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OidcDeviceAuthorization: """Implementation for OAuth 2.0 Device Authorization Grant.""" def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret=None, access_token_endpoint=None, device_authorization_endpoint=None, discovery_endpoint=None, code_challenge=None, code_...
stack_v2_sparse_classes_75kplus_train_004461
26,868
permissive
[ { "docstring": "The OAuth 2.0 Device Authorization plugin expects the following. :param device_authorization_endpoint: OAuth 2.0 Device Authorization Endpoint, for example: https://localhost:8020/oidc/authorize/device Note that if a discovery document is provided this value will override the discovered one. :ty...
6
stack_v2_sparse_classes_30k_train_033769
Implement the Python class `OidcDeviceAuthorization` described below. Class description: Implementation for OAuth 2.0 Device Authorization Grant. Method signatures and docstrings: - def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret=None, access_token_endpoint=None, device_authorizatio...
Implement the Python class `OidcDeviceAuthorization` described below. Class description: Implementation for OAuth 2.0 Device Authorization Grant. Method signatures and docstrings: - def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret=None, access_token_endpoint=None, device_authorizatio...
e6f3999c6f2f846e3dda505343166ab8c8346c2a
<|skeleton|> class OidcDeviceAuthorization: """Implementation for OAuth 2.0 Device Authorization Grant.""" def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret=None, access_token_endpoint=None, device_authorization_endpoint=None, discovery_endpoint=None, code_challenge=None, code_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OidcDeviceAuthorization: """Implementation for OAuth 2.0 Device Authorization Grant.""" def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret=None, access_token_endpoint=None, device_authorization_endpoint=None, discovery_endpoint=None, code_challenge=None, code_challenge_met...
the_stack_v2_python_sparse
keystoneauth1/identity/v3/oidc.py
openstack/keystoneauth
train
51
39dd1df263aeb270406c25a7c06bd35dae05337a
[ "super(DeepclusteringReconstructor, self).__init__(conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation)\nusedbins_names = conf['usedbins'].split(' ')\nusedbins_dataconfs = []\nfor usedbins_name in usedbins_names:\n usedbins_dataconfs.append(dict(dataconf.items(usedbins_name)))\nself.usedbins_reade...
<|body_start_0|> super(DeepclusteringReconstructor, self).__init__(conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation) usedbins_names = conf['usedbins'].split(' ') usedbins_dataconfs = [] for usedbins_name in usedbins_names: usedbins_dataconfs.append(dict(data...
the deepclustering reconstructor class a reconstructor using deep clustering
DeepclusteringReconstructor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepclusteringReconstructor: """the deepclustering reconstructor class a reconstructor using deep clustering""" def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation=False): """DeepclusteringReconstructor constructor Args: conf: the reconstructor confi...
stack_v2_sparse_classes_75kplus_train_004462
4,868
permissive
[ { "docstring": "DeepclusteringReconstructor constructor Args: conf: the reconstructor configuration as a dictionary evalconf: the evaluator configuration as a ConfigParser dataconf: the database configuration rec_dir: the directory where the reconstructions will be stored", "name": "__init__", "signatur...
3
stack_v2_sparse_classes_30k_train_012532
Implement the Python class `DeepclusteringReconstructor` described below. Class description: the deepclustering reconstructor class a reconstructor using deep clustering Method signatures and docstrings: - def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation=False): DeepclusteringReco...
Implement the Python class `DeepclusteringReconstructor` described below. Class description: the deepclustering reconstructor class a reconstructor using deep clustering Method signatures and docstrings: - def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation=False): DeepclusteringReco...
5e862cbf846d45b8a317f87588533f3fde9f0726
<|skeleton|> class DeepclusteringReconstructor: """the deepclustering reconstructor class a reconstructor using deep clustering""" def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation=False): """DeepclusteringReconstructor constructor Args: conf: the reconstructor confi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeepclusteringReconstructor: """the deepclustering reconstructor class a reconstructor using deep clustering""" def __init__(self, conf, evalconf, dataconf, rec_dir, task, optimal_frame_permutation=False): """DeepclusteringReconstructor constructor Args: conf: the reconstructor configuration as a...
the_stack_v2_python_sparse
nabu/postprocessing/reconstructors/deepclustering_reconstructor.py
JeroenZegers/Nabu-MSSS
train
19
1abf2d4646379c4a743604a6834a37bbf2bb26d8
[ "if GuidedBackprop.GuidedReluRegistered is False:\n\n @tf.RegisterGradient('GuidedRelu')\n def _GuidedReluGrad(op, grad):\n gate_g = tf.cast(grad > 0, 'float32')\n gate_y = tf.cast(op.outputs[0] > 0, 'float32')\n return gate_y * gate_g * grad\nGuidedBackprop.GuidedReluRegistered = True\n'...
<|body_start_0|> if GuidedBackprop.GuidedReluRegistered is False: @tf.RegisterGradient('GuidedRelu') def _GuidedReluGrad(op, grad): gate_g = tf.cast(grad > 0, 'float32') gate_y = tf.cast(op.outputs[0] > 0, 'float32') return gate_y * gate_g...
A SaliencyMask class that computes saliency masks with GuidedBackProp. This implementation copies the TensorFlow graph to a new graph with the ReLU gradient overwritten as in the paper: https://arxiv.org/abs/1412.6806
GuidedBackprop
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GuidedBackprop: """A SaliencyMask class that computes saliency masks with GuidedBackProp. This implementation copies the TensorFlow graph to a new graph with the ReLU gradient overwritten as in the paper: https://arxiv.org/abs/1412.6806""" def __init__(self, model, output_index=0, custom_los...
stack_v2_sparse_classes_75kplus_train_004463
3,700
permissive
[ { "docstring": "Constructs a GuidedBackprop SaliencyMask.", "name": "__init__", "signature": "def __init__(self, model, output_index=0, custom_loss=None)" }, { "docstring": "Returns a GuidedBackprop mask.", "name": "get_mask", "signature": "def get_mask(self, input_image)" } ]
2
null
Implement the Python class `GuidedBackprop` described below. Class description: A SaliencyMask class that computes saliency masks with GuidedBackProp. This implementation copies the TensorFlow graph to a new graph with the ReLU gradient overwritten as in the paper: https://arxiv.org/abs/1412.6806 Method signatures an...
Implement the Python class `GuidedBackprop` described below. Class description: A SaliencyMask class that computes saliency masks with GuidedBackProp. This implementation copies the TensorFlow graph to a new graph with the ReLU gradient overwritten as in the paper: https://arxiv.org/abs/1412.6806 Method signatures an...
692785e881dc12a1500a9e651b07c7ff6fef6f9d
<|skeleton|> class GuidedBackprop: """A SaliencyMask class that computes saliency masks with GuidedBackProp. This implementation copies the TensorFlow graph to a new graph with the ReLU gradient overwritten as in the paper: https://arxiv.org/abs/1412.6806""" def __init__(self, model, output_index=0, custom_los...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GuidedBackprop: """A SaliencyMask class that computes saliency masks with GuidedBackProp. This implementation copies the TensorFlow graph to a new graph with the ReLU gradient overwritten as in the paper: https://arxiv.org/abs/1412.6806""" def __init__(self, model, output_index=0, custom_loss=None): ...
the_stack_v2_python_sparse
keras_explain/deep_viz_keras/guided_backprop.py
PrimozGodec/keras-explain
train
18
060cf491d95c2562dee4a400e3409fef73b7b275
[ "self.attempt_num = attempt_num\nself.job_instance_id = job_instance_id\nself.job_start_time_usecs = job_start_time_usecs", "if dictionary is None:\n return None\nattempt_num = dictionary.get('attemptNum')\njob_instance_id = dictionary.get('jobInstanceId')\njob_start_time_usecs = dictionary.get('jobStartTimeUs...
<|body_start_0|> self.attempt_num = attempt_num self.job_instance_id = job_instance_id self.job_start_time_usecs = job_start_time_usecs <|end_body_0|> <|body_start_1|> if dictionary is None: return None attempt_num = dictionary.get('attemptNum') job_instance_...
Implementation of the 'MagnetoInstanceId' model. TODO: type description here. Attributes: attempt_num (long|int): The attempt of the job instance that took the snapshot. job_instance_id (long|int): Instance of the job that took the snapshot. job_start_time_usecs (long|int): Start time of the job instance.
MagnetoInstanceId
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MagnetoInstanceId: """Implementation of the 'MagnetoInstanceId' model. TODO: type description here. Attributes: attempt_num (long|int): The attempt of the job instance that took the snapshot. job_instance_id (long|int): Instance of the job that took the snapshot. job_start_time_usecs (long|int): ...
stack_v2_sparse_classes_75kplus_train_004464
1,991
permissive
[ { "docstring": "Constructor for the MagnetoInstanceId class", "name": "__init__", "signature": "def __init__(self, attempt_num=None, job_instance_id=None, job_start_time_usecs=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionar...
2
stack_v2_sparse_classes_30k_val_001383
Implement the Python class `MagnetoInstanceId` described below. Class description: Implementation of the 'MagnetoInstanceId' model. TODO: type description here. Attributes: attempt_num (long|int): The attempt of the job instance that took the snapshot. job_instance_id (long|int): Instance of the job that took the snap...
Implement the Python class `MagnetoInstanceId` described below. Class description: Implementation of the 'MagnetoInstanceId' model. TODO: type description here. Attributes: attempt_num (long|int): The attempt of the job instance that took the snapshot. job_instance_id (long|int): Instance of the job that took the snap...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class MagnetoInstanceId: """Implementation of the 'MagnetoInstanceId' model. TODO: type description here. Attributes: attempt_num (long|int): The attempt of the job instance that took the snapshot. job_instance_id (long|int): Instance of the job that took the snapshot. job_start_time_usecs (long|int): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MagnetoInstanceId: """Implementation of the 'MagnetoInstanceId' model. TODO: type description here. Attributes: attempt_num (long|int): The attempt of the job instance that took the snapshot. job_instance_id (long|int): Instance of the job that took the snapshot. job_start_time_usecs (long|int): Start time of...
the_stack_v2_python_sparse
cohesity_management_sdk/models/magneto_instance_id.py
cohesity/management-sdk-python
train
24
fba92b565b0b80e6da232dba71044d76188fa657
[ "user = self.request.user\nif not user.profile.has_backdated:\n backdate_user(user.profile)\nreturn user", "user = self.request.user\ncontext = super().get_context_data(**kwargs)\nif not user.profile.has_backdated:\n backdate_user(user.profile)\nmemberships = user.membership_set.all().order_by('group__name'...
<|body_start_0|> user = self.request.user if not user.profile.has_backdated: backdate_user(user.profile) return user <|end_body_0|> <|body_start_1|> user = self.request.user context = super().get_context_data(**kwargs) if not user.profile.has_backdated: ...
View for a user's dashboard.
UserDetailView
[ "MIT", "AGPL-3.0-only", "ISC", "LGPL-2.1-or-later", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserDetailView: """View for a user's dashboard.""" def get_object(self): """Get object for template.""" <|body_0|> def get_context_data(self, **kwargs): """Get additional context data for template.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_004465
16,961
permissive
[ { "docstring": "Get object for template.", "name": "get_object", "signature": "def get_object(self)" }, { "docstring": "Get additional context data for template.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_037378
Implement the Python class `UserDetailView` described below. Class description: View for a user's dashboard. Method signatures and docstrings: - def get_object(self): Get object for template. - def get_context_data(self, **kwargs): Get additional context data for template.
Implement the Python class `UserDetailView` described below. Class description: View for a user's dashboard. Method signatures and docstrings: - def get_object(self): Get object for template. - def get_context_data(self, **kwargs): Get additional context data for template. <|skeleton|> class UserDetailView: """V...
5b668eb66449e2ebaeb2177237b9a55a14d69efb
<|skeleton|> class UserDetailView: """View for a user's dashboard.""" def get_object(self): """Get object for template.""" <|body_0|> def get_context_data(self, **kwargs): """Get additional context data for template.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserDetailView: """View for a user's dashboard.""" def get_object(self): """Get object for template.""" user = self.request.user if not user.profile.has_backdated: backdate_user(user.profile) return user def get_context_data(self, **kwargs): """Get...
the_stack_v2_python_sparse
codewof/users/views.py
uccser/codewof
train
7
70c6aa44c56170d6968e1fb33022c2cc416e92b4
[ "if not isinstance(node, Node):\n raise TypeError('not a node')\nfor child in node:\n yield child\n for subchild in self.walk(child, condition):\n yield subchild", "if not isinstance(node, Node):\n raise TypeError('not a node')\nfor child in node:\n if condition(child):\n yield child\...
<|body_start_0|> if not isinstance(node, Node): raise TypeError('not a node') for child in node: yield child for subchild in self.walk(child, condition): yield subchild <|end_body_0|> <|body_start_1|> if not isinstance(node, Node): ...
The generic walker that will walk through the asttypes tree. It also provide a couple helper methods that serves as filters, i.e. it will only return specific nodes that match the conditions that were provided. The condition is specified as a function that accept a single Node as the argument, which the function may us...
Walker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Walker: """The generic walker that will walk through the asttypes tree. It also provide a couple helper methods that serves as filters, i.e. it will only return specific nodes that match the conditions that were provided. The condition is specified as a function that accept a single Node as the a...
stack_v2_sparse_classes_75kplus_train_004466
6,622
permissive
[ { "docstring": "Simply walk through the entire node; condition argument is ignored.", "name": "walk", "signature": "def walk(self, node, condition=None)" }, { "docstring": "This method accepts a node and the condition function; a generator will be returned to yield the nodes that got matched by ...
3
null
Implement the Python class `Walker` described below. Class description: The generic walker that will walk through the asttypes tree. It also provide a couple helper methods that serves as filters, i.e. it will only return specific nodes that match the conditions that were provided. The condition is specified as a func...
Implement the Python class `Walker` described below. Class description: The generic walker that will walk through the asttypes tree. It also provide a couple helper methods that serves as filters, i.e. it will only return specific nodes that match the conditions that were provided. The condition is specified as a func...
a9748e668e7111365d373f1edff07f0b779d6efc
<|skeleton|> class Walker: """The generic walker that will walk through the asttypes tree. It also provide a couple helper methods that serves as filters, i.e. it will only return specific nodes that match the conditions that were provided. The condition is specified as a function that accept a single Node as the a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Walker: """The generic walker that will walk through the asttypes tree. It also provide a couple helper methods that serves as filters, i.e. it will only return specific nodes that match the conditions that were provided. The condition is specified as a function that accept a single Node as the argument, whic...
the_stack_v2_python_sparse
src/calmjs/parse/walkers.py
calmjs/calmjs.parse
train
40
2ae67a3233aa99941dccfb5e10bb936bc9ef392c
[ "records = set(words)\noutput = ''\nfor word in words:\n if len(word) > len(output) or (len(word) == len(output) and word < output):\n if all([word[:i] in records for i in range(1, len(word))]):\n output = word\nreturn output", "_trie = lambda: collections.defaultdict(_trie)\ntrie = _trie()\n...
<|body_start_0|> records = set(words) output = '' for word in words: if len(word) > len(output) or (len(word) == len(output) and word < output): if all([word[:i] in records for i in range(1, len(word))]): output = word return output <|end_b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestWord(self, words): """:type words: List[str] :rtype: str""" <|body_0|> def longestWord_trie(self, words): """:type words: List[str] :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> records = set(words) output ...
stack_v2_sparse_classes_75kplus_train_004467
2,816
no_license
[ { "docstring": ":type words: List[str] :rtype: str", "name": "longestWord", "signature": "def longestWord(self, words)" }, { "docstring": ":type words: List[str] :rtype: str", "name": "longestWord_trie", "signature": "def longestWord_trie(self, words)" } ]
2
stack_v2_sparse_classes_30k_train_028022
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestWord(self, words): :type words: List[str] :rtype: str - def longestWord_trie(self, words): :type words: List[str] :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestWord(self, words): :type words: List[str] :rtype: str - def longestWord_trie(self, words): :type words: List[str] :rtype: str <|skeleton|> class Solution: def lo...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def longestWord(self, words): """:type words: List[str] :rtype: str""" <|body_0|> def longestWord_trie(self, words): """:type words: List[str] :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestWord(self, words): """:type words: List[str] :rtype: str""" records = set(words) output = '' for word in words: if len(word) > len(output) or (len(word) == len(output) and word < output): if all([word[:i] in records for i in rang...
the_stack_v2_python_sparse
src/lt_720.py
oxhead/CodingYourWay
train
0
763274af084f20092907e9a1a89050693dcdd4bb
[ "if not strs:\n return ''\nstr0 = min(strs)\nstr1 = max(strs)\nfor i in range(len(str0)):\n if str0[i] != str1[i]:\n return str0[:i]\nreturn str0", "if not strs:\n return ''\nmin_len_str = sorted([[str_, len(str_)] for str_ in strs], key=lambda s: s[1])[0][0]\nstrs.remove(min_len_str)\nlongest_pre...
<|body_start_0|> if not strs: return '' str0 = min(strs) str1 = max(strs) for i in range(len(str0)): if str0[i] != str1[i]: return str0[:i] return str0 <|end_body_0|> <|body_start_1|> if not strs: return '' min_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def longestCommonPrefix2(self, strs): """:type strs: List[str] :rtype: str""" <|body_1|> def longestCommonPrefix3(self, strs): """:type strs: List[s...
stack_v2_sparse_classes_75kplus_train_004468
1,893
no_license
[ { "docstring": ":type strs: List[str] :rtype: str", "name": "longestCommonPrefix", "signature": "def longestCommonPrefix(self, strs)" }, { "docstring": ":type strs: List[str] :rtype: str", "name": "longestCommonPrefix2", "signature": "def longestCommonPrefix2(self, strs)" }, { "d...
3
stack_v2_sparse_classes_30k_train_004460
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix2(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix3(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix2(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix3(self, ...
97cc61fefe0bedf5161687aab92fb09b0df990e2
<|skeleton|> class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def longestCommonPrefix2(self, strs): """:type strs: List[str] :rtype: str""" <|body_1|> def longestCommonPrefix3(self, strs): """:type strs: List[s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" if not strs: return '' str0 = min(strs) str1 = max(strs) for i in range(len(str0)): if str0[i] != str1[i]: return str0[:i] return str0 ...
the_stack_v2_python_sparse
code/other/longest_common_prefix.py
JiaXingBinggan/For_work
train
0
dd8bf1ef85e35c48f44068986bc6fce957132d8f
[ "del kwargs\nif not isinstance(model, Model):\n wrapper_warning()\n model = CallableModelWrapper(model, 'probs')\nsuper(FastGradientMethod, self).__init__(model, dtypestr)", "assert self.parse_params(**kwargs)\nlabels, _nb_classes = self.get_or_guess_labels(x, kwargs)\nreturn self.fgm(x, labels=labels, targ...
<|body_start_0|> del kwargs if not isinstance(model, Model): wrapper_warning() model = CallableModelWrapper(model, 'probs') super(FastGradientMethod, self).__init__(model, dtypestr) <|end_body_0|> <|body_start_1|> assert self.parse_params(**kwargs) labels...
Inherited class from Attack and cleverhans.attacks.FastGradientMethod. This attack was originally implemented by Goodfellow et al. (2015) with the infinity norm (and is known as the "Fast Gradient Sign Method"). This implementation extends the attack to other norms, and is therefore called the Fast Gradient Method. Pap...
FastGradientMethod
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FastGradientMethod: """Inherited class from Attack and cleverhans.attacks.FastGradientMethod. This attack was originally implemented by Goodfellow et al. (2015) with the infinity norm (and is known as the "Fast Gradient Sign Method"). This implementation extends the attack to other norms, and is ...
stack_v2_sparse_classes_75kplus_train_004469
6,719
permissive
[ { "docstring": "Creates a FastGradientMethod instance in eager execution. :model: cleverhans.model.Model :dtypestr: datatype in the string format.", "name": "__init__", "signature": "def __init__(self, model, dtypestr='float32', **kwargs)" }, { "docstring": "Generates the adversarial sample for ...
3
null
Implement the Python class `FastGradientMethod` described below. Class description: Inherited class from Attack and cleverhans.attacks.FastGradientMethod. This attack was originally implemented by Goodfellow et al. (2015) with the infinity norm (and is known as the "Fast Gradient Sign Method"). This implementation ext...
Implement the Python class `FastGradientMethod` described below. Class description: Inherited class from Attack and cleverhans.attacks.FastGradientMethod. This attack was originally implemented by Goodfellow et al. (2015) with the infinity norm (and is known as the "Fast Gradient Sign Method"). This implementation ext...
bbe96757fa7daded0090b1d9a26b9c90d7d87c61
<|skeleton|> class FastGradientMethod: """Inherited class from Attack and cleverhans.attacks.FastGradientMethod. This attack was originally implemented by Goodfellow et al. (2015) with the infinity norm (and is known as the "Fast Gradient Sign Method"). This implementation extends the attack to other norms, and is ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FastGradientMethod: """Inherited class from Attack and cleverhans.attacks.FastGradientMethod. This attack was originally implemented by Goodfellow et al. (2015) with the infinity norm (and is known as the "Fast Gradient Sign Method"). This implementation extends the attack to other norms, and is therefore cal...
the_stack_v2_python_sparse
cleverhans/attacks_tfe.py
yogeshbalaji/InvGAN
train
17
1b07b5a66f6ef5dd53e8b640e31ec9a771a49b57
[ "if not hasattr(cls, 'instance') or not cls.instance:\n cls.instance = super().__new__(cls)\nreturn cls.instance", "if hasattr(self, 'context'):\n return\n' initialize CIContext '\ncontext_options = NSDictionary.dictionaryWithDictionary_({'workingColorSpace': Quartz.CoreGraphics.kCGColorSpaceExtendedSRGB, '...
<|body_start_0|> if not hasattr(cls, 'instance') or not cls.instance: cls.instance = super().__new__(cls) return cls.instance <|end_body_0|> <|body_start_1|> if hasattr(self, 'context'): return ' initialize CIContext ' context_options = NSDictionary.dicti...
Convert images to jpeg. This class is a singleton which will re-use the Core Image CIContext to avoid creating a new context for every conversion.
ImageConverter
[ "MIT", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageConverter: """Convert images to jpeg. This class is a singleton which will re-use the Core Image CIContext to avoid creating a new context for every conversion.""" def __new__(cls, *args, **kwargs): """create new object or return instance of already created singleton""" ...
stack_v2_sparse_classes_75kplus_train_004470
5,124
permissive
[ { "docstring": "create new object or return instance of already created singleton", "name": "__new__", "signature": "def __new__(cls, *args, **kwargs)" }, { "docstring": "return existing singleton or create a new one", "name": "__init__", "signature": "def __init__(self)" }, { "d...
3
stack_v2_sparse_classes_30k_val_000198
Implement the Python class `ImageConverter` described below. Class description: Convert images to jpeg. This class is a singleton which will re-use the Core Image CIContext to avoid creating a new context for every conversion. Method signatures and docstrings: - def __new__(cls, *args, **kwargs): create new object or...
Implement the Python class `ImageConverter` described below. Class description: Convert images to jpeg. This class is a singleton which will re-use the Core Image CIContext to avoid creating a new context for every conversion. Method signatures and docstrings: - def __new__(cls, *args, **kwargs): create new object or...
2cb5a4d18a27be6ccf68f5f35abd39418d238016
<|skeleton|> class ImageConverter: """Convert images to jpeg. This class is a singleton which will re-use the Core Image CIContext to avoid creating a new context for every conversion.""" def __new__(cls, *args, **kwargs): """create new object or return instance of already created singleton""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageConverter: """Convert images to jpeg. This class is a singleton which will re-use the Core Image CIContext to avoid creating a new context for every conversion.""" def __new__(cls, *args, **kwargs): """create new object or return instance of already created singleton""" if not hasatt...
the_stack_v2_python_sparse
osxphotos/imageconverter.py
RhetTbull/osxphotos
train
1,287
22a95d052d6069f5ccb2bd60d93f52e335dbc054
[ "self.b = big\nself.m = medium\nself.s = small", "if carType == 1:\n self.b -= 1\n n = self.b\nelif carType == 2:\n self.m -= 1\n n = self.m\nelif carType == 3:\n self.s -= 1\n n = self.s\nreturn n >= 0" ]
<|body_start_0|> self.b = big self.m = medium self.s = small <|end_body_0|> <|body_start_1|> if carType == 1: self.b -= 1 n = self.b elif carType == 2: self.m -= 1 n = self.m elif carType == 3: self.s -= 1 ...
感觉只需要三个数就可以满足要求了 每次入车,车辆上限减一即可 因为这个系统完全不成熟,也没有出车的函数,所以我也不考虑得那么完善 210319
ParkingSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParkingSystem: """感觉只需要三个数就可以满足要求了 每次入车,车辆上限减一即可 因为这个系统完全不成熟,也没有出车的函数,所以我也不考虑得那么完善 210319""" def __init__(self, big, medium, small): """:type big: int :type medium: int :type small: int""" <|body_0|> def addCar(self, carType): """:type carType: int :rtype: bool""...
stack_v2_sparse_classes_75kplus_train_004471
1,001
no_license
[ { "docstring": ":type big: int :type medium: int :type small: int", "name": "__init__", "signature": "def __init__(self, big, medium, small)" }, { "docstring": ":type carType: int :rtype: bool", "name": "addCar", "signature": "def addCar(self, carType)" } ]
2
stack_v2_sparse_classes_30k_train_050904
Implement the Python class `ParkingSystem` described below. Class description: 感觉只需要三个数就可以满足要求了 每次入车,车辆上限减一即可 因为这个系统完全不成熟,也没有出车的函数,所以我也不考虑得那么完善 210319 Method signatures and docstrings: - def __init__(self, big, medium, small): :type big: int :type medium: int :type small: int - def addCar(self, carType): :type carTyp...
Implement the Python class `ParkingSystem` described below. Class description: 感觉只需要三个数就可以满足要求了 每次入车,车辆上限减一即可 因为这个系统完全不成熟,也没有出车的函数,所以我也不考虑得那么完善 210319 Method signatures and docstrings: - def __init__(self, big, medium, small): :type big: int :type medium: int :type small: int - def addCar(self, carType): :type carTyp...
7167f1a7c6cb16cca63675c80037682752ee2a7d
<|skeleton|> class ParkingSystem: """感觉只需要三个数就可以满足要求了 每次入车,车辆上限减一即可 因为这个系统完全不成熟,也没有出车的函数,所以我也不考虑得那么完善 210319""" def __init__(self, big, medium, small): """:type big: int :type medium: int :type small: int""" <|body_0|> def addCar(self, carType): """:type carType: int :rtype: bool""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ParkingSystem: """感觉只需要三个数就可以满足要求了 每次入车,车辆上限减一即可 因为这个系统完全不成熟,也没有出车的函数,所以我也不考虑得那么完善 210319""" def __init__(self, big, medium, small): """:type big: int :type medium: int :type small: int""" self.b = big self.m = medium self.s = small def addCar(self, carType): ...
the_stack_v2_python_sparse
Everyday/No1603.py
kikihiter/LeetCode2
train
4
4a53aa4da9f70b968fd61ce41cd1fc8d90ef6881
[ "self.sen_len = sen_len\nself.encoding_dim = encoding_dim\nself.autoencoder = None\nself.encoder = None\nself.kmeanmodel = KMeans(n_clusters=2)\nself.epoch = epoch", "x_train = self.preprocess(x, length=self.sen_len)\ninput_text = Input(shape=(self.sen_len,))\nencoded = Dense(1024, activation='tanh')(input_text)\...
<|body_start_0|> self.sen_len = sen_len self.encoding_dim = encoding_dim self.autoencoder = None self.encoder = None self.kmeanmodel = KMeans(n_clusters=2) self.epoch = epoch <|end_body_0|> <|body_start_1|> x_train = self.preprocess(x, length=self.sen_len) ...
基于字符的Autoencoder.
ASCIIAutoencoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ASCIIAutoencoder: """基于字符的Autoencoder.""" def __init__(self, sen_len=512, encoding_dim=32, epoch=50, val_ratio=0.3): """Init. :param sen_len:把sentences pad成相同的⻓度 :param encoding_dim:压缩后的维度dim :param epoch:要跑多少epoch :param kmeanmodel:简单的KNN clustering模型""" <|body_0|> def ...
stack_v2_sparse_classes_75kplus_train_004472
3,269
no_license
[ { "docstring": "Init. :param sen_len:把sentences pad成相同的⻓度 :param encoding_dim:压缩后的维度dim :param epoch:要跑多少epoch :param kmeanmodel:简单的KNN clustering模型", "name": "__init__", "signature": "def __init__(self, sen_len=512, encoding_dim=32, epoch=50, val_ratio=0.3)" }, { "docstring": "模型构建。 :param x: i...
2
stack_v2_sparse_classes_30k_train_020123
Implement the Python class `ASCIIAutoencoder` described below. Class description: 基于字符的Autoencoder. Method signatures and docstrings: - def __init__(self, sen_len=512, encoding_dim=32, epoch=50, val_ratio=0.3): Init. :param sen_len:把sentences pad成相同的⻓度 :param encoding_dim:压缩后的维度dim :param epoch:要跑多少epoch :param kmean...
Implement the Python class `ASCIIAutoencoder` described below. Class description: 基于字符的Autoencoder. Method signatures and docstrings: - def __init__(self, sen_len=512, encoding_dim=32, epoch=50, val_ratio=0.3): Init. :param sen_len:把sentences pad成相同的⻓度 :param encoding_dim:压缩后的维度dim :param epoch:要跑多少epoch :param kmean...
997d7617674019d3f6563e6370b1b36ddd3df7ea
<|skeleton|> class ASCIIAutoencoder: """基于字符的Autoencoder.""" def __init__(self, sen_len=512, encoding_dim=32, epoch=50, val_ratio=0.3): """Init. :param sen_len:把sentences pad成相同的⻓度 :param encoding_dim:压缩后的维度dim :param epoch:要跑多少epoch :param kmeanmodel:简单的KNN clustering模型""" <|body_0|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ASCIIAutoencoder: """基于字符的Autoencoder.""" def __init__(self, sen_len=512, encoding_dim=32, epoch=50, val_ratio=0.3): """Init. :param sen_len:把sentences pad成相同的⻓度 :param encoding_dim:压缩后的维度dim :param epoch:要跑多少epoch :param kmeanmodel:简单的KNN clustering模型""" self.sen_len = sen_len se...
the_stack_v2_python_sparse
ChatRobot/NLP/Auto-Encoder/Auto-Encoder.py
zhengruiguo/Python_Project
train
0
6116a1789235143236bd25ad2f695cbc06b922d0
[ "count = {0: 0, 1: 0, 2: 0}\nfor i in nums:\n if i == 0:\n count[0] += 1\n elif i == 1:\n count[1] += 1\n else:\n count[2] += 1\ni = 0\nfor cur in range(3):\n for j in range(count[cur]):\n nums[i] = cur\n i += 1", "p0 = curr = 0\np2 = len(nums) - 1\nwhile curr <= p2:...
<|body_start_0|> count = {0: 0, 1: 0, 2: 0} for i in nums: if i == 0: count[0] += 1 elif i == 1: count[1] += 1 else: count[2] += 1 i = 0 for cur in range(3): for j in range(count[cur]): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortColors(self, nums) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def sortColors(self, nums) -> None: """一次遍历即可""" <|body_1|> <|end_skeleton|> <|body_start_0|> count = {0: 0, 1: 0, 2: 0} for...
stack_v2_sparse_classes_75kplus_train_004473
1,820
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead.", "name": "sortColors", "signature": "def sortColors(self, nums) -> None" }, { "docstring": "一次遍历即可", "name": "sortColors", "signature": "def sortColors(self, nums) -> None" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortColors(self, nums) -> None: Do not return anything, modify nums in-place instead. - def sortColors(self, nums) -> None: 一次遍历即可
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortColors(self, nums) -> None: Do not return anything, modify nums in-place instead. - def sortColors(self, nums) -> None: 一次遍历即可 <|skeleton|> class Solution: def sort...
13e7ec9fe7a92ab13b247bd4edeb1ada5de81a08
<|skeleton|> class Solution: def sortColors(self, nums) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def sortColors(self, nums) -> None: """一次遍历即可""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def sortColors(self, nums) -> None: """Do not return anything, modify nums in-place instead.""" count = {0: 0, 1: 0, 2: 0} for i in nums: if i == 0: count[0] += 1 elif i == 1: count[1] += 1 else: ...
the_stack_v2_python_sparse
Algorithms/75_Sort_Colors/Sort_Colors.py
lirui-ML/my_leetcode
train
1
18cc873cffa0266534dae3894a133718fbdcbbc7
[ "last_time = db.session.query(func.max(Article.create_date).label('max_time')).one().max_time\nyear = date_maker.year(last_time)\nreturn year", "first_time = db.session.query(func.min(Article.create_date).label('min_time')).one().min_time\nfirst_year = date_maker.year(first_time)\nreturn first_year", "first = s...
<|body_start_0|> last_time = db.session.query(func.max(Article.create_date).label('max_time')).one().max_time year = date_maker.year(last_time) return year <|end_body_0|> <|body_start_1|> first_time = db.session.query(func.min(Article.create_date).label('min_time')).one().min_time ...
GetArchiveCtrl
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetArchiveCtrl: def last_create_time(): """最晚创建时间 :return:""" <|body_0|> def first_create_time(): """最早创建时间 :return:""" <|body_1|> def extract_post_with_year_and_month(self, order_desc=True): """按照年、月筛选博文 :param order_desc: bool,排序方式,默认按照时间倒序 :re...
stack_v2_sparse_classes_75kplus_train_004474
2,805
permissive
[ { "docstring": "最晚创建时间 :return:", "name": "last_create_time", "signature": "def last_create_time()" }, { "docstring": "最早创建时间 :return:", "name": "first_create_time", "signature": "def first_create_time()" }, { "docstring": "按照年、月筛选博文 :param order_desc: bool,排序方式,默认按照时间倒序 :return:...
4
stack_v2_sparse_classes_30k_train_018127
Implement the Python class `GetArchiveCtrl` described below. Class description: Implement the GetArchiveCtrl class. Method signatures and docstrings: - def last_create_time(): 最晚创建时间 :return: - def first_create_time(): 最早创建时间 :return: - def extract_post_with_year_and_month(self, order_desc=True): 按照年、月筛选博文 :param ord...
Implement the Python class `GetArchiveCtrl` described below. Class description: Implement the GetArchiveCtrl class. Method signatures and docstrings: - def last_create_time(): 最晚创建时间 :return: - def first_create_time(): 最早创建时间 :return: - def extract_post_with_year_and_month(self, order_desc=True): 按照年、月筛选博文 :param ord...
7faec2cd705659062a05787d26c307ff8ff2c055
<|skeleton|> class GetArchiveCtrl: def last_create_time(): """最晚创建时间 :return:""" <|body_0|> def first_create_time(): """最早创建时间 :return:""" <|body_1|> def extract_post_with_year_and_month(self, order_desc=True): """按照年、月筛选博文 :param order_desc: bool,排序方式,默认按照时间倒序 :re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GetArchiveCtrl: def last_create_time(): """最晚创建时间 :return:""" last_time = db.session.query(func.max(Article.create_date).label('max_time')).one().max_time year = date_maker.year(last_time) return year def first_create_time(): """最早创建时间 :return:""" first_tim...
the_stack_v2_python_sparse
back/controller/archives.py
imoyao/idealyard
train
159
989793b27ec9800cdbe94db42a5741762ab44729
[ "super().__init__(fl_model, data_handler, hyperparams, **kwargs)\ntrain_data, test_data = data_handler.get_data() or (None, None)\nenv_class_ref = data_handler.get_env_class_ref()\nif not inspect.isclass(env_class_ref):\n raise ValueError('Environment reference should be a class reference and not an instance')\n...
<|body_start_0|> super().__init__(fl_model, data_handler, hyperparams, **kwargs) train_data, test_data = data_handler.get_data() or (None, None) env_class_ref = data_handler.get_env_class_ref() if not inspect.isclass(env_class_ref): raise ValueError('Environment reference sho...
Local training handler for RL
RLLocalTrainingHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RLLocalTrainingHandler: """Local training handler for RL""" def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs): """Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be trained :type fl_model: `model.FLModel` :param data_handler:...
stack_v2_sparse_classes_75kplus_train_004475
3,100
permissive
[ { "docstring": "Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be trained :type fl_model: `model.FLModel` :param data_handler: data handler that will be used to obtain data and environment reference :type data_handler: `DataHandler` :param hyperparams: Hyperparameters used...
3
stack_v2_sparse_classes_30k_train_029854
Implement the Python class `RLLocalTrainingHandler` described below. Class description: Local training handler for RL Method signatures and docstrings: - def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs): Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be tra...
Implement the Python class `RLLocalTrainingHandler` described below. Class description: Local training handler for RL Method signatures and docstrings: - def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs): Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be tra...
64ffa2ee2e906b1bd6b3dd6aabcf6fc3de862608
<|skeleton|> class RLLocalTrainingHandler: """Local training handler for RL""" def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs): """Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be trained :type fl_model: `model.FLModel` :param data_handler:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RLLocalTrainingHandler: """Local training handler for RL""" def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs): """Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be trained :type fl_model: `model.FLModel` :param data_handler: data handler...
the_stack_v2_python_sparse
debugging-constructs/ibmfl/party/training/rl_local_training_handler.py
SEED-VT/FedDebug
train
8
e79ea0ba090ace826ae05528a567088197f7861a
[ "if path.endswith('/'):\n path = path[:-1]\nreturn Bip32PathParser.__ParseElements(list(filter(None, path.split('/'))))", "if len(path_elems) > 0 and path_elems[0] == Bip32PathConst.MASTER_CHAR:\n path_elems = path_elems[1:]\n is_absolute = True\nelse:\n is_absolute = False\nparsed_elems = list(map(Bi...
<|body_start_0|> if path.endswith('/'): path = path[:-1] return Bip32PathParser.__ParseElements(list(filter(None, path.split('/')))) <|end_body_0|> <|body_start_1|> if len(path_elems) > 0 and path_elems[0] == Bip32PathConst.MASTER_CHAR: path_elems = path_elems[1:] ...
BIP32 path parser class. It parses a BIP-0032 path and returns a Bip32Path object.
Bip32PathParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bip32PathParser: """BIP32 path parser class. It parses a BIP-0032 path and returns a Bip32Path object.""" def Parse(path: str) -> Bip32Path: """Parse a path and return a Bip32Path object. Args: path (str): Path Returns: Bip32Path object: Bip32Path object Raises: Bip32PathError: If th...
stack_v2_sparse_classes_75kplus_train_004476
7,181
permissive
[ { "docstring": "Parse a path and return a Bip32Path object. Args: path (str): Path Returns: Bip32Path object: Bip32Path object Raises: Bip32PathError: If the path is not valid", "name": "Parse", "signature": "def Parse(path: str) -> Bip32Path" }, { "docstring": "Parse path elements and return a ...
3
stack_v2_sparse_classes_30k_train_050382
Implement the Python class `Bip32PathParser` described below. Class description: BIP32 path parser class. It parses a BIP-0032 path and returns a Bip32Path object. Method signatures and docstrings: - def Parse(path: str) -> Bip32Path: Parse a path and return a Bip32Path object. Args: path (str): Path Returns: Bip32Pa...
Implement the Python class `Bip32PathParser` described below. Class description: BIP32 path parser class. It parses a BIP-0032 path and returns a Bip32Path object. Method signatures and docstrings: - def Parse(path: str) -> Bip32Path: Parse a path and return a Bip32Path object. Args: path (str): Path Returns: Bip32Pa...
d15c75ddd74e4838c396a0d036ef6faf11b06a4b
<|skeleton|> class Bip32PathParser: """BIP32 path parser class. It parses a BIP-0032 path and returns a Bip32Path object.""" def Parse(path: str) -> Bip32Path: """Parse a path and return a Bip32Path object. Args: path (str): Path Returns: Bip32Path object: Bip32Path object Raises: Bip32PathError: If th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Bip32PathParser: """BIP32 path parser class. It parses a BIP-0032 path and returns a Bip32Path object.""" def Parse(path: str) -> Bip32Path: """Parse a path and return a Bip32Path object. Args: path (str): Path Returns: Bip32Path object: Bip32Path object Raises: Bip32PathError: If the path is not...
the_stack_v2_python_sparse
bip_utils/bip/bip32/bip32_path.py
ebellocchia/bip_utils
train
244
58953c5910dee224e691f3be8b79716d30d77171
[ "def dfs(nd):\n if nd:\n s.add(nd.val)\n dfs(nd.left)\n dfs(nd.right)\ns = set()\ndfs(root)\nret = float('inf')\nfor v in s:\n if v > root.val and v < ret:\n ret = v\nif ret < float('inf'):\n return ret\nelse:\n return -1", "self.ret = float('inf')\n\ndef dfs(nd):\n if n...
<|body_start_0|> def dfs(nd): if nd: s.add(nd.val) dfs(nd.left) dfs(nd.right) s = set() dfs(root) ret = float('inf') for v in s: if v > root.val and v < ret: ret = v if ret < float('in...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findSecondMinimumValue1(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def findSecondMinimumValue2(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def dfs(nd): ...
stack_v2_sparse_classes_75kplus_train_004477
1,646
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "findSecondMinimumValue1", "signature": "def findSecondMinimumValue1(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "findSecondMinimumValue2", "signature": "def findSecondMinimumValue2(self, root)" }...
2
stack_v2_sparse_classes_30k_train_014757
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findSecondMinimumValue1(self, root): :type root: TreeNode :rtype: int - def findSecondMinimumValue2(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findSecondMinimumValue1(self, root): :type root: TreeNode :rtype: int - def findSecondMinimumValue2(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution...
d3e8669f932fc2e22711e8b7590d3365d020e189
<|skeleton|> class Solution: def findSecondMinimumValue1(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def findSecondMinimumValue2(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findSecondMinimumValue1(self, root): """:type root: TreeNode :rtype: int""" def dfs(nd): if nd: s.add(nd.val) dfs(nd.left) dfs(nd.right) s = set() dfs(root) ret = float('inf') for v in s: ...
the_stack_v2_python_sparse
leetcode/671.py
liuweilin17/algorithm
train
3
81566d03b343c74dfea384fb5bcdd5eb05be66be
[ "index = 'test_index'\nsketch_id = 1\nanalyzer = SessionizerSketchPlugin(index, sketch_id)\nanalyzer.datastore.client = mock.Mock()\ndatastore = analyzer.datastore\n_create_mock_event(datastore, 0, 3, time_diffs=[3000, 400000000])\nmessage = analyzer.run()\nself.assertEqual(message, 'Sessionizing completed, number ...
<|body_start_0|> index = 'test_index' sketch_id = 1 analyzer = SessionizerSketchPlugin(index, sketch_id) analyzer.datastore.client = mock.Mock() datastore = analyzer.datastore _create_mock_event(datastore, 0, 3, time_diffs=[3000, 400000000]) message = analyzer.run...
Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases.
TestSessionizerPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSessionizerPlugin: """Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases.""" def test_multiple_sessions(self): """Test multiple events, two of which are in the same session and one in a different session.""" <|body_0|> def test_zero_t...
stack_v2_sparse_classes_75kplus_train_004478
4,019
permissive
[ { "docstring": "Test multiple events, two of which are in the same session and one in a different session.", "name": "test_multiple_sessions", "signature": "def test_multiple_sessions(self)" }, { "docstring": "Test events with no time difference between them are allocated correctly.", "name"...
4
stack_v2_sparse_classes_30k_train_002656
Implement the Python class `TestSessionizerPlugin` described below. Class description: Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases. Method signatures and docstrings: - def test_multiple_sessions(self): Test multiple events, two of which are in the same session and one in a diff...
Implement the Python class `TestSessionizerPlugin` described below. Class description: Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases. Method signatures and docstrings: - def test_multiple_sessions(self): Test multiple events, two of which are in the same session and one in a diff...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class TestSessionizerPlugin: """Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases.""" def test_multiple_sessions(self): """Test multiple events, two of which are in the same session and one in a different session.""" <|body_0|> def test_zero_t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestSessionizerPlugin: """Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases.""" def test_multiple_sessions(self): """Test multiple events, two of which are in the same session and one in a different session.""" index = 'test_index' sketch_id = 1 ...
the_stack_v2_python_sparse
timesketch/lib/analyzers/sessionizer_test.py
google/timesketch
train
2,263
f2f9470b16140013b76c537a7f7386088a62a3ef
[ "suggestions_grouped_by_target = self.pipeline | 'Get all non-deleted suggestion models' >> ndb_io.GetModels(suggestion_models.GeneralSuggestionModel.get_all(include_deleted=False)) | 'Filter translate suggestions' >> beam.Filter(lambda m: m.suggestion_type == feconf.SUGGESTION_TYPE_TRANSLATE_CONTENT) | 'Transform ...
<|body_start_0|> suggestions_grouped_by_target = self.pipeline | 'Get all non-deleted suggestion models' >> ndb_io.GetModels(suggestion_models.GeneralSuggestionModel.get_all(include_deleted=False)) | 'Filter translate suggestions' >> beam.Filter(lambda m: m.suggestion_type == feconf.SUGGESTION_TYPE_TRANSLATE_CO...
Job that indexes the explorations in Elastic Search.
GenerateTranslationContributionStats
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenerateTranslationContributionStats: """Job that indexes the explorations in Elastic Search.""" def run(self) -> beam.PCollection[job_run_result.JobRunResult]: """Generates the translation contributins stats. Returns: PCollection. A PCollection of 'SUCCESS x' results, where x is the...
stack_v2_sparse_classes_75kplus_train_004479
26,368
permissive
[ { "docstring": "Generates the translation contributins stats. Returns: PCollection. A PCollection of 'SUCCESS x' results, where x is the number of generated stats..", "name": "run", "signature": "def run(self) -> beam.PCollection[job_run_result.JobRunResult]" }, { "docstring": "Generates transla...
3
stack_v2_sparse_classes_30k_train_038937
Implement the Python class `GenerateTranslationContributionStats` described below. Class description: Job that indexes the explorations in Elastic Search. Method signatures and docstrings: - def run(self) -> beam.PCollection[job_run_result.JobRunResult]: Generates the translation contributins stats. Returns: PCollect...
Implement the Python class `GenerateTranslationContributionStats` described below. Class description: Job that indexes the explorations in Elastic Search. Method signatures and docstrings: - def run(self) -> beam.PCollection[job_run_result.JobRunResult]: Generates the translation contributins stats. Returns: PCollect...
2862b7da750ce332c975b64237791f96189d7aa8
<|skeleton|> class GenerateTranslationContributionStats: """Job that indexes the explorations in Elastic Search.""" def run(self) -> beam.PCollection[job_run_result.JobRunResult]: """Generates the translation contributins stats. Returns: PCollection. A PCollection of 'SUCCESS x' results, where x is the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GenerateTranslationContributionStats: """Job that indexes the explorations in Elastic Search.""" def run(self) -> beam.PCollection[job_run_result.JobRunResult]: """Generates the translation contributins stats. Returns: PCollection. A PCollection of 'SUCCESS x' results, where x is the number of ge...
the_stack_v2_python_sparse
core/jobs/batch_jobs/cron_jobs.py
FareesHussain/oppia
train
2
26c33ec77c16085c7f7e677efaea8f76732eff79
[ "try:\n branch = Branch.objects.get(id=kwargs['branch_id'], repository_id=kwargs['repository_id'])\nexcept Branch.DoesNotExist:\n raise Http404\nsuper(BranchDetail, self).check_permissions(request, branch)\nreturn branch", "branch = self.get_object(request, branch_id=kwargs['branch_id'], repository_id=kwarg...
<|body_start_0|> try: branch = Branch.objects.get(id=kwargs['branch_id'], repository_id=kwargs['repository_id']) except Branch.DoesNotExist: raise Http404 super(BranchDetail, self).check_permissions(request, branch) return branch <|end_body_0|> <|body_start_1|> ...
This view handle all requests what comes on endpoint repositories/(?P<repository_id>[0-9]+)/branches/(?P<branch_id>[0-9]+)/$
BranchDetail
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BranchDetail: """This view handle all requests what comes on endpoint repositories/(?P<repository_id>[0-9]+)/branches/(?P<branch_id>[0-9]+)/$""" def get_object(self, request, *args, **kwargs) -> Branch: """Trying to find branch by branch and repository id in database and return them ...
stack_v2_sparse_classes_75kplus_train_004480
4,560
permissive
[ { "docstring": "Trying to find branch by branch and repository id in database and return them :param args: other parameters :param kwargs: dict parsed url variables {\"branch_id\": \"id\", \"repository_id\":\"id\"} :return: Branch object or DoesNotExist exception :raise Branch.DoesNotExist", "name": "get_ob...
3
stack_v2_sparse_classes_30k_train_036432
Implement the Python class `BranchDetail` described below. Class description: This view handle all requests what comes on endpoint repositories/(?P<repository_id>[0-9]+)/branches/(?P<branch_id>[0-9]+)/$ Method signatures and docstrings: - def get_object(self, request, *args, **kwargs) -> Branch: Trying to find branch...
Implement the Python class `BranchDetail` described below. Class description: This view handle all requests what comes on endpoint repositories/(?P<repository_id>[0-9]+)/branches/(?P<branch_id>[0-9]+)/$ Method signatures and docstrings: - def get_object(self, request, *args, **kwargs) -> Branch: Trying to find branch...
fdb911dfafbd2609b7f96561ab6780b4131a77bd
<|skeleton|> class BranchDetail: """This view handle all requests what comes on endpoint repositories/(?P<repository_id>[0-9]+)/branches/(?P<branch_id>[0-9]+)/$""" def get_object(self, request, *args, **kwargs) -> Branch: """Trying to find branch by branch and repository id in database and return them ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BranchDetail: """This view handle all requests what comes on endpoint repositories/(?P<repository_id>[0-9]+)/branches/(?P<branch_id>[0-9]+)/$""" def get_object(self, request, *args, **kwargs) -> Branch: """Trying to find branch by branch and repository id in database and return them :param args: ...
the_stack_v2_python_sparse
branches/views.py
Kh-011-WebUIPython/lit
train
4
4e7f9becb2574ef5a700afa0fdccc08f8e4ed8a8
[ "self.assertEqual(is_prime(78), False)\nself.assertEqual(is_prime(7), True)\nself.assertEqual(is_prime(21), False)", "self.assertEqual(is_perfect(6), True)\nself.assertEqual(is_perfect(496), True)\nself.assertEqual(is_perfect(189), False)" ]
<|body_start_0|> self.assertEqual(is_prime(78), False) self.assertEqual(is_prime(7), True) self.assertEqual(is_prime(21), False) <|end_body_0|> <|body_start_1|> self.assertEqual(is_perfect(6), True) self.assertEqual(is_perfect(496), True) self.assertEqual(is_perfect(189)...
is_prime function tests.
PrimalityTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrimalityTest: """is_prime function tests.""" def test_is_prime(self): """Test some small hand picked example.""" <|body_0|> def test_is_perfect(self): """Test some small hand picked example.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self....
stack_v2_sparse_classes_75kplus_train_004481
1,490
no_license
[ { "docstring": "Test some small hand picked example.", "name": "test_is_prime", "signature": "def test_is_prime(self)" }, { "docstring": "Test some small hand picked example.", "name": "test_is_perfect", "signature": "def test_is_perfect(self)" } ]
2
stack_v2_sparse_classes_30k_train_026831
Implement the Python class `PrimalityTest` described below. Class description: is_prime function tests. Method signatures and docstrings: - def test_is_prime(self): Test some small hand picked example. - def test_is_perfect(self): Test some small hand picked example.
Implement the Python class `PrimalityTest` described below. Class description: is_prime function tests. Method signatures and docstrings: - def test_is_prime(self): Test some small hand picked example. - def test_is_perfect(self): Test some small hand picked example. <|skeleton|> class PrimalityTest: """is_prime...
662eed857389fa9bb4dea01458bc43a705768a3c
<|skeleton|> class PrimalityTest: """is_prime function tests.""" def test_is_prime(self): """Test some small hand picked example.""" <|body_0|> def test_is_perfect(self): """Test some small hand picked example.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrimalityTest: """is_prime function tests.""" def test_is_prime(self): """Test some small hand picked example.""" self.assertEqual(is_prime(78), False) self.assertEqual(is_prime(7), True) self.assertEqual(is_prime(21), False) def test_is_perfect(self): """Test...
the_stack_v2_python_sparse
home/kolszak/primality.py
anagorko/inf
train
0
47bce94e33187688a662bbcf97a6622c8523fc25
[ "if not nums:\n return 0\ni = 0\nwhile i < len(nums):\n if val == nums[i]:\n nums.remove(val)\n i -= 1\n i += 1\nreturn len(nums)", "cur = 0\nfor i in range(len(nums)):\n if nums[i] != val:\n nums[cur] = nums[i]\n cur += 1\nreturn cur" ]
<|body_start_0|> if not nums: return 0 i = 0 while i < len(nums): if val == nums[i]: nums.remove(val) i -= 1 i += 1 return len(nums) <|end_body_0|> <|body_start_1|> cur = 0 for i in range(len(nums)): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeElement(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" <|body_0|> def removeElement2(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_004482
879
no_license
[ { "docstring": ":type nums: List[int] :type val: int :rtype: int", "name": "removeElement", "signature": "def removeElement(self, nums, val)" }, { "docstring": ":type nums: List[int] :type val: int :rtype: int", "name": "removeElement2", "signature": "def removeElement2(self, nums, val)"...
2
stack_v2_sparse_classes_30k_train_033264
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement(self, nums, val): :type nums: List[int] :type val: int :rtype: int - def removeElement2(self, nums, val): :type nums: List[int] :type val: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement(self, nums, val): :type nums: List[int] :type val: int :rtype: int - def removeElement2(self, nums, val): :type nums: List[int] :type val: int :rtype: int <|sk...
bd8df12c0d4afd048cf1b58b04c27fa1f3622769
<|skeleton|> class Solution: def removeElement(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" <|body_0|> def removeElement2(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def removeElement(self, nums, val): """:type nums: List[int] :type val: int :rtype: int""" if not nums: return 0 i = 0 while i < len(nums): if val == nums[i]: nums.remove(val) i -= 1 i += 1 re...
the_stack_v2_python_sparse
27_remove_element.py
aojugg/leetcode
train
0
e64a288b62eef565085dc358921a209b1fd4eb0e
[ "assert isinstance(type, Type), 'Invalid object type %s' % type\nassert value is not None, 'Provide an object value'\nif type.isOf(str):\n return value\nif type.isOf(int) or type.isOf(float):\n return str(value)\nif type.isOf(bool):\n return 'true' if value is True else 'false'\nif type.isOf(datetime):\n ...
<|body_start_0|> assert isinstance(type, Type), 'Invalid object type %s' % type assert value is not None, 'Provide an object value' if type.isOf(str): return value if type.isOf(int) or type.isOf(float): return str(value) if type.isOf(bool): ret...
Provides the conversion of primitive types to strings in vice versa. The converter provides basic conversion, please extend for more complex or custom transformation.
Converter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Converter: """Provides the conversion of primitive types to strings in vice versa. The converter provides basic conversion, please extend for more complex or custom transformation.""" def asString(self, value, type): """Converts the provided object to a string. First it will detect t...
stack_v2_sparse_classes_75kplus_train_004483
3,289
no_license
[ { "docstring": "Converts the provided object to a string. First it will detect the type and based on that it will call the corresponding convert method. @param value: object The value to be converted to string. @param type: Type The type of object to convert the string to. @return: string The string form of the...
2
stack_v2_sparse_classes_30k_train_027577
Implement the Python class `Converter` described below. Class description: Provides the conversion of primitive types to strings in vice versa. The converter provides basic conversion, please extend for more complex or custom transformation. Method signatures and docstrings: - def asString(self, value, type): Convert...
Implement the Python class `Converter` described below. Class description: Provides the conversion of primitive types to strings in vice versa. The converter provides basic conversion, please extend for more complex or custom transformation. Method signatures and docstrings: - def asString(self, value, type): Convert...
e0b3466b34d31548996d57be4a9dac134d904380
<|skeleton|> class Converter: """Provides the conversion of primitive types to strings in vice versa. The converter provides basic conversion, please extend for more complex or custom transformation.""" def asString(self, value, type): """Converts the provided object to a string. First it will detect t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Converter: """Provides the conversion of primitive types to strings in vice versa. The converter provides basic conversion, please extend for more complex or custom transformation.""" def asString(self, value, type): """Converts the provided object to a string. First it will detect the type and b...
the_stack_v2_python_sparse
components/ally-core/ally/core/spec/resources.py
cristidomsa/Ally-Py
train
0
356865ed511d54a2f02223ad1556d14a0c255e83
[ "self.path_to_raster = base_raster_file\nself.path_agg_raster = '../tmp/local_raster.tif'\nself.x_size, self.top_left_x_coords, self.top_left_y_coords, self.centroid_x_coords, self.centroid_y_coords, self.bands_data = self._read_raster(self.path_to_raster)\nif lon is not None:\n self.lon, self.lat = (lon, lat)\n...
<|body_start_0|> self.path_to_raster = base_raster_file self.path_agg_raster = '../tmp/local_raster.tif' self.x_size, self.top_left_x_coords, self.top_left_y_coords, self.centroid_x_coords, self.centroid_y_coords, self.bands_data = self._read_raster(self.path_to_raster) if lon is not Non...
Class that handles the geometries and data. We use a raster as input to define the geo-spatial attributes of our data. Attributes: path_to_raster (str): path to existing raster file. x_size (float): size of a pixel in degrees. top_left_x_coords (array): longitudes for the top left corner of each pixel. self.top_left_y_...
BaseLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseLayer: """Class that handles the geometries and data. We use a raster as input to define the geo-spatial attributes of our data. Attributes: path_to_raster (str): path to existing raster file. x_size (float): size of a pixel in degrees. top_left_x_coords (array): longitudes for the top left c...
stack_v2_sparse_classes_75kplus_train_004484
5,866
permissive
[ { "docstring": "Args: base_raster_file (str): path to the .tif raster to use. lon (list): list of longitudes of the survey. lat (list): list of latitudes of the survey.", "name": "__init__", "signature": "def __init__(self, base_raster_file, lon=None, lat=None)" }, { "docstring": "takes lon lat ...
5
stack_v2_sparse_classes_30k_train_033999
Implement the Python class `BaseLayer` described below. Class description: Class that handles the geometries and data. We use a raster as input to define the geo-spatial attributes of our data. Attributes: path_to_raster (str): path to existing raster file. x_size (float): size of a pixel in degrees. top_left_x_coords...
Implement the Python class `BaseLayer` described below. Class description: Class that handles the geometries and data. We use a raster as input to define the geo-spatial attributes of our data. Attributes: path_to_raster (str): path to existing raster file. x_size (float): size of a pixel in degrees. top_left_x_coords...
7f54196ae10e1b3712d4907c9ddd202b56eb3606
<|skeleton|> class BaseLayer: """Class that handles the geometries and data. We use a raster as input to define the geo-spatial attributes of our data. Attributes: path_to_raster (str): path to existing raster file. x_size (float): size of a pixel in degrees. top_left_x_coords (array): longitudes for the top left c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseLayer: """Class that handles the geometries and data. We use a raster as input to define the geo-spatial attributes of our data. Attributes: path_to_raster (str): path to existing raster file. x_size (float): size of a pixel in degrees. top_left_x_coords (array): longitudes for the top left corner of each...
the_stack_v2_python_sparse
Src/base_layer.py
alexnwoko/HRM
train
0
68dfc0f950ba4cc07bbbcb9aec5ed9e8631ede51
[ "CtrlDev.__init__(self, parent)\nself._name = u'Memória'\nself._category = 'Sistema'\nself._diag = DiagMemory(self)\nself._compat = CompatMemory(self)\nself._guiClass = GUIMemory", "self._callInfo()\nself._callCompat()\nself._callDiag()" ]
<|body_start_0|> CtrlDev.__init__(self, parent) self._name = u'Memória' self._category = 'Sistema' self._diag = DiagMemory(self) self._compat = CompatMemory(self) self._guiClass = GUIMemory <|end_body_0|> <|body_start_1|> self._callInfo() self._callCompat...
Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade, diagnóstico e cria a tela de exibição.
CtrlMemory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CtrlMemory: """Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade, diagnóstico e cria a tela de exibição.""" def __init__(self, parent): """Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe ba...
stack_v2_sparse_classes_75kplus_train_004485
1,202
no_license
[ { "docstring": "Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe base 'CtrlDev'.", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "Executa o info, compat, diag e cria as telas de exibição.", "name": "execute_lib", ...
2
stack_v2_sparse_classes_30k_train_030615
Implement the Python class `CtrlMemory` described below. Class description: Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade, diagnóstico e cria a tela de exibição. Method signatures and docstrings: - def __init__(self, parent): Construtor que inicializa os atributo...
Implement the Python class `CtrlMemory` described below. Class description: Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade, diagnóstico e cria a tela de exibição. Method signatures and docstrings: - def __init__(self, parent): Construtor que inicializa os atributo...
bda0c2c8977dd1246339f1f0f4718d29e8795f21
<|skeleton|> class CtrlMemory: """Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade, diagnóstico e cria a tela de exibição.""" def __init__(self, parent): """Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe ba...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CtrlMemory: """Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificação, compatibilidade, diagnóstico e cria a tela de exibição.""" def __init__(self, parent): """Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe base 'CtrlDev'....
the_stack_v2_python_sparse
src/libs/memory/ctrl_memory.py
adrianomelo/ldc-desktop
train
1
7d975d93ed707821b52c9d69343333b4283b4d6d
[ "super(FollowingFeatureAgent, self).__init__(data_collection_config, reward_config=None, model_config=None)\nfeatures[0]['visible'] = True\ndata_collection_config['data'] += features\nfollowed_data = create_data(features[0])\nself.feature_template = followed_data.feature_template", "_, _, owned_stocks, _ = self.u...
<|body_start_0|> super(FollowingFeatureAgent, self).__init__(data_collection_config, reward_config=None, model_config=None) features[0]['visible'] = True data_collection_config['data'] += features followed_data = create_data(features[0]) self.feature_template = followed_data.feat...
An agent that tries to follow a feature as its poicy. e.g. if feature for STOCK_1 is > 0, than it will buy/hold STOCK_1. Otherwise it will sell STOCK_1. Note: This is example of non-reinforcement learning agent.
FollowingFeatureAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FollowingFeatureAgent: """An agent that tries to follow a feature as its poicy. e.g. if feature for STOCK_1 is > 0, than it will buy/hold STOCK_1. Otherwise it will sell STOCK_1. Note: This is example of non-reinforcement learning agent.""" def __init__(self, data_collection_config, reward_c...
stack_v2_sparse_classes_75kplus_train_004486
2,416
permissive
[ { "docstring": "Initializer for FollowingFeatureAgent class. Args: data_collection_config: configuration for the data collection used by the agent. reward_config: configuration for reward used by the agent. model_config: configuration for model used by the agent. features: list of data configs, the first one is...
2
null
Implement the Python class `FollowingFeatureAgent` described below. Class description: An agent that tries to follow a feature as its poicy. e.g. if feature for STOCK_1 is > 0, than it will buy/hold STOCK_1. Otherwise it will sell STOCK_1. Note: This is example of non-reinforcement learning agent. Method signatures a...
Implement the Python class `FollowingFeatureAgent` described below. Class description: An agent that tries to follow a feature as its poicy. e.g. if feature for STOCK_1 is > 0, than it will buy/hold STOCK_1. Otherwise it will sell STOCK_1. Note: This is example of non-reinforcement learning agent. Method signatures a...
7161026b7b4deb78a934b66550c85a27c6b32933
<|skeleton|> class FollowingFeatureAgent: """An agent that tries to follow a feature as its poicy. e.g. if feature for STOCK_1 is > 0, than it will buy/hold STOCK_1. Otherwise it will sell STOCK_1. Note: This is example of non-reinforcement learning agent.""" def __init__(self, data_collection_config, reward_c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FollowingFeatureAgent: """An agent that tries to follow a feature as its poicy. e.g. if feature for STOCK_1 is > 0, than it will buy/hold STOCK_1. Otherwise it will sell STOCK_1. Note: This is example of non-reinforcement learning agent.""" def __init__(self, data_collection_config, reward_config, model_...
the_stack_v2_python_sparse
stock_trading_backend/agent/following_feature_agent.py
iryzhkov/stock-trading-backend
train
1
6f2465aa1bd77860f9a3c0ef251a5cf7516c70cc
[ "if operation == OP_CREATE and (not hasattr(user.configuration, 'username') or user.configuration.username is None):\n validation_result = to_json_error(REQUIRED_FIELD_MESSAGE, None, 'username')\n return validation_result\nif not hasattr(user.configuration, 'password') or user.configuration.password is None:\...
<|body_start_0|> if operation == OP_CREATE and (not hasattr(user.configuration, 'username') or user.configuration.username is None): validation_result = to_json_error(REQUIRED_FIELD_MESSAGE, None, 'username') return validation_result if not hasattr(user.configuration, 'password')...
UserValidator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserValidator: def __validate_required_fields__(self, user, operation): """Validate required user fields Returns None when valid else returns error json dict""" <|body_0|> def __validate_username__(self, username): """Validate username using a regular expression Retu...
stack_v2_sparse_classes_75kplus_train_004487
6,175
permissive
[ { "docstring": "Validate required user fields Returns None when valid else returns error json dict", "name": "__validate_required_fields__", "signature": "def __validate_required_fields__(self, user, operation)" }, { "docstring": "Validate username using a regular expression Returns None when va...
5
stack_v2_sparse_classes_30k_train_012518
Implement the Python class `UserValidator` described below. Class description: Implement the UserValidator class. Method signatures and docstrings: - def __validate_required_fields__(self, user, operation): Validate required user fields Returns None when valid else returns error json dict - def __validate_username__(...
Implement the Python class `UserValidator` described below. Class description: Implement the UserValidator class. Method signatures and docstrings: - def __validate_required_fields__(self, user, operation): Validate required user fields Returns None when valid else returns error json dict - def __validate_username__(...
46e34b5470182059ae5355b1d56a112c1a50d0ee
<|skeleton|> class UserValidator: def __validate_required_fields__(self, user, operation): """Validate required user fields Returns None when valid else returns error json dict""" <|body_0|> def __validate_username__(self, username): """Validate username using a regular expression Retu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserValidator: def __validate_required_fields__(self, user, operation): """Validate required user fields Returns None when valid else returns error json dict""" if operation == OP_CREATE and (not hasattr(user.configuration, 'username') or user.configuration.username is None): valid...
the_stack_v2_python_sparse
opsrest/custom/user_validator.py
kuntaldaftary/ops-restd
train
0
9a6248b7639a9ff6d7f3e638405a88ff7b222123
[ "self.timeout = config('DEFAULT_TIMEOUT')\nif 'timeout' in kwargs:\n self.timeout = kwargs['timeout']\n del kwargs['timeout']\nsuper().__init__(*args, **kwargs)", "timeout_ = kwargs.get('timeout')\nif timeout_ is None:\n kwargs['timeout'] = self.timeout\nreturn super().send(request, **kwargs)" ]
<|body_start_0|> self.timeout = config('DEFAULT_TIMEOUT') if 'timeout' in kwargs: self.timeout = kwargs['timeout'] del kwargs['timeout'] super().__init__(*args, **kwargs) <|end_body_0|> <|body_start_1|> timeout_ = kwargs.get('timeout') if timeout_ is None...
Nome : TimeoutHTTPAdapter Parametro_1 : HTTPAdapter Criada : junho-2021 Descrição : faz... ____________________________________________________________________________________________________ Todos direitos reservados à Magna Sistemas (▀̿̿Ĺ̯̿▀̿ ̿)
TimeoutHTTPAdapter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeoutHTTPAdapter: """Nome : TimeoutHTTPAdapter Parametro_1 : HTTPAdapter Criada : junho-2021 Descrição : faz... ____________________________________________________________________________________________________ Todos direitos reservados à Magna Sistemas (▀̿̿Ĺ̯̿▀̿ ̿)""" def __init__(self,...
stack_v2_sparse_classes_75kplus_train_004488
21,914
no_license
[ { "docstring": "nome: __init__ :param args: tuple, Any :param kwargs: str", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "nome: send :param request: request :param kwargs: str :return: super().send(request, **kwargs)", "name": "send", "signatur...
2
stack_v2_sparse_classes_30k_train_003706
Implement the Python class `TimeoutHTTPAdapter` described below. Class description: Nome : TimeoutHTTPAdapter Parametro_1 : HTTPAdapter Criada : junho-2021 Descrição : faz... ____________________________________________________________________________________________________ Todos direitos reservados à Magna Sistemas ...
Implement the Python class `TimeoutHTTPAdapter` described below. Class description: Nome : TimeoutHTTPAdapter Parametro_1 : HTTPAdapter Criada : junho-2021 Descrição : faz... ____________________________________________________________________________________________________ Todos direitos reservados à Magna Sistemas ...
b976114c78099c0b949ba915c636e111b9120884
<|skeleton|> class TimeoutHTTPAdapter: """Nome : TimeoutHTTPAdapter Parametro_1 : HTTPAdapter Criada : junho-2021 Descrição : faz... ____________________________________________________________________________________________________ Todos direitos reservados à Magna Sistemas (▀̿̿Ĺ̯̿▀̿ ̿)""" def __init__(self,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TimeoutHTTPAdapter: """Nome : TimeoutHTTPAdapter Parametro_1 : HTTPAdapter Criada : junho-2021 Descrição : faz... ____________________________________________________________________________________________________ Todos direitos reservados à Magna Sistemas (▀̿̿Ĺ̯̿▀̿ ̿)""" def __init__(self, *args, **kwa...
the_stack_v2_python_sparse
api/utilities.py
maccaconta/orquestradora
train
0
a4d7dedd52736b68b3c913b5fde707957af23d54
[ "def f1():\n return 1\n\ndef f2():\n return 2\n\ndef f3():\n pass\nreturn_values = parallel.RunParallelSteps([f1, f2, f3], return_values=True)\nself.assertEquals(return_values, [1, 2, None])", "def f1():\n return ret_value\nret_value = ''\nfor _ in xrange(10000):\n ret_value += 'This will be repeat...
<|body_start_0|> def f1(): return 1 def f2(): return 2 def f3(): pass return_values = parallel.RunParallelSteps([f1, f2, f3], return_values=True) self.assertEquals(return_values, [1, 2, None]) <|end_body_0|> <|body_start_1|> def f1()...
Tests for RunParallelSteps.
TestRunParallelSteps
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestRunParallelSteps: """Tests for RunParallelSteps.""" def testReturnValues(self): """Test that we pass return values through when requested.""" <|body_0|> def testLargeReturnValues(self): """Test that the managed queue prevents hanging on large return values.""...
stack_v2_sparse_classes_75kplus_train_004489
19,222
permissive
[ { "docstring": "Test that we pass return values through when requested.", "name": "testReturnValues", "signature": "def testReturnValues(self)" }, { "docstring": "Test that the managed queue prevents hanging on large return values.", "name": "testLargeReturnValues", "signature": "def tes...
2
stack_v2_sparse_classes_30k_train_037149
Implement the Python class `TestRunParallelSteps` described below. Class description: Tests for RunParallelSteps. Method signatures and docstrings: - def testReturnValues(self): Test that we pass return values through when requested. - def testLargeReturnValues(self): Test that the managed queue prevents hanging on l...
Implement the Python class `TestRunParallelSteps` described below. Class description: Tests for RunParallelSteps. Method signatures and docstrings: - def testReturnValues(self): Test that we pass return values through when requested. - def testLargeReturnValues(self): Test that the managed queue prevents hanging on l...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class TestRunParallelSteps: """Tests for RunParallelSteps.""" def testReturnValues(self): """Test that we pass return values through when requested.""" <|body_0|> def testLargeReturnValues(self): """Test that the managed queue prevents hanging on large return values.""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestRunParallelSteps: """Tests for RunParallelSteps.""" def testReturnValues(self): """Test that we pass return values through when requested.""" def f1(): return 1 def f2(): return 2 def f3(): pass return_values = parallel.Run...
the_stack_v2_python_sparse
third_party/chromite/lib/parallel_unittest.py
metux/chromium-suckless
train
5
cb6d44c635c7a4f714b3aa144e09ce539d8358b9
[ "res = [1]\nfor i in range(1, rowIndex + 1):\n res.insert(0, 0)\n for j in range(i):\n res[j] = res[j] + res[j + 1]\nreturn res", "res = [1]\nfor i in range(1, rowIndex + 1):\n res.append(int(res[-1] * (rowIndex - i + 1) / i))\nreturn res" ]
<|body_start_0|> res = [1] for i in range(1, rowIndex + 1): res.insert(0, 0) for j in range(i): res[j] = res[j] + res[j + 1] return res <|end_body_0|> <|body_start_1|> res = [1] for i in range(1, rowIndex + 1): res.append(int(r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getRow(self, rowIndex): """现在前面加一个0 然后迭代相加 :param rowIndex: :return:""" <|body_0|> def getRow2(self, rowIndex): """使用公式,后一个数是前一个数的(n-k+1)/k倍!!! :param rowIndex: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [1] ...
stack_v2_sparse_classes_75kplus_train_004490
648
no_license
[ { "docstring": "现在前面加一个0 然后迭代相加 :param rowIndex: :return:", "name": "getRow", "signature": "def getRow(self, rowIndex)" }, { "docstring": "使用公式,后一个数是前一个数的(n-k+1)/k倍!!! :param rowIndex: :return:", "name": "getRow2", "signature": "def getRow2(self, rowIndex)" } ]
2
stack_v2_sparse_classes_30k_train_047822
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex): 现在前面加一个0 然后迭代相加 :param rowIndex: :return: - def getRow2(self, rowIndex): 使用公式,后一个数是前一个数的(n-k+1)/k倍!!! :param rowIndex: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex): 现在前面加一个0 然后迭代相加 :param rowIndex: :return: - def getRow2(self, rowIndex): 使用公式,后一个数是前一个数的(n-k+1)/k倍!!! :param rowIndex: :return: <|skeleton|> class So...
d8ad2da776066ac3fd99f246cb2b41a921c21a73
<|skeleton|> class Solution: def getRow(self, rowIndex): """现在前面加一个0 然后迭代相加 :param rowIndex: :return:""" <|body_0|> def getRow2(self, rowIndex): """使用公式,后一个数是前一个数的(n-k+1)/k倍!!! :param rowIndex: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def getRow(self, rowIndex): """现在前面加一个0 然后迭代相加 :param rowIndex: :return:""" res = [1] for i in range(1, rowIndex + 1): res.insert(0, 0) for j in range(i): res[j] = res[j] + res[j + 1] return res def getRow2(self, rowIndex):...
the_stack_v2_python_sparse
Python/LeetCode/LeetCode119getRow.py
540928898/LeetCodeMe
train
0
9e817030d9a1825ee63e330c0a3599f1bda097e4
[ "if not cls._resolver_helpers_manager:\n from dfvfs.resolver_helpers import manager\n cls._resolver_helpers_manager = manager.ResolverHelperManager\nreturn cls._resolver_helpers_manager.GetHelper(type_indicator)", "file_system = cls.OpenFileSystem(path_spec_object, resolver_context=resolver_context)\nif res...
<|body_start_0|> if not cls._resolver_helpers_manager: from dfvfs.resolver_helpers import manager cls._resolver_helpers_manager = manager.ResolverHelperManager return cls._resolver_helpers_manager.GetHelper(type_indicator) <|end_body_0|> <|body_start_1|> file_system = cl...
Path specification resolver.
Resolver
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Resolver: """Path specification resolver.""" def _GetResolverHelper(cls, type_indicator): """Retrieves the path specification resolver helper for the specified type. Args: type_indicator (str): type indicator. Returns: ResolverHelper: a resolver helper.""" <|body_0|> def...
stack_v2_sparse_classes_75kplus_train_004491
6,142
permissive
[ { "docstring": "Retrieves the path specification resolver helper for the specified type. Args: type_indicator (str): type indicator. Returns: ResolverHelper: a resolver helper.", "name": "_GetResolverHelper", "signature": "def _GetResolverHelper(cls, type_indicator)" }, { "docstring": "Opens a f...
4
null
Implement the Python class `Resolver` described below. Class description: Path specification resolver. Method signatures and docstrings: - def _GetResolverHelper(cls, type_indicator): Retrieves the path specification resolver helper for the specified type. Args: type_indicator (str): type indicator. Returns: Resolver...
Implement the Python class `Resolver` described below. Class description: Path specification resolver. Method signatures and docstrings: - def _GetResolverHelper(cls, type_indicator): Retrieves the path specification resolver helper for the specified type. Args: type_indicator (str): type indicator. Returns: Resolver...
28756d910e951a22c5f0b2bcf5184f055a19d544
<|skeleton|> class Resolver: """Path specification resolver.""" def _GetResolverHelper(cls, type_indicator): """Retrieves the path specification resolver helper for the specified type. Args: type_indicator (str): type indicator. Returns: ResolverHelper: a resolver helper.""" <|body_0|> def...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Resolver: """Path specification resolver.""" def _GetResolverHelper(cls, type_indicator): """Retrieves the path specification resolver helper for the specified type. Args: type_indicator (str): type indicator. Returns: ResolverHelper: a resolver helper.""" if not cls._resolver_helpers_man...
the_stack_v2_python_sparse
dfvfs/resolver/resolver.py
log2timeline/dfvfs
train
197
562025bf99f1de4ce6bd11069551e4f50bc3c893
[ "self._gv = gv\nself._dlg = SelectluDialog()\nself._dlg.setWindowFlags(self._dlg.windowFlags() & ~Qt.WindowContextHelpButtonHint)\nself._dlg.move(self._gv.selectLuPos)\nself._luse = ''", "self._gv.db.populateAllLanduses(self._dlg.listBox, includeWATR=False)\nself._dlg.listBox.currentTextChanged.connect(self.selec...
<|body_start_0|> self._gv = gv self._dlg = SelectluDialog() self._dlg.setWindowFlags(self._dlg.windowFlags() & ~Qt.WindowContextHelpButtonHint) self._dlg.move(self._gv.selectLuPos) self._luse = '' <|end_body_0|> <|body_start_1|> self._gv.db.populateAllLanduses(self._dlg....
Dialog to select a landuse from a list in listBox.
Selectlu
[ "GPL-2.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Selectlu: """Dialog to select a landuse from a list in listBox.""" def __init__(self, gv): """Initialise class variables.""" <|body_0|> def run(self): """Run the dialog and return selected landuse.""" <|body_1|> def select(self, selection): "...
stack_v2_sparse_classes_75kplus_train_004492
2,589
permissive
[ { "docstring": "Initialise class variables.", "name": "__init__", "signature": "def __init__(self, gv)" }, { "docstring": "Run the dialog and return selected landuse.", "name": "run", "signature": "def run(self)" }, { "docstring": "A selection has the form 'LUSE (Description)' or...
3
stack_v2_sparse_classes_30k_train_024373
Implement the Python class `Selectlu` described below. Class description: Dialog to select a landuse from a list in listBox. Method signatures and docstrings: - def __init__(self, gv): Initialise class variables. - def run(self): Run the dialog and return selected landuse. - def select(self, selection): A selection h...
Implement the Python class `Selectlu` described below. Class description: Dialog to select a landuse from a list in listBox. Method signatures and docstrings: - def __init__(self, gv): Initialise class variables. - def run(self): Run the dialog and return selected landuse. - def select(self, selection): A selection h...
ddb3de70708687ca3167ec4b72ac432426175f45
<|skeleton|> class Selectlu: """Dialog to select a landuse from a list in listBox.""" def __init__(self, gv): """Initialise class variables.""" <|body_0|> def run(self): """Run the dialog and return selected landuse.""" <|body_1|> def select(self, selection): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Selectlu: """Dialog to select a landuse from a list in listBox.""" def __init__(self, gv): """Initialise class variables.""" self._gv = gv self._dlg = SelectluDialog() self._dlg.setWindowFlags(self._dlg.windowFlags() & ~Qt.WindowContextHelpButtonHint) self._dlg.mov...
the_stack_v2_python_sparse
qswatplus/selectlu.py
celray/swatplus-automatic-workflow
train
11
2e6e2c2d41038ed9d1bcde668a87653c0293b837
[ "shuzi = Test(7, 3)\nself.assertEqual(shuzi.add(), 10)\nself.assertEqual(shuzi.dele(), 4)", "liangshuzi = Test(6, 5)\nt = liangshuzi.add() * 2 + liangshuzi.dele() * 2\nself.assertEqual(t, 24)" ]
<|body_start_0|> shuzi = Test(7, 3) self.assertEqual(shuzi.add(), 10) self.assertEqual(shuzi.dele(), 4) <|end_body_0|> <|body_start_1|> liangshuzi = Test(6, 5) t = liangshuzi.add() * 2 + liangshuzi.dele() * 2 self.assertEqual(t, 24) <|end_body_1|>
数字计算
Test_test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_test: """数字计算""" def test_shuzi(self): """两个数字相加以及两个数字相减""" <|body_0|> def test_liangmethod(self): """两数字相加的2倍 加上 两个数字相减的2倍""" <|body_1|> <|end_skeleton|> <|body_start_0|> shuzi = Test(7, 3) self.assertEqual(shuzi.add(), 10) ...
stack_v2_sparse_classes_75kplus_train_004493
888
no_license
[ { "docstring": "两个数字相加以及两个数字相减", "name": "test_shuzi", "signature": "def test_shuzi(self)" }, { "docstring": "两数字相加的2倍 加上 两个数字相减的2倍", "name": "test_liangmethod", "signature": "def test_liangmethod(self)" } ]
2
stack_v2_sparse_classes_30k_train_005959
Implement the Python class `Test_test` described below. Class description: 数字计算 Method signatures and docstrings: - def test_shuzi(self): 两个数字相加以及两个数字相减 - def test_liangmethod(self): 两数字相加的2倍 加上 两个数字相减的2倍
Implement the Python class `Test_test` described below. Class description: 数字计算 Method signatures and docstrings: - def test_shuzi(self): 两个数字相加以及两个数字相减 - def test_liangmethod(self): 两数字相加的2倍 加上 两个数字相减的2倍 <|skeleton|> class Test_test: """数字计算""" def test_shuzi(self): """两个数字相加以及两个数字相减""" <|b...
98882c3599d0eb9ac84e74193c584ba7b78ecfab
<|skeleton|> class Test_test: """数字计算""" def test_shuzi(self): """两个数字相加以及两个数字相减""" <|body_0|> def test_liangmethod(self): """两数字相加的2倍 加上 两个数字相减的2倍""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_test: """数字计算""" def test_shuzi(self): """两个数字相加以及两个数字相减""" shuzi = Test(7, 3) self.assertEqual(shuzi.add(), 10) self.assertEqual(shuzi.dele(), 4) def test_liangmethod(self): """两数字相加的2倍 加上 两个数字相减的2倍""" liangshuzi = Test(6, 5) t = liangshu...
the_stack_v2_python_sparse
Course0823/Week05/test_demo/add_dele.py
chenbaoshun/AutomationTesting
train
0
e2064189ead1822de08470740c14e6e499e797b4
[ "try:\n self.balanced_height_check(node)\nexcept self.NotBalancedError:\n return False\nreturn True", "if not node:\n return 0\nleft_height = self.balanced_height_check(node.left)\nright_height = self.balanced_height_check(node.right)\nif abs(left_height - right_height) > 1:\n raise self.NotBalancedEr...
<|body_start_0|> try: self.balanced_height_check(node) except self.NotBalancedError: return False return True <|end_body_0|> <|body_start_1|> if not node: return 0 left_height = self.balanced_height_check(node.left) right_height = self...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def is_balanced(self, node): """Return True if the depth of children at any node differs by more than 1. :param node: The node to check :return:""" <|body_0|> def balanced_height_check(self, node): """Get the height of the tree. Also check that the tree is ...
stack_v2_sparse_classes_75kplus_train_004494
1,593
no_license
[ { "docstring": "Return True if the depth of children at any node differs by more than 1. :param node: The node to check :return:", "name": "is_balanced", "signature": "def is_balanced(self, node)" }, { "docstring": "Get the height of the tree. Also check that the tree is balanced.", "name": ...
2
stack_v2_sparse_classes_30k_val_000436
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_balanced(self, node): Return True if the depth of children at any node differs by more than 1. :param node: The node to check :return: - def balanced_height_check(self, no...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_balanced(self, node): Return True if the depth of children at any node differs by more than 1. :param node: The node to check :return: - def balanced_height_check(self, no...
9cfc663c5bb382f9983eb82e60344bd290e7284b
<|skeleton|> class Solution: def is_balanced(self, node): """Return True if the depth of children at any node differs by more than 1. :param node: The node to check :return:""" <|body_0|> def balanced_height_check(self, node): """Get the height of the tree. Also check that the tree is ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def is_balanced(self, node): """Return True if the depth of children at any node differs by more than 1. :param node: The node to check :return:""" try: self.balanced_height_check(node) except self.NotBalancedError: return False return True ...
the_stack_v2_python_sparse
c4/4_4_check_balanced.py
ltn100/ctci
train
0
101d06cbde415cddfdcc20d47670c3d7214a2114
[ "template_values = dict(form=self.form_class(), breadcrumbs=self.breadcrumbs)\ntemplate_values = users.view_util.fill_template_values(request, **template_values)\nreturn render(request, self.template_name, template_values)", "form = self.form_class(request.POST)\ntemplate_values = dict(form=form, breadcrumbs=self...
<|body_start_0|> template_values = dict(form=self.form_class(), breadcrumbs=self.breadcrumbs) template_values = users.view_util.fill_template_values(request, **template_values) return render(request, self.template_name, template_values) <|end_body_0|> <|body_start_1|> form = self.form_c...
Compute capacity and charge rates.
ChargeRateView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChargeRateView: """Compute capacity and charge rates.""" def get(self, request, *args, **kwargs): """Process a GET request""" <|body_0|> def post(self, request, *args, **kwargs): """Process a POST request""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_004495
1,850
permissive
[ { "docstring": "Process a GET request", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Process a POST request", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_019081
Implement the Python class `ChargeRateView` described below. Class description: Compute capacity and charge rates. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Process a GET request - def post(self, request, *args, **kwargs): Process a POST request
Implement the Python class `ChargeRateView` described below. Class description: Compute capacity and charge rates. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Process a GET request - def post(self, request, *args, **kwargs): Process a POST request <|skeleton|> class ChargeRateView: ...
8381a0a1e64fb8df89a28e4729cb2957e0ebce57
<|skeleton|> class ChargeRateView: """Compute capacity and charge rates.""" def get(self, request, *args, **kwargs): """Process a GET request""" <|body_0|> def post(self, request, *args, **kwargs): """Process a POST request""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChargeRateView: """Compute capacity and charge rates.""" def get(self, request, *args, **kwargs): """Process a GET request""" template_values = dict(form=self.form_class(), breadcrumbs=self.breadcrumbs) template_values = users.view_util.fill_template_values(request, **template_val...
the_stack_v2_python_sparse
web_reflectivity/tools/views.py
neutrons/web_reflectivity
train
1
5db307096b939a19f1160000defbc60887c96dcf
[ "df_impressions = fb.build_features(df)\nf.print_time('target column')\ndf_impressions.loc[:, 'is_clicked'] = (df_impressions['referenced_item'] == df_impressions['impressed_item']).astype(int)\nfeatures = ['position', 'prices', 'interaction_count', 'is_last_interacted']\nX = df_impressions[features]\ny = df_impres...
<|body_start_0|> df_impressions = fb.build_features(df) f.print_time('target column') df_impressions.loc[:, 'is_clicked'] = (df_impressions['referenced_item'] == df_impressions['impressed_item']).astype(int) features = ['position', 'prices', 'interaction_count', 'is_last_interacted'] ...
Model class for the logistic regression model. Methods fit(df): Fit the model on training data predict(df): Calculate recommendations for test data
ModelLogReg
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelLogReg: """Model class for the logistic regression model. Methods fit(df): Fit the model on training data predict(df): Calculate recommendations for test data""" def fit(self, df): """Train the logistic regression model.""" <|body_0|> def predict(self, df): ...
stack_v2_sparse_classes_75kplus_train_004496
2,096
permissive
[ { "docstring": "Train the logistic regression model.", "name": "fit", "signature": "def fit(self, df)" }, { "docstring": "Calculate click probability based on trained logistic regression model.", "name": "predict", "signature": "def predict(self, df)" } ]
2
stack_v2_sparse_classes_30k_train_026032
Implement the Python class `ModelLogReg` described below. Class description: Model class for the logistic regression model. Methods fit(df): Fit the model on training data predict(df): Calculate recommendations for test data Method signatures and docstrings: - def fit(self, df): Train the logistic regression model. -...
Implement the Python class `ModelLogReg` described below. Class description: Model class for the logistic regression model. Methods fit(df): Fit the model on training data predict(df): Calculate recommendations for test data Method signatures and docstrings: - def fit(self, df): Train the logistic regression model. -...
9e54a88b9fd2f5451e9b9108872b28a320cb2f09
<|skeleton|> class ModelLogReg: """Model class for the logistic regression model. Methods fit(df): Fit the model on training data predict(df): Calculate recommendations for test data""" def fit(self, df): """Train the logistic regression model.""" <|body_0|> def predict(self, df): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModelLogReg: """Model class for the logistic regression model. Methods fit(df): Fit the model on training data predict(df): Calculate recommendations for test data""" def fit(self, df): """Train the logistic regression model.""" df_impressions = fb.build_features(df) f.print_time(...
the_stack_v2_python_sparse
src/models/model_log_reg.py
dav009/recsys-challenge-2019-benchmarks
train
0
d2b17ebf21c9073cebf23b6752c5bfb0db802e3a
[ "entity.missing_mand_fields = cls.identify_missing_fields_from_object(entity, cls.mandatory_fields_list)\nif cls.optional_fields_list:\n entity.missing_opt_fields = cls.identify_missing_fields_from_object(entity, cls.optional_fields_list)", "if entity.has_minimal:\n return True\ncls.report_missing_fields(en...
<|body_start_0|> entity.missing_mand_fields = cls.identify_missing_fields_from_object(entity, cls.mandatory_fields_list) if cls.optional_fields_list: entity.missing_opt_fields = cls.identify_missing_fields_from_object(entity, cls.optional_fields_list) <|end_body_0|> <|body_start_1|> ...
This class contains the functionality needed for checking the status of an entity - i.e. whether it has minimal metadata required for iRODS submission or not, and if not which fields are missing.
EntityMetaStatusChecker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntityMetaStatusChecker: """This class contains the functionality needed for checking the status of an entity - i.e. whether it has minimal metadata required for iRODS submission or not, and if not which fields are missing.""" def report_missing_fields(cls, entity): """This method ch...
stack_v2_sparse_classes_75kplus_train_004497
24,848
no_license
[ { "docstring": "This method checks that the current entity has all the mandatory and optional fields. In case it doesn't, it reports the missing fields by appending them to the corresponding fields list. Returns True if it has missing fields, false if not.", "name": "report_missing_fields", "signature":...
2
stack_v2_sparse_classes_30k_train_033384
Implement the Python class `EntityMetaStatusChecker` described below. Class description: This class contains the functionality needed for checking the status of an entity - i.e. whether it has minimal metadata required for iRODS submission or not, and if not which fields are missing. Method signatures and docstrings:...
Implement the Python class `EntityMetaStatusChecker` described below. Class description: This class contains the functionality needed for checking the status of an entity - i.e. whether it has minimal metadata required for iRODS submission or not, and if not which fields are missing. Method signatures and docstrings:...
84f31bce05976dc8d3049637f88236e8c5691f9e
<|skeleton|> class EntityMetaStatusChecker: """This class contains the functionality needed for checking the status of an entity - i.e. whether it has minimal metadata required for iRODS submission or not, and if not which fields are missing.""" def report_missing_fields(cls, entity): """This method ch...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EntityMetaStatusChecker: """This class contains the functionality needed for checking the status of an entity - i.e. whether it has minimal metadata required for iRODS submission or not, and if not which fields are missing.""" def report_missing_fields(cls, entity): """This method checks that the...
the_stack_v2_python_sparse
serapis/controller/logic/status_checker.py
wtsi-hgi/serapis
train
2
cd8d22e46ba847769f048ad78e47486e3e3c9c43
[ "self.protection_sources = protection_sources\nself.sid = sid\nself.views = views", "if dictionary is None:\n return None\nprotection_sources = None\nif dictionary.get('protectionSources') != None:\n protection_sources = list()\n for structure in dictionary.get('protectionSources'):\n protection_s...
<|body_start_0|> self.protection_sources = protection_sources self.sid = sid self.views = views <|end_body_0|> <|body_start_1|> if dictionary is None: return None protection_sources = None if dictionary.get('protectionSources') != None: protection...
Implementation of the 'SourcesForSid' model. Protection Sources and Views With Access Permissions. Specifies the Protection Sources objects and Views that the specified principal has permissions to access. The principal is specified using a security identifier (SID). Attributes: protection_sources (list of ProtectionSo...
SourcesForSid
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourcesForSid: """Implementation of the 'SourcesForSid' model. Protection Sources and Views With Access Permissions. Specifies the Protection Sources objects and Views that the specified principal has permissions to access. The principal is specified using a security identifier (SID). Attributes:...
stack_v2_sparse_classes_75kplus_train_004498
2,792
permissive
[ { "docstring": "Constructor for the SourcesForSid class", "name": "__init__", "signature": "def __init__(self, protection_sources=None, sid=None, views=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the ...
2
stack_v2_sparse_classes_30k_train_025888
Implement the Python class `SourcesForSid` described below. Class description: Implementation of the 'SourcesForSid' model. Protection Sources and Views With Access Permissions. Specifies the Protection Sources objects and Views that the specified principal has permissions to access. The principal is specified using a...
Implement the Python class `SourcesForSid` described below. Class description: Implementation of the 'SourcesForSid' model. Protection Sources and Views With Access Permissions. Specifies the Protection Sources objects and Views that the specified principal has permissions to access. The principal is specified using a...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SourcesForSid: """Implementation of the 'SourcesForSid' model. Protection Sources and Views With Access Permissions. Specifies the Protection Sources objects and Views that the specified principal has permissions to access. The principal is specified using a security identifier (SID). Attributes:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SourcesForSid: """Implementation of the 'SourcesForSid' model. Protection Sources and Views With Access Permissions. Specifies the Protection Sources objects and Views that the specified principal has permissions to access. The principal is specified using a security identifier (SID). Attributes: protection_s...
the_stack_v2_python_sparse
cohesity_management_sdk/models/sources_for_sid.py
cohesity/management-sdk-python
train
24
25900585b9a619017c521c8b488fc3e6d6d20728
[ "self.ignore_index = ignore_index or nn.CrossEntropyLoss().ignore_index\nself.cross_entropy_loss = nn.CrossEntropyLoss(ignore_index=self.ignore_index)\nsuper().__init__(metric_fn=self.metric_fn, input_key=input_key, output_key=output_key, prefix=prefix)", "cross_entropy = self.cross_entropy_loss(outputs, targets)...
<|body_start_0|> self.ignore_index = ignore_index or nn.CrossEntropyLoss().ignore_index self.cross_entropy_loss = nn.CrossEntropyLoss(ignore_index=self.ignore_index) super().__init__(metric_fn=self.metric_fn, input_key=input_key, output_key=output_key, prefix=prefix) <|end_body_0|> <|body_start...
Perplexity is a very popular metric in NLP especially in Language Modeling task. It is 2^cross_entropy.
PerplexityMetricCallback
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PerplexityMetricCallback: """Perplexity is a very popular metric in NLP especially in Language Modeling task. It is 2^cross_entropy.""" def __init__(self, input_key: str='targets', output_key: str='logits', prefix: str='perplexity', ignore_index: int=None): """Args: input_key (str): ...
stack_v2_sparse_classes_75kplus_train_004499
1,382
permissive
[ { "docstring": "Args: input_key (str): input key to use for perplexity calculation, target tokens output_key (str): output key to use for perplexity calculation, logits of the predicted tokens ignore_index (int): index to ignore, usually pad_index", "name": "__init__", "signature": "def __init__(self, i...
2
stack_v2_sparse_classes_30k_test_001765
Implement the Python class `PerplexityMetricCallback` described below. Class description: Perplexity is a very popular metric in NLP especially in Language Modeling task. It is 2^cross_entropy. Method signatures and docstrings: - def __init__(self, input_key: str='targets', output_key: str='logits', prefix: str='perp...
Implement the Python class `PerplexityMetricCallback` described below. Class description: Perplexity is a very popular metric in NLP especially in Language Modeling task. It is 2^cross_entropy. Method signatures and docstrings: - def __init__(self, input_key: str='targets', output_key: str='logits', prefix: str='perp...
a35297ecab8d1a6c2f00b6435ea1d6d37ec9f441
<|skeleton|> class PerplexityMetricCallback: """Perplexity is a very popular metric in NLP especially in Language Modeling task. It is 2^cross_entropy.""" def __init__(self, input_key: str='targets', output_key: str='logits', prefix: str='perplexity', ignore_index: int=None): """Args: input_key (str): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PerplexityMetricCallback: """Perplexity is a very popular metric in NLP especially in Language Modeling task. It is 2^cross_entropy.""" def __init__(self, input_key: str='targets', output_key: str='logits', prefix: str='perplexity', ignore_index: int=None): """Args: input_key (str): input key to ...
the_stack_v2_python_sparse
catalyst/contrib/dl/callbacks/perplexity_metric.py
saswat0/catalyst
train
2