blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1655774900c30b2ea2885a6035b4e95059664eb5 | [
"self.data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True)\nself.data_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True)\nself.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(self.data_train)",
"bfc = tfds.deprecated.text.SubwordTex... | <|body_start_0|>
self.data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True)
self.data_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True)
self.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(self.data_train)
<|end_bo... | the dataset class for using with transformers | Dataset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dataset:
"""the dataset class for using with transformers"""
def __init__(self):
"""class initializer uses ted_hrlr_translate/pt_to_en saves both english and portuguese tokenizers"""
<|body_0|>
def tokenize_dataset(self, data):
"""creates sub-word tokenizers for ... | stack_v2_sparse_classes_36k_train_014000 | 1,549 | no_license | [
{
"docstring": "class initializer uses ted_hrlr_translate/pt_to_en saves both english and portuguese tokenizers",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "creates sub-word tokenizers for the dataset data: tf.data.Dataset as tuple (pt, en) pt: tf.Tensor of portugue... | 2 | stack_v2_sparse_classes_30k_train_002999 | Implement the Python class `Dataset` described below.
Class description:
the dataset class for using with transformers
Method signatures and docstrings:
- def __init__(self): class initializer uses ted_hrlr_translate/pt_to_en saves both english and portuguese tokenizers
- def tokenize_dataset(self, data): creates sub... | Implement the Python class `Dataset` described below.
Class description:
the dataset class for using with transformers
Method signatures and docstrings:
- def __init__(self): class initializer uses ted_hrlr_translate/pt_to_en saves both english and portuguese tokenizers
- def tokenize_dataset(self, data): creates sub... | d86b0e0cae2dd07c761f84a493abc895007873ee | <|skeleton|>
class Dataset:
"""the dataset class for using with transformers"""
def __init__(self):
"""class initializer uses ted_hrlr_translate/pt_to_en saves both english and portuguese tokenizers"""
<|body_0|>
def tokenize_dataset(self, data):
"""creates sub-word tokenizers for ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Dataset:
"""the dataset class for using with transformers"""
def __init__(self):
"""class initializer uses ted_hrlr_translate/pt_to_en saves both english and portuguese tokenizers"""
self.data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True)
self... | the_stack_v2_python_sparse | supervised_learning/0x12-transformer_apps/0-dataset.py | mag389/holbertonschool-machine_learning | train | 2 |
1fa0610143ade26a0846957dd4658cf0674bd99f | [
"data = pd.read_csv(filename)\ncleaned_data = data.drop(['Unnamed: 0', 'Unnamed: 0.1'], axis=1)\ncleaned_data = cleaned_data.dropna()\ncleaned_data['success_metric'] = cleaned_data['Total_races'] * cleaned_data['Success_rate']\ngender_dummies = pd.get_dummies(cleaned_data.gender, prefix='gender')\ncleaned_data = cl... | <|body_start_0|>
data = pd.read_csv(filename)
cleaned_data = data.drop(['Unnamed: 0', 'Unnamed: 0.1'], axis=1)
cleaned_data = cleaned_data.dropna()
cleaned_data['success_metric'] = cleaned_data['Total_races'] * cleaned_data['Success_rate']
gender_dummies = pd.get_dummies(cleaned_... | Model_setup | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Model_setup:
def clean_dataframe(filename):
"""INPUT: .csv file with feature data OUTPUT: dataframe for model analysis"""
<|body_0|>
def coding(col, codeDict):
"""Consolidate all starts (code DNF with finishers) for modeling"""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_014001 | 1,363 | no_license | [
{
"docstring": "INPUT: .csv file with feature data OUTPUT: dataframe for model analysis",
"name": "clean_dataframe",
"signature": "def clean_dataframe(filename)"
},
{
"docstring": "Consolidate all starts (code DNF with finishers) for modeling",
"name": "coding",
"signature": "def coding(... | 2 | stack_v2_sparse_classes_30k_train_011787 | Implement the Python class `Model_setup` described below.
Class description:
Implement the Model_setup class.
Method signatures and docstrings:
- def clean_dataframe(filename): INPUT: .csv file with feature data OUTPUT: dataframe for model analysis
- def coding(col, codeDict): Consolidate all starts (code DNF with fi... | Implement the Python class `Model_setup` described below.
Class description:
Implement the Model_setup class.
Method signatures and docstrings:
- def clean_dataframe(filename): INPUT: .csv file with feature data OUTPUT: dataframe for model analysis
- def coding(col, codeDict): Consolidate all starts (code DNF with fi... | 6f80100502b5efbd4cf3937b30b95c8b4a8c3c56 | <|skeleton|>
class Model_setup:
def clean_dataframe(filename):
"""INPUT: .csv file with feature data OUTPUT: dataframe for model analysis"""
<|body_0|>
def coding(col, codeDict):
"""Consolidate all starts (code DNF with finishers) for modeling"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Model_setup:
def clean_dataframe(filename):
"""INPUT: .csv file with feature data OUTPUT: dataframe for model analysis"""
data = pd.read_csv(filename)
cleaned_data = data.drop(['Unnamed: 0', 'Unnamed: 0.1'], axis=1)
cleaned_data = cleaned_data.dropna()
cleaned_data['suc... | the_stack_v2_python_sparse | model/Model_setup.py | ophiolite/ultrasignup | train | 4 | |
904df93573bb80736384274f1af7eb505009354b | [
"page = request.args.get('page', 1, type=int)\nlimit = request.args.get('limit', type=int)\nname = request.args.get('name')\ngroup = request.args.get('group', type=int)\nsort = request.args.get('sort', '+id')\nper_page = limit or current_app.config['BACK_ITEM_PER_PAGE']\npagination = Host.query.filter(Host.hostname... | <|body_start_0|>
page = request.args.get('page', 1, type=int)
limit = request.args.get('limit', type=int)
name = request.args.get('name')
group = request.args.get('group', type=int)
sort = request.args.get('sort', '+id')
per_page = limit or current_app.config['BACK_ITEM_P... | HostsAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HostsAPI:
def get(self):
"""主机列表接口"""
<|body_0|>
def post(self, args):
"""新建主机接口"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
page = request.args.get('page', 1, type=int)
limit = request.args.get('limit', type=int)
name = request.... | stack_v2_sparse_classes_36k_train_014002 | 10,959 | permissive | [
{
"docstring": "主机列表接口",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "新建主机接口",
"name": "post",
"signature": "def post(self, args)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003515 | Implement the Python class `HostsAPI` described below.
Class description:
Implement the HostsAPI class.
Method signatures and docstrings:
- def get(self): 主机列表接口
- def post(self, args): 新建主机接口 | Implement the Python class `HostsAPI` described below.
Class description:
Implement the HostsAPI class.
Method signatures and docstrings:
- def get(self): 主机列表接口
- def post(self, args): 新建主机接口
<|skeleton|>
class HostsAPI:
def get(self):
"""主机列表接口"""
<|body_0|>
def post(self, args):
... | b4e37ba60fc4a37f9dca3a7518cbca112ee05739 | <|skeleton|>
class HostsAPI:
def get(self):
"""主机列表接口"""
<|body_0|>
def post(self, args):
"""新建主机接口"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HostsAPI:
def get(self):
"""主机列表接口"""
page = request.args.get('page', 1, type=int)
limit = request.args.get('limit', type=int)
name = request.args.get('name')
group = request.args.get('group', type=int)
sort = request.args.get('sort', '+id')
per_page = l... | the_stack_v2_python_sparse | backend/api/v1/views/inventory.py | hpf0532/corona | train | 6 | |
b2557043a358e29768c46317c208c5169ddc117a | [
"super(KeyPair, self).__init__(config, logger, None)\nself.user = user\nself.private_key_path = os.path.expanduser(private_key_path)\nself.public_key_path = public_key_path\nself.public_key = ''\nself.private_key = ''",
"key = RSA.generate(2048)\nself.private_key = key.exportKey('PEM')\nself.public_key = key.expo... | <|body_start_0|>
super(KeyPair, self).__init__(config, logger, None)
self.user = user
self.private_key_path = os.path.expanduser(private_key_path)
self.public_key_path = public_key_path
self.public_key = ''
self.private_key = ''
<|end_body_0|>
<|body_start_1|>
ke... | KeyPair | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KeyPair:
def __init__(self, config, logger, user, private_key_path, public_key_path):
"""Create KeyPair object :param config: gcp auth file :param logger: logger object :param user: name of the user to authenticate :param private_key_path: path where private key is stored"""
<|bo... | stack_v2_sparse_classes_36k_train_014003 | 5,856 | permissive | [
{
"docstring": "Create KeyPair object :param config: gcp auth file :param logger: logger object :param user: name of the user to authenticate :param private_key_path: path where private key is stored",
"name": "__init__",
"signature": "def __init__(self, config, logger, user, private_key_path, public_ke... | 5 | null | Implement the Python class `KeyPair` described below.
Class description:
Implement the KeyPair class.
Method signatures and docstrings:
- def __init__(self, config, logger, user, private_key_path, public_key_path): Create KeyPair object :param config: gcp auth file :param logger: logger object :param user: name of th... | Implement the Python class `KeyPair` described below.
Class description:
Implement the KeyPair class.
Method signatures and docstrings:
- def __init__(self, config, logger, user, private_key_path, public_key_path): Create KeyPair object :param config: gcp auth file :param logger: logger object :param user: name of th... | c89ae1252841dc369427c3ac40ded8564a289c1f | <|skeleton|>
class KeyPair:
def __init__(self, config, logger, user, private_key_path, public_key_path):
"""Create KeyPair object :param config: gcp auth file :param logger: logger object :param user: name of the user to authenticate :param private_key_path: path where private key is stored"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KeyPair:
def __init__(self, config, logger, user, private_key_path, public_key_path):
"""Create KeyPair object :param config: gcp auth file :param logger: logger object :param user: name of the user to authenticate :param private_key_path: path where private key is stored"""
super(KeyPair, sel... | the_stack_v2_python_sparse | cloudify_gcp/compute/keypair.py | cloudify-cosmo/cloudify-gcp-plugin | train | 6 | |
09905eb97e65595e4717b3eed54d7a1759364b56 | [
"current_app.logger.info('<Payments.get')\ncheck_auth(business_identifier=None, account_id=account_id, one_of_roles=[MAKE_PAYMENT, EDIT_ROLE, VIEW_ROLE])\npage: int = int(request.args.get('page', '1'))\nlimit: int = int(request.args.get('limit', '10'))\nstatus: str = request.args.get('status', None)\nresponse, stat... | <|body_start_0|>
current_app.logger.info('<Payments.get')
check_auth(business_identifier=None, account_id=account_id, one_of_roles=[MAKE_PAYMENT, EDIT_ROLE, VIEW_ROLE])
page: int = int(request.args.get('page', '1'))
limit: int = int(request.args.get('limit', '10'))
status: str = ... | Endpoint resource to create and return an account payments. | Payments | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Payments:
"""Endpoint resource to create and return an account payments."""
def get(account_id: str):
"""Get account payments."""
<|body_0|>
def post(account_id: str):
"""Create account payments."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
c... | stack_v2_sparse_classes_36k_train_014004 | 4,041 | permissive | [
{
"docstring": "Get account payments.",
"name": "get",
"signature": "def get(account_id: str)"
},
{
"docstring": "Create account payments.",
"name": "post",
"signature": "def post(account_id: str)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001818 | Implement the Python class `Payments` described below.
Class description:
Endpoint resource to create and return an account payments.
Method signatures and docstrings:
- def get(account_id: str): Get account payments.
- def post(account_id: str): Create account payments. | Implement the Python class `Payments` described below.
Class description:
Endpoint resource to create and return an account payments.
Method signatures and docstrings:
- def get(account_id: str): Get account payments.
- def post(account_id: str): Create account payments.
<|skeleton|>
class Payments:
"""Endpoint ... | 0d71d37b0e08d11f6b6d9f59a4b202dfabc98fc1 | <|skeleton|>
class Payments:
"""Endpoint resource to create and return an account payments."""
def get(account_id: str):
"""Get account payments."""
<|body_0|>
def post(account_id: str):
"""Create account payments."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Payments:
"""Endpoint resource to create and return an account payments."""
def get(account_id: str):
"""Get account payments."""
current_app.logger.info('<Payments.get')
check_auth(business_identifier=None, account_id=account_id, one_of_roles=[MAKE_PAYMENT, EDIT_ROLE, VIEW_ROLE])... | the_stack_v2_python_sparse | pay-api/src/pay_api/resources/payment.py | bcgov/sbc-pay | train | 6 |
0aa06497395ee14ed1746e725d2607b987ead4e7 | [
"if root is None:\n return []\nqueue = deque([root])\nans = []\nans.append(['#', root.val])\nwhile queue:\n node = queue.popleft()\n child_list = []\n for child in node.children:\n child_list.append(child.val)\n queue.append(child)\n ans.append([node.val, child_list])\nreturn ans",
"i... | <|body_start_0|>
if root is None:
return []
queue = deque([root])
ans = []
ans.append(['#', root.val])
while queue:
node = queue.popleft()
child_list = []
for child in node.children:
child_list.append(child.val)
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_014005 | 1,523 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def deserialize(self, ... | 2 | stack_v2_sparse_classes_30k_train_005234 | 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: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | 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: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | 5e09a5d36ac55d782628a888ad57d48e234b61ac | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
if root is None:
return []
queue = deque([root])
ans = []
ans.append(['#', root.val])
while queue:
node = queue.popleft()
... | the_stack_v2_python_sparse | 428/428.py | sjzyjc/leetcode | train | 0 | |
da8bf669b3376badf975ea6b64e514cfb17c8168 | [
"params = params.copy()\noptions = params.pop('OPTIONS').copy()\noptions.setdefault('autoescape', True)\noptions.setdefault('debug', settings.DEBUG)\noptions.setdefault('file_charset', settings.FILE_CHARSET)\nlibraries = options.get('libraries', {})\noptions['libraries'] = self.get_templatetag_libraries(libraries)\... | <|body_start_0|>
params = params.copy()
options = params.pop('OPTIONS').copy()
options.setdefault('autoescape', True)
options.setdefault('debug', settings.DEBUG)
options.setdefault('file_charset', settings.FILE_CHARSET)
libraries = options.get('libraries', {})
opt... | DjangoTemplates | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DjangoTemplates:
def __init__(self, params):
"""Hard override of init to use our engine."""
<|body_0|>
def get_template(self, template_name, app_label=None, model_name=None):
"""Hard override accepts app_label and model_name"""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_014006 | 1,292 | permissive | [
{
"docstring": "Hard override of init to use our engine.",
"name": "__init__",
"signature": "def __init__(self, params)"
},
{
"docstring": "Hard override accepts app_label and model_name",
"name": "get_template",
"signature": "def get_template(self, template_name, app_label=None, model_n... | 2 | stack_v2_sparse_classes_30k_train_015845 | Implement the Python class `DjangoTemplates` described below.
Class description:
Implement the DjangoTemplates class.
Method signatures and docstrings:
- def __init__(self, params): Hard override of init to use our engine.
- def get_template(self, template_name, app_label=None, model_name=None): Hard override accepts... | Implement the Python class `DjangoTemplates` described below.
Class description:
Implement the DjangoTemplates class.
Method signatures and docstrings:
- def __init__(self, params): Hard override of init to use our engine.
- def get_template(self, template_name, app_label=None, model_name=None): Hard override accepts... | 3762baf7e10bf80bfb6efb44a585beff8e8fc882 | <|skeleton|>
class DjangoTemplates:
def __init__(self, params):
"""Hard override of init to use our engine."""
<|body_0|>
def get_template(self, template_name, app_label=None, model_name=None):
"""Hard override accepts app_label and model_name"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DjangoTemplates:
def __init__(self, params):
"""Hard override of init to use our engine."""
params = params.copy()
options = params.pop('OPTIONS').copy()
options.setdefault('autoescape', True)
options.setdefault('debug', settings.DEBUG)
options.setdefault('file_... | the_stack_v2_python_sparse | foundation/template/backends/django.py | altio/foundation | train | 5 | |
d3f11cebed9b189eba232ee866743c5c9428e55b | [
"self.entry_map = {}\nself.linked_list = self.LinkedList()\nself.capacity = capacity",
"complex_value = self.entry_map.get(key)\nif complex_value is None:\n return -1\nelse:\n value, node = complex_value\n node = self.linked_list.move_to_end(node)\n self.entry_map[key] = (value, node)\n return valu... | <|body_start_0|>
self.entry_map = {}
self.linked_list = self.LinkedList()
self.capacity = capacity
<|end_body_0|>
<|body_start_1|>
complex_value = self.entry_map.get(key)
if complex_value is None:
return -1
else:
value, node = complex_value
... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":rtype: int"""
<|body_1|>
def set(self, key, value):
""":type key: int :type value: int :rtype: nothing"""
<|body_2|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_014007 | 3,603 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: nothing",
"name": "set",
"sig... | 3 | null | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :rtype: int
- def set(self, key, value): :type key: int :type value: int :rtype: nothing | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :rtype: int
- def set(self, key, value): :type key: int :type value: int :rtype: nothing
<|skeleton|>
cla... | 488d93280d45ea686d30b0928e96aa5ed5498e6b | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":rtype: int"""
<|body_1|>
def set(self, key, value):
""":type key: int :type value: int :rtype: nothing"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.entry_map = {}
self.linked_list = self.LinkedList()
self.capacity = capacity
def get(self, key):
""":rtype: int"""
complex_value = self.entry_map.get(key)
if complex_value is Non... | the_stack_v2_python_sparse | leetcode/lc146.py | JasonXJ/algorithms | train | 1 | |
2eb0dc82674a71b1106a6ff3fd91ea15ab63b59d | [
"team_role: Optional[Role] = get(bot.guilds[0].roles, name=team)\nif team_role is not None:\n return team_role\nteam_role: Role = await bot.guilds[0].create_role(name=team, color=get_color())\nawait bot.guilds[0].get_member(author.id).add_roles(team_role)\nt_cat_overwrites = {bot.guilds[0].default_role: Permissi... | <|body_start_0|>
team_role: Optional[Role] = get(bot.guilds[0].roles, name=team)
if team_role is not None:
return team_role
team_role: Role = await bot.guilds[0].create_role(name=team, color=get_color())
await bot.guilds[0].get_member(author.id).add_roles(team_role)
t... | is a extension from the RoleCog | Ext | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ext:
"""is a extension from the RoleCog"""
async def create_team(bot: Bot, team: str, author: Member) -> Role:
"""creates a new team"""
<|body_0|>
async def delete_team(bot: Bot, category: CategoryChannel) -> None:
"""deletes a team by the category"""
<|b... | stack_v2_sparse_classes_36k_train_014008 | 7,490 | permissive | [
{
"docstring": "creates a new team",
"name": "create_team",
"signature": "async def create_team(bot: Bot, team: str, author: Member) -> Role"
},
{
"docstring": "deletes a team by the category",
"name": "delete_team",
"signature": "async def delete_team(bot: Bot, category: CategoryChannel... | 2 | stack_v2_sparse_classes_30k_train_011462 | Implement the Python class `Ext` described below.
Class description:
is a extension from the RoleCog
Method signatures and docstrings:
- async def create_team(bot: Bot, team: str, author: Member) -> Role: creates a new team
- async def delete_team(bot: Bot, category: CategoryChannel) -> None: deletes a team by the ca... | Implement the Python class `Ext` described below.
Class description:
is a extension from the RoleCog
Method signatures and docstrings:
- async def create_team(bot: Bot, team: str, author: Member) -> Role: creates a new team
- async def delete_team(bot: Bot, category: CategoryChannel) -> None: deletes a team by the ca... | 6f1431feb87d3671f21a979ac271060686338b9f | <|skeleton|>
class Ext:
"""is a extension from the RoleCog"""
async def create_team(bot: Bot, team: str, author: Member) -> Role:
"""creates a new team"""
<|body_0|>
async def delete_team(bot: Bot, category: CategoryChannel) -> None:
"""deletes a team by the category"""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Ext:
"""is a extension from the RoleCog"""
async def create_team(bot: Bot, team: str, author: Member) -> Role:
"""creates a new team"""
team_role: Optional[Role] = get(bot.guilds[0].roles, name=team)
if team_role is not None:
return team_role
team_role: Role = ... | the_stack_v2_python_sparse | modules/role.py | AlbertUnruh/HackathonLeer2021 | train | 0 |
01938eab1839f749d7ca473bb746ad1be593562d | [
"print(zip_file, dist_dir)\nif not os.path.exists(zip_file):\n return\nif not os.path.exists(dist_dir):\n os.makedirs(dist_dir)\nr = zipfile.is_zipfile(zip_file)\nprint(r)\nif not r:\n return\nwith zipfile.ZipFile(zip_file, 'r') as zf:\n print(zf.namelist())\n for file in zf.namelist():\n zf.e... | <|body_start_0|>
print(zip_file, dist_dir)
if not os.path.exists(zip_file):
return
if not os.path.exists(dist_dir):
os.makedirs(dist_dir)
r = zipfile.is_zipfile(zip_file)
print(r)
if not r:
return
with zipfile.ZipFile(zip_file, ... | 文件压缩 | ZIP | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZIP:
"""文件压缩"""
def unzip_file(self, zip_file: str, dist_dir: str=None, password: str=None):
"""解压缩文件 :param zip_file: 压缩文件路径 :param dist_dir: 目标文件夹 :param password: 压缩文件密码 :return:"""
<|body_0|>
def zip_file(self, source_path, zip_file, password: str=None):
"""对... | stack_v2_sparse_classes_36k_train_014009 | 2,081 | no_license | [
{
"docstring": "解压缩文件 :param zip_file: 压缩文件路径 :param dist_dir: 目标文件夹 :param password: 压缩文件密码 :return:",
"name": "unzip_file",
"signature": "def unzip_file(self, zip_file: str, dist_dir: str=None, password: str=None)"
},
{
"docstring": "对目标进行压缩 :param source_path: 待压缩目标路径 :param zip_file: 压缩文件路径 ... | 2 | stack_v2_sparse_classes_30k_train_017057 | Implement the Python class `ZIP` described below.
Class description:
文件压缩
Method signatures and docstrings:
- def unzip_file(self, zip_file: str, dist_dir: str=None, password: str=None): 解压缩文件 :param zip_file: 压缩文件路径 :param dist_dir: 目标文件夹 :param password: 压缩文件密码 :return:
- def zip_file(self, source_path, zip_file, p... | Implement the Python class `ZIP` described below.
Class description:
文件压缩
Method signatures and docstrings:
- def unzip_file(self, zip_file: str, dist_dir: str=None, password: str=None): 解压缩文件 :param zip_file: 压缩文件路径 :param dist_dir: 目标文件夹 :param password: 压缩文件密码 :return:
- def zip_file(self, source_path, zip_file, p... | 7a553e3416c2dc13f3675b9fa7e5eb36e2941070 | <|skeleton|>
class ZIP:
"""文件压缩"""
def unzip_file(self, zip_file: str, dist_dir: str=None, password: str=None):
"""解压缩文件 :param zip_file: 压缩文件路径 :param dist_dir: 目标文件夹 :param password: 压缩文件密码 :return:"""
<|body_0|>
def zip_file(self, source_path, zip_file, password: str=None):
"""对... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZIP:
"""文件压缩"""
def unzip_file(self, zip_file: str, dist_dir: str=None, password: str=None):
"""解压缩文件 :param zip_file: 压缩文件路径 :param dist_dir: 目标文件夹 :param password: 压缩文件密码 :return:"""
print(zip_file, dist_dir)
if not os.path.exists(zip_file):
return
if not os.... | the_stack_v2_python_sparse | tools/zip.py | plusyou13/py_tools | train | 12 |
5e872aaf50142500d7a3573769ca37b9a7cc7d65 | [
"super(ResNetRFL, self).__init__()\nself.backbone = RFLBase(input_channel)\nself.out_channel = output_channel\nself.output_channel_block = [int(self.out_channel / 4), int(self.out_channel / 2), self.out_channel, self.out_channel]\nblock = BasicBlock\nlayers = [1, 2, 5, 3]\nself.inplanes = int(self.out_channel // 2)... | <|body_start_0|>
super(ResNetRFL, self).__init__()
self.backbone = RFLBase(input_channel)
self.out_channel = output_channel
self.output_channel_block = [int(self.out_channel / 4), int(self.out_channel / 2), self.out_channel, self.out_channel]
block = BasicBlock
layers = [... | Backbone network of the reciprocal feature learning in Ref [1] Ref [1]: Reciprocal Feature Learning via Explicit and Implicit Tasks in Scene Text Recognition. ICDAR-2021. | ResNetRFL | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResNetRFL:
"""Backbone network of the reciprocal feature learning in Ref [1] Ref [1]: Reciprocal Feature Learning via Explicit and Implicit Tasks in Scene Text Recognition. ICDAR-2021."""
def __init__(self, input_channel, output_channel=512):
"""Args: input_channel (int): input chann... | stack_v2_sparse_classes_36k_train_014010 | 11,483 | permissive | [
{
"docstring": "Args: input_channel (int): input channel output_channel (int): output channel",
"name": "__init__",
"signature": "def __init__(self, input_channel, output_channel=512)"
},
{
"docstring": "Args: block (block): convolution block planes (int): input channels blocks (list): layers of... | 4 | stack_v2_sparse_classes_30k_train_012444 | Implement the Python class `ResNetRFL` described below.
Class description:
Backbone network of the reciprocal feature learning in Ref [1] Ref [1]: Reciprocal Feature Learning via Explicit and Implicit Tasks in Scene Text Recognition. ICDAR-2021.
Method signatures and docstrings:
- def __init__(self, input_channel, ou... | Implement the Python class `ResNetRFL` described below.
Class description:
Backbone network of the reciprocal feature learning in Ref [1] Ref [1]: Reciprocal Feature Learning via Explicit and Implicit Tasks in Scene Text Recognition. ICDAR-2021.
Method signatures and docstrings:
- def __init__(self, input_channel, ou... | fb47a96d1a38f5ce634c6f12d710ed5300cc89fc | <|skeleton|>
class ResNetRFL:
"""Backbone network of the reciprocal feature learning in Ref [1] Ref [1]: Reciprocal Feature Learning via Explicit and Implicit Tasks in Scene Text Recognition. ICDAR-2021."""
def __init__(self, input_channel, output_channel=512):
"""Args: input_channel (int): input chann... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResNetRFL:
"""Backbone network of the reciprocal feature learning in Ref [1] Ref [1]: Reciprocal Feature Learning via Explicit and Implicit Tasks in Scene Text Recognition. ICDAR-2021."""
def __init__(self, input_channel, output_channel=512):
"""Args: input_channel (int): input channel output_cha... | the_stack_v2_python_sparse | davarocr/davarocr/davar_rcg/models/backbones/ResNetRFL.py | OCRWorld/DAVAR-Lab-OCR | train | 0 |
cf6b6b25f59899ecbb1cb825cca97bb766e43fb0 | [
"client.sendOverload()\nself.client.sendServerMessage('Overload sent to %s' % client.username)\nself.client.factory.queue.put((self.client, TASK_SERVERURGENTMESSAGE, '[OVERLOAD] &6%s was overloaded by %s' % (client.username, self.client.username)))",
"if len(parts) != 3:\n self.client.sendServerMessage('You mu... | <|body_start_0|>
client.sendOverload()
self.client.sendServerMessage('Overload sent to %s' % client.username)
self.client.factory.queue.put((self.client, TASK_SERVERURGENTMESSAGE, '[OVERLOAD] &6%s was overloaded by %s' % (client.username, self.client.username)))
<|end_body_0|>
<|body_start_1|>
... | OverloadPlugin | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OverloadPlugin:
def commandOverload(self, client, fromloc, overriderank):
"""/overload username - Admin Sends the users client a massive fake world."""
<|body_0|>
def commandSendTo(self, parts, fromloc, overriderank):
"""/send username world - Mod Sends the users cli... | stack_v2_sparse_classes_36k_train_014011 | 2,060 | permissive | [
{
"docstring": "/overload username - Admin Sends the users client a massive fake world.",
"name": "commandOverload",
"signature": "def commandOverload(self, client, fromloc, overriderank)"
},
{
"docstring": "/send username world - Mod Sends the users client to another world.",
"name": "comma... | 2 | null | Implement the Python class `OverloadPlugin` described below.
Class description:
Implement the OverloadPlugin class.
Method signatures and docstrings:
- def commandOverload(self, client, fromloc, overriderank): /overload username - Admin Sends the users client a massive fake world.
- def commandSendTo(self, parts, fro... | Implement the Python class `OverloadPlugin` described below.
Class description:
Implement the OverloadPlugin class.
Method signatures and docstrings:
- def commandOverload(self, client, fromloc, overriderank): /overload username - Admin Sends the users client a massive fake world.
- def commandSendTo(self, parts, fro... | 5482def8b50562fdbae980cda9b1708bfad8bffb | <|skeleton|>
class OverloadPlugin:
def commandOverload(self, client, fromloc, overriderank):
"""/overload username - Admin Sends the users client a massive fake world."""
<|body_0|>
def commandSendTo(self, parts, fromloc, overriderank):
"""/send username world - Mod Sends the users cli... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OverloadPlugin:
def commandOverload(self, client, fromloc, overriderank):
"""/overload username - Admin Sends the users client a massive fake world."""
client.sendOverload()
self.client.sendServerMessage('Overload sent to %s' % client.username)
self.client.factory.queue.put((se... | the_stack_v2_python_sparse | core/plugins/overload.py | TheArchives/Nexus | train | 1 | |
3163f2e8699e3fff3f90ce2297d0af3cde3b627e | [
"super(MicroDecoder, self).__init__()\nself.aux_cell = aux_cell\nself.collect_inds = []\nself.pool = ['l{}'.format(i + 1) for i in range(num_pools)]\nself.num_pools = num_pools\nself.info = []\nself.agg_size = agg_size\nself.agg_concat = agg_concat\nself.op_names = op_names\nself.cell_concat = cell_concat\nself.num... | <|body_start_0|>
super(MicroDecoder, self).__init__()
self.aux_cell = aux_cell
self.collect_inds = []
self.pool = ['l{}'.format(i + 1) for i in range(num_pools)]
self.num_pools = num_pools
self.info = []
self.agg_size = agg_size
self.agg_concat = agg_conca... | Parent class for MicroDecoders. | MicroDecoder | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MicroDecoder:
"""Parent class for MicroDecoders."""
def __init__(self, op_names, backbone_out_sizes, num_classes, config, data_format, agg_size=64, num_pools=4, ctx_cell=ContextualCell_v1, aux_cell=False, sep_repeats=1, agg_concat=False, cell_concat=False, **params):
"""Construct Mic... | stack_v2_sparse_classes_36k_train_014012 | 12,491 | permissive | [
{
"docstring": "Construct MicroDecoder class. :param op_names: list of operation candidate names :param backbone_out_sizes: backbone output channels :param num_classes: number of classes :param config: config list :param agg_size: number of channels in aggregation cells :param num_pools: number of pools :param ... | 3 | stack_v2_sparse_classes_30k_train_002587 | Implement the Python class `MicroDecoder` described below.
Class description:
Parent class for MicroDecoders.
Method signatures and docstrings:
- def __init__(self, op_names, backbone_out_sizes, num_classes, config, data_format, agg_size=64, num_pools=4, ctx_cell=ContextualCell_v1, aux_cell=False, sep_repeats=1, agg_... | Implement the Python class `MicroDecoder` described below.
Class description:
Parent class for MicroDecoders.
Method signatures and docstrings:
- def __init__(self, op_names, backbone_out_sizes, num_classes, config, data_format, agg_size=64, num_pools=4, ctx_cell=ContextualCell_v1, aux_cell=False, sep_repeats=1, agg_... | df51ed9c1d6dbde1deef63f2a037a369f8554406 | <|skeleton|>
class MicroDecoder:
"""Parent class for MicroDecoders."""
def __init__(self, op_names, backbone_out_sizes, num_classes, config, data_format, agg_size=64, num_pools=4, ctx_cell=ContextualCell_v1, aux_cell=False, sep_repeats=1, agg_concat=False, cell_concat=False, **params):
"""Construct Mic... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MicroDecoder:
"""Parent class for MicroDecoders."""
def __init__(self, op_names, backbone_out_sizes, num_classes, config, data_format, agg_size=64, num_pools=4, ctx_cell=ContextualCell_v1, aux_cell=False, sep_repeats=1, agg_concat=False, cell_concat=False, **params):
"""Construct MicroDecoder cla... | the_stack_v2_python_sparse | built-in/TensorFlow/Official/cv/image_classification/ResnetVariant_for_TensorFlow/automl/vega/search_space/networks/tensorflow/customs/adelaide_nn/micro_decoders.py | Huawei-Ascend/modelzoo | train | 1 |
bccb78a86de052ed362694317dbaa8cecfcd2e96 | [
"N = len(nums)\nif N < 2:\n return 0\nmin_n, max_n = (min(nums), max(nums))\ngap = int(math.ceil((max_n - min_n) / float(N - 1)))\nbuckets = [[None, None] for _ in range(N - 1)]\nfor x in nums:\n if x == max_n:\n continue\n slot = int((x - min_n) / gap)\n buckets[slot][0] = min(buckets[slot][0], ... | <|body_start_0|>
N = len(nums)
if N < 2:
return 0
min_n, max_n = (min(nums), max(nums))
gap = int(math.ceil((max_n - min_n) / float(N - 1)))
buckets = [[None, None] for _ in range(N - 1)]
for x in nums:
if x == max_n:
continue
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
N = len(nums)
if N < 2:
ret... | stack_v2_sparse_classes_36k_train_014013 | 1,720 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maximumGap",
"signature": "def maximumGap(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maximumGap",
"signature": "def maximumGap(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017831 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumGap(self, nums): :type nums: List[int] :rtype: int
- def maximumGap(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumGap(self, nums): :type nums: List[int] :rtype: int
- def maximumGap(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def maximumGap(se... | ef1c3bae0f6b1087df51530ba2322cfc9c970cde | <|skeleton|>
class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
N = len(nums)
if N < 2:
return 0
min_n, max_n = (min(nums), max(nums))
gap = int(math.ceil((max_n - min_n) / float(N - 1)))
buckets = [[None, None] for _ in range(N - 1)]
... | the_stack_v2_python_sparse | Leetcode/LeetCode1/164. Maximum Gap.py | liugingko/LeetCode-Python | train | 0 | |
92007de2dbf804ea7f42be3bc6c02559e3186034 | [
"azimuth = self.random.uniform(0, 2 * np.pi)\norientation = np.array((np.cos(azimuth / 2), 0, 0, np.sin(azimuth / 2)))\nspawn_radius = 0.9 * physics.named.model.geom_size['floor', 0]\nx_pos, y_pos = self.random.uniform(-spawn_radius, spawn_radius, size=(2,))\n_find_non_contacting_height(physics, orientation, x_pos,... | <|body_start_0|>
azimuth = self.random.uniform(0, 2 * np.pi)
orientation = np.array((np.cos(azimuth / 2), 0, 0, np.sin(azimuth / 2)))
spawn_radius = 0.9 * physics.named.model.geom_size['floor', 0]
x_pos, y_pos = self.random.uniform(-spawn_radius, spawn_radius, size=(2,))
_find_no... | A quadruped task solved by bringing a ball to the origin. | Fetch | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fetch:
"""A quadruped task solved by bringing a ball to the origin."""
def initialize_episode(self, physics):
"""Sets the state of the environment at the start of each episode. Args: physics: An instance of `Physics`."""
<|body_0|>
def get_observation(self, physics):
... | stack_v2_sparse_classes_36k_train_014014 | 17,995 | permissive | [
{
"docstring": "Sets the state of the environment at the start of each episode. Args: physics: An instance of `Physics`.",
"name": "initialize_episode",
"signature": "def initialize_episode(self, physics)"
},
{
"docstring": "Returns an observation to the agent.",
"name": "get_observation",
... | 3 | null | Implement the Python class `Fetch` described below.
Class description:
A quadruped task solved by bringing a ball to the origin.
Method signatures and docstrings:
- def initialize_episode(self, physics): Sets the state of the environment at the start of each episode. Args: physics: An instance of `Physics`.
- def get... | Implement the Python class `Fetch` described below.
Class description:
A quadruped task solved by bringing a ball to the origin.
Method signatures and docstrings:
- def initialize_episode(self, physics): Sets the state of the environment at the start of each episode. Args: physics: An instance of `Physics`.
- def get... | 33d3ea2682409ee82bf9c5129ceaf06ab01cd48e | <|skeleton|>
class Fetch:
"""A quadruped task solved by bringing a ball to the origin."""
def initialize_episode(self, physics):
"""Sets the state of the environment at the start of each episode. Args: physics: An instance of `Physics`."""
<|body_0|>
def get_observation(self, physics):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Fetch:
"""A quadruped task solved by bringing a ball to the origin."""
def initialize_episode(self, physics):
"""Sets the state of the environment at the start of each episode. Args: physics: An instance of `Physics`."""
azimuth = self.random.uniform(0, 2 * np.pi)
orientation = np... | the_stack_v2_python_sparse | src/env/dm_control/dm_control/suite/quadruped.py | nicklashansen/svea-vit | train | 16 |
eacbb03b47a367533df99567b2c7a6203bb69615 | [
"super(HyperTextTextInferExportCell, self).__init__(auto_prefix=False)\nself.network = network\nself.argmax = ArgMaxWithValue(axis=1, keep_dims=True)",
"predicted_idx = self.network(x1, x2)\npredicted_idx = self.argmax(predicted_idx)\nreturn predicted_idx"
] | <|body_start_0|>
super(HyperTextTextInferExportCell, self).__init__(auto_prefix=False)
self.network = network
self.argmax = ArgMaxWithValue(axis=1, keep_dims=True)
<|end_body_0|>
<|body_start_1|>
predicted_idx = self.network(x1, x2)
predicted_idx = self.argmax(predicted_idx)
... | HyperText network infer. | HyperTextTextInferExportCell | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HyperTextTextInferExportCell:
"""HyperText network infer."""
def __init__(self, network):
"""init fun"""
<|body_0|>
def construct(self, x1, x2):
"""construct hypertexttext infer cell"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(HyperTex... | stack_v2_sparse_classes_36k_train_014015 | 3,306 | permissive | [
{
"docstring": "init fun",
"name": "__init__",
"signature": "def __init__(self, network)"
},
{
"docstring": "construct hypertexttext infer cell",
"name": "construct",
"signature": "def construct(self, x1, x2)"
}
] | 2 | null | Implement the Python class `HyperTextTextInferExportCell` described below.
Class description:
HyperText network infer.
Method signatures and docstrings:
- def __init__(self, network): init fun
- def construct(self, x1, x2): construct hypertexttext infer cell | Implement the Python class `HyperTextTextInferExportCell` described below.
Class description:
HyperText network infer.
Method signatures and docstrings:
- def __init__(self, network): init fun
- def construct(self, x1, x2): construct hypertexttext infer cell
<|skeleton|>
class HyperTextTextInferExportCell:
"""Hy... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class HyperTextTextInferExportCell:
"""HyperText network infer."""
def __init__(self, network):
"""init fun"""
<|body_0|>
def construct(self, x1, x2):
"""construct hypertexttext infer cell"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HyperTextTextInferExportCell:
"""HyperText network infer."""
def __init__(self, network):
"""init fun"""
super(HyperTextTextInferExportCell, self).__init__(auto_prefix=False)
self.network = network
self.argmax = ArgMaxWithValue(axis=1, keep_dims=True)
def construct(se... | the_stack_v2_python_sparse | research/nlp/hypertext/export.py | mindspore-ai/models | train | 301 |
2812c88682fab7dfca8decf9b1a11c72b63710a8 | [
"super().__init__(self.PROBLEM_NAME)\nself.input_linked_list1 = input_linked_list1\nself.input_linked_list2 = input_linked_list2",
"print('Solving {} problem ...'.format(self.PROBLEM_NAME))\nmerged_list = LinkedList()\nnode1 = self.input_linked_list1.head\nnode2 = self.input_linked_list2.head\nwhile node1 is not ... | <|body_start_0|>
super().__init__(self.PROBLEM_NAME)
self.input_linked_list1 = input_linked_list1
self.input_linked_list2 = input_linked_list2
<|end_body_0|>
<|body_start_1|>
print('Solving {} problem ...'.format(self.PROBLEM_NAME))
merged_list = LinkedList()
node1 = sel... | Merge Two Sorted Linked Lists | MergeTwoSortedLinkedLists | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MergeTwoSortedLinkedLists:
"""Merge Two Sorted Linked Lists"""
def __init__(self, input_linked_list1, input_linked_list2):
"""Merge Two Sorted Linked Lists Args: input_linked_list1: First linked list input_linked_list2: Second linked list Returns: None Raises: None"""
<|body_... | stack_v2_sparse_classes_36k_train_014016 | 2,231 | no_license | [
{
"docstring": "Merge Two Sorted Linked Lists Args: input_linked_list1: First linked list input_linked_list2: Second linked list Returns: None Raises: None",
"name": "__init__",
"signature": "def __init__(self, input_linked_list1, input_linked_list2)"
},
{
"docstring": "Solve the problem Note: O... | 2 | null | Implement the Python class `MergeTwoSortedLinkedLists` described below.
Class description:
Merge Two Sorted Linked Lists
Method signatures and docstrings:
- def __init__(self, input_linked_list1, input_linked_list2): Merge Two Sorted Linked Lists Args: input_linked_list1: First linked list input_linked_list2: Second ... | Implement the Python class `MergeTwoSortedLinkedLists` described below.
Class description:
Merge Two Sorted Linked Lists
Method signatures and docstrings:
- def __init__(self, input_linked_list1, input_linked_list2): Merge Two Sorted Linked Lists Args: input_linked_list1: First linked list input_linked_list2: Second ... | 11f4d25cb211740514c119a60962d075a0817abd | <|skeleton|>
class MergeTwoSortedLinkedLists:
"""Merge Two Sorted Linked Lists"""
def __init__(self, input_linked_list1, input_linked_list2):
"""Merge Two Sorted Linked Lists Args: input_linked_list1: First linked list input_linked_list2: Second linked list Returns: None Raises: None"""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MergeTwoSortedLinkedLists:
"""Merge Two Sorted Linked Lists"""
def __init__(self, input_linked_list1, input_linked_list2):
"""Merge Two Sorted Linked Lists Args: input_linked_list1: First linked list input_linked_list2: Second linked list Returns: None Raises: None"""
super().__init__(sel... | the_stack_v2_python_sparse | python/problems/linked_list/merge_two_sorted_linked_lists.py | santhosh-kumar/AlgorithmsAndDataStructures | train | 2 |
b8e85ce7ff91b9d851048f46e94eec147a38396d | [
"if acct1 == memofrom:\n if rstatus < 1:\n self.invite_msg(acct1, acct2, memoid)\n else:\n self.ignore('{} has already'.format(acct1) + 'started this exchange.')\nelse:\n self.ignore('Invalid action. {} '.format(acct1) + ' has not yet started this ' + 'exhange.')",
"invalid = False\nif acct... | <|body_start_0|>
if acct1 == memofrom:
if rstatus < 1:
self.invite_msg(acct1, acct2, memoid)
else:
self.ignore('{} has already'.format(acct1) + 'started this exchange.')
else:
self.ignore('Invalid action. {} '.format(acct1) + ' has not ... | Reaction | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Reaction:
def start(self, acct1, acct2, memofrom, rstatus, memoid):
"""The start method grants the authority to the exchange from the inviter."""
<|body_0|>
def accept(self, acct1, acct2, memofrom, rstatus, memoid):
"""The accept method is used to authorize a change ... | stack_v2_sparse_classes_36k_train_014017 | 10,800 | permissive | [
{
"docstring": "The start method grants the authority to the exchange from the inviter.",
"name": "start",
"signature": "def start(self, acct1, acct2, memofrom, rstatus, memoid)"
},
{
"docstring": "The accept method is used to authorize a change whenever an invite or a barter is sent.",
"nam... | 3 | stack_v2_sparse_classes_30k_train_014922 | Implement the Python class `Reaction` described below.
Class description:
Implement the Reaction class.
Method signatures and docstrings:
- def start(self, acct1, acct2, memofrom, rstatus, memoid): The start method grants the authority to the exchange from the inviter.
- def accept(self, acct1, acct2, memofrom, rstat... | Implement the Python class `Reaction` described below.
Class description:
Implement the Reaction class.
Method signatures and docstrings:
- def start(self, acct1, acct2, memofrom, rstatus, memoid): The start method grants the authority to the exchange from the inviter.
- def accept(self, acct1, acct2, memofrom, rstat... | 4002ff7c7bdd4bf53d27e862919fab07250301b4 | <|skeleton|>
class Reaction:
def start(self, acct1, acct2, memofrom, rstatus, memoid):
"""The start method grants the authority to the exchange from the inviter."""
<|body_0|>
def accept(self, acct1, acct2, memofrom, rstatus, memoid):
"""The accept method is used to authorize a change ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Reaction:
def start(self, acct1, acct2, memofrom, rstatus, memoid):
"""The start method grants the authority to the exchange from the inviter."""
if acct1 == memofrom:
if rstatus < 1:
self.invite_msg(acct1, acct2, memoid)
else:
self.ignor... | the_stack_v2_python_sparse | steemax/axtrans.py | chronocrypto/SteemAX | train | 0 | |
a2bf34d587bc9ee2a087ceecdd383893f6feff67 | [
"super(LandmarkDataSource, self).__init__(id_dict_preprocessing=id_dict_preprocessing)\nself.point_list_file_name = point_list_file_name\nself.num_points = num_points\nself.dim = dim\nself.silent_not_found = silent_not_found\nself.load()",
"ext = os.path.splitext(self.point_list_file_name)[1]\nif ext == '.csv':\n... | <|body_start_0|>
super(LandmarkDataSource, self).__init__(id_dict_preprocessing=id_dict_preprocessing)
self.point_list_file_name = point_list_file_name
self.num_points = num_points
self.dim = dim
self.silent_not_found = silent_not_found
self.load()
<|end_body_0|>
<|body_... | Datasource used for loading landmarks. Uses id_dict['image_id'] as the landmark file key and returns a list of landmarks. | LandmarkDataSource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LandmarkDataSource:
"""Datasource used for loading landmarks. Uses id_dict['image_id'] as the landmark file key and returns a list of landmarks."""
def __init__(self, point_list_file_name, num_points, dim, silent_not_found=False, id_dict_preprocessing=None):
"""Initializer. :param po... | stack_v2_sparse_classes_36k_train_014018 | 5,859 | no_license | [
{
"docstring": "Initializer. :param point_list_file_name: File that contains all the landmarks. Either a .csv file or a .idl file. :param num_points: Number of landmarks in the landmarks file. :param dim: Dimension of the landmarks. :param silent_not_found: If true, will return a list of invalid landmarks, in c... | 4 | stack_v2_sparse_classes_30k_train_012860 | Implement the Python class `LandmarkDataSource` described below.
Class description:
Datasource used for loading landmarks. Uses id_dict['image_id'] as the landmark file key and returns a list of landmarks.
Method signatures and docstrings:
- def __init__(self, point_list_file_name, num_points, dim, silent_not_found=F... | Implement the Python class `LandmarkDataSource` described below.
Class description:
Datasource used for loading landmarks. Uses id_dict['image_id'] as the landmark file key and returns a list of landmarks.
Method signatures and docstrings:
- def __init__(self, point_list_file_name, num_points, dim, silent_not_found=F... | ef6cee91264ba1fe6b40d9823a07647b95bcc2c4 | <|skeleton|>
class LandmarkDataSource:
"""Datasource used for loading landmarks. Uses id_dict['image_id'] as the landmark file key and returns a list of landmarks."""
def __init__(self, point_list_file_name, num_points, dim, silent_not_found=False, id_dict_preprocessing=None):
"""Initializer. :param po... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LandmarkDataSource:
"""Datasource used for loading landmarks. Uses id_dict['image_id'] as the landmark file key and returns a list of landmarks."""
def __init__(self, point_list_file_name, num_points, dim, silent_not_found=False, id_dict_preprocessing=None):
"""Initializer. :param point_list_file... | the_stack_v2_python_sparse | datasources/landmark_datasource.py | XiaoweiXu/MedicalDataAugmentationTool | train | 1 |
2f63d7bbb540347bc8af6a2cb9cabf9c4c17954d | [
"orderList = Shop_User(id=current_user.id).orderList\nif orderList:\n orderList = marshal(orderList, output_order)\n return Response(data=orderList)\nelse:\n return Response(code=HttpStatus.HTTP_404_NOT_FOUND, message='无符合条件的订单')",
"args = reqparse.RequestParser().add_argument('order_id', type=str, locat... | <|body_start_0|>
orderList = Shop_User(id=current_user.id).orderList
if orderList:
orderList = marshal(orderList, output_order)
return Response(data=orderList)
else:
return Response(code=HttpStatus.HTTP_404_NOT_FOUND, message='无符合条件的订单')
<|end_body_0|>
<|body... | Order | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Order:
def get(self):
"""获取个人订单 :return:"""
<|body_0|>
def post(self):
"""评价个人订单 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
orderList = Shop_User(id=current_user.id).orderList
if orderList:
orderList = marshal(order... | stack_v2_sparse_classes_36k_train_014019 | 2,760 | no_license | [
{
"docstring": "获取个人订单 :return:",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "评价个人订单 :return:",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005140 | Implement the Python class `Order` described below.
Class description:
Implement the Order class.
Method signatures and docstrings:
- def get(self): 获取个人订单 :return:
- def post(self): 评价个人订单 :return: | Implement the Python class `Order` described below.
Class description:
Implement the Order class.
Method signatures and docstrings:
- def get(self): 获取个人订单 :return:
- def post(self): 评价个人订单 :return:
<|skeleton|>
class Order:
def get(self):
"""获取个人订单 :return:"""
<|body_0|>
def post(self):
... | 34a2bf4a51cc40a22dd43cb5eb88af7c2f2c5120 | <|skeleton|>
class Order:
def get(self):
"""获取个人订单 :return:"""
<|body_0|>
def post(self):
"""评价个人订单 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Order:
def get(self):
"""获取个人订单 :return:"""
orderList = Shop_User(id=current_user.id).orderList
if orderList:
orderList = marshal(orderList, output_order)
return Response(data=orderList)
else:
return Response(code=HttpStatus.HTTP_404_NOT_FOUN... | the_stack_v2_python_sparse | App/Shop/Controller/UserResource.py | Vulcanhy/api.grooo-master | train | 0 | |
f3dc5db833e1defacc02ab10e009868975eacf5d | [
"nums = set(nums)\nif len(nums) < 3:\n return max(nums)\nelse:\n nums.remove(max(nums))\n nums.remove(max(nums))\n return max(nums)",
"nums = set(nums)\nif len(nums) < 3:\n return max(nums)\nelse:\n return sorted(nums)[len(nums) - 3]"
] | <|body_start_0|>
nums = set(nums)
if len(nums) < 3:
return max(nums)
else:
nums.remove(max(nums))
nums.remove(max(nums))
return max(nums)
<|end_body_0|>
<|body_start_1|>
nums = set(nums)
if len(nums) < 3:
return max(num... | Problem: https://leetcode.com/problems/third-maximum-number/ Example: Input: [3, 2, 1] Output: 1 Explanation: The third maximum is 1. | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Problem: https://leetcode.com/problems/third-maximum-number/ Example: Input: [3, 2, 1] Output: 1 Explanation: The third maximum is 1."""
def thirdMaxBest(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def thirdMax(self, nums):
""":ty... | stack_v2_sparse_classes_36k_train_014020 | 940 | permissive | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "thirdMaxBest",
"signature": "def thirdMaxBest(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "thirdMax",
"signature": "def thirdMax(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Problem: https://leetcode.com/problems/third-maximum-number/ Example: Input: [3, 2, 1] Output: 1 Explanation: The third maximum is 1.
Method signatures and docstrings:
- def thirdMaxBest(self, nums): :type nums: List[int] :rtype: int
- def thir... | Implement the Python class `Solution` described below.
Class description:
Problem: https://leetcode.com/problems/third-maximum-number/ Example: Input: [3, 2, 1] Output: 1 Explanation: The third maximum is 1.
Method signatures and docstrings:
- def thirdMaxBest(self, nums): :type nums: List[int] :rtype: int
- def thir... | 0420fbcbebad3b746db63b9e9a5878b4af8ad6ac | <|skeleton|>
class Solution:
"""Problem: https://leetcode.com/problems/third-maximum-number/ Example: Input: [3, 2, 1] Output: 1 Explanation: The third maximum is 1."""
def thirdMaxBest(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def thirdMax(self, nums):
""":ty... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""Problem: https://leetcode.com/problems/third-maximum-number/ Example: Input: [3, 2, 1] Output: 1 Explanation: The third maximum is 1."""
def thirdMaxBest(self, nums):
""":type nums: List[int] :rtype: int"""
nums = set(nums)
if len(nums) < 3:
return max(num... | the_stack_v2_python_sparse | leetcode/array/easy/thirdMax.py | joway/PyAlgorithm | train | 1 |
32958c23a3a9feedfe94215a646975cae6b60751 | [
"self.formset.group = obj\nself.form.group = obj\nreturn super(GroupRolesInline, self).get_formset(request, obj=obj, **kwargs)",
"if resolve(request.path).url_name == 'users_group_add':\n return False\nreturn super(GroupRolesInline, self).has_add_permission(request)"
] | <|body_start_0|>
self.formset.group = obj
self.form.group = obj
return super(GroupRolesInline, self).get_formset(request, obj=obj, **kwargs)
<|end_body_0|>
<|body_start_1|>
if resolve(request.path).url_name == 'users_group_add':
return False
return super(GroupRolesIn... | GroupRolesInline | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupRolesInline:
def get_formset(self, request, obj=None, **kwargs):
"""Hook obj into formset to tell the difference bewteen add or change so it can validate correctly that each group has at least one admin, except during the add process which will be added automatically"""
<|bo... | stack_v2_sparse_classes_36k_train_014021 | 13,806 | no_license | [
{
"docstring": "Hook obj into formset to tell the difference bewteen add or change so it can validate correctly that each group has at least one admin, except during the add process which will be added automatically",
"name": "get_formset",
"signature": "def get_formset(self, request, obj=None, **kwargs... | 2 | null | Implement the Python class `GroupRolesInline` described below.
Class description:
Implement the GroupRolesInline class.
Method signatures and docstrings:
- def get_formset(self, request, obj=None, **kwargs): Hook obj into formset to tell the difference bewteen add or change so it can validate correctly that each grou... | Implement the Python class `GroupRolesInline` described below.
Class description:
Implement the GroupRolesInline class.
Method signatures and docstrings:
- def get_formset(self, request, obj=None, **kwargs): Hook obj into formset to tell the difference bewteen add or change so it can validate correctly that each grou... | dd798dc9bd3321b17007ff131e7b1288a2cd3c36 | <|skeleton|>
class GroupRolesInline:
def get_formset(self, request, obj=None, **kwargs):
"""Hook obj into formset to tell the difference bewteen add or change so it can validate correctly that each group has at least one admin, except during the add process which will be added automatically"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GroupRolesInline:
def get_formset(self, request, obj=None, **kwargs):
"""Hook obj into formset to tell the difference bewteen add or change so it can validate correctly that each group has at least one admin, except during the add process which will be added automatically"""
self.formset.group... | the_stack_v2_python_sparse | controller/apps/users/admin.py | m00dy/vct-controller | train | 2 | |
ba5e1d4f0bd54b5de85d6830601869c65aa2bd2c | [
"curnum = 0\ncurstring = ''\nstack = []\nfor char in s:\n if char == '[':\n stack.append(curstring)\n stack.append(curnum)\n curstring = ''\n curnum = 0\n elif char == ']':\n prenum = stack.pop()\n prestring = stack.pop()\n curstring = prestring + prenum * curs... | <|body_start_0|>
curnum = 0
curstring = ''
stack = []
for char in s:
if char == '[':
stack.append(curstring)
stack.append(curnum)
curstring = ''
curnum = 0
elif char == ']':
prenum = s... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def decodeString(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def decodeString_failed(self, s):
""":type s: str :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
curnum = 0
curstring = ''
stack = []
... | stack_v2_sparse_classes_36k_train_014022 | 2,478 | no_license | [
{
"docstring": ":type s: str :rtype: str",
"name": "decodeString",
"signature": "def decodeString(self, s)"
},
{
"docstring": ":type s: str :rtype: str",
"name": "decodeString_failed",
"signature": "def decodeString_failed(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002215 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def decodeString(self, s): :type s: str :rtype: str
- def decodeString_failed(self, s): :type s: str :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def decodeString(self, s): :type s: str :rtype: str
- def decodeString_failed(self, s): :type s: str :rtype: str
<|skeleton|>
class Solution:
def decodeString(self, s):
... | 93266095329e2e8e949a72371b88b07382a60e0d | <|skeleton|>
class Solution:
def decodeString(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def decodeString_failed(self, s):
""":type s: str :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def decodeString(self, s):
""":type s: str :rtype: str"""
curnum = 0
curstring = ''
stack = []
for char in s:
if char == '[':
stack.append(curstring)
stack.append(curnum)
curstring = ''
... | the_stack_v2_python_sparse | decodeString.py | shivangi-prog/leetcode | train | 0 | |
3ee7a1bdc06202aa5754ffa2ad3dbf7763d4db3d | [
"self._get_current_time_fn = get_current_time_fn\nself._archive_data_source = archive_data_source\nself._trigger_pvs = [config.trigger_pv for config in configs]\nself._time_last_active = time_last_active\nsearch_for_change_from, self._last_sample_id_for_time = time_last_active.get()\ninitial_data_values = archive_d... | <|body_start_0|>
self._get_current_time_fn = get_current_time_fn
self._archive_data_source = archive_data_source
self._trigger_pvs = [config.trigger_pv for config in configs]
self._time_last_active = time_last_active
search_for_change_from, self._last_sample_id_for_time = time_la... | Initiate the writing of a log file based on the change of a PV. | LogFileInitiatorOnPVChange | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogFileInitiatorOnPVChange:
"""Initiate the writing of a log file based on the change of a PV."""
def __init__(self, configs, archive_data_source, time_last_active, get_current_time_fn=utc_time_now, data_file_creator_factory=DataFileCreatorFactory()):
"""Args: configs(list[ArchiverAc... | stack_v2_sparse_classes_36k_train_014023 | 11,537 | permissive | [
{
"docstring": "Args: configs(list[ArchiverAccess.archive_access_configuration.ArchiveAccessConfig]): list of configs archive_data_source(ArchiverAccess.archiver_data_source.ArchiverDataSource): data source time_last_active(ArchiverAccess.time_last_active.TimeLastActive): provider for the time from which to sea... | 3 | stack_v2_sparse_classes_30k_val_001100 | Implement the Python class `LogFileInitiatorOnPVChange` described below.
Class description:
Initiate the writing of a log file based on the change of a PV.
Method signatures and docstrings:
- def __init__(self, configs, archive_data_source, time_last_active, get_current_time_fn=utc_time_now, data_file_creator_factory... | Implement the Python class `LogFileInitiatorOnPVChange` described below.
Class description:
Initiate the writing of a log file based on the change of a PV.
Method signatures and docstrings:
- def __init__(self, configs, archive_data_source, time_last_active, get_current_time_fn=utc_time_now, data_file_creator_factory... | 2e605cbff1cfe071571a64bed61708d8c92dc204 | <|skeleton|>
class LogFileInitiatorOnPVChange:
"""Initiate the writing of a log file based on the change of a PV."""
def __init__(self, configs, archive_data_source, time_last_active, get_current_time_fn=utc_time_now, data_file_creator_factory=DataFileCreatorFactory()):
"""Args: configs(list[ArchiverAc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LogFileInitiatorOnPVChange:
"""Initiate the writing of a log file based on the change of a PV."""
def __init__(self, configs, archive_data_source, time_last_active, get_current_time_fn=utc_time_now, data_file_creator_factory=DataFileCreatorFactory()):
"""Args: configs(list[ArchiverAccess.archive_... | the_stack_v2_python_sparse | ArchiverAccess/log_file_initiator.py | ISISComputingGroup/EPICS-inst_servers | train | 1 |
bcc675325ec9a1ad9fae9361a2baac1bef7dfd75 | [
"url = 'https://www.zhihu.com'\nfor _ in range(2):\n async with self.client.get(url) as r:\n resp = await r.text()\n session_token = re.findall('session_token=(.*?)\\\\&', resp)\n if session_token:\n session_token = session_token[0]\n break\nelse:\n raise AssertionError('获取sessi... | <|body_start_0|>
url = 'https://www.zhihu.com'
for _ in range(2):
async with self.client.get(url) as r:
resp = await r.text()
session_token = re.findall('session_token=(.*?)\\&', resp)
if session_token:
session_token = session_token... | 文章相关 | ArticleSpider | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArticleSpider:
"""文章相关"""
async def get_recommend_article(self) -> dict:
"""获取推荐文章 :return:"""
<|body_0|>
async def endorse_answer(self, uid: str, typ: str='up') -> dict:
"""赞同回答 :param uid: :param typ: up赞同, down踩, neutral中立 :return:"""
<|body_1|>
a... | stack_v2_sparse_classes_36k_train_014024 | 4,388 | permissive | [
{
"docstring": "获取推荐文章 :return:",
"name": "get_recommend_article",
"signature": "async def get_recommend_article(self) -> dict"
},
{
"docstring": "赞同回答 :param uid: :param typ: up赞同, down踩, neutral中立 :return:",
"name": "endorse_answer",
"signature": "async def endorse_answer(self, uid: st... | 6 | stack_v2_sparse_classes_30k_train_014179 | Implement the Python class `ArticleSpider` described below.
Class description:
文章相关
Method signatures and docstrings:
- async def get_recommend_article(self) -> dict: 获取推荐文章 :return:
- async def endorse_answer(self, uid: str, typ: str='up') -> dict: 赞同回答 :param uid: :param typ: up赞同, down踩, neutral中立 :return:
- async... | Implement the Python class `ArticleSpider` described below.
Class description:
文章相关
Method signatures and docstrings:
- async def get_recommend_article(self) -> dict: 获取推荐文章 :return:
- async def endorse_answer(self, uid: str, typ: str='up') -> dict: 赞同回答 :param uid: :param typ: up赞同, down踩, neutral中立 :return:
- async... | bd8cbae26b0027eeffa78b8a4888b3b4aa4a84e0 | <|skeleton|>
class ArticleSpider:
"""文章相关"""
async def get_recommend_article(self) -> dict:
"""获取推荐文章 :return:"""
<|body_0|>
async def endorse_answer(self, uid: str, typ: str='up') -> dict:
"""赞同回答 :param uid: :param typ: up赞同, down踩, neutral中立 :return:"""
<|body_1|>
a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ArticleSpider:
"""文章相关"""
async def get_recommend_article(self) -> dict:
"""获取推荐文章 :return:"""
url = 'https://www.zhihu.com'
for _ in range(2):
async with self.client.get(url) as r:
resp = await r.text()
session_token = re.findall('sessi... | the_stack_v2_python_sparse | spider/article_spider.py | wf1314/zhihu-terminal | train | 124 |
e41a38be42eb1f06f4314b252213a3498f2aa4e3 | [
"data_model = self._sdc_definitions.data_model\nrequest = data_model.msg_types.GetLocalizedText()\nif refs is not None:\n request.Ref.extend(refs)\nif version is not None:\n request.Version = version\nif langs is not None:\n request.Lang.extend(langs)\nif text_widths is not None:\n request.TextWidth.ext... | <|body_start_0|>
data_model = self._sdc_definitions.data_model
request = data_model.msg_types.GetLocalizedText()
if refs is not None:
request.Ref.extend(refs)
if version is not None:
request.Version = version
if langs is not None:
request.Lang.... | Client for LocalizationService. | LocalizationServiceClient | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalizationServiceClient:
"""Client for LocalizationService."""
def get_localized_texts(self, refs: list[str] | None=None, version: int | None=None, langs: list[str] | None=None, text_widths: list[LocalizedTextWidth] | None=None, number_of_lines: list[int] | None=None, request_manipulator: ... | stack_v2_sparse_classes_36k_train_014025 | 3,304 | permissive | [
{
"docstring": "Send a GetLocalizedText request. :param refs: optional list of reference names of the texts that are requested. :param version: optional revision of the referenced text that is requested. :param langs: optional list of language identifiers. :param text_widths: optional list of LocalizedTextWidth... | 2 | stack_v2_sparse_classes_30k_train_000010 | Implement the Python class `LocalizationServiceClient` described below.
Class description:
Client for LocalizationService.
Method signatures and docstrings:
- def get_localized_texts(self, refs: list[str] | None=None, version: int | None=None, langs: list[str] | None=None, text_widths: list[LocalizedTextWidth] | None... | Implement the Python class `LocalizationServiceClient` described below.
Class description:
Client for LocalizationService.
Method signatures and docstrings:
- def get_localized_texts(self, refs: list[str] | None=None, version: int | None=None, langs: list[str] | None=None, text_widths: list[LocalizedTextWidth] | None... | dab57b38ed9a9e70e6bc6a9cf44140b96fd95851 | <|skeleton|>
class LocalizationServiceClient:
"""Client for LocalizationService."""
def get_localized_texts(self, refs: list[str] | None=None, version: int | None=None, langs: list[str] | None=None, text_widths: list[LocalizedTextWidth] | None=None, number_of_lines: list[int] | None=None, request_manipulator: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LocalizationServiceClient:
"""Client for LocalizationService."""
def get_localized_texts(self, refs: list[str] | None=None, version: int | None=None, langs: list[str] | None=None, text_widths: list[LocalizedTextWidth] | None=None, number_of_lines: list[int] | None=None, request_manipulator: RequestManipu... | the_stack_v2_python_sparse | src/sdc11073/consumer/serviceclients/localizationservice.py | deichmab-draeger/sdc11073 | train | 0 |
afbf0983e90d9efac98652276eec985fadbb9700 | [
"super(RelativePosition, self).__init__()\nself.num_units = num_units\nself.device = device\nself.max_relative_position = max_relative_position\nself.embeddings_table = nn.Parameter(torch.Tensor(max_relative_position * 2 + 1, num_units))\nnn.init.xavier_uniform_(self.embeddings_table)",
"range_vec_q = torch.arang... | <|body_start_0|>
super(RelativePosition, self).__init__()
self.num_units = num_units
self.device = device
self.max_relative_position = max_relative_position
self.embeddings_table = nn.Parameter(torch.Tensor(max_relative_position * 2 + 1, num_units))
nn.init.xavier_uniform... | RelativePosition | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RelativePosition:
def __init__(self, num_units, max_relative_position, device=None):
""":param num_units: d_a :param max_relative_position: k"""
<|body_0|>
def forward(self, length_q, length_k):
"""for self-att: length_q == length_k == length_x return: embeddings: le... | stack_v2_sparse_classes_36k_train_014026 | 1,268 | no_license | [
{
"docstring": ":param num_units: d_a :param max_relative_position: k",
"name": "__init__",
"signature": "def __init__(self, num_units, max_relative_position, device=None)"
},
{
"docstring": "for self-att: length_q == length_k == length_x return: embeddings: length_q x length_k x d_a",
"name... | 2 | stack_v2_sparse_classes_30k_train_021164 | Implement the Python class `RelativePosition` described below.
Class description:
Implement the RelativePosition class.
Method signatures and docstrings:
- def __init__(self, num_units, max_relative_position, device=None): :param num_units: d_a :param max_relative_position: k
- def forward(self, length_q, length_k): ... | Implement the Python class `RelativePosition` described below.
Class description:
Implement the RelativePosition class.
Method signatures and docstrings:
- def __init__(self, num_units, max_relative_position, device=None): :param num_units: d_a :param max_relative_position: k
- def forward(self, length_q, length_k): ... | 1bfff12c6b03f64f57d118b435c0040431befcdf | <|skeleton|>
class RelativePosition:
def __init__(self, num_units, max_relative_position, device=None):
""":param num_units: d_a :param max_relative_position: k"""
<|body_0|>
def forward(self, length_q, length_k):
"""for self-att: length_q == length_k == length_x return: embeddings: le... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RelativePosition:
def __init__(self, num_units, max_relative_position, device=None):
""":param num_units: d_a :param max_relative_position: k"""
super(RelativePosition, self).__init__()
self.num_units = num_units
self.device = device
self.max_relative_position = max_rel... | the_stack_v2_python_sparse | nag/modules/relative_position.py | liu-hz18/Non-Autoregressive-Neural-Dialogue-Generation | train | 0 | |
892d7858339b81905bfc55bdff543a05d4da3d89 | [
"childs = len(child_ratings)\nif childs <= 1:\n return childs\nup = peak = down = 0\ntotal_candies = 1\nfor child in range(1, childs):\n if child_ratings[child] > child_ratings[child - 1]:\n up += 1\n down = 0\n peak = up\n total_candies += up + 1\n elif child_ratings[child] == ... | <|body_start_0|>
childs = len(child_ratings)
if childs <= 1:
return childs
up = peak = down = 0
total_candies = 1
for child in range(1, childs):
if child_ratings[child] > child_ratings[child - 1]:
up += 1
down = 0
... | Candy | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Candy:
def get_all_candies(self, child_ratings: List[int]) -> int:
"""Approach: Single Pass with Constant Space Time Complexity: O(N) Space Complexity: O(1) :param child_ratings: :return:"""
<|body_0|>
def get_all_candies__(self, child_ratings: List[int]) -> int:
"""... | stack_v2_sparse_classes_36k_train_014027 | 3,858 | no_license | [
{
"docstring": "Approach: Single Pass with Constant Space Time Complexity: O(N) Space Complexity: O(1) :param child_ratings: :return:",
"name": "get_all_candies",
"signature": "def get_all_candies(self, child_ratings: List[int]) -> int"
},
{
"docstring": "Approach: Using one array Time Complexit... | 4 | null | Implement the Python class `Candy` described below.
Class description:
Implement the Candy class.
Method signatures and docstrings:
- def get_all_candies(self, child_ratings: List[int]) -> int: Approach: Single Pass with Constant Space Time Complexity: O(N) Space Complexity: O(1) :param child_ratings: :return:
- def ... | Implement the Python class `Candy` described below.
Class description:
Implement the Candy class.
Method signatures and docstrings:
- def get_all_candies(self, child_ratings: List[int]) -> int: Approach: Single Pass with Constant Space Time Complexity: O(N) Space Complexity: O(1) :param child_ratings: :return:
- def ... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Candy:
def get_all_candies(self, child_ratings: List[int]) -> int:
"""Approach: Single Pass with Constant Space Time Complexity: O(N) Space Complexity: O(1) :param child_ratings: :return:"""
<|body_0|>
def get_all_candies__(self, child_ratings: List[int]) -> int:
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Candy:
def get_all_candies(self, child_ratings: List[int]) -> int:
"""Approach: Single Pass with Constant Space Time Complexity: O(N) Space Complexity: O(1) :param child_ratings: :return:"""
childs = len(child_ratings)
if childs <= 1:
return childs
up = peak = down ... | the_stack_v2_python_sparse | revisited/math_and_strings/math/candies.py | Shiv2157k/leet_code | train | 1 | |
4079728bc564e1f7068106050a7bd1ebf53a1fcc | [
"kwargs = {'bonded': bonded, 'indices': indices}\ntry:\n constraint = self._constraint_types_freeze[constraint_type.lower()](**kwargs)\n if constraint not in self.freeze:\n self.freeze.append(constraint)\nexcept KeyError:\n raise ConstraintError(f'The constraint type {constraint_type} is not support... | <|body_start_0|>
kwargs = {'bonded': bonded, 'indices': indices}
try:
constraint = self._constraint_types_freeze[constraint_type.lower()](**kwargs)
if constraint not in self.freeze:
self.freeze.append(constraint)
except KeyError:
raise Constrai... | A constraints holder which validates the constraints type and data structure however the indices are not checked for connection as this is not required. | Constraints | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Constraints:
"""A constraints holder which validates the constraints type and data structure however the indices are not checked for connection as this is not required."""
def add_freeze_constraint(self, constraint_type: ConstraintType, indices: List[int], bonded: bool=True) -> None:
... | stack_v2_sparse_classes_36k_train_014028 | 8,547 | permissive | [
{
"docstring": "Add a new freeze constraint to the constraint holder after validating it and making sure it is not already present. Parameters: constraint_type: The type of frozen constraint to be generated indices: The indices of the atoms which will be constrained bonded: If the atoms in the constraint are bo... | 5 | stack_v2_sparse_classes_30k_train_020145 | Implement the Python class `Constraints` described below.
Class description:
A constraints holder which validates the constraints type and data structure however the indices are not checked for connection as this is not required.
Method signatures and docstrings:
- def add_freeze_constraint(self, constraint_type: Con... | Implement the Python class `Constraints` described below.
Class description:
A constraints holder which validates the constraints type and data structure however the indices are not checked for connection as this is not required.
Method signatures and docstrings:
- def add_freeze_constraint(self, constraint_type: Con... | 48943d8e7a5b6947001d29a9c629a65c4133dbd6 | <|skeleton|>
class Constraints:
"""A constraints holder which validates the constraints type and data structure however the indices are not checked for connection as this is not required."""
def add_freeze_constraint(self, constraint_type: ConstraintType, indices: List[int], bonded: bool=True) -> None:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Constraints:
"""A constraints holder which validates the constraints type and data structure however the indices are not checked for connection as this is not required."""
def add_freeze_constraint(self, constraint_type: ConstraintType, indices: List[int], bonded: bool=True) -> None:
"""Add a new... | the_stack_v2_python_sparse | openff/qcsubmit/constraints.py | openforcefield/openff-qcsubmit | train | 15 |
d5bd89fef6f90d9bbb5c94e25598ff57681454db | [
"self._LR_SCHEDULE_MAP = {'ExponentialDecay': tf.keras.optimizers.schedules.ExponentialDecay, 'PiecewiseConstantDecay': tf.keras.optimizers.schedules.PiecewiseConstantDecay, 'PolynomialDecay': tf.keras.optimizers.schedules.PolynomialDecay}\nself._OPTIMIZER_MAP = {'Adam': tf.keras.optimizers.Adam, 'RMSprop': tf.kera... | <|body_start_0|>
self._LR_SCHEDULE_MAP = {'ExponentialDecay': tf.keras.optimizers.schedules.ExponentialDecay, 'PiecewiseConstantDecay': tf.keras.optimizers.schedules.PiecewiseConstantDecay, 'PolynomialDecay': tf.keras.optimizers.schedules.PolynomialDecay}
self._OPTIMIZER_MAP = {'Adam': tf.keras.optimize... | ModelTrainer | [
"LicenseRef-scancode-unicode"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelTrainer:
def __init__(self, config_path='configs/sample_config.ini'):
"""Read and set configuration from config file (.ini file) and create keras.Model object or input function according to configuration. To add new model, simply add new base model to self._MODEL_MAP. Args: config_p... | stack_v2_sparse_classes_36k_train_014029 | 9,317 | permissive | [
{
"docstring": "Read and set configuration from config file (.ini file) and create keras.Model object or input function according to configuration. To add new model, simply add new base model to self._MODEL_MAP. Args: config_path: Str, path to config (.ini) file. Raises: ValueError: if values in config file doe... | 4 | stack_v2_sparse_classes_30k_train_011446 | Implement the Python class `ModelTrainer` described below.
Class description:
Implement the ModelTrainer class.
Method signatures and docstrings:
- def __init__(self, config_path='configs/sample_config.ini'): Read and set configuration from config file (.ini file) and create keras.Model object or input function accor... | Implement the Python class `ModelTrainer` described below.
Class description:
Implement the ModelTrainer class.
Method signatures and docstrings:
- def __init__(self, config_path='configs/sample_config.ini'): Read and set configuration from config file (.ini file) and create keras.Model object or input function accor... | 2b78bf2c37fb474162573c73b67411a84f235b2b | <|skeleton|>
class ModelTrainer:
def __init__(self, config_path='configs/sample_config.ini'):
"""Read and set configuration from config file (.ini file) and create keras.Model object or input function according to configuration. To add new model, simply add new base model to self._MODEL_MAP. Args: config_p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelTrainer:
def __init__(self, config_path='configs/sample_config.ini'):
"""Read and set configuration from config file (.ini file) and create keras.Model object or input function according to configuration. To add new model, simply add new base model to self._MODEL_MAP. Args: config_path: Str, path... | the_stack_v2_python_sparse | custom_train.py | airbagy/ml-confusables-generator | train | 1 | |
00ff5f8f672c81e1eac1ca9fd13a8116810fe8df | [
"isLeaf = self.isQuadTree(grid)\nl = len(grid)\nif isLeaf is None:\n mid = l // 2\n topLeftGrid = [[grid[i][j] for j in range(mid)] for i in range(mid)]\n topRightGrid = [[grid[i][j] for j in range(mid, l)] for i in range(mid)]\n bottomLeftGrid = [[grid[i][j] for j in range(mid)] for i in range(mid, l)]... | <|body_start_0|>
isLeaf = self.isQuadTree(grid)
l = len(grid)
if isLeaf is None:
mid = l // 2
topLeftGrid = [[grid[i][j] for j in range(mid)] for i in range(mid)]
topRightGrid = [[grid[i][j] for j in range(mid, l)] for i in range(mid)]
bottomLeftGr... | Solution | [
"ICU"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def construct(self, grid):
""":type grid: List[List[int]] :rtype: Node"""
<|body_0|>
def isQuadTree(self, grid):
""":type grid: List[List[int]] :return: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
isLeaf = self.isQuadTree(grid)
... | stack_v2_sparse_classes_36k_train_014030 | 3,193 | permissive | [
{
"docstring": ":type grid: List[List[int]] :rtype: Node",
"name": "construct",
"signature": "def construct(self, grid)"
},
{
"docstring": ":type grid: List[List[int]] :return: bool",
"name": "isQuadTree",
"signature": "def isQuadTree(self, grid)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def construct(self, grid): :type grid: List[List[int]] :rtype: Node
- def isQuadTree(self, grid): :type grid: List[List[int]] :return: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def construct(self, grid): :type grid: List[List[int]] :rtype: Node
- def isQuadTree(self, grid): :type grid: List[List[int]] :return: bool
<|skeleton|>
class Solution:
def... | 304d91d793b2dc6e8ce1c91abea16cd5a1c8fe76 | <|skeleton|>
class Solution:
def construct(self, grid):
""":type grid: List[List[int]] :rtype: Node"""
<|body_0|>
def isQuadTree(self, grid):
""":type grid: List[List[int]] :return: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def construct(self, grid):
""":type grid: List[List[int]] :rtype: Node"""
isLeaf = self.isQuadTree(grid)
l = len(grid)
if isLeaf is None:
mid = l // 2
topLeftGrid = [[grid[i][j] for j in range(mid)] for i in range(mid)]
topRightGrid... | the_stack_v2_python_sparse | 427. Construct Quad Tree/Construct Quad Tree/main.py | boaass/Leetcode | train | 0 | |
a47378bd614c68377d1f907b6e3434019a46c430 | [
"movieElement = self.getMovieElement()\nif not movieElement:\n return None\ntry:\n returnString = movieElement.CallFunction('<invoke name=\"%s\" returntype=\"javascript\">%s</invoke>' % (functionName, self.flashArgumentsToXML(arguments, 0)))\n returnValue = ''\n if returnString:\n if returnString... | <|body_start_0|>
movieElement = self.getMovieElement()
if not movieElement:
return None
try:
returnString = movieElement.CallFunction('<invoke name="%s" returntype="javascript">%s</invoke>' % (functionName, self.flashArgumentsToXML(arguments, 0)))
returnValue ... | FlashPanel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FlashPanel:
def callFlash(self, functionName, arguments=[]):
"""@param functionName: Methodname of ExternalInterface @param arguments: List with arguments of ExternalInterfaces method @return: return value of ExternalInterfaces method"""
<|body_0|>
def toJS(self, list_or_dic... | stack_v2_sparse_classes_36k_train_014031 | 1,956 | permissive | [
{
"docstring": "@param functionName: Methodname of ExternalInterface @param arguments: List with arguments of ExternalInterfaces method @return: return value of ExternalInterfaces method",
"name": "callFlash",
"signature": "def callFlash(self, functionName, arguments=[])"
},
{
"docstring": "@par... | 2 | null | Implement the Python class `FlashPanel` described below.
Class description:
Implement the FlashPanel class.
Method signatures and docstrings:
- def callFlash(self, functionName, arguments=[]): @param functionName: Methodname of ExternalInterface @param arguments: List with arguments of ExternalInterfaces method @retu... | Implement the Python class `FlashPanel` described below.
Class description:
Implement the FlashPanel class.
Method signatures and docstrings:
- def callFlash(self, functionName, arguments=[]): @param functionName: Methodname of ExternalInterface @param arguments: List with arguments of ExternalInterfaces method @retu... | 68baba6f3f5f64ef0b269981dc5a1ef46bf29284 | <|skeleton|>
class FlashPanel:
def callFlash(self, functionName, arguments=[]):
"""@param functionName: Methodname of ExternalInterface @param arguments: List with arguments of ExternalInterfaces method @return: return value of ExternalInterfaces method"""
<|body_0|>
def toJS(self, list_or_dic... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FlashPanel:
def callFlash(self, functionName, arguments=[]):
"""@param functionName: Methodname of ExternalInterface @param arguments: List with arguments of ExternalInterfaces method @return: return value of ExternalInterfaces method"""
movieElement = self.getMovieElement()
if not mov... | the_stack_v2_python_sparse | library/pyjamas/ui/FlashPanel.browser.py | minghuascode/pyj | train | 0 | |
523180d9ca36ae28f02cb325e7ff8bdde9ad6886 | [
"m_file = mock.MagicMock()\nwith mock.patch('sys.version_info', new=(2, 7)), mock.patch('imp.find_module', return_value=(m_file, 'p', 'd')) as m_find_module, mock.patch('imp.load_module', return_value='mod') as m_load_module:\n self.assertEqual(tested._load_module_file('mymod', 'my/path'), 'mod')\n m_find_mod... | <|body_start_0|>
m_file = mock.MagicMock()
with mock.patch('sys.version_info', new=(2, 7)), mock.patch('imp.find_module', return_value=(m_file, 'p', 'd')) as m_find_module, mock.patch('imp.load_module', return_value='mod') as m_load_module:
self.assertEqual(tested._load_module_file('mymod', ... | Test__load_module_file | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test__load_module_file:
def test__load_module_file_py27(self):
"""Test SConsArguments.Importer._load_module_file() with python 2.7"""
<|body_0|>
def test__load_module_file_py33(self):
"""Test SConsArguments.Importer._load_module_file() with python 3.3"""
<|bo... | stack_v2_sparse_classes_36k_train_014032 | 42,804 | permissive | [
{
"docstring": "Test SConsArguments.Importer._load_module_file() with python 2.7",
"name": "test__load_module_file_py27",
"signature": "def test__load_module_file_py27(self)"
},
{
"docstring": "Test SConsArguments.Importer._load_module_file() with python 3.3",
"name": "test__load_module_file... | 3 | stack_v2_sparse_classes_30k_train_005163 | Implement the Python class `Test__load_module_file` described below.
Class description:
Implement the Test__load_module_file class.
Method signatures and docstrings:
- def test__load_module_file_py27(self): Test SConsArguments.Importer._load_module_file() with python 2.7
- def test__load_module_file_py33(self): Test ... | Implement the Python class `Test__load_module_file` described below.
Class description:
Implement the Test__load_module_file class.
Method signatures and docstrings:
- def test__load_module_file_py27(self): Test SConsArguments.Importer._load_module_file() with python 2.7
- def test__load_module_file_py33(self): Test ... | f4b783fc79fe3fc16e8d0f58308099a67752d299 | <|skeleton|>
class Test__load_module_file:
def test__load_module_file_py27(self):
"""Test SConsArguments.Importer._load_module_file() with python 2.7"""
<|body_0|>
def test__load_module_file_py33(self):
"""Test SConsArguments.Importer._load_module_file() with python 3.3"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test__load_module_file:
def test__load_module_file_py27(self):
"""Test SConsArguments.Importer._load_module_file() with python 2.7"""
m_file = mock.MagicMock()
with mock.patch('sys.version_info', new=(2, 7)), mock.patch('imp.find_module', return_value=(m_file, 'p', 'd')) as m_find_modu... | the_stack_v2_python_sparse | unit_tests/SConsArgumentsT/ImporterTests.py | mcqueen256/scons-arguments | train | 0 | |
f13edf90f98059f2b9c9eeb2b1526529e49f28d2 | [
"if data is None:\n if lambtha <= 0:\n raise ValueError('lambtha must be a positive value')\n else:\n self.lambtha = float(lambtha)\nelif not isinstance(data, list):\n raise TypeError('data must be a list')\nelse:\n num_of_elements = len(data)\n if num_of_elements < 2:\n raise Va... | <|body_start_0|>
if data is None:
if lambtha <= 0:
raise ValueError('lambtha must be a positive value')
else:
self.lambtha = float(lambtha)
elif not isinstance(data, list):
raise TypeError('data must be a list')
else:
... | Class Exponential that represents an Exponential Distribution. | Exponential | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Exponential:
"""Class Exponential that represents an Exponential Distribution."""
def __init__(self, data=None, lambtha=1.0):
"""Initializes a Exponential Distribution. Keyword Arguments: data (List): a list of the data to be used to estimate the distribution (default: {None}) lambth... | stack_v2_sparse_classes_36k_train_014033 | 2,168 | no_license | [
{
"docstring": "Initializes a Exponential Distribution. Keyword Arguments: data (List): a list of the data to be used to estimate the distribution (default: {None}) lambtha (Float): the expected number of occurrences in a given time frame (default: {1.}) Raises: ValueError: If data isn't given and lambtha isn't... | 3 | stack_v2_sparse_classes_30k_train_003830 | Implement the Python class `Exponential` described below.
Class description:
Class Exponential that represents an Exponential Distribution.
Method signatures and docstrings:
- def __init__(self, data=None, lambtha=1.0): Initializes a Exponential Distribution. Keyword Arguments: data (List): a list of the data to be u... | Implement the Python class `Exponential` described below.
Class description:
Class Exponential that represents an Exponential Distribution.
Method signatures and docstrings:
- def __init__(self, data=None, lambtha=1.0): Initializes a Exponential Distribution. Keyword Arguments: data (List): a list of the data to be u... | 554a13606af58cd506404e80d83a09454bb49aeb | <|skeleton|>
class Exponential:
"""Class Exponential that represents an Exponential Distribution."""
def __init__(self, data=None, lambtha=1.0):
"""Initializes a Exponential Distribution. Keyword Arguments: data (List): a list of the data to be used to estimate the distribution (default: {None}) lambth... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Exponential:
"""Class Exponential that represents an Exponential Distribution."""
def __init__(self, data=None, lambtha=1.0):
"""Initializes a Exponential Distribution. Keyword Arguments: data (List): a list of the data to be used to estimate the distribution (default: {None}) lambtha (Float): th... | the_stack_v2_python_sparse | math/0x03-probability/exponential.py | thenickforero/holbertonschool-machine_learning | train | 0 |
cb3f4d1f0be29bfc98199dacb9a7fa84db6ff84e | [
"output = ''\nfor s in strs:\n output += str(len(s)) + ' ' + s\nreturn output",
"output = []\ni = 0\nnum = ''\nwhile i < len(s):\n while s[i] != ' ':\n num += s[i]\n i += 1\n if int(num) == 0:\n output.append('')\n else:\n output.append(s[i + 1:i + 1 + int(num)])\n i += ... | <|body_start_0|>
output = ''
for s in strs:
output += str(len(s)) + ' ' + s
return output
<|end_body_0|>
<|body_start_1|>
output = []
i = 0
num = ''
while i < len(s):
while s[i] != ' ':
num += s[i]
i += 1
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def encode(self, strs: [str]) -> str:
"""Encodes a list of strings to a single string."""
<|body_0|>
def decode(self, s: str) -> [str]:
"""Decodes a single string to a list of strings."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
output = ... | stack_v2_sparse_classes_36k_train_014034 | 1,037 | no_license | [
{
"docstring": "Encodes a list of strings to a single string.",
"name": "encode",
"signature": "def encode(self, strs: [str]) -> str"
},
{
"docstring": "Decodes a single string to a list of strings.",
"name": "decode",
"signature": "def decode(self, s: str) -> [str]"
}
] | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string.
- def decode(self, s: str) -> [str]: Decodes a single string to a list of strings. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string.
- def decode(self, s: str) -> [str]: Decodes a single string to a list of strings.
<|skeleton|>
cla... | 4668b64fcb9320b6c316d8608fc61911ce43b6c7 | <|skeleton|>
class Codec:
def encode(self, strs: [str]) -> str:
"""Encodes a list of strings to a single string."""
<|body_0|>
def decode(self, s: str) -> [str]:
"""Decodes a single string to a list of strings."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def encode(self, strs: [str]) -> str:
"""Encodes a list of strings to a single string."""
output = ''
for s in strs:
output += str(len(s)) + ' ' + s
return output
def decode(self, s: str) -> [str]:
"""Decodes a single string to a list of strings.... | the_stack_v2_python_sparse | 0001_0599/271.py | renjieliu/leetcode | train | 7 | |
2b05fe21a8eb918f6ca76feb0a2101b9f060606a | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('emmaliu_gaotian_xli33_yuyangl', 'emmaliu_gaotian_xli33_yuyangl')\ntweetsData = repo.emmaliu_gaotian_xli33_yuyangl.tweets_translated.find()\nsentences = []\ncompoundScore = []\nsentiment = []\nanalyzer = ... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('emmaliu_gaotian_xli33_yuyangl', 'emmaliu_gaotian_xli33_yuyangl')
tweetsData = repo.emmaliu_gaotian_xli33_yuyangl.tweets_translated.find()
sentence... | sentimentAnalysis | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class sentimentAnalysis:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everyt... | stack_v2_sparse_classes_36k_train_014035 | 4,128 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | null | Implement the Python class `sentimentAnalysis` described below.
Class description:
Implement the sentimentAnalysis class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime... | Implement the Python class `sentimentAnalysis` described below.
Class description:
Implement the sentimentAnalysis class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime... | 90284cf3debbac36eead07b8d2339cdd191b86cf | <|skeleton|>
class sentimentAnalysis:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everyt... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class sentimentAnalysis:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('emmaliu_gaotian_xli33_yuyangl', '... | the_stack_v2_python_sparse | emmaliu_gaotian_xli33_yuyangl/sentimentAnalysis.py | maximega/course-2019-spr-proj | train | 2 | |
16102a96f87d6517391c1d964afa85a0ff13288b | [
"if id is not None:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = self.__nb_objects",
"if list_dictionaries and len(list_dictionaries) is not 0:\n return json.dumps(list_dictionaries)\nelse:\n return '[]'",
"list_of_dicts = []\nfile_name = '{}.json'.format(cls.__name__)\nwith open(fi... | <|body_start_0|>
if id is not None:
self.id = id
else:
Base.__nb_objects += 1
self.id = self.__nb_objects
<|end_body_0|>
<|body_start_1|>
if list_dictionaries and len(list_dictionaries) is not 0:
return json.dumps(list_dictionaries)
else:
... | Class Base: Ancesteral Object nb: number of objects | Base | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Base:
"""Class Base: Ancesteral Object nb: number of objects"""
def __init__(self, id=None):
"""initiates the class attributes --- self: object id: of object"""
<|body_0|>
def to_json_string(list_dictionaries):
"""takes a list of dictionaries and translates it to... | stack_v2_sparse_classes_36k_train_014036 | 2,811 | no_license | [
{
"docstring": "initiates the class attributes --- self: object id: of object",
"name": "__init__",
"signature": "def __init__(self, id=None)"
},
{
"docstring": "takes a list of dictionaries and translates it to a string that is in json --- list_dictionaries: list of dicts",
"name": "to_json... | 6 | stack_v2_sparse_classes_30k_train_014299 | Implement the Python class `Base` described below.
Class description:
Class Base: Ancesteral Object nb: number of objects
Method signatures and docstrings:
- def __init__(self, id=None): initiates the class attributes --- self: object id: of object
- def to_json_string(list_dictionaries): takes a list of dictionaries... | Implement the Python class `Base` described below.
Class description:
Class Base: Ancesteral Object nb: number of objects
Method signatures and docstrings:
- def __init__(self, id=None): initiates the class attributes --- self: object id: of object
- def to_json_string(list_dictionaries): takes a list of dictionaries... | 7d3de4bbd477f4a3b8cc05ade621ffc6da37dd1a | <|skeleton|>
class Base:
"""Class Base: Ancesteral Object nb: number of objects"""
def __init__(self, id=None):
"""initiates the class attributes --- self: object id: of object"""
<|body_0|>
def to_json_string(list_dictionaries):
"""takes a list of dictionaries and translates it to... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Base:
"""Class Base: Ancesteral Object nb: number of objects"""
def __init__(self, id=None):
"""initiates the class attributes --- self: object id: of object"""
if id is not None:
self.id = id
else:
Base.__nb_objects += 1
self.id = self.__nb_obj... | the_stack_v2_python_sparse | 0x0C-python-almost_a_circle/models/base.py | aydentownsley/holbertonschool-higher_level_programming | train | 0 |
06b481fd33d30ec0a1bb4847c2e20766d8cb203b | [
"params = {'action': 'process', 'json': 'true', 'page_size': PAGE_SIZE, 'page': page_number, 'fields': FIELDS_OF_PRODUCT, 'sort_by': 'unique_scans_n'}\nheaders = {'User-Agent': 'NameOfYourApp - Android - Version 1.0 - www.yourappwebsite.com'}\ntry:\n result = requests.get(API_BASE_URL, headers=headers, params=pa... | <|body_start_0|>
params = {'action': 'process', 'json': 'true', 'page_size': PAGE_SIZE, 'page': page_number, 'fields': FIELDS_OF_PRODUCT, 'sort_by': 'unique_scans_n'}
headers = {'User-Agent': 'NameOfYourApp - Android - Version 1.0 - www.yourappwebsite.com'}
try:
result = requests.get... | OffApi class To manage Open Food Facts API data recovery | OffApi | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OffApi:
"""OffApi class To manage Open Food Facts API data recovery"""
def get_api_products(self, page_number):
"""We retrieve the raw data (products) from the api :return: json data :rtype: list()"""
<|body_0|>
def get_full_api_products(self):
"""We recover as m... | stack_v2_sparse_classes_36k_train_014037 | 2,431 | no_license | [
{
"docstring": "We retrieve the raw data (products) from the api :return: json data :rtype: list()",
"name": "get_api_products",
"signature": "def get_api_products(self, page_number)"
},
{
"docstring": "We recover as many pages of raw data as defined in the application configuration (see food/se... | 2 | stack_v2_sparse_classes_30k_train_006653 | Implement the Python class `OffApi` described below.
Class description:
OffApi class To manage Open Food Facts API data recovery
Method signatures and docstrings:
- def get_api_products(self, page_number): We retrieve the raw data (products) from the api :return: json data :rtype: list()
- def get_full_api_products(s... | Implement the Python class `OffApi` described below.
Class description:
OffApi class To manage Open Food Facts API data recovery
Method signatures and docstrings:
- def get_api_products(self, page_number): We retrieve the raw data (products) from the api :return: json data :rtype: list()
- def get_full_api_products(s... | f623b0cbdb929710dca1331faa37f5148bb91fa1 | <|skeleton|>
class OffApi:
"""OffApi class To manage Open Food Facts API data recovery"""
def get_api_products(self, page_number):
"""We retrieve the raw data (products) from the api :return: json data :rtype: list()"""
<|body_0|>
def get_full_api_products(self):
"""We recover as m... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OffApi:
"""OffApi class To manage Open Food Facts API data recovery"""
def get_api_products(self, page_number):
"""We retrieve the raw data (products) from the api :return: json data :rtype: list()"""
params = {'action': 'process', 'json': 'true', 'page_size': PAGE_SIZE, 'page': page_numb... | the_stack_v2_python_sparse | food/off_api.py | Githb-usr/purbeurre-improvement | train | 0 |
199689dc56fd6fd4410d7620620842f97fb43cf0 | [
"if not num_feat_per_dim > 1:\n raise pyrado.ValueErr(given=num_feat_per_dim, g_constraint='1')\nif not len(bounds) == 2:\n raise pyrado.ShapeErr(given=bounds, expected_match=np.empty(2))\nbounds_to = [None, None]\nfor i, b in enumerate(bounds):\n if isinstance(b, np.ndarray):\n bounds_to[i] = to.fr... | <|body_start_0|>
if not num_feat_per_dim > 1:
raise pyrado.ValueErr(given=num_feat_per_dim, g_constraint='1')
if not len(bounds) == 2:
raise pyrado.ShapeErr(given=bounds, expected_match=np.empty(2))
bounds_to = [None, None]
for i, b in enumerate(bounds):
... | Normalized Gaussian radial basis function features | RBFFeat | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RBFFeat:
"""Normalized Gaussian radial basis function features"""
def __init__(self, num_feat_per_dim: int, bounds: [Sequence[np.ndarray], Sequence[to.Tensor], Sequence[float]], scale: float=None, state_wise_norm: bool=True):
"""Constructor :param num_feat_per_dim: number of radial b... | stack_v2_sparse_classes_36k_train_014038 | 13,729 | permissive | [
{
"docstring": "Constructor :param num_feat_per_dim: number of radial basis functions, identical for every dimension of the input :param bounds: lower and upper bound for the Gaussians' centers, the input dimension is inferred from them :param scale: scaling factor for the squared distance, if `None` the factor... | 3 | null | Implement the Python class `RBFFeat` described below.
Class description:
Normalized Gaussian radial basis function features
Method signatures and docstrings:
- def __init__(self, num_feat_per_dim: int, bounds: [Sequence[np.ndarray], Sequence[to.Tensor], Sequence[float]], scale: float=None, state_wise_norm: bool=True)... | Implement the Python class `RBFFeat` described below.
Class description:
Normalized Gaussian radial basis function features
Method signatures and docstrings:
- def __init__(self, num_feat_per_dim: int, bounds: [Sequence[np.ndarray], Sequence[to.Tensor], Sequence[float]], scale: float=None, state_wise_norm: bool=True)... | a6c982862e2ab39a9f65d1c09aa59d9a8b7ac6c5 | <|skeleton|>
class RBFFeat:
"""Normalized Gaussian radial basis function features"""
def __init__(self, num_feat_per_dim: int, bounds: [Sequence[np.ndarray], Sequence[to.Tensor], Sequence[float]], scale: float=None, state_wise_norm: bool=True):
"""Constructor :param num_feat_per_dim: number of radial b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RBFFeat:
"""Normalized Gaussian radial basis function features"""
def __init__(self, num_feat_per_dim: int, bounds: [Sequence[np.ndarray], Sequence[to.Tensor], Sequence[float]], scale: float=None, state_wise_norm: bool=True):
"""Constructor :param num_feat_per_dim: number of radial basis function... | the_stack_v2_python_sparse | Pyrado/pyrado/policies/features.py | jacarvalho/SimuRLacra | train | 0 |
6fb26e357fe873040df4128205744e415796c2b1 | [
"results = self._convert_json_results_to_result_objects(results)\naggregated_results = defaultdict(lambda: defaultdict(list))\nfor r in results:\n build_url = 'http://ci.chromium.org/b/%s' % r.build_id\n aggregated_results[r.test][r.typ_tags].append(dt.ImageDiffTagTupleType(r.image_diff_tag[0], r.image_diff_t... | <|body_start_0|>
results = self._convert_json_results_to_result_objects(results)
aggregated_results = defaultdict(lambda: defaultdict(list))
for r in results:
build_url = 'http://ci.chromium.org/b/%s' % r.build_id
aggregated_results[r.test][r.typ_tags].append(dt.ImageDiff... | ResultProcessor | [
"GPL-1.0-or-later",
"MIT",
"LGPL-2.0-or-later",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResultProcessor:
def aggregate_results(self, results: ct.QueryJsonType) -> dt.AggregatedResultsType:
"""Aggregates BigQuery results for all image comparison tests. Args: results: Parsed JSON test results from a BigQuery query. Returns: A map in the following format: { 'test_name': { 'typ... | stack_v2_sparse_classes_36k_train_014039 | 2,220 | permissive | [
{
"docstring": "Aggregates BigQuery results for all image comparison tests. Args: results: Parsed JSON test results from a BigQuery query. Returns: A map in the following format: { 'test_name': { 'typ_tags_as_tuple': [ (0, 200, 'url_1'), (3, 400, 'url_2'),], }, }",
"name": "aggregate_results",
"signatur... | 2 | stack_v2_sparse_classes_30k_train_010384 | Implement the Python class `ResultProcessor` described below.
Class description:
Implement the ResultProcessor class.
Method signatures and docstrings:
- def aggregate_results(self, results: ct.QueryJsonType) -> dt.AggregatedResultsType: Aggregates BigQuery results for all image comparison tests. Args: results: Parse... | Implement the Python class `ResultProcessor` described below.
Class description:
Implement the ResultProcessor class.
Method signatures and docstrings:
- def aggregate_results(self, results: ct.QueryJsonType) -> dt.AggregatedResultsType: Aggregates BigQuery results for all image comparison tests. Args: results: Parse... | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | <|skeleton|>
class ResultProcessor:
def aggregate_results(self, results: ct.QueryJsonType) -> dt.AggregatedResultsType:
"""Aggregates BigQuery results for all image comparison tests. Args: results: Parsed JSON test results from a BigQuery query. Returns: A map in the following format: { 'test_name': { 'typ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResultProcessor:
def aggregate_results(self, results: ct.QueryJsonType) -> dt.AggregatedResultsType:
"""Aggregates BigQuery results for all image comparison tests. Args: results: Parsed JSON test results from a BigQuery query. Returns: A map in the following format: { 'test_name': { 'typ_tags_as_tuple... | the_stack_v2_python_sparse | third_party/blink/tools/blinkpy/web_tests/fuzzy_diff_analyzer/results.py | chromium/chromium | train | 17,408 | |
71b1c35f975605741dce944f7b662ab9660fa935 | [
"super(EmailBackend, self).__init__(**kwargs)\nself.api_key = api_key if api_key is not None else getattr(settings, 'POSTMARK_API_KEY', None)\nif self.api_key is None:\n raise ImproperlyConfigured('POSTMARK API key must be set in Django settings file or passed to backend constructor.')\nself.default_sender = get... | <|body_start_0|>
super(EmailBackend, self).__init__(**kwargs)
self.api_key = api_key if api_key is not None else getattr(settings, 'POSTMARK_API_KEY', None)
if self.api_key is None:
raise ImproperlyConfigured('POSTMARK API key must be set in Django settings file or passed to backend ... | EmailBackend | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmailBackend:
def __init__(self, api_key=None, default_sender=None, **kwargs):
"""Initialize the backend."""
<|body_0|>
def send_messages(self, email_messages):
"""Sends one or more EmailMessage objects and returns the number of email messages sent."""
<|body... | stack_v2_sparse_classes_36k_train_014040 | 39,873 | no_license | [
{
"docstring": "Initialize the backend.",
"name": "__init__",
"signature": "def __init__(self, api_key=None, default_sender=None, **kwargs)"
},
{
"docstring": "Sends one or more EmailMessage objects and returns the number of email messages sent.",
"name": "send_messages",
"signature": "d... | 4 | stack_v2_sparse_classes_30k_train_002755 | Implement the Python class `EmailBackend` described below.
Class description:
Implement the EmailBackend class.
Method signatures and docstrings:
- def __init__(self, api_key=None, default_sender=None, **kwargs): Initialize the backend.
- def send_messages(self, email_messages): Sends one or more EmailMessage objects... | Implement the Python class `EmailBackend` described below.
Class description:
Implement the EmailBackend class.
Method signatures and docstrings:
- def __init__(self, api_key=None, default_sender=None, **kwargs): Initialize the backend.
- def send_messages(self, email_messages): Sends one or more EmailMessage objects... | 0ac6653219c2701c13c508c5c4fc9bc3437eea06 | <|skeleton|>
class EmailBackend:
def __init__(self, api_key=None, default_sender=None, **kwargs):
"""Initialize the backend."""
<|body_0|>
def send_messages(self, email_messages):
"""Sends one or more EmailMessage objects and returns the number of email messages sent."""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EmailBackend:
def __init__(self, api_key=None, default_sender=None, **kwargs):
"""Initialize the backend."""
super(EmailBackend, self).__init__(**kwargs)
self.api_key = api_key if api_key is not None else getattr(settings, 'POSTMARK_API_KEY', None)
if self.api_key is None:
... | the_stack_v2_python_sparse | repoData/themartorana-python-postmark/allPythonContent.py | aCoffeeYin/pyreco | train | 0 | |
1fe5f6896d624d2925ff2c7ed4184cd5b3339c6c | [
"logs.log_info('You are using the vgNa channel type: Nav1.2')\nself.time_unit = 1000.0\nself.vrev = 50\nmAlpha = 0.182 * (V - 10.0 - -35.0) / (1 - np.exp(-(V - 10.0 - -35.0) / 9))\nmBeta = 0.124 * (-(V - 10.0) - 35.0) / (1 - np.exp(-(-(V - 10.0) - 35.0) / 9))\nself.m = mAlpha / (mAlpha + mBeta)\nself.h = 1.0 / (1 +... | <|body_start_0|>
logs.log_info('You are using the vgNa channel type: Nav1.2')
self.time_unit = 1000.0
self.vrev = 50
mAlpha = 0.182 * (V - 10.0 - -35.0) / (1 - np.exp(-(V - 10.0 - -35.0) / 9))
mBeta = 0.124 * (-(V - 10.0) - 35.0) / (1 - np.exp(-(-(V - 10.0) - 35.0) / 9))
... | NaV model from Hammil et al 1991, derived from rat neocortical neurons. This channel produces well behaved action-potentials with a variety of vgK channels. Good general-purpose vgNa channel. Reference: Hammil, OP et al. Patch-clamp studies of voltage-gated currents in identified neurons of the rat cerebral cortex. Cer... | Nav1p2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Nav1p2:
"""NaV model from Hammil et al 1991, derived from rat neocortical neurons. This channel produces well behaved action-potentials with a variety of vgK channels. Good general-purpose vgNa channel. Reference: Hammil, OP et al. Patch-clamp studies of voltage-gated currents in identified neuro... | stack_v2_sparse_classes_36k_train_014041 | 15,691 | no_license | [
{
"docstring": "Run initialization calculation for m and h gates of the channel at starting Vmem value.",
"name": "_init_state",
"signature": "def _init_state(self, V)"
},
{
"docstring": "Update the state of m and h gates of the channel given their present value and present simulation Vmem.",
... | 2 | null | Implement the Python class `Nav1p2` described below.
Class description:
NaV model from Hammil et al 1991, derived from rat neocortical neurons. This channel produces well behaved action-potentials with a variety of vgK channels. Good general-purpose vgNa channel. Reference: Hammil, OP et al. Patch-clamp studies of vol... | Implement the Python class `Nav1p2` described below.
Class description:
NaV model from Hammil et al 1991, derived from rat neocortical neurons. This channel produces well behaved action-potentials with a variety of vgK channels. Good general-purpose vgNa channel. Reference: Hammil, OP et al. Patch-clamp studies of vol... | dd03ff5e3df3ef48d887a6566a6286fcd168880b | <|skeleton|>
class Nav1p2:
"""NaV model from Hammil et al 1991, derived from rat neocortical neurons. This channel produces well behaved action-potentials with a variety of vgK channels. Good general-purpose vgNa channel. Reference: Hammil, OP et al. Patch-clamp studies of voltage-gated currents in identified neuro... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Nav1p2:
"""NaV model from Hammil et al 1991, derived from rat neocortical neurons. This channel produces well behaved action-potentials with a variety of vgK channels. Good general-purpose vgNa channel. Reference: Hammil, OP et al. Patch-clamp studies of voltage-gated currents in identified neurons of the rat... | the_stack_v2_python_sparse | betse/science/channels/vg_na.py | R-Stefano/betse-ml | train | 0 |
6a17df71ec7b64b35de3af7ba38ff0d3b9c5ab9b | [
"arr = np.asarray(self._getfunc())\narr = arr.reshape((1,) + arr.shape)\nself.db._arrays[chain, self.name].append(arr)",
"if chain is None:\n chain = -1\nchain = self.db.chains[chain]\narr = self.db._arrays[chain, self.name]\nif slicing is not None:\n burn, stop, thin = (slicing.start, slicing.stop, slicing... | <|body_start_0|>
arr = np.asarray(self._getfunc())
arr = arr.reshape((1,) + arr.shape)
self.db._arrays[chain, self.name].append(arr)
<|end_body_0|>
<|body_start_1|>
if chain is None:
chain = -1
chain = self.db.chains[chain]
arr = self.db._arrays[chain, self.n... | HDF5 trace. | Trace | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Trace:
"""HDF5 trace."""
def tally(self, chain):
"""Adds current value to trace."""
<|body_0|>
def gettrace(self, burn=0, thin=1, chain=-1, slicing=None):
"""Return the trace (last by default). :Parameters: burn : integer The number of transient steps to skip. th... | stack_v2_sparse_classes_36k_train_014042 | 9,853 | permissive | [
{
"docstring": "Adds current value to trace.",
"name": "tally",
"signature": "def tally(self, chain)"
},
{
"docstring": "Return the trace (last by default). :Parameters: burn : integer The number of transient steps to skip. thin : integer Keep one in thin. chain : integer The index of the chain ... | 2 | stack_v2_sparse_classes_30k_train_011512 | Implement the Python class `Trace` described below.
Class description:
HDF5 trace.
Method signatures and docstrings:
- def tally(self, chain): Adds current value to trace.
- def gettrace(self, burn=0, thin=1, chain=-1, slicing=None): Return the trace (last by default). :Parameters: burn : integer The number of transi... | Implement the Python class `Trace` described below.
Class description:
HDF5 trace.
Method signatures and docstrings:
- def tally(self, chain): Adds current value to trace.
- def gettrace(self, burn=0, thin=1, chain=-1, slicing=None): Return the trace (last by default). :Parameters: burn : integer The number of transi... | 9e5d377d0242ac5eb1e82a357e6701095a8ca1ff | <|skeleton|>
class Trace:
"""HDF5 trace."""
def tally(self, chain):
"""Adds current value to trace."""
<|body_0|>
def gettrace(self, burn=0, thin=1, chain=-1, slicing=None):
"""Return the trace (last by default). :Parameters: burn : integer The number of transient steps to skip. th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Trace:
"""HDF5 trace."""
def tally(self, chain):
"""Adds current value to trace."""
arr = np.asarray(self._getfunc())
arr = arr.reshape((1,) + arr.shape)
self.db._arrays[chain, self.name].append(arr)
def gettrace(self, burn=0, thin=1, chain=-1, slicing=None):
... | the_stack_v2_python_sparse | home--tommy--mypy/mypy/lib/python2.7/site-packages/pymc/database/hdf5ea.py | tommybutler/mlearnpy2 | train | 0 |
5a33546340dfb068cef5289b43b5decb19e22a92 | [
"left = 0\nright = len(height) - 1\nleft_max = right_max = water = 0\nwhile left < right:\n if height[left] <= height[right]:\n if height[left] >= left_max:\n left_max = height[left]\n else:\n water += left_max - height[left]\n left += 1\n else:\n if height[ri... | <|body_start_0|>
left = 0
right = len(height) - 1
left_max = right_max = water = 0
while left < right:
if height[left] <= height[right]:
if height[left] >= left_max:
left_max = height[left]
else:
water +=... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def trap(self, height):
""":type height: List[int] :rtype: int 用两个指针来做"""
<|body_0|>
def trap1(self, height):
"""动态规划, 维护数组dp 对于height中的每一个元素 第一次遍历 dp[i]的值是height[i]左边的最大元素, 第二次遍历, dp[i] 取height[i]中右边最大元素和左边做大元素中较小的 减去height[i]就是当前元素能存的水 对于height[i],最终水平面一定... | stack_v2_sparse_classes_36k_train_014043 | 1,983 | no_license | [
{
"docstring": ":type height: List[int] :rtype: int 用两个指针来做",
"name": "trap",
"signature": "def trap(self, height)"
},
{
"docstring": "动态规划, 维护数组dp 对于height中的每一个元素 第一次遍历 dp[i]的值是height[i]左边的最大元素, 第二次遍历, dp[i] 取height[i]中右边最大元素和左边做大元素中较小的 减去height[i]就是当前元素能存的水 对于height[i],最终水平面一定是左边做大元素和右边最大元素较小的... | 2 | stack_v2_sparse_classes_30k_train_011251 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def trap(self, height): :type height: List[int] :rtype: int 用两个指针来做
- def trap1(self, height): 动态规划, 维护数组dp 对于height中的每一个元素 第一次遍历 dp[i]的值是height[i]左边的最大元素, 第二次遍历, dp[i] 取height[i... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def trap(self, height): :type height: List[int] :rtype: int 用两个指针来做
- def trap1(self, height): 动态规划, 维护数组dp 对于height中的每一个元素 第一次遍历 dp[i]的值是height[i]左边的最大元素, 第二次遍历, dp[i] 取height[i... | 11ad9d3841de09c0b4dc3a667e7e63c3558656a5 | <|skeleton|>
class Solution:
def trap(self, height):
""":type height: List[int] :rtype: int 用两个指针来做"""
<|body_0|>
def trap1(self, height):
"""动态规划, 维护数组dp 对于height中的每一个元素 第一次遍历 dp[i]的值是height[i]左边的最大元素, 第二次遍历, dp[i] 取height[i]中右边最大元素和左边做大元素中较小的 减去height[i]就是当前元素能存的水 对于height[i],最终水平面一定... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def trap(self, height):
""":type height: List[int] :rtype: int 用两个指针来做"""
left = 0
right = len(height) - 1
left_max = right_max = water = 0
while left < right:
if height[left] <= height[right]:
if height[left] >= left_max:
... | the_stack_v2_python_sparse | trapping-rain-water.py | ganlanshu/leetcode | train | 0 | |
f45a11ed061b10b40b7d370933479887b06fd868 | [
"super(CNN_ARC_I, self).__init__()\nself.dictionary = dictionary\nself.embedding_index = embedding_index\nself.config = args\nself.embedding = EmbeddingLayer(len(self.dictionary), self.config)\nself.convolution1 = nn.Conv1d(self.config.emsize, self.config.nfilters, 1)\nself.convolution2 = nn.Conv1d(self.config.emsi... | <|body_start_0|>
super(CNN_ARC_I, self).__init__()
self.dictionary = dictionary
self.embedding_index = embedding_index
self.config = args
self.embedding = EmbeddingLayer(len(self.dictionary), self.config)
self.convolution1 = nn.Conv1d(self.config.emsize, self.config.nfilt... | Implementation of the convolutional matching model (ARC-II). | CNN_ARC_I | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CNN_ARC_I:
"""Implementation of the convolutional matching model (ARC-II)."""
def __init__(self, dictionary, embedding_index, args):
""""Constructor of the class."""
<|body_0|>
def forward(self, batch_queries, batch_docs):
"""Forward function of the match tensor ... | stack_v2_sparse_classes_36k_train_014044 | 3,725 | permissive | [
{
"docstring": "\"Constructor of the class.",
"name": "__init__",
"signature": "def __init__(self, dictionary, embedding_index, args)"
},
{
"docstring": "Forward function of the match tensor model. Return average loss for a batch of sessions. :param batch_queries: 2d tensor [batch_size x max_que... | 2 | stack_v2_sparse_classes_30k_train_000884 | Implement the Python class `CNN_ARC_I` described below.
Class description:
Implementation of the convolutional matching model (ARC-II).
Method signatures and docstrings:
- def __init__(self, dictionary, embedding_index, args): "Constructor of the class.
- def forward(self, batch_queries, batch_docs): Forward function... | Implement the Python class `CNN_ARC_I` described below.
Class description:
Implementation of the convolutional matching model (ARC-II).
Method signatures and docstrings:
- def __init__(self, dictionary, embedding_index, args): "Constructor of the class.
- def forward(self, batch_queries, batch_docs): Forward function... | 5bd241fb49f08fa4937539991e12e5a502d5a072 | <|skeleton|>
class CNN_ARC_I:
"""Implementation of the convolutional matching model (ARC-II)."""
def __init__(self, dictionary, embedding_index, args):
""""Constructor of the class."""
<|body_0|>
def forward(self, batch_queries, batch_docs):
"""Forward function of the match tensor ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CNN_ARC_I:
"""Implementation of the convolutional matching model (ARC-II)."""
def __init__(self, dictionary, embedding_index, args):
""""Constructor of the class."""
super(CNN_ARC_I, self).__init__()
self.dictionary = dictionary
self.embedding_index = embedding_index
... | the_stack_v2_python_sparse | ranking_baselines/ARCI/model.py | polaris79/mnsrf_ranking_suggestion | train | 0 |
5ea9cadb6252c364917095031b5ad575fd5b9728 | [
"data = dj_serializers.serialize('json', obj.children())\njson_data = json.loads(data)\nfor item in json_data:\n item['fields']['content_type'] = obj.content_type.name\nreturn json_data",
"if timesince.timesince(obj.datetime_created) == timesince.timesince(obj.datetime_modified):\n created_value = timesince... | <|body_start_0|>
data = dj_serializers.serialize('json', obj.children())
json_data = json.loads(data)
for item in json_data:
item['fields']['content_type'] = obj.content_type.name
return json_data
<|end_body_0|>
<|body_start_1|>
if timesince.timesince(obj.datetime_cr... | Serializer for Comment model. | CommentSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommentSerializer:
"""Serializer for Comment model."""
def get_children(self, obj):
"""Return `children` serialized objects."""
<|body_0|>
def get_date_to_display(self, obj):
"""Return timesince formatted date."""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_36k_train_014045 | 2,149 | no_license | [
{
"docstring": "Return `children` serialized objects.",
"name": "get_children",
"signature": "def get_children(self, obj)"
},
{
"docstring": "Return timesince formatted date.",
"name": "get_date_to_display",
"signature": "def get_date_to_display(self, obj)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006374 | Implement the Python class `CommentSerializer` described below.
Class description:
Serializer for Comment model.
Method signatures and docstrings:
- def get_children(self, obj): Return `children` serialized objects.
- def get_date_to_display(self, obj): Return timesince formatted date. | Implement the Python class `CommentSerializer` described below.
Class description:
Serializer for Comment model.
Method signatures and docstrings:
- def get_children(self, obj): Return `children` serialized objects.
- def get_date_to_display(self, obj): Return timesince formatted date.
<|skeleton|>
class CommentSeri... | faee901943371ed85f8ecde456b342efdb07e865 | <|skeleton|>
class CommentSerializer:
"""Serializer for Comment model."""
def get_children(self, obj):
"""Return `children` serialized objects."""
<|body_0|>
def get_date_to_display(self, obj):
"""Return timesince formatted date."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommentSerializer:
"""Serializer for Comment model."""
def get_children(self, obj):
"""Return `children` serialized objects."""
data = dj_serializers.serialize('json', obj.children())
json_data = json.loads(data)
for item in json_data:
item['fields']['content_t... | the_stack_v2_python_sparse | comments/serializers.py | arviesan24/social_media | train | 0 |
9c80c18a7b8c7cd5f3f7221ffd67d1feb91cf88e | [
"self.max_depth = 0\nif root is None:\n return 0\n\ndef deeper(node, depth):\n if node.left is None and node.right is None:\n if depth > self.max_depth:\n self.max_depth = depth\n return\n if node.left:\n deeper(node.left, depth + 1)\n if node.right:\n deeper(node.... | <|body_start_0|>
self.max_depth = 0
if root is None:
return 0
def deeper(node, depth):
if node.left is None and node.right is None:
if depth > self.max_depth:
self.max_depth = depth
return
if node.left:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxDepth2(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def maxDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.max_depth = 0
if root is None:
... | stack_v2_sparse_classes_36k_train_014046 | 1,173 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "maxDepth2",
"signature": "def maxDepth2(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "maxDepth",
"signature": "def maxDepth(self, root)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth2(self, root): :type root: TreeNode :rtype: int
- def maxDepth(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 maxDepth2(self, root): :type root: TreeNode :rtype: int
- def maxDepth(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
def maxDepth2(self, ro... | 97533d53c8892b6519e99f344489fa4fd4c9ab93 | <|skeleton|>
class Solution:
def maxDepth2(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def maxDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxDepth2(self, root):
""":type root: TreeNode :rtype: int"""
self.max_depth = 0
if root is None:
return 0
def deeper(node, depth):
if node.left is None and node.right is None:
if depth > self.max_depth:
... | the_stack_v2_python_sparse | 2. DFS/104.py | proTao/leetcode | train | 0 | |
3c072d2c7596d37f793ae010979f1e728ae696e2 | [
"try:\n if isinstance(function, string_types) and PY2:\n function = function.encode('ascii')\nexcept UnicodeError:\n raise TypeError('Unicode encoded functions are not supported.')\nself._type = type\nself._language = language\nself._function = function\nself._keep = keep\nself._arg = arg",
"stepdef ... | <|body_start_0|>
try:
if isinstance(function, string_types) and PY2:
function = function.encode('ascii')
except UnicodeError:
raise TypeError('Unicode encoded functions are not supported.')
self._type = type
self._language = language
self._... | The RiakMapReducePhase holds information about a Map or Reduce phase in a RiakMapReduce operation. Normally you won't need to use this object directly, but instead call methods on RiakMapReduce objects to add instances to the query. | RiakMapReducePhase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RiakMapReducePhase:
"""The RiakMapReducePhase holds information about a Map or Reduce phase in a RiakMapReduce operation. Normally you won't need to use this object directly, but instead call methods on RiakMapReduce objects to add instances to the query."""
def __init__(self, type, function... | stack_v2_sparse_classes_36k_train_014047 | 26,697 | permissive | [
{
"docstring": "Construct a RiakMapReducePhase object. :param type: the phase type - 'map', 'reduce', 'link' :type type: string :param function: the function to execute :type function: string, list :param language: 'javascript' or 'erlang' :type language: string :param keep: whether to return the output of this... | 2 | stack_v2_sparse_classes_30k_train_015402 | Implement the Python class `RiakMapReducePhase` described below.
Class description:
The RiakMapReducePhase holds information about a Map or Reduce phase in a RiakMapReduce operation. Normally you won't need to use this object directly, but instead call methods on RiakMapReduce objects to add instances to the query.
M... | Implement the Python class `RiakMapReducePhase` described below.
Class description:
The RiakMapReducePhase holds information about a Map or Reduce phase in a RiakMapReduce operation. Normally you won't need to use this object directly, but instead call methods on RiakMapReduce objects to add instances to the query.
M... | 91de13a16607cdf553d1a194e762734e3bec4231 | <|skeleton|>
class RiakMapReducePhase:
"""The RiakMapReducePhase holds information about a Map or Reduce phase in a RiakMapReduce operation. Normally you won't need to use this object directly, but instead call methods on RiakMapReduce objects to add instances to the query."""
def __init__(self, type, function... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RiakMapReducePhase:
"""The RiakMapReducePhase holds information about a Map or Reduce phase in a RiakMapReduce operation. Normally you won't need to use this object directly, but instead call methods on RiakMapReduce objects to add instances to the query."""
def __init__(self, type, function, language, k... | the_stack_v2_python_sparse | riak/mapreduce.py | EDITD/riak-python-client | train | 0 |
537a597a73ab20be3d40a94295bc5c7548214eed | [
"self.snmp_object = snmp_object\nself.test_oid = test_oid\nself.tags = tags",
"validity = False\nif self.snmp_object.oid_exists(self.test_oid) is True:\n validity = True\nreturn validity"
] | <|body_start_0|>
self.snmp_object = snmp_object
self.test_oid = test_oid
self.tags = tags
<|end_body_0|>
<|body_start_1|>
validity = False
if self.snmp_object.oid_exists(self.test_oid) is True:
validity = True
return validity
<|end_body_1|>
| Base snmp query object. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. layer1: Returns all needed layer 1 MIB information from the device. Keyed by... | Query | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Query:
"""Base snmp query object. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. layer1: Returns all needed layer 1 MIB info... | stack_v2_sparse_classes_36k_train_014048 | 1,527 | permissive | [
{
"docstring": "Function for intializing the class. Args: snmp_object: SNMP Interact class object from snmp_manager.py Returns: None",
"name": "__init__",
"signature": "def __init__(self, snmp_object, test_oid, tags)"
},
{
"docstring": "Return device's support for the MIB. Args: None Returns: va... | 2 | stack_v2_sparse_classes_30k_train_017758 | Implement the Python class `Query` described below.
Class description:
Base snmp query object. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. laye... | Implement the Python class `Query` described below.
Class description:
Base snmp query object. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. laye... | ae82589fbbab77fef6d6be09c1fcca5846f595a8 | <|skeleton|>
class Query:
"""Base snmp query object. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. layer1: Returns all needed layer 1 MIB info... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Query:
"""Base snmp query object. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. layer1: Returns all needed layer 1 MIB information from ... | the_stack_v2_python_sparse | switchmap/snmp/base_query.py | PalisadoesFoundation/switchmap-ng | train | 8 |
ff71295e0c7367c6d568112c40cebb3a8a77c733 | [
"super().__init__(board)\nself.drop_steps = dropped_steps\nself.went_up = False",
"if self.went_up:\n self.position += random.randint(1, 6) + self.drop_steps\nelse:\n self.position += random.randint(1, 6)\nif self.position < self.board.position_adjustment(self.position):\n self.went_up = True\nelse:\n ... | <|body_start_0|>
super().__init__(board)
self.drop_steps = dropped_steps
self.went_up = False
<|end_body_0|>
<|body_start_1|>
if self.went_up:
self.position += random.randint(1, 6) + self.drop_steps
else:
self.position += random.randint(1, 6)
if s... | LazyPlayer class, this player takes one step backwards next round if he climbed in the previous round. | LazyPlayer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LazyPlayer:
"""LazyPlayer class, this player takes one step backwards next round if he climbed in the previous round."""
def __init__(self, board, dropped_steps=1):
""":param board: Takes board as input :param dropped_steps: Takes amount fo steps he should drop next round"""
... | stack_v2_sparse_classes_36k_train_014049 | 7,940 | no_license | [
{
"docstring": ":param board: Takes board as input :param dropped_steps: Takes amount fo steps he should drop next round",
"name": "__init__",
"signature": "def __init__(self, board, dropped_steps=1)"
},
{
"docstring": "Move function, moves player. Basically the same as ResilientPlayer, however ... | 2 | stack_v2_sparse_classes_30k_val_000127 | Implement the Python class `LazyPlayer` described below.
Class description:
LazyPlayer class, this player takes one step backwards next round if he climbed in the previous round.
Method signatures and docstrings:
- def __init__(self, board, dropped_steps=1): :param board: Takes board as input :param dropped_steps: Ta... | Implement the Python class `LazyPlayer` described below.
Class description:
LazyPlayer class, this player takes one step backwards next round if he climbed in the previous round.
Method signatures and docstrings:
- def __init__(self, board, dropped_steps=1): :param board: Takes board as input :param dropped_steps: Ta... | 4d2f6cc594a4c5decd844fdfba7baced6b78aa72 | <|skeleton|>
class LazyPlayer:
"""LazyPlayer class, this player takes one step backwards next round if he climbed in the previous round."""
def __init__(self, board, dropped_steps=1):
""":param board: Takes board as input :param dropped_steps: Takes amount fo steps he should drop next round"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LazyPlayer:
"""LazyPlayer class, this player takes one step backwards next round if he climbed in the previous round."""
def __init__(self, board, dropped_steps=1):
""":param board: Takes board as input :param dropped_steps: Takes amount fo steps he should drop next round"""
super().__ini... | the_stack_v2_python_sparse | src/pa02/chutes_simulation.py | amirarfan/INF200-2019-Exercises | train | 0 |
5410829d7a9f2ffc68714519d86de3a6199663be | [
"arguments_length = 1 if not isinstance(value, collections.Iterable) else len(value)\noperations_length = 1 if isinstance(self.document[other], str) else len(self.document[other])\nif arguments_length > operations_length:\n self._error(field, 'More arguments provided in field: {} than in operations!'.format(fiel... | <|body_start_0|>
arguments_length = 1 if not isinstance(value, collections.Iterable) else len(value)
operations_length = 1 if isinstance(self.document[other], str) else len(self.document[other])
if arguments_length > operations_length:
self._error(field, 'More arguments provided in f... | Validator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Validator:
def _validate_is_shorter(self, other: str, field, value):
"""Test whether one field (arguments) is shorter than other (operations). The rule's arguments are validated against this schema: {"type": "string"}"""
<|body_0|>
def _validate_broadcastable(self, shape_fie... | stack_v2_sparse_classes_36k_train_014050 | 7,119 | permissive | [
{
"docstring": "Test whether one field (arguments) is shorter than other (operations). The rule's arguments are validated against this schema: {\"type\": \"string\"}",
"name": "_validate_is_shorter",
"signature": "def _validate_is_shorter(self, other: str, field, value)"
},
{
"docstring": "Test ... | 2 | stack_v2_sparse_classes_30k_train_013196 | Implement the Python class `Validator` described below.
Class description:
Implement the Validator class.
Method signatures and docstrings:
- def _validate_is_shorter(self, other: str, field, value): Test whether one field (arguments) is shorter than other (operations). The rule's arguments are validated against this... | Implement the Python class `Validator` described below.
Class description:
Implement the Validator class.
Method signatures and docstrings:
- def _validate_is_shorter(self, other: str, field, value): Test whether one field (arguments) is shorter than other (operations). The rule's arguments are validated against this... | 3122c4366fe629c911d67b2ec4fc22e50fd2f981 | <|skeleton|>
class Validator:
def _validate_is_shorter(self, other: str, field, value):
"""Test whether one field (arguments) is shorter than other (operations). The rule's arguments are validated against this schema: {"type": "string"}"""
<|body_0|>
def _validate_broadcastable(self, shape_fie... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Validator:
def _validate_is_shorter(self, other: str, field, value):
"""Test whether one field (arguments) is shorter than other (operations). The rule's arguments are validated against this schema: {"type": "string"}"""
arguments_length = 1 if not isinstance(value, collections.Iterable) else ... | the_stack_v2_python_sparse | torchlambda/implementation/utils/template/validator.py | medric49/torchlambda | train | 0 | |
24220de101e35b7db0ea655e03b56610d2688fc4 | [
"if x < y:\n x, y = (y, x)\nwhile x % y != 0:\n x, y = (y, x % y)\nreturn y",
"if x < y:\n x, y = (y, x)\nwhile x - y != y:\n if x - y > y:\n x, y = (x - y, y)\n else:\n x, y = (y, x - y)\nreturn y"
] | <|body_start_0|>
if x < y:
x, y = (y, x)
while x % y != 0:
x, y = (y, x % y)
return y
<|end_body_0|>
<|body_start_1|>
if x < y:
x, y = (y, x)
while x - y != y:
if x - y > y:
x, y = (x - y, y)
else:
... | MathUtils | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MathUtils:
def gcd0(x, y):
"""辗转相除法求最大公约数 :param x: :param y: :return:"""
<|body_0|>
def gcd1(x, y):
"""更相减损术求最大公约数 :param x: :param y: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if x < y:
x, y = (y, x)
while x % y ... | stack_v2_sparse_classes_36k_train_014051 | 6,881 | no_license | [
{
"docstring": "辗转相除法求最大公约数 :param x: :param y: :return:",
"name": "gcd0",
"signature": "def gcd0(x, y)"
},
{
"docstring": "更相减损术求最大公约数 :param x: :param y: :return:",
"name": "gcd1",
"signature": "def gcd1(x, y)"
}
] | 2 | null | Implement the Python class `MathUtils` described below.
Class description:
Implement the MathUtils class.
Method signatures and docstrings:
- def gcd0(x, y): 辗转相除法求最大公约数 :param x: :param y: :return:
- def gcd1(x, y): 更相减损术求最大公约数 :param x: :param y: :return: | Implement the Python class `MathUtils` described below.
Class description:
Implement the MathUtils class.
Method signatures and docstrings:
- def gcd0(x, y): 辗转相除法求最大公约数 :param x: :param y: :return:
- def gcd1(x, y): 更相减损术求最大公约数 :param x: :param y: :return:
<|skeleton|>
class MathUtils:
def gcd0(x, y):
... | 7a1c3aba65f338f6e11afd2864dabd2b26142b6c | <|skeleton|>
class MathUtils:
def gcd0(x, y):
"""辗转相除法求最大公约数 :param x: :param y: :return:"""
<|body_0|>
def gcd1(x, y):
"""更相减损术求最大公约数 :param x: :param y: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MathUtils:
def gcd0(x, y):
"""辗转相除法求最大公约数 :param x: :param y: :return:"""
if x < y:
x, y = (y, x)
while x % y != 0:
x, y = (y, x % y)
return y
def gcd1(x, y):
"""更相减损术求最大公约数 :param x: :param y: :return:"""
if x < y:
x, y ... | the_stack_v2_python_sparse | G55Utils/Py/Utils.py | SS4G/AlgorithmTraining | train | 2 | |
5cfd1037c434e94fb43c99cbe696634bbc5ed8c6 | [
"self.method = method\nself.M = M\nself.snr = snr\nself.dt = dt\nself.z = z\nself.mirror = mirror\nself.p = p\nself.like = 0.0\nA = fstat.snr_f_to_a(self.z, event.get_fsig(mirror))\nself.D, self.cosi, _, _ = fstat.a_to_params(A)\nif method is not 'time' and method is not 'marg':\n self.approx_like(event, Dmax)\n... | <|body_start_0|>
self.method = method
self.M = M
self.snr = snr
self.dt = dt
self.z = z
self.mirror = mirror
self.p = p
self.like = 0.0
A = fstat.snr_f_to_a(self.z, event.get_fsig(mirror))
self.D, self.cosi, _, _ = fstat.a_to_params(A)
... | class to hold the details of a localization method | localization | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class localization:
"""class to hold the details of a localization method"""
def __init__(self, method, M, snr, dt, z, event, mirror=False, p=0.9, Dmax=1000, area=0):
"""Initialization :param method: how we do localization, one of "time", "coh", "left, "right", "marg" :param M: localizatio... | stack_v2_sparse_classes_36k_train_014052 | 29,171 | no_license | [
{
"docstring": "Initialization :param method: how we do localization, one of \"time\", \"coh\", \"left, \"right\", \"marg\" :param M: localization matrix :param snr: snr of event :param dt: time offset :param z: complex snr :param event: details of event :param mirror: are we looking in the mirror location :par... | 4 | stack_v2_sparse_classes_30k_train_002331 | Implement the Python class `localization` described below.
Class description:
class to hold the details of a localization method
Method signatures and docstrings:
- def __init__(self, method, M, snr, dt, z, event, mirror=False, p=0.9, Dmax=1000, area=0): Initialization :param method: how we do localization, one of "t... | Implement the Python class `localization` described below.
Class description:
class to hold the details of a localization method
Method signatures and docstrings:
- def __init__(self, method, M, snr, dt, z, event, mirror=False, p=0.9, Dmax=1000, area=0): Initialization :param method: how we do localization, one of "t... | 22342a3bc81e4a12ff506c76f24167d5d29b26d1 | <|skeleton|>
class localization:
"""class to hold the details of a localization method"""
def __init__(self, method, M, snr, dt, z, event, mirror=False, p=0.9, Dmax=1000, area=0):
"""Initialization :param method: how we do localization, one of "time", "coh", "left, "right", "marg" :param M: localizatio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class localization:
"""class to hold the details of a localization method"""
def __init__(self, method, M, snr, dt, z, event, mirror=False, p=0.9, Dmax=1000, area=0):
"""Initialization :param method: how we do localization, one of "time", "coh", "left, "right", "marg" :param M: localization matrix :par... | the_stack_v2_python_sparse | simple_pe/localize.py | grferna/GW150914_phase | train | 0 |
408e74d4c066cd0124e4d9d2affa16ef24a32999 | [
"rows, cols = (len(matrix), len(matrix[0]))\nself.prefixSumMatrix = []\nfor i in range(rows):\n l = [matrix[i][0]]\n for j in range(1, cols):\n l.append(l[-1] + matrix[i][j])\n self.prefixSumMatrix.append(l)",
"res = 0\nfor i in range(row1, row2 + 1):\n if col1 != 0:\n res += self.prefix... | <|body_start_0|>
rows, cols = (len(matrix), len(matrix[0]))
self.prefixSumMatrix = []
for i in range(rows):
l = [matrix[i][0]]
for j in range(1, cols):
l.append(l[-1] + matrix[i][j])
self.prefixSumMatrix.append(l)
<|end_body_0|>
<|body_start_1... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
""":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_014053 | 1,206 | no_license | [
{
"docstring": ":type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int",
"name": "sumRegion",
"signature": "def sumRegion(self, row1, col1, row2, col2)"
... | 2 | stack_v2_sparse_classes_30k_train_000312 | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:... | ee59b82125f100970c842d5e1245287c484d6649 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
""":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
rows, cols = (len(matrix), len(matrix[0]))
self.prefixSumMatrix = []
for i in range(rows):
l = [matrix[i][0]]
for j in range(1, cols):
l.append(l[-1] + matrix[i][j... | the_stack_v2_python_sparse | _CodeTopics/LeetCode/201-400/000304/RE--000304.py | BIAOXYZ/variousCodes | train | 0 | |
d48ef221e051f16678b1c833f3bc31589a08420d | [
"super().__init__(None, mode, SYSTEM_REGISTER_PANEL_SIZE, client)\nself.mode = mode\nself.username_static = wx.StaticText(self.pnl, label=USERNAME_STATIC)\nself.password_static = wx.StaticText(self.pnl, label=PASSWORD_STATIC)\nself.user_txt = wx.TextCtrl(self.pnl)\nself.password_txt = wx.TextCtrl(self.pnl)\nself.bt... | <|body_start_0|>
super().__init__(None, mode, SYSTEM_REGISTER_PANEL_SIZE, client)
self.mode = mode
self.username_static = wx.StaticText(self.pnl, label=USERNAME_STATIC)
self.password_static = wx.StaticText(self.pnl, label=PASSWORD_STATIC)
self.user_txt = wx.TextCtrl(self.pnl)
... | enter username & password - connect to server | SystemRegisterGUI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SystemRegisterGUI:
"""enter username & password - connect to server"""
def __init__(self, mode, client):
""":param mode: LOG IN \\ SIGN UP"""
<|body_0|>
def on_submit(self, e):
""":return: checks the log in \\ sign up method"""
<|body_1|>
def positio... | stack_v2_sparse_classes_36k_train_014054 | 3,217 | no_license | [
{
"docstring": ":param mode: LOG IN \\\\ SIGN UP",
"name": "__init__",
"signature": "def __init__(self, mode, client)"
},
{
"docstring": ":return: checks the log in \\\\ sign up method",
"name": "on_submit",
"signature": "def on_submit(self, e)"
},
{
"docstring": ":return: puts t... | 3 | stack_v2_sparse_classes_30k_train_016682 | Implement the Python class `SystemRegisterGUI` described below.
Class description:
enter username & password - connect to server
Method signatures and docstrings:
- def __init__(self, mode, client): :param mode: LOG IN \\ SIGN UP
- def on_submit(self, e): :return: checks the log in \\ sign up method
- def positions(s... | Implement the Python class `SystemRegisterGUI` described below.
Class description:
enter username & password - connect to server
Method signatures and docstrings:
- def __init__(self, mode, client): :param mode: LOG IN \\ SIGN UP
- def on_submit(self, e): :return: checks the log in \\ sign up method
- def positions(s... | b8e9ae3300a7fd79d72109bb3d7db5020fca55d8 | <|skeleton|>
class SystemRegisterGUI:
"""enter username & password - connect to server"""
def __init__(self, mode, client):
""":param mode: LOG IN \\ SIGN UP"""
<|body_0|>
def on_submit(self, e):
""":return: checks the log in \\ sign up method"""
<|body_1|>
def positio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SystemRegisterGUI:
"""enter username & password - connect to server"""
def __init__(self, mode, client):
""":param mode: LOG IN \\ SIGN UP"""
super().__init__(None, mode, SYSTEM_REGISTER_PANEL_SIZE, client)
self.mode = mode
self.username_static = wx.StaticText(self.pnl, la... | the_stack_v2_python_sparse | Classes/SystemRegisterGUI.py | tomerbar2903/CloudProject | train | 0 |
41c90b097d5e3d50c2e8234ba740ef99038953b2 | [
"self.driver = driver\nself.comp_name = comp_name\nself.element = self.get_component()",
"if self.find_elem_is_clickable('select[name=\"' + name + '\"]', timeout=1) != None:\n return True\nelse:\n return False"
] | <|body_start_0|>
self.driver = driver
self.comp_name = comp_name
self.element = self.get_component()
<|end_body_0|>
<|body_start_1|>
if self.find_elem_is_clickable('select[name="' + name + '"]', timeout=1) != None:
return True
else:
return False
<|end_bod... | 手机端部门选择框控件 | DepartmentPhonePage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DepartmentPhonePage:
"""手机端部门选择框控件"""
def __init__(self, driver, comp_name):
"""类初始化执行"""
<|body_0|>
def is_department_clickable(self, name):
"""判断部门选择框是否可点击,可点击返回Ture,不可返回False"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.driver = drive... | stack_v2_sparse_classes_36k_train_014055 | 2,660 | no_license | [
{
"docstring": "类初始化执行",
"name": "__init__",
"signature": "def __init__(self, driver, comp_name)"
},
{
"docstring": "判断部门选择框是否可点击,可点击返回Ture,不可返回False",
"name": "is_department_clickable",
"signature": "def is_department_clickable(self, name)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009847 | Implement the Python class `DepartmentPhonePage` described below.
Class description:
手机端部门选择框控件
Method signatures and docstrings:
- def __init__(self, driver, comp_name): 类初始化执行
- def is_department_clickable(self, name): 判断部门选择框是否可点击,可点击返回Ture,不可返回False | Implement the Python class `DepartmentPhonePage` described below.
Class description:
手机端部门选择框控件
Method signatures and docstrings:
- def __init__(self, driver, comp_name): 类初始化执行
- def is_department_clickable(self, name): 判断部门选择框是否可点击,可点击返回Ture,不可返回False
<|skeleton|>
class DepartmentPhonePage:
"""手机端部门选择框控件"""
... | 78768989a79a14013b983024cf6e4838d51ed595 | <|skeleton|>
class DepartmentPhonePage:
"""手机端部门选择框控件"""
def __init__(self, driver, comp_name):
"""类初始化执行"""
<|body_0|>
def is_department_clickable(self, name):
"""判断部门选择框是否可点击,可点击返回Ture,不可返回False"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DepartmentPhonePage:
"""手机端部门选择框控件"""
def __init__(self, driver, comp_name):
"""类初始化执行"""
self.driver = driver
self.comp_name = comp_name
self.element = self.get_component()
def is_department_clickable(self, name):
"""判断部门选择框是否可点击,可点击返回Ture,不可返回False"""
... | the_stack_v2_python_sparse | test_case/page_obj/form/department_page.py | pylk/pythonSelenium | train | 0 |
9fbecb529d70108d30831ec25cef202c9c063aaa | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn IdentityUserFlowAttributeAssignment()",
"from .entity import Entity\nfrom .identity_user_flow_attribute import IdentityUserFlowAttribute\nfrom .identity_user_flow_attribute_input_type import IdentityUserFlowAttributeInputType\nfrom .us... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return IdentityUserFlowAttributeAssignment()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .identity_user_flow_attribute import IdentityUserFlowAttribute
from .identit... | IdentityUserFlowAttributeAssignment | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdentityUserFlowAttributeAssignment:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IdentityUserFlowAttributeAssignment:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discr... | stack_v2_sparse_classes_36k_train_014056 | 4,693 | 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: IdentityUserFlowAttributeAssignment",
"name": "create_from_discriminator_value",
"signature": "def create_fr... | 3 | stack_v2_sparse_classes_30k_train_001552 | Implement the Python class `IdentityUserFlowAttributeAssignment` described below.
Class description:
Implement the IdentityUserFlowAttributeAssignment class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IdentityUserFlowAttributeAssignment: Creates a ... | Implement the Python class `IdentityUserFlowAttributeAssignment` described below.
Class description:
Implement the IdentityUserFlowAttributeAssignment class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IdentityUserFlowAttributeAssignment: Creates a ... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class IdentityUserFlowAttributeAssignment:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IdentityUserFlowAttributeAssignment:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IdentityUserFlowAttributeAssignment:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IdentityUserFlowAttributeAssignment:
"""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... | the_stack_v2_python_sparse | msgraph/generated/models/identity_user_flow_attribute_assignment.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
7a6712c61ecdf9a74e48eb5e942712f827fdc96e | [
"x = Conv3D(number_of_filters, self.filter_size, strides=self.stride_size, padding='same', use_bias=False)(x)\nif use_batch_norm:\n x = BatchNormalization(momentum=0.99, epsilon=0.001)(x)\nx = LeakyReLU(alpha=0.2)(x)\nreturn x",
"if skip_x is not None:\n x = concatenate([x, skip_x])\nx = Conv3DTranspose(nod... | <|body_start_0|>
x = Conv3D(number_of_filters, self.filter_size, strides=self.stride_size, padding='same', use_bias=False)(x)
if use_batch_norm:
x = BatchNormalization(momentum=0.99, epsilon=0.001)(x)
x = LeakyReLU(alpha=0.2)(x)
return x
<|end_body_0|>
<|body_start_1|>
... | This class defines the architecture for a U-NET and must be inherited by a child class that executes various functions like training or predicting | DefineDoseFromCT | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DefineDoseFromCT:
"""This class defines the architecture for a U-NET and must be inherited by a child class that executes various functions like training or predicting"""
def generator_convolution(self, x, number_of_filters, use_batch_norm=True):
"""Convolution block used for generat... | stack_v2_sparse_classes_36k_train_014057 | 3,441 | no_license | [
{
"docstring": "Convolution block used for generator",
"name": "generator_convolution",
"signature": "def generator_convolution(self, x, number_of_filters, use_batch_norm=True)"
},
{
"docstring": "Convolution transpose block used for generator",
"name": "generator_convolution_transpose",
... | 3 | stack_v2_sparse_classes_30k_train_006355 | Implement the Python class `DefineDoseFromCT` described below.
Class description:
This class defines the architecture for a U-NET and must be inherited by a child class that executes various functions like training or predicting
Method signatures and docstrings:
- def generator_convolution(self, x, number_of_filters,... | Implement the Python class `DefineDoseFromCT` described below.
Class description:
This class defines the architecture for a U-NET and must be inherited by a child class that executes various functions like training or predicting
Method signatures and docstrings:
- def generator_convolution(self, x, number_of_filters,... | 2db52d7186c8fe788994c7a5fd70dc9052e0ff8e | <|skeleton|>
class DefineDoseFromCT:
"""This class defines the architecture for a U-NET and must be inherited by a child class that executes various functions like training or predicting"""
def generator_convolution(self, x, number_of_filters, use_batch_norm=True):
"""Convolution block used for generat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DefineDoseFromCT:
"""This class defines the architecture for a U-NET and must be inherited by a child class that executes various functions like training or predicting"""
def generator_convolution(self, x, number_of_filters, use_batch_norm=True):
"""Convolution block used for generator"""
... | the_stack_v2_python_sparse | provided_code/network_architectures.py | Scu-sen/AAPM2020_open_kbp | train | 26 |
66b0d04f9ff8ff6a25a73968d0081278f7593e60 | [
"context = super(AIUpdateView, self).get_context_data(**kwargs)\ncontext['import_form'] = ImportAIForm\nreturn context",
"initial = super(AIUpdateView, self).get_initial()\ninitial = get_ai(self.request.session.get('token', False), self.kwargs['aiid'])\ninitial['default_chat_responses'] = settings.TOKENFIELD_DELI... | <|body_start_0|>
context = super(AIUpdateView, self).get_context_data(**kwargs)
context['import_form'] = ImportAIForm
return context
<|end_body_0|>
<|body_start_1|>
initial = super(AIUpdateView, self).get_initial()
initial = get_ai(self.request.session.get('token', False), self.... | Manage AI settings | AIUpdateView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AIUpdateView:
"""Manage AI settings"""
def get_context_data(self, **kwargs):
"""Update context adding import form"""
<|body_0|>
def get_initial(self):
"""Returns the initial data to use for forms on this view."""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_36k_train_014058 | 39,842 | permissive | [
{
"docstring": "Update context adding import form",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
},
{
"docstring": "Returns the initial data to use for forms on this view.",
"name": "get_initial",
"signature": "def get_initial(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000380 | Implement the Python class `AIUpdateView` described below.
Class description:
Manage AI settings
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Update context adding import form
- def get_initial(self): Returns the initial data to use for forms on this view. | Implement the Python class `AIUpdateView` described below.
Class description:
Manage AI settings
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Update context adding import form
- def get_initial(self): Returns the initial data to use for forms on this view.
<|skeleton|>
class AIUpdateView... | d632d00f9a22a7a826bba4896a7102b2ac8690ff | <|skeleton|>
class AIUpdateView:
"""Manage AI settings"""
def get_context_data(self, **kwargs):
"""Update context adding import form"""
<|body_0|>
def get_initial(self):
"""Returns the initial data to use for forms on this view."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AIUpdateView:
"""Manage AI settings"""
def get_context_data(self, **kwargs):
"""Update context adding import form"""
context = super(AIUpdateView, self).get_context_data(**kwargs)
context['import_form'] = ImportAIForm
return context
def get_initial(self):
"""R... | the_stack_v2_python_sparse | src/studio/views.py | hutomadotAI/web-console | train | 6 |
daaec62534e4721bb4a6b02755da7f9aa82e9f0a | [
"self.logfile = logfile\nself.pitch_Stability_PID = Stability_PID_Controller(IMU_PITCH_ROLL_Kp, IMU_PITCH_ROLL_Kd, IMU_PITCH_ROLL_Ki)\nself.roll_Stability_PID = Stability_PID_Controller(IMU_PITCH_ROLL_Kp, IMU_PITCH_ROLL_Kd, IMU_PITCH_ROLL_Ki)\nself.yaw_IMU_PID = Yaw_PID_Controller(IMU_YAW_Kp, IMU_YAW_Kd, IMU_YAW_Ki... | <|body_start_0|>
self.logfile = logfile
self.pitch_Stability_PID = Stability_PID_Controller(IMU_PITCH_ROLL_Kp, IMU_PITCH_ROLL_Kd, IMU_PITCH_ROLL_Ki)
self.roll_Stability_PID = Stability_PID_Controller(IMU_PITCH_ROLL_Kp, IMU_PITCH_ROLL_Kd, IMU_PITCH_ROLL_Ki)
self.yaw_IMU_PID = Yaw_PID_Cont... | FMU | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FMU:
def __init__(self, logfile=None):
"""Creates a new Quadrotor object with optional logfile."""
<|body_0|>
def get_motors(self, imu_angles, controller_input, timestep, extra_data):
"""Gets motor thrusts based on current telemetry: imuAngles IMU pitch, roll, yaw an... | stack_v2_sparse_classes_36k_train_014059 | 5,512 | no_license | [
{
"docstring": "Creates a new Quadrotor object with optional logfile.",
"name": "__init__",
"signature": "def __init__(self, logfile=None)"
},
{
"docstring": "Gets motor thrusts based on current telemetry: imuAngles IMU pitch, roll, yaw angles in radians (positive = nose up, right down, nose rig... | 2 | stack_v2_sparse_classes_30k_train_012761 | Implement the Python class `FMU` described below.
Class description:
Implement the FMU class.
Method signatures and docstrings:
- def __init__(self, logfile=None): Creates a new Quadrotor object with optional logfile.
- def get_motors(self, imu_angles, controller_input, timestep, extra_data): Gets motor thrusts based... | Implement the Python class `FMU` described below.
Class description:
Implement the FMU class.
Method signatures and docstrings:
- def __init__(self, logfile=None): Creates a new Quadrotor object with optional logfile.
- def get_motors(self, imu_angles, controller_input, timestep, extra_data): Gets motor thrusts based... | e9edc06adbc3371c1453e0b23bdd098564f73d5e | <|skeleton|>
class FMU:
def __init__(self, logfile=None):
"""Creates a new Quadrotor object with optional logfile."""
<|body_0|>
def get_motors(self, imu_angles, controller_input, timestep, extra_data):
"""Gets motor thrusts based on current telemetry: imuAngles IMU pitch, roll, yaw an... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FMU:
def __init__(self, logfile=None):
"""Creates a new Quadrotor object with optional logfile."""
self.logfile = logfile
self.pitch_Stability_PID = Stability_PID_Controller(IMU_PITCH_ROLL_Kp, IMU_PITCH_ROLL_Kd, IMU_PITCH_ROLL_Ki)
self.roll_Stability_PID = Stability_PID_Control... | the_stack_v2_python_sparse | sim-python/sim/physics/fmu.py | raman-belsevr/labs | train | 0 | |
fc6a325fcd0548b4cbd42d1d4472a20bda7affa7 | [
"q = [(0, 1, 0)]\nwhile q:\n i, step, cnt = q.pop(0)\n if i == target:\n return cnt\n q.append((i - step, step + 1, cnt + 1))\n q.append((i + step, step + 1, cnt + 1))\nreturn None",
"start, end, cnt = (0, 0, 1)\nwhile True:\n start -= cnt\n end += cnt\n cnt += 1\n if start <= targe... | <|body_start_0|>
q = [(0, 1, 0)]
while q:
i, step, cnt = q.pop(0)
if i == target:
return cnt
q.append((i - step, step + 1, cnt + 1))
q.append((i + step, step + 1, cnt + 1))
return None
<|end_body_0|>
<|body_start_1|>
start,... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reachNumber0(self, target):
"""self.ret, self.visited = float('inf'), set() def foo(i, step, cnt): if i in self.visited: return cnt += 1 if self.ret < cnt: return if i + step == target or i - step == target: self.ret = cnt return self.visited.add(i) foo(i - step, step + 1, ... | stack_v2_sparse_classes_36k_train_014060 | 1,957 | no_license | [
{
"docstring": "self.ret, self.visited = float('inf'), set() def foo(i, step, cnt): if i in self.visited: return cnt += 1 if self.ret < cnt: return if i + step == target or i - step == target: self.ret = cnt return self.visited.add(i) foo(i - step, step + 1, cnt) foo(i + step, step + 1, cnt) foo(0, 1, 0) return... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reachNumber0(self, target): self.ret, self.visited = float('inf'), set() def foo(i, step, cnt): if i in self.visited: return cnt += 1 if self.ret < cnt: return if i + step ==... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reachNumber0(self, target): self.ret, self.visited = float('inf'), set() def foo(i, step, cnt): if i in self.visited: return cnt += 1 if self.ret < cnt: return if i + step ==... | 5376dd48b1cefb4faba9d2ef6a8a497b6b1d6c67 | <|skeleton|>
class Solution:
def reachNumber0(self, target):
"""self.ret, self.visited = float('inf'), set() def foo(i, step, cnt): if i in self.visited: return cnt += 1 if self.ret < cnt: return if i + step == target or i - step == target: self.ret = cnt return self.visited.add(i) foo(i - step, step + 1, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def reachNumber0(self, target):
"""self.ret, self.visited = float('inf'), set() def foo(i, step, cnt): if i in self.visited: return cnt += 1 if self.ret < cnt: return if i + step == target or i - step == target: self.ret = cnt return self.visited.add(i) foo(i - step, step + 1, cnt) foo(i + s... | the_stack_v2_python_sparse | python/problem-ETC/reach_a_number.py | hyunjun/practice | train | 3 | |
e25192bcc4e1f7229d8162c3575ea0a858f245c1 | [
"rows = super(Table, self).rows\nif len(rows) == 1 and self.row_empty.is_present:\n return []\nelse:\n return rows",
"_columns = {}\nfor pos, cell in enumerate(self.header.cells, 1):\n column = cell.get_attribute('innerText').strip()\n if column:\n column = re.sub('[ -]', '_', column).lower()\n... | <|body_start_0|>
rows = super(Table, self).rows
if len(rows) == 1 and self.row_empty.is_present:
return []
else:
return rows
<|end_body_0|>
<|body_start_1|>
_columns = {}
for pos, cell in enumerate(self.header.cells, 1):
column = cell.get_attr... | Custom table. | Table | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Table:
"""Custom table."""
def rows(self):
"""Table rows."""
<|body_0|>
def columns(self):
"""Table columns {'name': position}."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
rows = super(Table, self).rows
if len(rows) == 1 and self.row... | stack_v2_sparse_classes_36k_train_014061 | 2,719 | no_license | [
{
"docstring": "Table rows.",
"name": "rows",
"signature": "def rows(self)"
},
{
"docstring": "Table columns {'name': position}.",
"name": "columns",
"signature": "def columns(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018544 | Implement the Python class `Table` described below.
Class description:
Custom table.
Method signatures and docstrings:
- def rows(self): Table rows.
- def columns(self): Table columns {'name': position}. | Implement the Python class `Table` described below.
Class description:
Custom table.
Method signatures and docstrings:
- def rows(self): Table rows.
- def columns(self): Table columns {'name': position}.
<|skeleton|>
class Table:
"""Custom table."""
def rows(self):
"""Table rows."""
<|body_0... | e7583444cd24893ec6ae237b47db7c605b99b0c5 | <|skeleton|>
class Table:
"""Custom table."""
def rows(self):
"""Table rows."""
<|body_0|>
def columns(self):
"""Table columns {'name': position}."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Table:
"""Custom table."""
def rows(self):
"""Table rows."""
rows = super(Table, self).rows
if len(rows) == 1 and self.row_empty.is_present:
return []
else:
return rows
def columns(self):
"""Table columns {'name': position}."""
... | the_stack_v2_python_sparse | stepler/horizon/app/ui/table.py | Mirantis/stepler | train | 16 |
61c72a1ada66addb4e95cd0f94e353a38adb65ac | [
"super(QNetwork, self).__init__()\nself.update_iterations = embedding_update_iterations\nself.embedding_dimension = embedding_dimension\nself.edge_feature_dimension = edge_feature_dimension\nself.node_feature_dimension = node_feature_dimension\nself.theta1 = nn.Parameter(torch.Tensor(embedding_dimension, node_featu... | <|body_start_0|>
super(QNetwork, self).__init__()
self.update_iterations = embedding_update_iterations
self.embedding_dimension = embedding_dimension
self.edge_feature_dimension = edge_feature_dimension
self.node_feature_dimension = node_feature_dimension
self.theta1 = nn... | This is the Q-function neural network that will return Q_value for choosing a variable (i.e a p-dimensional embedding) in a state (defined by a p-dimensional vector). It returns a 2 X 1 vector corresponding to the value of the variable in False or True state. Refer to the paper: https://arxiv.org/abs/1704.01665. Only d... | QNetwork | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QNetwork:
"""This is the Q-function neural network that will return Q_value for choosing a variable (i.e a p-dimensional embedding) in a state (defined by a p-dimensional vector). It returns a 2 X 1 vector corresponding to the value of the variable in False or True state. Refer to the paper: http... | stack_v2_sparse_classes_36k_train_014062 | 8,416 | no_license | [
{
"docstring": "Instantiate the class with weights needed for message passing and neural network.",
"name": "__init__",
"signature": "def __init__(self, embedding_dimension=100, embedding_update_iterations=4, node_feature_dimension=1, edge_feature_dimension=1)"
},
{
"docstring": "Initializes wei... | 4 | stack_v2_sparse_classes_30k_train_019243 | Implement the Python class `QNetwork` described below.
Class description:
This is the Q-function neural network that will return Q_value for choosing a variable (i.e a p-dimensional embedding) in a state (defined by a p-dimensional vector). It returns a 2 X 1 vector corresponding to the value of the variable in False ... | Implement the Python class `QNetwork` described below.
Class description:
This is the Q-function neural network that will return Q_value for choosing a variable (i.e a p-dimensional embedding) in a state (defined by a p-dimensional vector). It returns a 2 X 1 vector corresponding to the value of the variable in False ... | 58187d7dd7b4c0dfcfc3f90ffcc39bc1c5f81cfd | <|skeleton|>
class QNetwork:
"""This is the Q-function neural network that will return Q_value for choosing a variable (i.e a p-dimensional embedding) in a state (defined by a p-dimensional vector). It returns a 2 X 1 vector corresponding to the value of the variable in False or True state. Refer to the paper: http... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QNetwork:
"""This is the Q-function neural network that will return Q_value for choosing a variable (i.e a p-dimensional embedding) in a state (defined by a p-dimensional vector). It returns a 2 X 1 vector corresponding to the value of the variable in False or True state. Refer to the paper: https://arxiv.org... | the_stack_v2_python_sparse | linear_Q_network.py | pg2455/DQN-SAT | train | 5 |
6aeb528e42a9e8f13a32079f29be146721b6dd3a | [
"super().__init__(**kwargs)\nself.loss_type = None\nself.loss_key = loss_key\nself.scoring_type = scoring_type\nself.output_name = output_name",
"config = super().get_config()\nconfig.update({'loss_type': self.loss_type, 'loss_key': self.loss_key, 'scoring_type': self.scoring_type})\nreturn config"
] | <|body_start_0|>
super().__init__(**kwargs)
self.loss_type = None
self.loss_key = loss_key
self.scoring_type = scoring_type
self.output_name = output_name
<|end_body_0|>
<|body_start_1|>
config = super().get_config()
config.update({'loss_type': self.loss_type, 'l... | Abstract class that defines a Ranking loss function | RankingLossBase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RankingLossBase:
"""Abstract class that defines a Ranking loss function"""
def __init__(self, loss_type: str, loss_key: str, scoring_type: str, output_name: str, **kwargs):
"""Instantiate a RankingLossBase object Parameters ---------- loss_type : str Type of the loss function - point... | stack_v2_sparse_classes_36k_train_014063 | 4,015 | permissive | [
{
"docstring": "Instantiate a RankingLossBase object Parameters ---------- loss_type : str Type of the loss function - pointwise, pairwise, listwise loss_key : str Name of the loss function used scoring_type : str Type of scoring function - pointwise, pairwise, groupwise output_name: str Name of the output node... | 2 | stack_v2_sparse_classes_30k_train_001633 | Implement the Python class `RankingLossBase` described below.
Class description:
Abstract class that defines a Ranking loss function
Method signatures and docstrings:
- def __init__(self, loss_type: str, loss_key: str, scoring_type: str, output_name: str, **kwargs): Instantiate a RankingLossBase object Parameters ---... | Implement the Python class `RankingLossBase` described below.
Class description:
Abstract class that defines a Ranking loss function
Method signatures and docstrings:
- def __init__(self, loss_type: str, loss_key: str, scoring_type: str, output_name: str, **kwargs): Instantiate a RankingLossBase object Parameters ---... | bc2366e9180597ba4772b39249e290be28f504b8 | <|skeleton|>
class RankingLossBase:
"""Abstract class that defines a Ranking loss function"""
def __init__(self, loss_type: str, loss_key: str, scoring_type: str, output_name: str, **kwargs):
"""Instantiate a RankingLossBase object Parameters ---------- loss_type : str Type of the loss function - point... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RankingLossBase:
"""Abstract class that defines a Ranking loss function"""
def __init__(self, loss_type: str, loss_key: str, scoring_type: str, output_name: str, **kwargs):
"""Instantiate a RankingLossBase object Parameters ---------- loss_type : str Type of the loss function - pointwise, pairwis... | the_stack_v2_python_sparse | python/ml4ir/applications/ranking/model/losses/loss_base.py | salesforce/ml4ir | train | 94 |
20c5c7ad8c2751f270e41a4a5765798beaeca94d | [
"logging.Handler.__init__(self, level)\nformatter = logging.Formatter(_guiLogFormat, _guiDateFormat)\nself.setFormatter(formatter)\nself.__callbackHandler = utils.CallbackEventHandler()\nself.__logWidget = logWidget\nself.__logMessageQueue = Queue.Queue()",
"message = self.format(record)\nif self.level <= record.... | <|body_start_0|>
logging.Handler.__init__(self, level)
formatter = logging.Formatter(_guiLogFormat, _guiDateFormat)
self.setFormatter(formatter)
self.__callbackHandler = utils.CallbackEventHandler()
self.__logWidget = logWidget
self.__logMessageQueue = Queue.Queue()
<|end... | Handler class used to display logging messages in a widget. The logging widget used for output has only to implement the method C{append} that takes a C{unicode} as input, the method C{scrollToBottom} and the method C{clear}. | GuiLoggerHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GuiLoggerHandler:
"""Handler class used to display logging messages in a widget. The logging widget used for output has only to implement the method C{append} that takes a C{unicode} as input, the method C{scrollToBottom} and the method C{clear}."""
def __init__(self, logWidget, level=loggin... | stack_v2_sparse_classes_36k_train_014064 | 3,878 | no_license | [
{
"docstring": "Constuctor. @param logWidget: A qt widget with an C{append} interface. @type logWidget: L{QWidget<qt.QWidget>} @param level: Level constant. @see: L{logging<logging>} module.",
"name": "__init__",
"signature": "def __init__(self, logWidget, level=logging.INFO)"
},
{
"docstring": ... | 2 | null | Implement the Python class `GuiLoggerHandler` described below.
Class description:
Handler class used to display logging messages in a widget. The logging widget used for output has only to implement the method C{append} that takes a C{unicode} as input, the method C{scrollToBottom} and the method C{clear}.
Method sig... | Implement the Python class `GuiLoggerHandler` described below.
Class description:
Handler class used to display logging messages in a widget. The logging widget used for output has only to implement the method C{append} that takes a C{unicode} as input, the method C{scrollToBottom} and the method C{clear}.
Method sig... | 958fda4f3064f9f6b2034da396a20ac9d9abd52f | <|skeleton|>
class GuiLoggerHandler:
"""Handler class used to display logging messages in a widget. The logging widget used for output has only to implement the method C{append} that takes a C{unicode} as input, the method C{scrollToBottom} and the method C{clear}."""
def __init__(self, logWidget, level=loggin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GuiLoggerHandler:
"""Handler class used to display logging messages in a widget. The logging widget used for output has only to implement the method C{append} that takes a C{unicode} as input, the method C{scrollToBottom} and the method C{clear}."""
def __init__(self, logWidget, level=logging.INFO):
... | the_stack_v2_python_sparse | src/datafinder/gui/admin/common/logger_handler.py | DLR-SC/DataFinder | train | 9 |
759af17b3cec5520d59c86c400b7b48220a404d0 | [
"count = 0\nwhile head:\n count += 1\n head = head.next\nreturn count",
"if headA is None or headB is None:\n return None\nlength1 = self.length(headA)\nlength2 = self.length(headB)\nif length1 > length2:\n steps = length1 - length2\n slower = headB\n faster = headA\nelse:\n steps = length2 -... | <|body_start_0|>
count = 0
while head:
count += 1
head = head.next
return count
<|end_body_0|>
<|body_start_1|>
if headA is None or headB is None:
return None
length1 = self.length(headA)
length2 = self.length(headB)
if length1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def length(self, head):
""">>> s = Solution() >>> s.length(None) 0 >>> head = LinkedList.fromList([1]) >>> s.length(head) 1 >>> head = LinkedList.fromList([1, 2, 3]) >>> s.length(head) 3"""
<|body_0|>
def getIntersectionNode(self, headA, headB):
""":type he... | stack_v2_sparse_classes_36k_train_014065 | 1,786 | no_license | [
{
"docstring": ">>> s = Solution() >>> s.length(None) 0 >>> head = LinkedList.fromList([1]) >>> s.length(head) 1 >>> head = LinkedList.fromList([1, 2, 3]) >>> s.length(head) 3",
"name": "length",
"signature": "def length(self, head)"
},
{
"docstring": ":type head1, head1: ListNode :rtype: ListNo... | 2 | stack_v2_sparse_classes_30k_train_001666 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def length(self, head): >>> s = Solution() >>> s.length(None) 0 >>> head = LinkedList.fromList([1]) >>> s.length(head) 1 >>> head = LinkedList.fromList([1, 2, 3]) >>> s.length(he... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def length(self, head): >>> s = Solution() >>> s.length(None) 0 >>> head = LinkedList.fromList([1]) >>> s.length(head) 1 >>> head = LinkedList.fromList([1, 2, 3]) >>> s.length(he... | 3b13a02f9c8273f9794a57b948d2655792707f37 | <|skeleton|>
class Solution:
def length(self, head):
""">>> s = Solution() >>> s.length(None) 0 >>> head = LinkedList.fromList([1]) >>> s.length(head) 1 >>> head = LinkedList.fromList([1, 2, 3]) >>> s.length(head) 3"""
<|body_0|>
def getIntersectionNode(self, headA, headB):
""":type he... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def length(self, head):
""">>> s = Solution() >>> s.length(None) 0 >>> head = LinkedList.fromList([1]) >>> s.length(head) 1 >>> head = LinkedList.fromList([1, 2, 3]) >>> s.length(head) 3"""
count = 0
while head:
count += 1
head = head.next
retu... | the_stack_v2_python_sparse | insection_of_lists.py | gsy/leetcode | train | 1 | |
df5860a482b8baa3ecf2eca97ae0438a3d840ede | [
"post = Post.query.filter_by(id=id).first()\nif post is None:\n return ({'message': 'Post does not exist'}, 404)\nreturn post_schema.dump(post)",
"with db.session.no_autoflush:\n req = api.payload\n post = Post.query.filter_by(id=id).first()\n if post is None:\n return ({'message': 'Post does n... | <|body_start_0|>
post = Post.query.filter_by(id=id).first()
if post is None:
return ({'message': 'Post does not exist'}, 404)
return post_schema.dump(post)
<|end_body_0|>
<|body_start_1|>
with db.session.no_autoflush:
req = api.payload
post = Post.que... | SinglePost | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SinglePost:
def get(self, id):
"""Get Post by id"""
<|body_0|>
def patch(self, id):
"""Update a Post"""
<|body_1|>
def delete(self, id):
"""Delete a Post by id"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
post = Post.query.fi... | stack_v2_sparse_classes_36k_train_014066 | 3,474 | no_license | [
{
"docstring": "Get Post by id",
"name": "get",
"signature": "def get(self, id)"
},
{
"docstring": "Update a Post",
"name": "patch",
"signature": "def patch(self, id)"
},
{
"docstring": "Delete a Post by id",
"name": "delete",
"signature": "def delete(self, id)"
}
] | 3 | stack_v2_sparse_classes_30k_train_009831 | Implement the Python class `SinglePost` described below.
Class description:
Implement the SinglePost class.
Method signatures and docstrings:
- def get(self, id): Get Post by id
- def patch(self, id): Update a Post
- def delete(self, id): Delete a Post by id | Implement the Python class `SinglePost` described below.
Class description:
Implement the SinglePost class.
Method signatures and docstrings:
- def get(self, id): Get Post by id
- def patch(self, id): Update a Post
- def delete(self, id): Delete a Post by id
<|skeleton|>
class SinglePost:
def get(self, id):
... | ae78fff9888b0f68d9403d7f65cba086dabb3802 | <|skeleton|>
class SinglePost:
def get(self, id):
"""Get Post by id"""
<|body_0|>
def patch(self, id):
"""Update a Post"""
<|body_1|>
def delete(self, id):
"""Delete a Post by id"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SinglePost:
def get(self, id):
"""Get Post by id"""
post = Post.query.filter_by(id=id).first()
if post is None:
return ({'message': 'Post does not exist'}, 404)
return post_schema.dump(post)
def patch(self, id):
"""Update a Post"""
with db.sessi... | the_stack_v2_python_sparse | api/v1/posts.py | mythril-io/flask-api | train | 0 | |
371abce856bae05b2e2f10d1679b6983cbcfefa5 | [
"while root:\n if max(p.val, q.val) < root.val:\n root = root.left\n elif min(p.val, q.val) > root.val:\n root = root.right\n else:\n return root",
"if not root:\n return False\nif root == p or root == q:\n return root\nleft = self.lowestCommonAncestor2(root.left, p, q)\nright ... | <|body_start_0|>
while root:
if max(p.val, q.val) < root.val:
root = root.left
elif min(p.val, q.val) > root.val:
root = root.right
else:
return root
<|end_body_0|>
<|body_start_1|>
if not root:
return False... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lowestCommonAncestor1(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"""
<|body_0|>
def lowestCommonAncestor2(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode... | stack_v2_sparse_classes_36k_train_014067 | 1,141 | no_license | [
{
"docstring": ":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode",
"name": "lowestCommonAncestor1",
"signature": "def lowestCommonAncestor1(self, root, p, q)"
},
{
"docstring": ":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode",
"name": "lowe... | 2 | stack_v2_sparse_classes_30k_train_010913 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor1(self, root, p, q): :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode
- def lowestCommonAncestor2(self, root, p, q): :type root: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor1(self, root, p, q): :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode
- def lowestCommonAncestor2(self, root, p, q): :type root: ... | 8fb6c1d947046dabd58ff8482b2c0b41f39aa988 | <|skeleton|>
class Solution:
def lowestCommonAncestor1(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"""
<|body_0|>
def lowestCommonAncestor2(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lowestCommonAncestor1(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"""
while root:
if max(p.val, q.val) < root.val:
root = root.left
elif min(p.val, q.val) > root.val:
root =... | the_stack_v2_python_sparse | Python/LeetCode/235.py | czx94/Algorithms-Collection | train | 2 | |
32930b8491471dbd7a324db1180b573f4e27f5ea | [
"super(AlignBinary, self).__init__()\nself.config = config\nself.vocab = vocab\nself.need_flatten = True\nself.embedding = nn.Embedding(vocab.size + 1, vocab.size + 1, padding_idx=0)\nself.embedding.weight.data = torch.eye(vocab.size + 1)\nself.embedding.weight.requires_grad = False\nself.max_len_token = max_len_to... | <|body_start_0|>
super(AlignBinary, self).__init__()
self.config = config
self.vocab = vocab
self.need_flatten = True
self.embedding = nn.Embedding(vocab.size + 1, vocab.size + 1, padding_idx=0)
self.embedding.weight.data = torch.eye(vocab.size + 1)
self.embedding... | AlignBinary | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlignBinary:
def __init__(self, config, vocab, max_len_token):
"""param config: config object param vocab: vocab object param max_len_token: max number of tokens"""
<|body_0|>
def compute_loss(self, qry_tk, pos_tk, neg_tk):
"""Computes loss for batch of query positiv... | stack_v2_sparse_classes_36k_train_014068 | 4,951 | permissive | [
{
"docstring": "param config: config object param vocab: vocab object param max_len_token: max number of tokens",
"name": "__init__",
"signature": "def __init__(self, config, vocab, max_len_token)"
},
{
"docstring": "Computes loss for batch of query positive negative triplets param qry: query me... | 5 | stack_v2_sparse_classes_30k_train_017872 | Implement the Python class `AlignBinary` described below.
Class description:
Implement the AlignBinary class.
Method signatures and docstrings:
- def __init__(self, config, vocab, max_len_token): param config: config object param vocab: vocab object param max_len_token: max number of tokens
- def compute_loss(self, q... | Implement the Python class `AlignBinary` described below.
Class description:
Implement the AlignBinary class.
Method signatures and docstrings:
- def __init__(self, config, vocab, max_len_token): param config: config object param vocab: vocab object param max_len_token: max number of tokens
- def compute_loss(self, q... | b33977257ed3e6f95d95da570367e099ea24161f | <|skeleton|>
class AlignBinary:
def __init__(self, config, vocab, max_len_token):
"""param config: config object param vocab: vocab object param max_len_token: max number of tokens"""
<|body_0|>
def compute_loss(self, qry_tk, pos_tk, neg_tk):
"""Computes loss for batch of query positiv... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AlignBinary:
def __init__(self, config, vocab, max_len_token):
"""param config: config object param vocab: vocab object param max_len_token: max number of tokens"""
super(AlignBinary, self).__init__()
self.config = config
self.vocab = vocab
self.need_flatten = True
... | the_stack_v2_python_sparse | src/main/models/AlignBinary.py | fgregg/stance | train | 0 | |
7da03604e6f854297cf3b1462fceeef40ade09b1 | [
"self.error = ''\nself.payload = ''\nself.encoding = ''\nself.basename = ''\nsuper(TextToSpeech.Response, self).__init__(**kwargs)",
"b64Data = self.payload\nrawData = base64.b64decode(b64Data)\nreturn rawData",
"if destfile == '' or destfile == u'':\n raise ValueError('Empty destination file path {destfile}... | <|body_start_0|>
self.error = ''
self.payload = ''
self.encoding = ''
self.basename = ''
super(TextToSpeech.Response, self).__init__(**kwargs)
<|end_body_0|>
<|body_start_1|>
b64Data = self.payload
rawData = base64.b64decode(b64Data)
return rawData
<|end_... | Text-To-Speech (TTS) Cloud Response object. TextToSpeech.Response | Response | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Response:
"""Text-To-Speech (TTS) Cloud Response object. TextToSpeech.Response"""
def __init__(self, **kwargs):
"""! Constructor @param **kwargs - Keyword arguments. Apply values to the request attributes. - @ref error - @ref payload - @ref encoding - @ref basename"""
<|body_... | stack_v2_sparse_classes_36k_train_014069 | 3,539 | permissive | [
{
"docstring": "! Constructor @param **kwargs - Keyword arguments. Apply values to the request attributes. - @ref error - @ref payload - @ref encoding - @ref basename",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "! Get audio raw data from response",
"na... | 3 | stack_v2_sparse_classes_30k_train_011970 | Implement the Python class `Response` described below.
Class description:
Text-To-Speech (TTS) Cloud Response object. TextToSpeech.Response
Method signatures and docstrings:
- def __init__(self, **kwargs): ! Constructor @param **kwargs - Keyword arguments. Apply values to the request attributes. - @ref error - @ref p... | Implement the Python class `Response` described below.
Class description:
Text-To-Speech (TTS) Cloud Response object. TextToSpeech.Response
Method signatures and docstrings:
- def __init__(self, **kwargs): ! Constructor @param **kwargs - Keyword arguments. Apply values to the request attributes. - @ref error - @ref p... | 4b738be562b77525bc94e6e8463c1e126bdbf3b5 | <|skeleton|>
class Response:
"""Text-To-Speech (TTS) Cloud Response object. TextToSpeech.Response"""
def __init__(self, **kwargs):
"""! Constructor @param **kwargs - Keyword arguments. Apply values to the request attributes. - @ref error - @ref payload - @ref encoding - @ref basename"""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Response:
"""Text-To-Speech (TTS) Cloud Response object. TextToSpeech.Response"""
def __init__(self, **kwargs):
"""! Constructor @param **kwargs - Keyword arguments. Apply values to the request attributes. - @ref error - @ref payload - @ref encoding - @ref basename"""
self.error = ''
... | the_stack_v2_python_sparse | RappCloud/CloudMsgs/TextToSpeech.py | robotics-4-all/r4a_rapp_cloud_api_python | train | 1 |
e785b01076846bc811a3539aef7f62659fdf33fb | [
"self.max_atoms = int(max_atoms)\nself.remove_hydrogens = remove_hydrogens\nself.randomize = randomize\nself.n_samples = n_samples\nif seed is not None:\n seed = int(seed)\nself.seed = seed",
"if 'mol' in kwargs:\n datapoint = kwargs.get('mol')\n raise DeprecationWarning('Mol is being phased out as a par... | <|body_start_0|>
self.max_atoms = int(max_atoms)
self.remove_hydrogens = remove_hydrogens
self.randomize = randomize
self.n_samples = n_samples
if seed is not None:
seed = int(seed)
self.seed = seed
<|end_body_0|>
<|body_start_1|>
if 'mol' in kwargs:
... | Calculate the eigenvalues of Coulomb matrices for molecules. This featurizer computes the eigenvalues of the Coulomb matrices for provided molecules. Coulomb matrices are described in [1]_. Examples -------- >>> import deepchem as dc >>> featurizers = dc.feat.CoulombMatrixEig(max_atoms=23) >>> input_file = 'deepchem/fe... | CoulombMatrixEig | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CoulombMatrixEig:
"""Calculate the eigenvalues of Coulomb matrices for molecules. This featurizer computes the eigenvalues of the Coulomb matrices for provided molecules. Coulomb matrices are described in [1]_. Examples -------- >>> import deepchem as dc >>> featurizers = dc.feat.CoulombMatrixEig... | stack_v2_sparse_classes_36k_train_014070 | 10,925 | permissive | [
{
"docstring": "Initialize this featurizer. Parameters ---------- max_atoms: int The maximum number of atoms expected for molecules this featurizer will process. remove_hydrogens: bool, optional (default False) If True, remove hydrogens before processing them. randomize: bool, optional (default False) If True, ... | 2 | null | Implement the Python class `CoulombMatrixEig` described below.
Class description:
Calculate the eigenvalues of Coulomb matrices for molecules. This featurizer computes the eigenvalues of the Coulomb matrices for provided molecules. Coulomb matrices are described in [1]_. Examples -------- >>> import deepchem as dc >>>... | Implement the Python class `CoulombMatrixEig` described below.
Class description:
Calculate the eigenvalues of Coulomb matrices for molecules. This featurizer computes the eigenvalues of the Coulomb matrices for provided molecules. Coulomb matrices are described in [1]_. Examples -------- >>> import deepchem as dc >>>... | ee6e67ebcf7bf04259cf13aff6388e2b791fea3d | <|skeleton|>
class CoulombMatrixEig:
"""Calculate the eigenvalues of Coulomb matrices for molecules. This featurizer computes the eigenvalues of the Coulomb matrices for provided molecules. Coulomb matrices are described in [1]_. Examples -------- >>> import deepchem as dc >>> featurizers = dc.feat.CoulombMatrixEig... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CoulombMatrixEig:
"""Calculate the eigenvalues of Coulomb matrices for molecules. This featurizer computes the eigenvalues of the Coulomb matrices for provided molecules. Coulomb matrices are described in [1]_. Examples -------- >>> import deepchem as dc >>> featurizers = dc.feat.CoulombMatrixEig(max_atoms=23... | the_stack_v2_python_sparse | deepchem/feat/molecule_featurizers/coulomb_matrices.py | deepchem/deepchem | train | 4,876 |
458f026d3318a06cff6a0ac33677096ba650e437 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Define the service | SimulatorServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimulatorServicer:
"""Define the service"""
def start_simulation(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def step(self, request, context):
"""Missing associated documentation comment in .proto file."""
... | stack_v2_sparse_classes_36k_train_014071 | 3,825 | no_license | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "start_simulation",
"signature": "def start_simulation(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "step",
"signature": "def step(self, re... | 2 | stack_v2_sparse_classes_30k_train_011466 | Implement the Python class `SimulatorServicer` described below.
Class description:
Define the service
Method signatures and docstrings:
- def start_simulation(self, request, context): Missing associated documentation comment in .proto file.
- def step(self, request, context): Missing associated documentation comment ... | Implement the Python class `SimulatorServicer` described below.
Class description:
Define the service
Method signatures and docstrings:
- def start_simulation(self, request, context): Missing associated documentation comment in .proto file.
- def step(self, request, context): Missing associated documentation comment ... | 6f35a13c636519cc86ebc1a680ef160a4dedcfd1 | <|skeleton|>
class SimulatorServicer:
"""Define the service"""
def start_simulation(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def step(self, request, context):
"""Missing associated documentation comment in .proto file."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SimulatorServicer:
"""Define the service"""
def start_simulation(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError... | the_stack_v2_python_sparse | orchestrator/simulator_pb2_grpc.py | tsveiga/AI4EU-RL-Trondheim | train | 0 |
b120b63a4fcac2126041d970782f94c654c95d95 | [
"for rasterlayer in queryset:\n rasterlayer.parsestatus.reset()\n rasterlayer.refresh_from_db()\n rasterlayer.save()\nmsg = 'Parsing Rasters, check parse logs for progress'\nself.message_user(request, msg)",
"form = None\nlayer = queryset[0]\nif layer.rasterfile:\n self.message_user(request, 'This lay... | <|body_start_0|>
for rasterlayer in queryset:
rasterlayer.parsestatus.reset()
rasterlayer.refresh_from_db()
rasterlayer.save()
msg = 'Parsing Rasters, check parse logs for progress'
self.message_user(request, msg)
<|end_body_0|>
<|body_start_1|>
form ... | Admin action to update filepaths only. Files can be uploadded to the filesystems through any channel and then files can be assigned to the raster objects through this action. This might be useful for large raster files. | RasterLayerModelAdmin | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RasterLayerModelAdmin:
"""Admin action to update filepaths only. Files can be uploadded to the filesystems through any channel and then files can be assigned to the raster objects through this action. This might be useful for large raster files."""
def reparse_rasters(self, request, queryset... | stack_v2_sparse_classes_36k_train_014072 | 5,409 | permissive | [
{
"docstring": "Admin action to re-parse a set of rasterlayers.",
"name": "reparse_rasters",
"signature": "def reparse_rasters(self, request, queryset)"
},
{
"docstring": "Admin action to change filepath without uploading new file.",
"name": "manually_update_filepath",
"signature": "def ... | 2 | stack_v2_sparse_classes_30k_train_020270 | Implement the Python class `RasterLayerModelAdmin` described below.
Class description:
Admin action to update filepaths only. Files can be uploadded to the filesystems through any channel and then files can be assigned to the raster objects through this action. This might be useful for large raster files.
Method sign... | Implement the Python class `RasterLayerModelAdmin` described below.
Class description:
Admin action to update filepaths only. Files can be uploadded to the filesystems through any channel and then files can be assigned to the raster objects through this action. This might be useful for large raster files.
Method sign... | 34fffe3d1f921b2850d3cad598a3c9b382e1fec7 | <|skeleton|>
class RasterLayerModelAdmin:
"""Admin action to update filepaths only. Files can be uploadded to the filesystems through any channel and then files can be assigned to the raster objects through this action. This might be useful for large raster files."""
def reparse_rasters(self, request, queryset... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RasterLayerModelAdmin:
"""Admin action to update filepaths only. Files can be uploadded to the filesystems through any channel and then files can be assigned to the raster objects through this action. This might be useful for large raster files."""
def reparse_rasters(self, request, queryset):
""... | the_stack_v2_python_sparse | raster/admin.py | henhuy/django-raster | train | 0 |
41977d0cff197b1a4ac91309d23062cd517937cb | [
"if not nums or k == 0:\n return []\ndeque = collections.deque()\nfor i in range(k):\n while deque and deque[-1] < nums[i]:\n deque.pop()\n deque.append(nums[i])\nres = [deque[0]]\nfor i in range(k, len(nums)):\n if deque[0] == nums[i - k]:\n deque.popleft()\n while deque and deque[-1] ... | <|body_start_0|>
if not nums or k == 0:
return []
deque = collections.deque()
for i in range(k):
while deque and deque[-1] < nums[i]:
deque.pop()
deque.append(nums[i])
res = [deque[0]]
for i in range(k, len(nums)):
i... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
"""维护单调递减队列:窗口滑动添加了元素 nums[j + 1] ,需将 deque 内所有 < nums[j + 1] 的元素删除"""
<|body_0|>
def maxSlidingWindow1(self, nums: List[int], k: int) -> List[int]:
"""单调队列经典题目:https://leetcode-cn.com/proble... | stack_v2_sparse_classes_36k_train_014073 | 4,339 | permissive | [
{
"docstring": "维护单调递减队列:窗口滑动添加了元素 nums[j + 1] ,需将 deque 内所有 < nums[j + 1] 的元素删除",
"name": "maxSlidingWindow",
"signature": "def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]"
},
{
"docstring": "单调队列经典题目:https://leetcode-cn.com/problems/hua-dong-chuang-kou-de-zui-da-zhi-lcof/solut... | 3 | stack_v2_sparse_classes_30k_train_008083 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: 维护单调递减队列:窗口滑动添加了元素 nums[j + 1] ,需将 deque 内所有 < nums[j + 1] 的元素删除
- def maxSlidingWindow1(self, nums: List[int], ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: 维护单调递减队列:窗口滑动添加了元素 nums[j + 1] ,需将 deque 内所有 < nums[j + 1] 的元素删除
- def maxSlidingWindow1(self, nums: List[int], ... | e8a1c6cae6547cbcb6e8494be6df685f3e7c837c | <|skeleton|>
class Solution:
def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
"""维护单调递减队列:窗口滑动添加了元素 nums[j + 1] ,需将 deque 内所有 < nums[j + 1] 的元素删除"""
<|body_0|>
def maxSlidingWindow1(self, nums: List[int], k: int) -> List[int]:
"""单调队列经典题目:https://leetcode-cn.com/proble... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
"""维护单调递减队列:窗口滑动添加了元素 nums[j + 1] ,需将 deque 内所有 < nums[j + 1] 的元素删除"""
if not nums or k == 0:
return []
deque = collections.deque()
for i in range(k):
while deque and deque[-1] <... | the_stack_v2_python_sparse | lcof/59-hua-dong-chuang-kou-de-zui-da-zhi-lcof.py | yuenliou/leetcode | train | 0 | |
a5071fe61593e0069a2da4cff90225cc0646a662 | [
"self.n = int(n)\nself.p = float(p)\nif data is None:\n if n <= 0:\n raise ValueError('n must be a positive value')\n if p <= 0 or p >= 1:\n raise ValueError('p must be greater than 0 and less than 1')\nelse:\n if type(data) is not list:\n raise TypeError('data must be a list')\n if... | <|body_start_0|>
self.n = int(n)
self.p = float(p)
if data is None:
if n <= 0:
raise ValueError('n must be a positive value')
if p <= 0 or p >= 1:
raise ValueError('p must be greater than 0 and less than 1')
else:
if typ... | Class Binomial | Binomial | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Binomial:
"""Class Binomial"""
def __init__(self, data=None, n=1, p=0.5):
"""Settings for class Binomial"""
<|body_0|>
def pmf(self, k):
"""Method to calculate the PMF for a Binomial distribution"""
<|body_1|>
def cdf(self, k):
"""Method to c... | stack_v2_sparse_classes_36k_train_014074 | 1,982 | permissive | [
{
"docstring": "Settings for class Binomial",
"name": "__init__",
"signature": "def __init__(self, data=None, n=1, p=0.5)"
},
{
"docstring": "Method to calculate the PMF for a Binomial distribution",
"name": "pmf",
"signature": "def pmf(self, k)"
},
{
"docstring": "Method to calc... | 3 | null | Implement the Python class `Binomial` described below.
Class description:
Class Binomial
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): Settings for class Binomial
- def pmf(self, k): Method to calculate the PMF for a Binomial distribution
- def cdf(self, k): Method to calculate the PM... | Implement the Python class `Binomial` described below.
Class description:
Class Binomial
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): Settings for class Binomial
- def pmf(self, k): Method to calculate the PMF for a Binomial distribution
- def cdf(self, k): Method to calculate the PM... | eaf23423ec0f412f103f5931d6610fdd67bcc5be | <|skeleton|>
class Binomial:
"""Class Binomial"""
def __init__(self, data=None, n=1, p=0.5):
"""Settings for class Binomial"""
<|body_0|>
def pmf(self, k):
"""Method to calculate the PMF for a Binomial distribution"""
<|body_1|>
def cdf(self, k):
"""Method to c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Binomial:
"""Class Binomial"""
def __init__(self, data=None, n=1, p=0.5):
"""Settings for class Binomial"""
self.n = int(n)
self.p = float(p)
if data is None:
if n <= 0:
raise ValueError('n must be a positive value')
if p <= 0 or p >... | the_stack_v2_python_sparse | math/0x03-probability/binomial.py | ledbagholberton/holbertonschool-machine_learning | train | 1 |
965614a8a704d6161c20932dff7cb13c1b8b0d81 | [
"OGLDrawable.__init__(self)\nlength = wingspan / 2.0\nfuseLen = length / 2.0\ndepth = fuseLen / 2.0\nfuseHalf = fuseLen / 2.0\ndpthHalf = depth / 2.0\nwingHalf = wingspan / 2.0\nfront = [fuseHalf, 0.0, 0.0]\nbottom = [0.0, 0.0, -dpthHalf]\nback = [-fuseHalf, 0.0, 0.0]\ntop = [0.0, 0.0, dpthHalf]\nrghtWTip = [-lengt... | <|body_start_0|>
OGLDrawable.__init__(self)
length = wingspan / 2.0
fuseLen = length / 2.0
depth = fuseLen / 2.0
fuseHalf = fuseLen / 2.0
dpthHalf = depth / 2.0
wingHalf = wingspan / 2.0
front = [fuseHalf, 0.0, 0.0]
bottom = [0.0, 0.0, -dpthHalf]
... | Little Wing | StarGlider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StarGlider:
"""Little Wing"""
def __init__(self, wingspan=1.0):
"""Set up as drawable"""
<|body_0|>
def draw(self):
"""Render the StarGlider"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
OGLDrawable.__init__(self)
length = wingspan / 2... | stack_v2_sparse_classes_36k_train_014075 | 5,966 | no_license | [
{
"docstring": "Set up as drawable",
"name": "__init__",
"signature": "def __init__(self, wingspan=1.0)"
},
{
"docstring": "Render the StarGlider",
"name": "draw",
"signature": "def draw(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014778 | Implement the Python class `StarGlider` described below.
Class description:
Little Wing
Method signatures and docstrings:
- def __init__(self, wingspan=1.0): Set up as drawable
- def draw(self): Render the StarGlider | Implement the Python class `StarGlider` described below.
Class description:
Little Wing
Method signatures and docstrings:
- def __init__(self, wingspan=1.0): Set up as drawable
- def draw(self): Render the StarGlider
<|skeleton|>
class StarGlider:
"""Little Wing"""
def __init__(self, wingspan=1.0):
... | 7f3b2aaeb24e41002e9dee2f2af669006e1cbd5c | <|skeleton|>
class StarGlider:
"""Little Wing"""
def __init__(self, wingspan=1.0):
"""Set up as drawable"""
<|body_0|>
def draw(self):
"""Render the StarGlider"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StarGlider:
"""Little Wing"""
def __init__(self, wingspan=1.0):
"""Set up as drawable"""
OGLDrawable.__init__(self)
length = wingspan / 2.0
fuseLen = length / 2.0
depth = fuseLen / 2.0
fuseHalf = fuseLen / 2.0
dpthHalf = depth / 2.0
wingHalf... | the_stack_v2_python_sparse | Games/OGL_test.py | jwatson-CO-edu/py_toybox | train | 0 |
a7820b14fb2da19cf454940711b1e5cbb2b19716 | [
"ingest_methods = {'modinput': HECEventIngestor, 'windows_input': HECEventIngestor, 'file_monitor': HECRawEventIngestor, 'uf_file_monitor': FileMonitorEventIngestor, 'scripted_input': HECRawEventIngestor, 'hec_metric': HECMetricEventIngestor, 'syslog_tcp': SC4SEventIngestor, 'syslog_udp': None, 'default': HECRawEve... | <|body_start_0|>
ingest_methods = {'modinput': HECEventIngestor, 'windows_input': HECEventIngestor, 'file_monitor': HECRawEventIngestor, 'uf_file_monitor': FileMonitorEventIngestor, 'scripted_input': HECRawEventIngestor, 'hec_metric': HECMetricEventIngestor, 'syslog_tcp': SC4SEventIngestor, 'syslog_udp': None, ... | Module for helper methods for ingestors. | IngestorHelper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IngestorHelper:
"""Module for helper methods for ingestors."""
def get_event_ingestor(cls, input_type, ingest_meta_data):
"""Based on the input_type of the event, it returns an appropriate ingestor."""
<|body_0|>
def ingest_events(cls, ingest_meta_data, addon_path, confi... | stack_v2_sparse_classes_36k_train_014076 | 3,294 | permissive | [
{
"docstring": "Based on the input_type of the event, it returns an appropriate ingestor.",
"name": "get_event_ingestor",
"signature": "def get_event_ingestor(cls, input_type, ingest_meta_data)"
},
{
"docstring": "Events are ingested in the splunk. Args: ingest_meta_data(dict): Dictionary of req... | 2 | stack_v2_sparse_classes_30k_train_018680 | Implement the Python class `IngestorHelper` described below.
Class description:
Module for helper methods for ingestors.
Method signatures and docstrings:
- def get_event_ingestor(cls, input_type, ingest_meta_data): Based on the input_type of the event, it returns an appropriate ingestor.
- def ingest_events(cls, ing... | Implement the Python class `IngestorHelper` described below.
Class description:
Module for helper methods for ingestors.
Method signatures and docstrings:
- def get_event_ingestor(cls, input_type, ingest_meta_data): Based on the input_type of the event, it returns an appropriate ingestor.
- def ingest_events(cls, ing... | 1600f2c7d30ec304e9855642e63511780556b406 | <|skeleton|>
class IngestorHelper:
"""Module for helper methods for ingestors."""
def get_event_ingestor(cls, input_type, ingest_meta_data):
"""Based on the input_type of the event, it returns an appropriate ingestor."""
<|body_0|>
def ingest_events(cls, ingest_meta_data, addon_path, confi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IngestorHelper:
"""Module for helper methods for ingestors."""
def get_event_ingestor(cls, input_type, ingest_meta_data):
"""Based on the input_type of the event, it returns an appropriate ingestor."""
ingest_methods = {'modinput': HECEventIngestor, 'windows_input': HECEventIngestor, 'fil... | the_stack_v2_python_sparse | pytest_splunk_addon/standard_lib/event_ingestors/ingestor_helper.py | monishshah18/pytest-splunk-addon | train | 0 |
260e8b84b1e48c39c0961a5ee70432922e837ae5 | [
"super().__init__(master, **options)\nself.pack()\nself._player_info = player_info\nself._selected_color_bgr = StringVar(self, '顏色未定')\nself._selected_color_bgr.trace('w', self._update_player_color)\nself._previous_selected_color_bgr = self._selected_color_bgr.get()\nself._setup_layout(color_list)",
"color_label ... | <|body_start_0|>
super().__init__(master, **options)
self.pack()
self._player_info = player_info
self._selected_color_bgr = StringVar(self, '顏色未定')
self._selected_color_bgr.trace('w', self._update_player_color)
self._previous_selected_color_bgr = self._selected_color_bgr.... | The widget for setting and displaying BasicPlayerInfo or its derived class Usage: ``` playerInfoWidget = PlayerInfoWidget(...) playerInfoWidget.pack() playerInfoWidget.refresh() # To reflect the changes in BasicPlayerInfo ``` @var _player_info The object of BasicPlayerInfo or its derived class that binds to this widget... | BasicPlayerInfoWidget | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicPlayerInfoWidget:
"""The widget for setting and displaying BasicPlayerInfo or its derived class Usage: ``` playerInfoWidget = PlayerInfoWidget(...) playerInfoWidget.pack() playerInfoWidget.refresh() # To reflect the changes in BasicPlayerInfo ``` @var _player_info The object of BasicPlayerIn... | stack_v2_sparse_classes_36k_train_014077 | 8,055 | no_license | [
{
"docstring": "Constructor Constructor will invoke BasicPlayerInfoWidget._setup_layout() to setup its layout. @param master Specify he parent widget @param player_info Specify the target player information to be shwon @param color_list Specify he selectable color for this player. It will be a list of string re... | 5 | stack_v2_sparse_classes_30k_train_012544 | Implement the Python class `BasicPlayerInfoWidget` described below.
Class description:
The widget for setting and displaying BasicPlayerInfo or its derived class Usage: ``` playerInfoWidget = PlayerInfoWidget(...) playerInfoWidget.pack() playerInfoWidget.refresh() # To reflect the changes in BasicPlayerInfo ``` @var _... | Implement the Python class `BasicPlayerInfoWidget` described below.
Class description:
The widget for setting and displaying BasicPlayerInfo or its derived class Usage: ``` playerInfoWidget = PlayerInfoWidget(...) playerInfoWidget.pack() playerInfoWidget.refresh() # To reflect the changes in BasicPlayerInfo ``` @var _... | dc695322095b2eae4527fcdd33cf6304fbf39600 | <|skeleton|>
class BasicPlayerInfoWidget:
"""The widget for setting and displaying BasicPlayerInfo or its derived class Usage: ``` playerInfoWidget = PlayerInfoWidget(...) playerInfoWidget.pack() playerInfoWidget.refresh() # To reflect the changes in BasicPlayerInfo ``` @var _player_info The object of BasicPlayerIn... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasicPlayerInfoWidget:
"""The widget for setting and displaying BasicPlayerInfo or its derived class Usage: ``` playerInfoWidget = PlayerInfoWidget(...) playerInfoWidget.pack() playerInfoWidget.refresh() # To reflect the changes in BasicPlayerInfo ``` @var _player_info The object of BasicPlayerInfo or its der... | the_stack_v2_python_sparse | game_essential/game_widgets.py | LanKuDot/MazeArena-Console | train | 0 |
2b2e7bf1fe370a6c91f483a5be2ba4c7456b5615 | [
"bot = SlackHandler()\nuser = self.event['user']\nargs = self.arg_string.split()\nmessage = self.process_attr(args, user)\nbot.make_post(self.event, message)",
"commands = {'get': self.get_key, 'set': self.set_key, 'list': self.list_keys, 'delete': self.delete_key}\ncommand = args[0]\nargs = args[1:]\nif command ... | <|body_start_0|>
bot = SlackHandler()
user = self.event['user']
args = self.arg_string.split()
message = self.process_attr(args, user)
bot.make_post(self.event, message)
<|end_body_0|>
<|body_start_1|>
commands = {'get': self.get_key, 'set': self.set_key, 'list': self.li... | Misc. key/value storage for player stats. | AttrPlugin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttrPlugin:
"""Misc. key/value storage for player stats."""
def run(self):
"""Run Attr Plugin."""
<|body_0|>
def process_attr(self, args, user):
"""Process attribute roll."""
<|body_1|>
def get_key(self, args, user):
"""Get saved key."""
... | stack_v2_sparse_classes_36k_train_014078 | 2,623 | permissive | [
{
"docstring": "Run Attr Plugin.",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "Process attribute roll.",
"name": "process_attr",
"signature": "def process_attr(self, args, user)"
},
{
"docstring": "Get saved key.",
"name": "get_key",
"signature": "def g... | 6 | stack_v2_sparse_classes_30k_train_015492 | Implement the Python class `AttrPlugin` described below.
Class description:
Misc. key/value storage for player stats.
Method signatures and docstrings:
- def run(self): Run Attr Plugin.
- def process_attr(self, args, user): Process attribute roll.
- def get_key(self, args, user): Get saved key.
- def set_key(self, ar... | Implement the Python class `AttrPlugin` described below.
Class description:
Misc. key/value storage for player stats.
Method signatures and docstrings:
- def run(self): Run Attr Plugin.
- def process_attr(self, args, user): Process attribute roll.
- def get_key(self, args, user): Get saved key.
- def set_key(self, ar... | 715c14d3a06d8a7a8771572371b67cc87c7e17fb | <|skeleton|>
class AttrPlugin:
"""Misc. key/value storage for player stats."""
def run(self):
"""Run Attr Plugin."""
<|body_0|>
def process_attr(self, args, user):
"""Process attribute roll."""
<|body_1|>
def get_key(self, args, user):
"""Get saved key."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AttrPlugin:
"""Misc. key/value storage for player stats."""
def run(self):
"""Run Attr Plugin."""
bot = SlackHandler()
user = self.event['user']
args = self.arg_string.split()
message = self.process_attr(args, user)
bot.make_post(self.event, message)
d... | the_stack_v2_python_sparse | src/dungeonbot/plugins/attribute.py | DungeonBot/dungeonbot | train | 0 |
8f6e1d5da62393878c40893030382110d052af80 | [
"argvalidate('can_create_update_request', [{'arg': account, 'instance': models.Account, 'allow_none': False, 'arg_name': 'account'}, {'arg': journal, 'instance': models.Journal, 'allow_none': False, 'arg_name': 'journal'}], exceptions.ArgumentException)\nif account.is_super:\n return True\nif not account.has_rol... | <|body_start_0|>
argvalidate('can_create_update_request', [{'arg': account, 'instance': models.Account, 'allow_none': False, 'arg_name': 'account'}, {'arg': journal, 'instance': models.Journal, 'allow_none': False, 'arg_name': 'journal'}], exceptions.ArgumentException)
if account.is_super:
r... | ~~AuthNZ:Service->AuthNZ:Feature~~ | AuthorisationService | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AuthorisationService:
"""~~AuthNZ:Service->AuthNZ:Feature~~"""
def can_create_update_request(self, account, journal):
"""Is the given account allowed to create an update request from the given journal :param account: the account doing the action :param journal: the journal the accoun... | stack_v2_sparse_classes_36k_train_014079 | 5,958 | permissive | [
{
"docstring": "Is the given account allowed to create an update request from the given journal :param account: the account doing the action :param journal: the journal the account wants to create an update request from :return:",
"name": "can_create_update_request",
"signature": "def can_create_update_... | 4 | null | Implement the Python class `AuthorisationService` described below.
Class description:
~~AuthNZ:Service->AuthNZ:Feature~~
Method signatures and docstrings:
- def can_create_update_request(self, account, journal): Is the given account allowed to create an update request from the given journal :param account: the accoun... | Implement the Python class `AuthorisationService` described below.
Class description:
~~AuthNZ:Service->AuthNZ:Feature~~
Method signatures and docstrings:
- def can_create_update_request(self, account, journal): Is the given account allowed to create an update request from the given journal :param account: the accoun... | b441932e93a114129539abe4ce79221bd4c7e970 | <|skeleton|>
class AuthorisationService:
"""~~AuthNZ:Service->AuthNZ:Feature~~"""
def can_create_update_request(self, account, journal):
"""Is the given account allowed to create an update request from the given journal :param account: the account doing the action :param journal: the journal the accoun... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AuthorisationService:
"""~~AuthNZ:Service->AuthNZ:Feature~~"""
def can_create_update_request(self, account, journal):
"""Is the given account allowed to create an update request from the given journal :param account: the account doing the action :param journal: the journal the account wants to cr... | the_stack_v2_python_sparse | portality/bll/services/authorisation.py | DOAJ/doaj | train | 56 |
8559c2f788507b799a57b39f8b287b4def241390 | [
"self.cmds = self.master.dialog_data['descdict']\nself.desc = self.master.dialog_data['cmddict']\nfor key, value in self.desc.items():\n if key not in self.cmds and (not value):\n self.cmds[key] = ''\nfor key, value in self.cmds.items():\n if key not in self.desc and (not value):\n self.desc[key... | <|body_start_0|>
self.cmds = self.master.dialog_data['descdict']
self.desc = self.master.dialog_data['cmddict']
for key, value in self.desc.items():
if key not in self.cmds and (not value):
self.cmds[key] = ''
for key, value in self.cmds.items():
i... | (re)definition of generic dialog used in the main program | DcCompleteDialog | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DcCompleteDialog:
"""(re)definition of generic dialog used in the main program"""
def read_data(self):
"""lees eventuele extra commando's"""
<|body_0|>
def build_table(self):
"""vul de tabel met in te voeren gegevens"""
<|body_1|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_36k_train_014080 | 1,839 | permissive | [
{
"docstring": "lees eventuele extra commando's",
"name": "read_data",
"signature": "def read_data(self)"
},
{
"docstring": "vul de tabel met in te voeren gegevens",
"name": "build_table",
"signature": "def build_table(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000557 | Implement the Python class `DcCompleteDialog` described below.
Class description:
(re)definition of generic dialog used in the main program
Method signatures and docstrings:
- def read_data(self): lees eventuele extra commando's
- def build_table(self): vul de tabel met in te voeren gegevens | Implement the Python class `DcCompleteDialog` described below.
Class description:
(re)definition of generic dialog used in the main program
Method signatures and docstrings:
- def read_data(self): lees eventuele extra commando's
- def build_table(self): vul de tabel met in te voeren gegevens
<|skeleton|>
class DcCom... | 2f0df202b5795026b9a7b3fb1c8ca03ba8aac4fd | <|skeleton|>
class DcCompleteDialog:
"""(re)definition of generic dialog used in the main program"""
def read_data(self):
"""lees eventuele extra commando's"""
<|body_0|>
def build_table(self):
"""vul de tabel met in te voeren gegevens"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DcCompleteDialog:
"""(re)definition of generic dialog used in the main program"""
def read_data(self):
"""lees eventuele extra commando's"""
self.cmds = self.master.dialog_data['descdict']
self.desc = self.master.dialog_data['cmddict']
for key, value in self.desc.items():
... | the_stack_v2_python_sparse | plugin_examples/dckeys_qt.py | albertvisser/hotkeys | train | 1 |
143aa43eb0d34469691f51d93b9ad8172b66e583 | [
"def make(cls):\n if isinstance(cls, type):\n return cls()\n return cls\nif isinstance(data, (list, tuple)):\n items = []\n for d in data:\n items.append(Converter.serialize(d, fields))\n if envelope is not None:\n return OrderedDict([(envelope, items)])\n else:\n retur... | <|body_start_0|>
def make(cls):
if isinstance(cls, type):
return cls()
return cls
if isinstance(data, (list, tuple)):
items = []
for d in data:
items.append(Converter.serialize(d, fields))
if envelope is not None... | Converter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Converter:
def serialize(data, fields, envelope=None):
"""Takes raw data (in the form of a dict, list, object) and a dict of fields to output and filters the data based on those fields. :param data: the actual object(s) from which the fields are taken from :param fields: a dict of whose ... | stack_v2_sparse_classes_36k_train_014081 | 6,243 | no_license | [
{
"docstring": "Takes raw data (in the form of a dict, list, object) and a dict of fields to output and filters the data based on those fields. :param data: the actual object(s) from which the fields are taken from :param fields: a dict of whose keys will make up the final serialized response output :param enve... | 6 | stack_v2_sparse_classes_30k_train_009733 | Implement the Python class `Converter` described below.
Class description:
Implement the Converter class.
Method signatures and docstrings:
- def serialize(data, fields, envelope=None): Takes raw data (in the form of a dict, list, object) and a dict of fields to output and filters the data based on those fields. :par... | Implement the Python class `Converter` described below.
Class description:
Implement the Converter class.
Method signatures and docstrings:
- def serialize(data, fields, envelope=None): Takes raw data (in the form of a dict, list, object) and a dict of fields to output and filters the data based on those fields. :par... | b49396f6552567fe1d2c4bcb2f14e5ec44f7dc3b | <|skeleton|>
class Converter:
def serialize(data, fields, envelope=None):
"""Takes raw data (in the form of a dict, list, object) and a dict of fields to output and filters the data based on those fields. :param data: the actual object(s) from which the fields are taken from :param fields: a dict of whose ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Converter:
def serialize(data, fields, envelope=None):
"""Takes raw data (in the form of a dict, list, object) and a dict of fields to output and filters the data based on those fields. :param data: the actual object(s) from which the fields are taken from :param fields: a dict of whose keys will make... | the_stack_v2_python_sparse | ngpy-accounts-manager-api/api/modules/restipy/converter.py | egoettelmann/ngpy-accounts-manager | train | 0 | |
8407d93c02ac5d813a7f0d786cf73735d8d0d23a | [
"if score and page and language and group and author and voter:\n self.score = score\n self.page_id = page.id\n self.language_id = language.id\n self.group_id = group.id\n self.author_id = author.id\n self.voter_id = voter.id",
"if page is None or language is None or group is None or (author is ... | <|body_start_0|>
if score and page and language and group and author and voter:
self.score = score
self.page_id = page.id
self.language_id = language.id
self.group_id = group.id
self.author_id = author.id
self.voter_id = voter.id
<|end_body... | Represents a vote in the database | Vote | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vote:
"""Represents a vote in the database"""
def __init__(self, score, page, language, group, author, voter):
"""Initializes a vote :param score: the score :param page: the page :param language: the language :param group: the group :param author: the author :param voter: the voter""... | stack_v2_sparse_classes_36k_train_014082 | 6,346 | permissive | [
{
"docstring": "Initializes a vote :param score: the score :param page: the page :param language: the language :param group: the group :param author: the author :param voter: the voter",
"name": "__init__",
"signature": "def __init__(self, score, page, language, group, author, voter)"
},
{
"docs... | 5 | stack_v2_sparse_classes_30k_train_000159 | Implement the Python class `Vote` described below.
Class description:
Represents a vote in the database
Method signatures and docstrings:
- def __init__(self, score, page, language, group, author, voter): Initializes a vote :param score: the score :param page: the page :param language: the language :param group: the ... | Implement the Python class `Vote` described below.
Class description:
Represents a vote in the database
Method signatures and docstrings:
- def __init__(self, score, page, language, group, author, voter): Initializes a vote :param score: the score :param page: the page :param language: the language :param group: the ... | 42678afaee6d4b57cfaddb402bc6f15b37fdd027 | <|skeleton|>
class Vote:
"""Represents a vote in the database"""
def __init__(self, score, page, language, group, author, voter):
"""Initializes a vote :param score: the score :param page: the page :param language: the language :param group: the group :param author: the author :param voter: the voter""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Vote:
"""Represents a vote in the database"""
def __init__(self, score, page, language, group, author, voter):
"""Initializes a vote :param score: the score :param page: the page :param language: the language :param group: the group :param author: the author :param voter: the voter"""
if ... | the_stack_v2_python_sparse | annotran/votes/models.py | BirkbeckCTP/annotran | train | 8 |
7a72e1098b6d214adafd93b881d958f43ff0c7fc | [
"self.lg('%s STARTED' % self._testID)\nresponse = self.get_sli_search(keyword='asics')\nself.lg('#. Get SLI search, should succeed')\nself.assertEqual(response.status_code, 200)\nself.assertTrue(response.ok)\n\"\\n self.lg('#. Check response headers, should succeed')\\n [self.assertIn(header, response... | <|body_start_0|>
self.lg('%s STARTED' % self._testID)
response = self.get_sli_search(keyword='asics')
self.lg('#. Get SLI search, should succeed')
self.assertEqual(response.status_code, 200)
self.assertTrue(response.ok)
"\n self.lg('#. Check response headers, shoul... | TestSLI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSLI:
def test001_get_sli_search_with_results(self):
"""TestCase-16: Test case for test get SLI search with results.* **Test Scenario:** #. Get SLI search, should succeed #. Check response headers, should succeed #. Check response body, should succeed"""
<|body_0|>
def te... | stack_v2_sparse_classes_36k_train_014083 | 2,993 | no_license | [
{
"docstring": "TestCase-16: Test case for test get SLI search with results.* **Test Scenario:** #. Get SLI search, should succeed #. Check response headers, should succeed #. Check response body, should succeed",
"name": "test001_get_sli_search_with_results",
"signature": "def test001_get_sli_search_wi... | 2 | stack_v2_sparse_classes_30k_train_020350 | Implement the Python class `TestSLI` described below.
Class description:
Implement the TestSLI class.
Method signatures and docstrings:
- def test001_get_sli_search_with_results(self): TestCase-16: Test case for test get SLI search with results.* **Test Scenario:** #. Get SLI search, should succeed #. Check response ... | Implement the Python class `TestSLI` described below.
Class description:
Implement the TestSLI class.
Method signatures and docstrings:
- def test001_get_sli_search_with_results(self): TestCase-16: Test case for test get SLI search with results.* **Test Scenario:** #. Get SLI search, should succeed #. Check response ... | 9b25ce55fd44976b1b8afc1fb638c1a1b4d3589d | <|skeleton|>
class TestSLI:
def test001_get_sli_search_with_results(self):
"""TestCase-16: Test case for test get SLI search with results.* **Test Scenario:** #. Get SLI search, should succeed #. Check response headers, should succeed #. Check response body, should succeed"""
<|body_0|>
def te... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestSLI:
def test001_get_sli_search_with_results(self):
"""TestCase-16: Test case for test get SLI search with results.* **Test Scenario:** #. Get SLI search, should succeed #. Check response headers, should succeed #. Check response body, should succeed"""
self.lg('%s STARTED' % self._testID)... | the_stack_v2_python_sparse | mobile_api_testing/testsuite/test_sli.py | simplymahmoud/sss-scripts | train | 0 | |
979aebc37371b22765229798a6b90b05aa79b069 | [
"f = forgotpassword(self.driver)\nf.goto_forgotpassword()\nf.send_code()\nself.assertEqual(f.error_hint(), '忘记密码:请输入正确的邮箱地址')\nfunction.screenshot(self.driver, 'forgot_password_email_invalid.jpg')",
"f = forgotpassword(self.driver)\nf.goto_forgotpassword()\nf.forgot_password(Data.realemail)\nf.save()\nself.assert... | <|body_start_0|>
f = forgotpassword(self.driver)
f.goto_forgotpassword()
f.send_code()
self.assertEqual(f.error_hint(), '忘记密码:请输入正确的邮箱地址')
function.screenshot(self.driver, 'forgot_password_email_invalid.jpg')
<|end_body_0|>
<|body_start_1|>
f = forgotpassword(self.driver... | Test007_ForgotPassword_Error | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test007_ForgotPassword_Error:
def test_forgot_password_error1(self):
"""邮箱地址为空"""
<|body_0|>
def test_forgot_password_error2(self):
"""其他输入为空"""
<|body_1|>
def test_forgot_password_error3(self):
"""验证码错误"""
<|body_2|>
def test_forgot... | stack_v2_sparse_classes_36k_train_014084 | 2,814 | no_license | [
{
"docstring": "邮箱地址为空",
"name": "test_forgot_password_error1",
"signature": "def test_forgot_password_error1(self)"
},
{
"docstring": "其他输入为空",
"name": "test_forgot_password_error2",
"signature": "def test_forgot_password_error2(self)"
},
{
"docstring": "验证码错误",
"name": "tes... | 6 | stack_v2_sparse_classes_30k_train_018828 | Implement the Python class `Test007_ForgotPassword_Error` described below.
Class description:
Implement the Test007_ForgotPassword_Error class.
Method signatures and docstrings:
- def test_forgot_password_error1(self): 邮箱地址为空
- def test_forgot_password_error2(self): 其他输入为空
- def test_forgot_password_error3(self): 验证码... | Implement the Python class `Test007_ForgotPassword_Error` described below.
Class description:
Implement the Test007_ForgotPassword_Error class.
Method signatures and docstrings:
- def test_forgot_password_error1(self): 邮箱地址为空
- def test_forgot_password_error2(self): 其他输入为空
- def test_forgot_password_error3(self): 验证码... | 6f42c25249fc642cecc270578a180820988d45b5 | <|skeleton|>
class Test007_ForgotPassword_Error:
def test_forgot_password_error1(self):
"""邮箱地址为空"""
<|body_0|>
def test_forgot_password_error2(self):
"""其他输入为空"""
<|body_1|>
def test_forgot_password_error3(self):
"""验证码错误"""
<|body_2|>
def test_forgot... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test007_ForgotPassword_Error:
def test_forgot_password_error1(self):
"""邮箱地址为空"""
f = forgotpassword(self.driver)
f.goto_forgotpassword()
f.send_code()
self.assertEqual(f.error_hint(), '忘记密码:请输入正确的邮箱地址')
function.screenshot(self.driver, 'forgot_password_email_in... | the_stack_v2_python_sparse | GlxssLive_web/TestCase/User/Test007_forgotpassword_error.py | rrmiracle/GlxssLive | train | 0 | |
1b3538cb8b6ddc9180fb62f925ab213932bb6415 | [
"self.minBit = minBit\nself.nBits = nBits\nself.desc = desc",
"reg_shift = regVal / 2 ** self.minBit\nreg_mod = reg_shift % 2 ** self.nBits\nreturn reg_mod"
] | <|body_start_0|>
self.minBit = minBit
self.nBits = nBits
self.desc = desc
<|end_body_0|>
<|body_start_1|>
reg_shift = regVal / 2 ** self.minBit
reg_mod = reg_shift % 2 ** self.nBits
return reg_mod
<|end_body_1|>
| Describe meaning of a register bit-set | RegisterFieldInfo | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegisterFieldInfo:
"""Describe meaning of a register bit-set"""
def __init__(self, minBit, nBits, desc):
"""fieldName - name of bitfield withing register minBit - LSB of field (numbered from 0) nBits - size of bit-field desc - txt description"""
<|body_0|>
def extractVal... | stack_v2_sparse_classes_36k_train_014085 | 9,121 | permissive | [
{
"docstring": "fieldName - name of bitfield withing register minBit - LSB of field (numbered from 0) nBits - size of bit-field desc - txt description",
"name": "__init__",
"signature": "def __init__(self, minBit, nBits, desc)"
},
{
"docstring": "Extract register field value (as integer) from fu... | 2 | stack_v2_sparse_classes_30k_train_015329 | Implement the Python class `RegisterFieldInfo` described below.
Class description:
Describe meaning of a register bit-set
Method signatures and docstrings:
- def __init__(self, minBit, nBits, desc): fieldName - name of bitfield withing register minBit - LSB of field (numbered from 0) nBits - size of bit-field desc - ... | Implement the Python class `RegisterFieldInfo` described below.
Class description:
Describe meaning of a register bit-set
Method signatures and docstrings:
- def __init__(self, minBit, nBits, desc): fieldName - name of bitfield withing register minBit - LSB of field (numbered from 0) nBits - size of bit-field desc - ... | 3b824540d8173a24be12316a3821304e4ea20a1f | <|skeleton|>
class RegisterFieldInfo:
"""Describe meaning of a register bit-set"""
def __init__(self, minBit, nBits, desc):
"""fieldName - name of bitfield withing register minBit - LSB of field (numbered from 0) nBits - size of bit-field desc - txt description"""
<|body_0|>
def extractVal... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RegisterFieldInfo:
"""Describe meaning of a register bit-set"""
def __init__(self, minBit, nBits, desc):
"""fieldName - name of bitfield withing register minBit - LSB of field (numbered from 0) nBits - size of bit-field desc - txt description"""
self.minBit = minBit
self.nBits = n... | the_stack_v2_python_sparse | python/LATCRootData.py | fermi-lat/configData | train | 0 |
e5f6c4f6f6f34caf2ab3423fee4dd933f8bd077e | [
"def generate(nums, current):\n if not nums:\n output.append(current)\n for i, n in enumerate(nums):\n if i - 1 >= 0 and nums[i - 1] == n:\n continue\n generate(nums[:i] + nums[i + 1:], [n] + current)\noutput = []\nnums.sort()\ngenerate(nums, [])\nreturn output",
"output = [[... | <|body_start_0|>
def generate(nums, current):
if not nums:
output.append(current)
for i, n in enumerate(nums):
if i - 1 >= 0 and nums[i - 1] == n:
continue
generate(nums[:i] + nums[i + 1:], [n] + current)
output ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def permuteUnique(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def permuteUnique_iterative(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
def permuteUnique_slow(self, nums):
""... | stack_v2_sparse_classes_36k_train_014086 | 2,484 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "permuteUnique",
"signature": "def permuteUnique(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "permuteUnique_iterative",
"signature": "def permuteUnique_iterative(self, nums... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def permuteUnique_iterative(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def permut... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def permuteUnique_iterative(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def permut... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def permuteUnique(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def permuteUnique_iterative(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
def permuteUnique_slow(self, nums):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def permuteUnique(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
def generate(nums, current):
if not nums:
output.append(current)
for i, n in enumerate(nums):
if i - 1 >= 0 and nums[i - 1] == n:
... | the_stack_v2_python_sparse | src/lt_47.py | oxhead/CodingYourWay | train | 0 | |
283747594be99f60c67c39cedfd101a9d2d4dd78 | [
"self.input_type = input_type\nself.input_shape = input_shape\nself.channel_axes = channel_axes",
"if self.per_channel and (self.input_shape is None or self.channel_axes is None):\n raise ValueError('The `input_shape` and `channel_axes` arguments are required when using per-channel quantization.')\nprefix = se... | <|body_start_0|>
self.input_type = input_type
self.input_shape = input_shape
self.channel_axes = channel_axes
<|end_body_0|>
<|body_start_1|>
if self.per_channel and (self.input_shape is None or self.channel_axes is None):
raise ValueError('The `input_shape` and `channel_axe... | SymmetricQuantizerV2 | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SymmetricQuantizerV2:
def set_input_spec(self, input_type: str, input_shape: Optional[List[int]]=None, channel_axes: Optional[List[int]]=None):
"""Sets input tensor specification for the quantizer. :param input_type: Indicates the type of input tensor: `inputs` or `weights`. :param input... | stack_v2_sparse_classes_36k_train_014087 | 5,442 | permissive | [
{
"docstring": "Sets input tensor specification for the quantizer. :param input_type: Indicates the type of input tensor: `inputs` or `weights`. :param input_shape: Shape of the input tensor for which the quantization is applied. Required only for per-channel quantization. :param channel_axes: Axes numbers of t... | 2 | null | Implement the Python class `SymmetricQuantizerV2` described below.
Class description:
Implement the SymmetricQuantizerV2 class.
Method signatures and docstrings:
- def set_input_spec(self, input_type: str, input_shape: Optional[List[int]]=None, channel_axes: Optional[List[int]]=None): Sets input tensor specification ... | Implement the Python class `SymmetricQuantizerV2` described below.
Class description:
Implement the SymmetricQuantizerV2 class.
Method signatures and docstrings:
- def set_input_spec(self, input_type: str, input_shape: Optional[List[int]]=None, channel_axes: Optional[List[int]]=None): Sets input tensor specification ... | c027c8b43c4865d46b8de01d8350dd338ec5a874 | <|skeleton|>
class SymmetricQuantizerV2:
def set_input_spec(self, input_type: str, input_shape: Optional[List[int]]=None, channel_axes: Optional[List[int]]=None):
"""Sets input tensor specification for the quantizer. :param input_type: Indicates the type of input tensor: `inputs` or `weights`. :param input... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SymmetricQuantizerV2:
def set_input_spec(self, input_type: str, input_shape: Optional[List[int]]=None, channel_axes: Optional[List[int]]=None):
"""Sets input tensor specification for the quantizer. :param input_type: Indicates the type of input tensor: `inputs` or `weights`. :param input_shape: Shape ... | the_stack_v2_python_sparse | nncf/experimental/tensorflow/quantization/quantizers.py | openvinotoolkit/nncf | train | 558 | |
927a0f6b59bae99c311ddc4480abf826eb58ed11 | [
"if request.method == 'POST':\n pk = request.data.get('pk', None)\n try:\n art = Help_article.objects.get(id=int(pk))\n except Help_article.DoesNotExist:\n return Response({'status': 0, 'msg': '选择合适的文章'})\n ser = Help_articeSerializers(art).data\n return Response(ser)",
"if request.me... | <|body_start_0|>
if request.method == 'POST':
pk = request.data.get('pk', None)
try:
art = Help_article.objects.get(id=int(pk))
except Help_article.DoesNotExist:
return Response({'status': 0, 'msg': '选择合适的文章'})
ser = Help_articeSeri... | help_article | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class help_article:
def GET_aaticle_as_pk(self, request):
"""获取具体文章"""
<|body_0|>
def GET_search(self, request):
"""搜索"""
<|body_1|>
def Get_article_list(self, request):
"""获取文章列表"""
<|body_2|>
def Get_category_article(self, request):
... | stack_v2_sparse_classes_36k_train_014088 | 7,936 | no_license | [
{
"docstring": "获取具体文章",
"name": "GET_aaticle_as_pk",
"signature": "def GET_aaticle_as_pk(self, request)"
},
{
"docstring": "搜索",
"name": "GET_search",
"signature": "def GET_search(self, request)"
},
{
"docstring": "获取文章列表",
"name": "Get_article_list",
"signature": "def G... | 6 | null | Implement the Python class `help_article` described below.
Class description:
Implement the help_article class.
Method signatures and docstrings:
- def GET_aaticle_as_pk(self, request): 获取具体文章
- def GET_search(self, request): 搜索
- def Get_article_list(self, request): 获取文章列表
- def Get_category_article(self, request): ... | Implement the Python class `help_article` described below.
Class description:
Implement the help_article class.
Method signatures and docstrings:
- def GET_aaticle_as_pk(self, request): 获取具体文章
- def GET_search(self, request): 搜索
- def Get_article_list(self, request): 获取文章列表
- def Get_category_article(self, request): ... | 19c45abe61d34c8c5b43b618f0e86e539645e914 | <|skeleton|>
class help_article:
def GET_aaticle_as_pk(self, request):
"""获取具体文章"""
<|body_0|>
def GET_search(self, request):
"""搜索"""
<|body_1|>
def Get_article_list(self, request):
"""获取文章列表"""
<|body_2|>
def Get_category_article(self, request):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class help_article:
def GET_aaticle_as_pk(self, request):
"""获取具体文章"""
if request.method == 'POST':
pk = request.data.get('pk', None)
try:
art = Help_article.objects.get(id=int(pk))
except Help_article.DoesNotExist:
return Response(... | the_stack_v2_python_sparse | help_center/views.py | DearXXD/community-resource-share | train | 0 | |
bfc492ffc57d1e9cc66ec5a463973e282bf2e60e | [
"if not email:\n raise ValueError('Users must have an email adress')\nemail = self.normalize_email(email)\nuser = self.model(email=email, name=name)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(email, name, password)\nuser.is_superuser = True\nuser.is_staff = ... | <|body_start_0|>
if not email:
raise ValueError('Users must have an email adress')
email = self.normalize_email(email)
user = self.model(email=email, name=name)
user.set_password(password)
user.save(using=self._db)
return user
<|end_body_0|>
<|body_start_1|>
... | Manager for users | UserProfileManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserProfileManager:
"""Manager for users"""
def create_user(self, email, name, password=None):
"""Create a new user"""
<|body_0|>
def create_superuser(self, email, name, password):
"""Create a new superuser"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_014089 | 3,703 | no_license | [
{
"docstring": "Create a new user",
"name": "create_user",
"signature": "def create_user(self, email, name, password=None)"
},
{
"docstring": "Create a new superuser",
"name": "create_superuser",
"signature": "def create_superuser(self, email, name, password)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006505 | Implement the Python class `UserProfileManager` described below.
Class description:
Manager for users
Method signatures and docstrings:
- def create_user(self, email, name, password=None): Create a new user
- def create_superuser(self, email, name, password): Create a new superuser | Implement the Python class `UserProfileManager` described below.
Class description:
Manager for users
Method signatures and docstrings:
- def create_user(self, email, name, password=None): Create a new user
- def create_superuser(self, email, name, password): Create a new superuser
<|skeleton|>
class UserProfileMana... | 7d726739af7392e1c7051d7fdd11bb2c5339e030 | <|skeleton|>
class UserProfileManager:
"""Manager for users"""
def create_user(self, email, name, password=None):
"""Create a new user"""
<|body_0|>
def create_superuser(self, email, name, password):
"""Create a new superuser"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserProfileManager:
"""Manager for users"""
def create_user(self, email, name, password=None):
"""Create a new user"""
if not email:
raise ValueError('Users must have an email adress')
email = self.normalize_email(email)
user = self.model(email=email, name=name... | the_stack_v2_python_sparse | api/models.py | OpenSpaceData/api.openspacedata.org | train | 5 |
fe6a0db2ed2b1403fbcb28411ba12014fea84cf6 | [
"self.name = self.__class__.__name__\nself.resources = {}\nself.subdevices = {}",
"if hasattr(self, 'driver') and self.driver == drivers.lgpib:\n if hasattr(self, 'eos_char'):\n self.device.config(gpib.IbcEOSchar, ord(self.eos_char))\n self.device.config(gpib.IbcEOSrd, 1)\n try:\n log.d... | <|body_start_0|>
self.name = self.__class__.__name__
self.resources = {}
self.subdevices = {}
<|end_body_0|>
<|body_start_1|>
if hasattr(self, 'driver') and self.driver == drivers.lgpib:
if hasattr(self, 'eos_char'):
self.device.config(gpib.IbcEOSchar, ord(se... | SuperDevice | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SuperDevice:
def _setup(self):
"""Pre-connection setup."""
<|body_0|>
def _connected(self):
"""Post-connection setup."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.name = self.__class__.__name__
self.resources = {}
self.subdev... | stack_v2_sparse_classes_36k_train_014090 | 18,795 | permissive | [
{
"docstring": "Pre-connection setup.",
"name": "_setup",
"signature": "def _setup(self)"
},
{
"docstring": "Post-connection setup.",
"name": "_connected",
"signature": "def _connected(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005967 | Implement the Python class `SuperDevice` described below.
Class description:
Implement the SuperDevice class.
Method signatures and docstrings:
- def _setup(self): Pre-connection setup.
- def _connected(self): Post-connection setup. | Implement the Python class `SuperDevice` described below.
Class description:
Implement the SuperDevice class.
Method signatures and docstrings:
- def _setup(self): Pre-connection setup.
- def _connected(self): Post-connection setup.
<|skeleton|>
class SuperDevice:
def _setup(self):
"""Pre-connection set... | f319a117fef7189d6dcc91124bd28ab3601e325e | <|skeleton|>
class SuperDevice:
def _setup(self):
"""Pre-connection setup."""
<|body_0|>
def _connected(self):
"""Post-connection setup."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SuperDevice:
def _setup(self):
"""Pre-connection setup."""
self.name = self.__class__.__name__
self.resources = {}
self.subdevices = {}
def _connected(self):
"""Post-connection setup."""
if hasattr(self, 'driver') and self.driver == drivers.lgpib:
... | the_stack_v2_python_sparse | spacq/devices/abstract_device.py | mainCSG/SpanishAcquisitionIQC | train | 1 | |
fa94c5408410bd46a65493293b49a41bcea37d59 | [
"allowed = list(NORM_LOOKUP.keys()) + [None]\nif normalization not in allowed:\n raise ValueError(f'Illegal normalization. Got: {normalization}. Allowed: {allowed}')\nself.normalization = normalization\nself.mean = mean\nself.std = std\nself.model = model\nself.model.eval()\nweight_mat = compute_pyramid_patch_we... | <|body_start_0|>
allowed = list(NORM_LOOKUP.keys()) + [None]
if normalization not in allowed:
raise ValueError(f'Illegal normalization. Got: {normalization}. Allowed: {allowed}')
self.normalization = normalization
self.mean = mean
self.std = std
self.model = m... | Predictor | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Predictor:
def __init__(self, model: nn.Module, patch_size: Tuple[int, int], normalization: str=None, mean: np.ndarray=None, std: np.ndarray=None, device: Union[str, torch.device]='cuda') -> None:
"""Predict dense soft masks with this helper class. Includes a weight matrix that can assig... | stack_v2_sparse_classes_36k_train_014091 | 6,734 | permissive | [
{
"docstring": "Predict dense soft masks with this helper class. Includes a weight matrix that can assign bigger weight on pixels in center and less weight to pixels on image boundary. helps dealing with prediction artifacts on tile boundaries. Parameters ---------- model : nn.Module: nn.Module pytorch model pa... | 3 | null | Implement the Python class `Predictor` described below.
Class description:
Implement the Predictor class.
Method signatures and docstrings:
- def __init__(self, model: nn.Module, patch_size: Tuple[int, int], normalization: str=None, mean: np.ndarray=None, std: np.ndarray=None, device: Union[str, torch.device]='cuda')... | Implement the Python class `Predictor` described below.
Class description:
Implement the Predictor class.
Method signatures and docstrings:
- def __init__(self, model: nn.Module, patch_size: Tuple[int, int], normalization: str=None, mean: np.ndarray=None, std: np.ndarray=None, device: Union[str, torch.device]='cuda')... | 7f79405012eb934b419bbdba8de23f35e840ca85 | <|skeleton|>
class Predictor:
def __init__(self, model: nn.Module, patch_size: Tuple[int, int], normalization: str=None, mean: np.ndarray=None, std: np.ndarray=None, device: Union[str, torch.device]='cuda') -> None:
"""Predict dense soft masks with this helper class. Includes a weight matrix that can assig... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Predictor:
def __init__(self, model: nn.Module, patch_size: Tuple[int, int], normalization: str=None, mean: np.ndarray=None, std: np.ndarray=None, device: Union[str, torch.device]='cuda') -> None:
"""Predict dense soft masks with this helper class. Includes a weight matrix that can assign bigger weigh... | the_stack_v2_python_sparse | cellseg_models_pytorch/inference/predictor.py | okunator/cellseg_models.pytorch | train | 43 | |
0ec659472519cd9e32a6f3a56b0d3e6a7980bbc6 | [
"self.config = config_entry\nself._data = dict(config_entry.data)\nself._errors = {}",
"if user_input is not None:\n self._data.update(user_input)\n return self.async_create_entry(title='', data=self._data)\nreturn await self._show_options_form(user_input)",
"self._errors = {}\nif user_input is not None:\... | <|body_start_0|>
self.config = config_entry
self._data = dict(config_entry.data)
self._errors = {}
<|end_body_0|>
<|body_start_1|>
if user_input is not None:
self._data.update(user_input)
return self.async_create_entry(title='', data=self._data)
return aw... | Options flow for NWS Alerts. | NWSAlertsOptionsFlow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NWSAlertsOptionsFlow:
"""Options flow for NWS Alerts."""
def __init__(self, config_entry):
"""Initialize."""
<|body_0|>
async def async_step_init(self, user_input=None):
"""Manage Mail and Packages options."""
<|body_1|>
async def async_step_gps_loc(... | stack_v2_sparse_classes_36k_train_014092 | 11,142 | no_license | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, config_entry)"
},
{
"docstring": "Manage Mail and Packages options.",
"name": "async_step_init",
"signature": "async def async_step_init(self, user_input=None)"
},
{
"docstring": "Handle a flow ini... | 6 | stack_v2_sparse_classes_30k_train_005774 | Implement the Python class `NWSAlertsOptionsFlow` described below.
Class description:
Options flow for NWS Alerts.
Method signatures and docstrings:
- def __init__(self, config_entry): Initialize.
- async def async_step_init(self, user_input=None): Manage Mail and Packages options.
- async def async_step_gps_loc(self... | Implement the Python class `NWSAlertsOptionsFlow` described below.
Class description:
Options flow for NWS Alerts.
Method signatures and docstrings:
- def __init__(self, config_entry): Initialize.
- async def async_step_init(self, user_input=None): Manage Mail and Packages options.
- async def async_step_gps_loc(self... | 625290c164c60611f501ee773583c06a85281300 | <|skeleton|>
class NWSAlertsOptionsFlow:
"""Options flow for NWS Alerts."""
def __init__(self, config_entry):
"""Initialize."""
<|body_0|>
async def async_step_init(self, user_input=None):
"""Manage Mail and Packages options."""
<|body_1|>
async def async_step_gps_loc(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NWSAlertsOptionsFlow:
"""Options flow for NWS Alerts."""
def __init__(self, config_entry):
"""Initialize."""
self.config = config_entry
self._data = dict(config_entry.data)
self._errors = {}
async def async_step_init(self, user_input=None):
"""Manage Mail and ... | the_stack_v2_python_sparse | custom_components/nws_alerts/config_flow.py | ntalekt/homeassistant | train | 213 |
800a992b573e5f34cd554a5201ea2a3af15634db | [
"self.__capacity = capacity\nself.__q = []\nself.__dic = {}",
"if key not in self.__dic:\n return -1\nself.__q.remove(key)\nself.__q.insert(0, key)\nreturn self.__dic[key]",
"if key in self.__dic:\n self.__q.remove(key)\nif len(self.__q) == self.__capacity:\n k = self.__q.pop()\n del self.__dic[k]\n... | <|body_start_0|>
self.__capacity = capacity
self.__q = []
self.__dic = {}
<|end_body_0|>
<|body_start_1|>
if key not in self.__dic:
return -1
self.__q.remove(key)
self.__q.insert(0, key)
return self.__dic[key]
<|end_body_1|>
<|body_start_2|>
... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: None"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k_train_014093 | 790 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: None",
"name": "pu... | 3 | null | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: None | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: None
<|sk... | d8ed762d1005975f0de4f07760c9671195621c88 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: None"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.__capacity = capacity
self.__q = []
self.__dic = {}
def get(self, key):
""":type key: int :rtype: int"""
if key not in self.__dic:
return -1
self.__q.remove(key)
... | the_stack_v2_python_sparse | lru-cache/solution.py | uxlsl/leetcode_practice | train | 0 | |
3cae711f467f76900f7f38461ad3fd4e0e302a92 | [
"self.used_ifids: DefaultDict[ISD_AS, List[IfId]] = defaultdict(list)\nfor link in topo_file['links']:\n for ep in [LinkEp(link['a']), LinkEp(link['b'])]:\n if ep.ifid:\n self.used_ifids[ep].append(IfId(ep.ifid))\nfor ifids in self.used_ifids.values():\n ifids.sort()",
"ifid = pick_unused_... | <|body_start_0|>
self.used_ifids: DefaultDict[ISD_AS, List[IfId]] = defaultdict(list)
for link in topo_file['links']:
for ep in [LinkEp(link['a']), LinkEp(link['b'])]:
if ep.ifid:
self.used_ifids[ep].append(IfId(ep.ifid))
for ifids in self.used_ifi... | Helper class keeping track of assigned interface identifers per AS. | IfIdMapping | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IfIdMapping:
"""Helper class keeping track of assigned interface identifers per AS."""
def __init__(self, topo_file: MutableMapping[str, Any]):
"""Initializes used interface identifier sets from the given topology file."""
<|body_0|>
def assign_ifid(self, isd_as: ISD_AS)... | stack_v2_sparse_classes_36k_train_014094 | 25,735 | permissive | [
{
"docstring": "Initializes used interface identifier sets from the given topology file.",
"name": "__init__",
"signature": "def __init__(self, topo_file: MutableMapping[str, Any])"
},
{
"docstring": "Returns an unused ifid in the given AS and marks it as used for future calls.",
"name": "as... | 2 | stack_v2_sparse_classes_30k_train_010156 | Implement the Python class `IfIdMapping` described below.
Class description:
Helper class keeping track of assigned interface identifers per AS.
Method signatures and docstrings:
- def __init__(self, topo_file: MutableMapping[str, Any]): Initializes used interface identifier sets from the given topology file.
- def a... | Implement the Python class `IfIdMapping` described below.
Class description:
Helper class keeping track of assigned interface identifers per AS.
Method signatures and docstrings:
- def __init__(self, topo_file: MutableMapping[str, Any]): Initializes used interface identifier sets from the given topology file.
- def a... | 3d06a8fb030b17faec40026d21758ecbfb3d6744 | <|skeleton|>
class IfIdMapping:
"""Helper class keeping track of assigned interface identifers per AS."""
def __init__(self, topo_file: MutableMapping[str, Any]):
"""Initializes used interface identifier sets from the given topology file."""
<|body_0|>
def assign_ifid(self, isd_as: ISD_AS)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IfIdMapping:
"""Helper class keeping track of assigned interface identifers per AS."""
def __init__(self, topo_file: MutableMapping[str, Any]):
"""Initializes used interface identifier sets from the given topology file."""
self.used_ifids: DefaultDict[ISD_AS, List[IfId]] = defaultdict(lis... | the_stack_v2_python_sparse | ixp_testbed/gen/generator.py | lschulz/scion-ixp-testbed | train | 0 |
eaf3581d109eb90977498d2aa8656c0c69b23833 | [
"printCustom('create instance of PyTorchModel ... ', STDOUT_TYPE.INFO)\nself.model_arch = model_arch\nif self.model_arch == 'squeezenet':\n self.model = models.squeezenet1_0(pretrained=True)\nelif self.model_arch == 'vgg16':\n self.model = models.vgg16(pretrained=True)\nelse:\n self.model_arch = None\n ... | <|body_start_0|>
printCustom('create instance of PyTorchModel ... ', STDOUT_TYPE.INFO)
self.model_arch = model_arch
if self.model_arch == 'squeezenet':
self.model = models.squeezenet1_0(pretrained=True)
elif self.model_arch == 'vgg16':
self.model = models.vgg16(pr... | This class is needed to create a specified cnn model architecture and extract the the features. | PyTorchModel | [
"GPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PyTorchModel:
"""This class is needed to create a specified cnn model architecture and extract the the features."""
def __init__(self, model_arch, use_gpu: bool=False):
"""Constructor. :param model_arch: This parameter must hold a string containing a valid model architecture name."""... | stack_v2_sparse_classes_36k_train_014095 | 2,691 | permissive | [
{
"docstring": "Constructor. :param model_arch: This parameter must hold a string containing a valid model architecture name.",
"name": "__init__",
"signature": "def __init__(self, model_arch, use_gpu: bool=False)"
},
{
"docstring": "This method is used to extract features. :param frm: THis para... | 2 | stack_v2_sparse_classes_30k_train_007356 | Implement the Python class `PyTorchModel` described below.
Class description:
This class is needed to create a specified cnn model architecture and extract the the features.
Method signatures and docstrings:
- def __init__(self, model_arch, use_gpu: bool=False): Constructor. :param model_arch: This parameter must hol... | Implement the Python class `PyTorchModel` described below.
Class description:
This class is needed to create a specified cnn model architecture and extract the the features.
Method signatures and docstrings:
- def __init__(self, model_arch, use_gpu: bool=False): Constructor. :param model_arch: This parameter must hol... | f348e3aead7eff4f0a6df5235e53732955b4ff11 | <|skeleton|>
class PyTorchModel:
"""This class is needed to create a specified cnn model architecture and extract the the features."""
def __init__(self, model_arch, use_gpu: bool=False):
"""Constructor. :param model_arch: This parameter must hold a string containing a valid model architecture name."""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PyTorchModel:
"""This class is needed to create a specified cnn model architecture and extract the the features."""
def __init__(self, model_arch, use_gpu: bool=False):
"""Constructor. :param model_arch: This parameter must hold a string containing a valid model architecture name."""
prin... | the_stack_v2_python_sparse | vhh_sbd/Model.py | dahe-cvl/vhh_sbd | train | 0 |
1ca06c76751601c387fe4abb965c861aa79b6c16 | [
"conn_str = 'DATABASE=%s;HOSTNAME=%s;PORT=%d;PROTOCOL=TCPIP;UID=%s;PWD=%s;' % (self._name, self._host, self._port, self._user, self._pass)\nconn = ibm_db.connect(conn_str, '', '')\nif conn:\n return conn\nelse:\n return None",
"fields = flds[:]\nfields.append(self._timefld)\nfields.append(self._msgfld)\nfie... | <|body_start_0|>
conn_str = 'DATABASE=%s;HOSTNAME=%s;PORT=%d;PROTOCOL=TCPIP;UID=%s;PWD=%s;' % (self._name, self._host, self._port, self._user, self._pass)
conn = ibm_db.connect(conn_str, '', '')
if conn:
return conn
else:
return None
<|end_body_0|>
<|body_start_1... | DB2数据库类 | DB2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DB2:
"""DB2数据库类"""
def _getConn(self):
"""连接数据库,获取数据库连接"""
<|body_0|>
def _createSql(self, flds, cpos):
"""生成抽取数据的SQL语句"""
<|body_1|>
def getData(self):
"""抽取数据 flds: 要抽取的字段列表 curpos: 从什么位置开始抽取数据;默认为-1,从0开始读取 fetch_tuple():返回元组,以列的位置索引 fetch_... | stack_v2_sparse_classes_36k_train_014096 | 2,476 | no_license | [
{
"docstring": "连接数据库,获取数据库连接",
"name": "_getConn",
"signature": "def _getConn(self)"
},
{
"docstring": "生成抽取数据的SQL语句",
"name": "_createSql",
"signature": "def _createSql(self, flds, cpos)"
},
{
"docstring": "抽取数据 flds: 要抽取的字段列表 curpos: 从什么位置开始抽取数据;默认为-1,从0开始读取 fetch_tuple():返回元组... | 3 | stack_v2_sparse_classes_30k_train_005899 | Implement the Python class `DB2` described below.
Class description:
DB2数据库类
Method signatures and docstrings:
- def _getConn(self): 连接数据库,获取数据库连接
- def _createSql(self, flds, cpos): 生成抽取数据的SQL语句
- def getData(self): 抽取数据 flds: 要抽取的字段列表 curpos: 从什么位置开始抽取数据;默认为-1,从0开始读取 fetch_tuple():返回元组,以列的位置索引 fetch_tuple():返回字典,以列... | Implement the Python class `DB2` described below.
Class description:
DB2数据库类
Method signatures and docstrings:
- def _getConn(self): 连接数据库,获取数据库连接
- def _createSql(self, flds, cpos): 生成抽取数据的SQL语句
- def getData(self): 抽取数据 flds: 要抽取的字段列表 curpos: 从什么位置开始抽取数据;默认为-1,从0开始读取 fetch_tuple():返回元组,以列的位置索引 fetch_tuple():返回字典,以列... | bc848f400703dec66592c9958a231c7d65e2b4a4 | <|skeleton|>
class DB2:
"""DB2数据库类"""
def _getConn(self):
"""连接数据库,获取数据库连接"""
<|body_0|>
def _createSql(self, flds, cpos):
"""生成抽取数据的SQL语句"""
<|body_1|>
def getData(self):
"""抽取数据 flds: 要抽取的字段列表 curpos: 从什么位置开始抽取数据;默认为-1,从0开始读取 fetch_tuple():返回元组,以列的位置索引 fetch_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DB2:
"""DB2数据库类"""
def _getConn(self):
"""连接数据库,获取数据库连接"""
conn_str = 'DATABASE=%s;HOSTNAME=%s;PORT=%d;PROTOCOL=TCPIP;UID=%s;PWD=%s;' % (self._name, self._host, self._port, self._user, self._pass)
conn = ibm_db.connect(conn_str, '', '')
if conn:
return conn
... | the_stack_v2_python_sparse | mdstack-service_2.2/mdstack-service_2/mdstack-service_2.0/mdstack/dbtools/db2.py | linxuanmax/msql_to_es | train | 0 |
aabecbfd2590ebca627c1889eb75002cc6b2d788 | [
"CommandDecoder.__init__(self, **argv)\nself.target = target\nself.EOL = argv.get('EOL', '\\n')\nself.CID = argv.get('CID', '0')\nself.stripChars = argv.get('stripChars', '')\nself.cmdWrapper = argv.get('cmdWrapper', None)\nself.mid = 1\nif self.debug > 1:\n CPL.log('RawCmdDecoder.init', 'target=%s cmdWrapper=%s... | <|body_start_0|>
CommandDecoder.__init__(self, **argv)
self.target = target
self.EOL = argv.get('EOL', '\n')
self.CID = argv.get('CID', '0')
self.stripChars = argv.get('stripChars', '')
self.cmdWrapper = argv.get('cmdWrapper', None)
self.mid = 1
if self.de... | A Command decoder for accepting commands which have no target, MID, or CID. We know our target, and assign an incrementing MID. In other words, we transform: cmdTxt -> tgt mid cmdTxt | RawCmdDecoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RawCmdDecoder:
"""A Command decoder for accepting commands which have no target, MID, or CID. We know our target, and assign an incrementing MID. In other words, we transform: cmdTxt -> tgt mid cmdTxt"""
def __init__(self, target, **argv):
"""Create ourself. Args: target - the name o... | stack_v2_sparse_classes_36k_train_014097 | 2,626 | no_license | [
{
"docstring": "Create ourself. Args: target - the name of an Actor. Optargs: EOL - the EOL string (default=' ') cmdWrapper - if set, call this command at the target actor, and pass the incoming cmd as an argument.",
"name": "__init__",
"signature": "def __init__(self, target, **argv)"
},
{
"doc... | 2 | null | Implement the Python class `RawCmdDecoder` described below.
Class description:
A Command decoder for accepting commands which have no target, MID, or CID. We know our target, and assign an incrementing MID. In other words, we transform: cmdTxt -> tgt mid cmdTxt
Method signatures and docstrings:
- def __init__(self, t... | Implement the Python class `RawCmdDecoder` described below.
Class description:
A Command decoder for accepting commands which have no target, MID, or CID. We know our target, and assign an incrementing MID. In other words, we transform: cmdTxt -> tgt mid cmdTxt
Method signatures and docstrings:
- def __init__(self, t... | 7824b03e4795c1e40375e587826151ab8f8b09d5 | <|skeleton|>
class RawCmdDecoder:
"""A Command decoder for accepting commands which have no target, MID, or CID. We know our target, and assign an incrementing MID. In other words, we transform: cmdTxt -> tgt mid cmdTxt"""
def __init__(self, target, **argv):
"""Create ourself. Args: target - the name o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RawCmdDecoder:
"""A Command decoder for accepting commands which have no target, MID, or CID. We know our target, and assign an incrementing MID. In other words, we transform: cmdTxt -> tgt mid cmdTxt"""
def __init__(self, target, **argv):
"""Create ourself. Args: target - the name of an Actor. O... | the_stack_v2_python_sparse | Hub/Command/Decoders/RawCmdDecoder.py | Subaru-PFS/tron_tron | train | 0 |
e4d01b0e01d0c69f5a144e96a45c09824890e48d | [
"if not envelopes:\n return 0\nenvelopes = sorted(envelopes, key=lambda x: (x[0], -x[1]))\nenvelopes_height = [x[1] for x in envelopes]\nreturn self.LIS(envelopes_height)",
"def binary_search(l, r, nums, target):\n while r - l > 1:\n m = l + (r - l) // 2\n if nums[m] >= target:\n r ... | <|body_start_0|>
if not envelopes:
return 0
envelopes = sorted(envelopes, key=lambda x: (x[0], -x[1]))
envelopes_height = [x[1] for x in envelopes]
return self.LIS(envelopes_height)
<|end_body_0|>
<|body_start_1|>
def binary_search(l, r, nums, target):
wh... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxEnvelopes(self, envelopes):
""":type envelopes: List[List[int]] :rtype: int"""
<|body_0|>
def LIS(self, nums):
"""Longest increasing sequences"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not envelopes:
return 0
... | stack_v2_sparse_classes_36k_train_014098 | 2,063 | no_license | [
{
"docstring": ":type envelopes: List[List[int]] :rtype: int",
"name": "maxEnvelopes",
"signature": "def maxEnvelopes(self, envelopes)"
},
{
"docstring": "Longest increasing sequences",
"name": "LIS",
"signature": "def LIS(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000821 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int
- def LIS(self, nums): Longest increasing sequences | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int
- def LIS(self, nums): Longest increasing sequences
<|skeleton|>
class Solution:
def maxEnve... | 4de7d3ea9aaa2e0cb2d934816036ced2357205ac | <|skeleton|>
class Solution:
def maxEnvelopes(self, envelopes):
""":type envelopes: List[List[int]] :rtype: int"""
<|body_0|>
def LIS(self, nums):
"""Longest increasing sequences"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxEnvelopes(self, envelopes):
""":type envelopes: List[List[int]] :rtype: int"""
if not envelopes:
return 0
envelopes = sorted(envelopes, key=lambda x: (x[0], -x[1]))
envelopes_height = [x[1] for x in envelopes]
return self.LIS(envelopes_heigh... | the_stack_v2_python_sparse | 354_russian_doll_envelopes.py | nshung2010/leet_code | train | 0 | |
62f05792f20bf5cff9761ca23035483296156426 | [
"for image_url in item['image_urls']:\n image_url = 'http:' + image_url\n yield scrapy.Request(image_url)",
"image_paths = [x['path'] for ok, x in results if ok]\nif not image_paths:\n raise DropItem('Item contains no images')\nreturn item"
] | <|body_start_0|>
for image_url in item['image_urls']:
image_url = 'http:' + image_url
yield scrapy.Request(image_url)
<|end_body_0|>
<|body_start_1|>
image_paths = [x['path'] for ok, x in results if ok]
if not image_paths:
raise DropItem('Item contains no ima... | JiandanPipeline | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JiandanPipeline:
def get_media_requests(self, item, info):
""":param item: :param info: :return: 在工作流程中可以看到, 管道会得到文件的URL并从项目中下载。 为了这么做,你需要重写 get_media_requests() 方法, 并对各个图片URL返回一个Request:"""
<|body_0|>
def item_completed(self, results, item, info):
""":param results:... | stack_v2_sparse_classes_36k_train_014099 | 2,344 | permissive | [
{
"docstring": ":param item: :param info: :return: 在工作流程中可以看到, 管道会得到文件的URL并从项目中下载。 为了这么做,你需要重写 get_media_requests() 方法, 并对各个图片URL返回一个Request:",
"name": "get_media_requests",
"signature": "def get_media_requests(self, item, info)"
},
{
"docstring": ":param results: :param item: :param info: :retu... | 2 | stack_v2_sparse_classes_30k_train_011545 | Implement the Python class `JiandanPipeline` described below.
Class description:
Implement the JiandanPipeline class.
Method signatures and docstrings:
- def get_media_requests(self, item, info): :param item: :param info: :return: 在工作流程中可以看到, 管道会得到文件的URL并从项目中下载。 为了这么做,你需要重写 get_media_requests() 方法, 并对各个图片URL返回一个Reque... | Implement the Python class `JiandanPipeline` described below.
Class description:
Implement the JiandanPipeline class.
Method signatures and docstrings:
- def get_media_requests(self, item, info): :param item: :param info: :return: 在工作流程中可以看到, 管道会得到文件的URL并从项目中下载。 为了这么做,你需要重写 get_media_requests() 方法, 并对各个图片URL返回一个Reque... | 8933c7a6d444d3d86a173984e6cf4c08dbf84039 | <|skeleton|>
class JiandanPipeline:
def get_media_requests(self, item, info):
""":param item: :param info: :return: 在工作流程中可以看到, 管道会得到文件的URL并从项目中下载。 为了这么做,你需要重写 get_media_requests() 方法, 并对各个图片URL返回一个Request:"""
<|body_0|>
def item_completed(self, results, item, info):
""":param results:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JiandanPipeline:
def get_media_requests(self, item, info):
""":param item: :param info: :return: 在工作流程中可以看到, 管道会得到文件的URL并从项目中下载。 为了这么做,你需要重写 get_media_requests() 方法, 并对各个图片URL返回一个Request:"""
for image_url in item['image_urls']:
image_url = 'http:' + image_url
yield scra... | the_stack_v2_python_sparse | jiandan/jiandan/pipelines.py | MisterZhouZhou/pythonLearn | train | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.