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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
daf7ce02d1a3d3a275d7e2a771f708388619e0df | [
"self.log.info('login from QQ')\ncode = context.get('code')\nredirect_uri = context.get('redirect_uri')\nif not code or not redirect_uri:\n return None\naccess_token = self.get_token(code, redirect_uri)\ninfo = self.get_info(access_token)\nuser_info = self.get_user_info(access_token, info['openid'], info['client... | <|body_start_0|>
self.log.info('login from QQ')
code = context.get('code')
redirect_uri = context.get('redirect_uri')
if not code or not redirect_uri:
return None
access_token = self.get_token(code, redirect_uri)
info = self.get_info(access_token)
user... | Sign in with QQ :Example: from client.user.login import QQLogin QQLogin() .. notes:: | QQLogin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QQLogin:
"""Sign in with QQ :Example: from client.user.login import QQLogin QQLogin() .. notes::"""
def login(self, context):
"""QQ Login :type context: Context :param context: :rtype: dict :return: token and instance of user"""
<|body_0|>
def get_token(self, code, redir... | stack_v2_sparse_classes_36k_train_014600 | 17,886 | permissive | [
{
"docstring": "QQ Login :type context: Context :param context: :rtype: dict :return: token and instance of user",
"name": "login",
"signature": "def login(self, context)"
},
{
"docstring": "Get qq access token :type code: str :param code: authorization code :type redirect_uri: str :param redire... | 4 | stack_v2_sparse_classes_30k_train_014887 | Implement the Python class `QQLogin` described below.
Class description:
Sign in with QQ :Example: from client.user.login import QQLogin QQLogin() .. notes::
Method signatures and docstrings:
- def login(self, context): QQ Login :type context: Context :param context: :rtype: dict :return: token and instance of user
-... | Implement the Python class `QQLogin` described below.
Class description:
Sign in with QQ :Example: from client.user.login import QQLogin QQLogin() .. notes::
Method signatures and docstrings:
- def login(self, context): QQ Login :type context: Context :param context: :rtype: dict :return: token and instance of user
-... | 945c4fd2755f5b0dea11e54eb649eeb37ec93d01 | <|skeleton|>
class QQLogin:
"""Sign in with QQ :Example: from client.user.login import QQLogin QQLogin() .. notes::"""
def login(self, context):
"""QQ Login :type context: Context :param context: :rtype: dict :return: token and instance of user"""
<|body_0|>
def get_token(self, code, redir... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QQLogin:
"""Sign in with QQ :Example: from client.user.login import QQLogin QQLogin() .. notes::"""
def login(self, context):
"""QQ Login :type context: Context :param context: :rtype: dict :return: token and instance of user"""
self.log.info('login from QQ')
code = context.get('c... | the_stack_v2_python_sparse | open-hackathon-server/src/hackathon/user/oauth_login.py | kaiyuanshe/open-hackathon | train | 46 |
a845898fa5edfc140140448855f78767fd63d1d0 | [
"assert start <= end\nif array[start] != target:\n return -1\nelif start == end:\n return start\ni = start\nstep = 1\nwhile True:\n if i == end:\n return i\n j = i + step\n step *= 2\n if j > end or array[j] != target:\n candidate = self.lastIndexOf(array, target, i + 1, end)\n ... | <|body_start_0|>
assert start <= end
if array[start] != target:
return -1
elif start == end:
return start
i = start
step = 1
while True:
if i == end:
return i
j = i + step
step *= 2
if... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lastIndexOf(self, array, target, start, end):
"""Finds the last index of target in range [start...end] of array. Returns -1 if the target does not exist. The array is expected to be sorted in ascending order and array[start] must be the target for the search to continue."""... | stack_v2_sparse_classes_36k_train_014601 | 2,903 | permissive | [
{
"docstring": "Finds the last index of target in range [start...end] of array. Returns -1 if the target does not exist. The array is expected to be sorted in ascending order and array[start] must be the target for the search to continue.",
"name": "lastIndexOf",
"signature": "def lastIndexOf(self, arra... | 2 | stack_v2_sparse_classes_30k_train_009016 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lastIndexOf(self, array, target, start, end): Finds the last index of target in range [start...end] of array. Returns -1 if the target does not exist. The array is expected t... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lastIndexOf(self, array, target, start, end): Finds the last index of target in range [start...end] of array. Returns -1 if the target does not exist. The array is expected t... | 363848b7870c8d90f5be0d345204c0bf8eb45daa | <|skeleton|>
class Solution:
def lastIndexOf(self, array, target, start, end):
"""Finds the last index of target in range [start...end] of array. Returns -1 if the target does not exist. The array is expected to be sorted in ascending order and array[start] must be the target for the search to continue."""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lastIndexOf(self, array, target, start, end):
"""Finds the last index of target in range [start...end] of array. Returns -1 if the target does not exist. The array is expected to be sorted in ascending order and array[start] must be the target for the search to continue."""
asser... | the_stack_v2_python_sparse | leetcode/algorithms/remove-duplicates-from-sorted-array-ii/solution.py | kgashok/algorithms | train | 1 | |
d8bfd1aef061f953390c4f6649b4f91f03191c74 | [
"try:\n self.cnx = psycopg2.connect(host='ec2-75-101-131-79.compute-1.amazonaws.com', user='dkbzkfrfpbnilt', password='7bf3491ccd38dcb5de2c4dd5ae07615a4b3c89dcea2ca9e104e517d569fcfac9', database='dd278jhf0njsd5')\n self.cursor = self.cnx.cursor(cursor_factory=psycopg2.extras.DictCursor)\n print('Successful... | <|body_start_0|>
try:
self.cnx = psycopg2.connect(host='ec2-75-101-131-79.compute-1.amazonaws.com', user='dkbzkfrfpbnilt', password='7bf3491ccd38dcb5de2c4dd5ae07615a4b3c89dcea2ca9e104e517d569fcfac9', database='dd278jhf0njsd5')
self.cursor = self.cnx.cursor(cursor_factory=psycopg2.extras.... | PostGres | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PostGres:
def __init__(self):
"""This class handles all interactions to the mysql database"""
<|body_0|>
def selectQuery(self, sql):
"""This functions gets / reads content from the database"""
<|body_1|>
def insertQuery(self, sql):
"""This functi... | stack_v2_sparse_classes_36k_train_014602 | 1,351 | no_license | [
{
"docstring": "This class handles all interactions to the mysql database",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "This functions gets / reads content from the database",
"name": "selectQuery",
"signature": "def selectQuery(self, sql)"
},
{
"docs... | 4 | stack_v2_sparse_classes_30k_train_016569 | Implement the Python class `PostGres` described below.
Class description:
Implement the PostGres class.
Method signatures and docstrings:
- def __init__(self): This class handles all interactions to the mysql database
- def selectQuery(self, sql): This functions gets / reads content from the database
- def insertQuer... | Implement the Python class `PostGres` described below.
Class description:
Implement the PostGres class.
Method signatures and docstrings:
- def __init__(self): This class handles all interactions to the mysql database
- def selectQuery(self, sql): This functions gets / reads content from the database
- def insertQuer... | 4afc6e2286dbc4192c1a8c0e1c9facb63cf925ce | <|skeleton|>
class PostGres:
def __init__(self):
"""This class handles all interactions to the mysql database"""
<|body_0|>
def selectQuery(self, sql):
"""This functions gets / reads content from the database"""
<|body_1|>
def insertQuery(self, sql):
"""This functi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PostGres:
def __init__(self):
"""This class handles all interactions to the mysql database"""
try:
self.cnx = psycopg2.connect(host='ec2-75-101-131-79.compute-1.amazonaws.com', user='dkbzkfrfpbnilt', password='7bf3491ccd38dcb5de2c4dd5ae07615a4b3c89dcea2ca9e104e517d569fcfac9', datab... | the_stack_v2_python_sparse | Ashesi Support Chatbot/CapstoneFinalProduct/libraries/postgres.py | mdekudugu/nlp-ashesi | train | 0 | |
ce44d75b82e3aa60e4803b10c7779840c1a907f6 | [
"if not datas:\n datas = {}\nif not context:\n context = {}\nif 'updated' not in datas:\n datas['updated'] = False\nreturn super(osv.osv, self).write(cr, uid, ids, datas, context)",
"if not context:\n context = {}\nserver_id = self.pool.get('prestashop.config').search(cr, uid, [('prestashop_flag', '='... | <|body_start_0|>
if not datas:
datas = {}
if not context:
context = {}
if 'updated' not in datas:
datas['updated'] = False
return super(osv.osv, self).write(cr, uid, ids, datas, context)
<|end_body_0|>
<|body_start_1|>
if not context:
... | A tax object. Inherited for prestashop synch | prestashop_tax | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class prestashop_tax:
"""A tax object. Inherited for prestashop synch"""
def write(self, cr, uid, ids, datas=None, context=None):
"""Base method overridden for custom approach"""
<|body_0|>
def prestashop_sync(self, cr, uid, tax_ids, context):
"""Creates and update tax... | stack_v2_sparse_classes_36k_train_014603 | 6,847 | no_license | [
{
"docstring": "Base method overridden for custom approach",
"name": "write",
"signature": "def write(self, cr, uid, ids, datas=None, context=None)"
},
{
"docstring": "Creates and update tax in openerp",
"name": "prestashop_sync",
"signature": "def prestashop_sync(self, cr, uid, tax_ids,... | 5 | stack_v2_sparse_classes_30k_train_012557 | Implement the Python class `prestashop_tax` described below.
Class description:
A tax object. Inherited for prestashop synch
Method signatures and docstrings:
- def write(self, cr, uid, ids, datas=None, context=None): Base method overridden for custom approach
- def prestashop_sync(self, cr, uid, tax_ids, context): C... | Implement the Python class `prestashop_tax` described below.
Class description:
A tax object. Inherited for prestashop synch
Method signatures and docstrings:
- def write(self, cr, uid, ids, datas=None, context=None): Base method overridden for custom approach
- def prestashop_sync(self, cr, uid, tax_ids, context): C... | 1081f3a5ff8864a31b2dcd89406fac076a908e78 | <|skeleton|>
class prestashop_tax:
"""A tax object. Inherited for prestashop synch"""
def write(self, cr, uid, ids, datas=None, context=None):
"""Base method overridden for custom approach"""
<|body_0|>
def prestashop_sync(self, cr, uid, tax_ids, context):
"""Creates and update tax... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class prestashop_tax:
"""A tax object. Inherited for prestashop synch"""
def write(self, cr, uid, ids, datas=None, context=None):
"""Base method overridden for custom approach"""
if not datas:
datas = {}
if not context:
context = {}
if 'updated' not in da... | the_stack_v2_python_sparse | extra-addons/prestashop/tax.py | sgeerish/sirr_production | train | 0 |
ac98909cde9109de9c8af1576271d038020356d9 | [
"super(EncoderBlock, self).__init__()\nself.mha = MultiHeadAttention(dm, h)\nself.dense_hidden = tf.keras.layers.Dense(units=hidden, activation='relu')\nself.dense_output = tf.keras.layers.Dense(units=dm)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.layernorm2 = tf.keras.layers.LayerNo... | <|body_start_0|>
super(EncoderBlock, self).__init__()
self.mha = MultiHeadAttention(dm, h)
self.dense_hidden = tf.keras.layers.Dense(units=hidden, activation='relu')
self.dense_output = tf.keras.layers.Dense(units=dm)
self.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1... | Create encoder block for a transformer | EncoderBlock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EncoderBlock:
"""Create encoder block for a transformer"""
def __init__(self, dm, h, hidden, drop_rate=0.1):
"""constructor @dm: dimensionality of the model @h: number of heads @hidden: number of hidden units in the fully connected layer @drop_rate: dropout rate *Sets the following p... | stack_v2_sparse_classes_36k_train_014604 | 2,364 | no_license | [
{
"docstring": "constructor @dm: dimensionality of the model @h: number of heads @hidden: number of hidden units in the fully connected layer @drop_rate: dropout rate *Sets the following public instance attributes: @mha: a MultiHeadAttention layer @dense_hidden: hidden dense layer with hidden units and relu act... | 2 | null | Implement the Python class `EncoderBlock` described below.
Class description:
Create encoder block for a transformer
Method signatures and docstrings:
- def __init__(self, dm, h, hidden, drop_rate=0.1): constructor @dm: dimensionality of the model @h: number of heads @hidden: number of hidden units in the fully conne... | Implement the Python class `EncoderBlock` described below.
Class description:
Create encoder block for a transformer
Method signatures and docstrings:
- def __init__(self, dm, h, hidden, drop_rate=0.1): constructor @dm: dimensionality of the model @h: number of heads @hidden: number of hidden units in the fully conne... | e20b284d5f1841952104d7d9a0274cff80eb304d | <|skeleton|>
class EncoderBlock:
"""Create encoder block for a transformer"""
def __init__(self, dm, h, hidden, drop_rate=0.1):
"""constructor @dm: dimensionality of the model @h: number of heads @hidden: number of hidden units in the fully connected layer @drop_rate: dropout rate *Sets the following p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EncoderBlock:
"""Create encoder block for a transformer"""
def __init__(self, dm, h, hidden, drop_rate=0.1):
"""constructor @dm: dimensionality of the model @h: number of heads @hidden: number of hidden units in the fully connected layer @drop_rate: dropout rate *Sets the following public instanc... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/7-transformer_encoder_block.py | jgadelugo/holbertonschool-machine_learning | train | 1 |
ba26be49d413a32d17bce1f137cbe61aafc28959 | [
"if self.search(cr, uid, [('id', 'in', ids), ('state', '=', 'receive'), ('pay_type', 'in', ('chk', 'letter')), ('chk_seq', '=', False)], context=context):\n raise orm.except_orm(_('Warning !'), _('Kindly print your payment check or bank letter before delivery it.'))\nreturn super(account_voucher, self).action_mo... | <|body_start_0|>
if self.search(cr, uid, [('id', 'in', ids), ('state', '=', 'receive'), ('pay_type', 'in', ('chk', 'letter')), ('chk_seq', '=', False)], context=context):
raise orm.except_orm(_('Warning !'), _('Kindly print your payment check or bank letter before delivery it.'))
return supe... | account_voucher | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class account_voucher:
def action_move_line_create(self, cr, uid, ids, vals={}, context=None):
"""Inherit action_move_line_create method to prevent creating journal entries when pay_type check or bank letter and doesn't print yet @return: super action_move_line_create"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_014605 | 2,922 | no_license | [
{
"docstring": "Inherit action_move_line_create method to prevent creating journal entries when pay_type check or bank letter and doesn't print yet @return: super action_move_line_create",
"name": "action_move_line_create",
"signature": "def action_move_line_create(self, cr, uid, ids, vals={}, context=N... | 3 | stack_v2_sparse_classes_30k_train_012829 | Implement the Python class `account_voucher` described below.
Class description:
Implement the account_voucher class.
Method signatures and docstrings:
- def action_move_line_create(self, cr, uid, ids, vals={}, context=None): Inherit action_move_line_create method to prevent creating journal entries when pay_type che... | Implement the Python class `account_voucher` described below.
Class description:
Implement the account_voucher class.
Method signatures and docstrings:
- def action_move_line_create(self, cr, uid, ids, vals={}, context=None): Inherit action_move_line_create method to prevent creating journal entries when pay_type che... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class account_voucher:
def action_move_line_create(self, cr, uid, ids, vals={}, context=None):
"""Inherit action_move_line_create method to prevent creating journal entries when pay_type check or bank letter and doesn't print yet @return: super action_move_line_create"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class account_voucher:
def action_move_line_create(self, cr, uid, ids, vals={}, context=None):
"""Inherit action_move_line_create method to prevent creating journal entries when pay_type check or bank letter and doesn't print yet @return: super action_move_line_create"""
if self.search(cr, uid, [('i... | the_stack_v2_python_sparse | v_7/Dongola/wafi/account_check_writing_wafi/account_voucher.py | musabahmed/baba | train | 0 | |
3db8b157373450e8c9f5107c235196cf019ee0af | [
"self.queue = myqueue\nself.category_name = category_name\nself.file_name = file_name\nsuper().__init__()",
"start_time = time.time()\nmongo = MongoDBConnection()\nwith mongo:\n my_db = mongo.connection.media\n categories = my_db[self.category_name]\n categories.drop()\n start_count = categories.count... | <|body_start_0|>
self.queue = myqueue
self.category_name = category_name
self.file_name = file_name
super().__init__()
<|end_body_0|>
<|body_start_1|>
start_time = time.time()
mongo = MongoDBConnection()
with mongo:
my_db = mongo.connection.media
... | my thread class that can be used to run things in parallel | MyThread | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyThread:
"""my thread class that can be used to run things in parallel"""
def __init__(self, myqueue, category_name, file_name):
"""setting up initial variables"""
<|body_0|>
def run(self):
"""create db, do the counts"""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_36k_train_014606 | 5,733 | no_license | [
{
"docstring": "setting up initial variables",
"name": "__init__",
"signature": "def __init__(self, myqueue, category_name, file_name)"
},
{
"docstring": "create db, do the counts",
"name": "run",
"signature": "def run(self)"
}
] | 2 | null | Implement the Python class `MyThread` described below.
Class description:
my thread class that can be used to run things in parallel
Method signatures and docstrings:
- def __init__(self, myqueue, category_name, file_name): setting up initial variables
- def run(self): create db, do the counts | Implement the Python class `MyThread` described below.
Class description:
my thread class that can be used to run things in parallel
Method signatures and docstrings:
- def __init__(self, myqueue, category_name, file_name): setting up initial variables
- def run(self): create db, do the counts
<|skeleton|>
class MyT... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class MyThread:
"""my thread class that can be used to run things in parallel"""
def __init__(self, myqueue, category_name, file_name):
"""setting up initial variables"""
<|body_0|>
def run(self):
"""create db, do the counts"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyThread:
"""my thread class that can be used to run things in parallel"""
def __init__(self, myqueue, category_name, file_name):
"""setting up initial variables"""
self.queue = myqueue
self.category_name = category_name
self.file_name = file_name
super().__init__(... | the_stack_v2_python_sparse | students/mint_k/lesson07/assignment/codes/parallel.py | JavaRod/SP_Python220B_2019 | train | 1 |
d02efb6ce105b338ad1adc93ff4b05a901431f8a | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WindowsMalwareInformation()",
"from .entity import Entity\nfrom .malware_state_for_windows_device import MalwareStateForWindowsDevice\nfrom .windows_malware_category import WindowsMalwareCategory\nfrom .windows_malware_severity import ... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return WindowsMalwareInformation()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .malware_state_for_windows_device import MalwareStateForWindowsDevice
from .windows_ma... | Malware information entity. | WindowsMalwareInformation | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WindowsMalwareInformation:
"""Malware information entity."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsMalwareInformation:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use... | stack_v2_sparse_classes_36k_train_014607 | 5,927 | 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: WindowsMalwareInformation",
"name": "create_from_discriminator_value",
"signature": "def create_from_discrim... | 3 | stack_v2_sparse_classes_30k_train_004527 | Implement the Python class `WindowsMalwareInformation` described below.
Class description:
Malware information entity.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsMalwareInformation: Creates a new instance of the appropriate class based on di... | Implement the Python class `WindowsMalwareInformation` described below.
Class description:
Malware information entity.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsMalwareInformation: Creates a new instance of the appropriate class based on di... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class WindowsMalwareInformation:
"""Malware information entity."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsMalwareInformation:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WindowsMalwareInformation:
"""Malware information entity."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsMalwareInformation:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the ... | the_stack_v2_python_sparse | msgraph/generated/models/windows_malware_information.py | microsoftgraph/msgraph-sdk-python | train | 135 |
96c56b5e1318bb37994c1186f8e6027a9be4ca12 | [
"if self.request.user.is_authenticated:\n if self.request.user.is_superuser:\n self.data_layer = 'admin_layer'\n else:\n self.data_layer = expressive_layer_name(self.request.user)",
"self.__set_layer_name()\ntry:\n unblocked_ids = self.request.session['datasets']\nexcept KeyError:\n unbl... | <|body_start_0|>
if self.request.user.is_authenticated:
if self.request.user.is_superuser:
self.data_layer = 'admin_layer'
else:
self.data_layer = expressive_layer_name(self.request.user)
<|end_body_0|>
<|body_start_1|>
self.__set_layer_name()
... | Template View to bring the necessary variables for the startup to the template | HomeView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HomeView:
"""Template View to bring the necessary variables for the startup to the template"""
def __set_layer_name(self):
"""Set name for layer in geoserver according to username or as admin_layer."""
<|body_0|>
def get_context_data(self, **kwargs: object):
"""C... | stack_v2_sparse_classes_36k_train_014608 | 37,263 | permissive | [
{
"docstring": "Set name for layer in geoserver according to username or as admin_layer.",
"name": "__set_layer_name",
"signature": "def __set_layer_name(self)"
},
{
"docstring": "Collect data needed for startup of V-FOR-WaTer Portal home. :param kwargs: :return:",
"name": "get_context_data"... | 2 | stack_v2_sparse_classes_30k_train_021242 | Implement the Python class `HomeView` described below.
Class description:
Template View to bring the necessary variables for the startup to the template
Method signatures and docstrings:
- def __set_layer_name(self): Set name for layer in geoserver according to username or as admin_layer.
- def get_context_data(self,... | Implement the Python class `HomeView` described below.
Class description:
Template View to bring the necessary variables for the startup to the template
Method signatures and docstrings:
- def __set_layer_name(self): Set name for layer in geoserver according to username or as admin_layer.
- def get_context_data(self,... | 9055095cbe796d6d6e2ce744d727ff60e27e09ed | <|skeleton|>
class HomeView:
"""Template View to bring the necessary variables for the startup to the template"""
def __set_layer_name(self):
"""Set name for layer in geoserver according to username or as admin_layer."""
<|body_0|>
def get_context_data(self, **kwargs: object):
"""C... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HomeView:
"""Template View to bring the necessary variables for the startup to the template"""
def __set_layer_name(self):
"""Set name for layer in geoserver according to username or as admin_layer."""
if self.request.user.is_authenticated:
if self.request.user.is_superuser:
... | the_stack_v2_python_sparse | vfw_home/views.py | VForWaTer/vforwater-portal | train | 8 |
6d49604ebfc1ffd5bc2cc0a201b896b3d70a3c54 | [
"if not isinstance(value, list) and len(value) > 0:\n raise serializers.ValidationError(_('请选择至少一项服务'))\nif Service.objects.filter(id__in=value).count() != len(value):\n raise serializers.ValidationError(_('部分服务不存在'))\nreturn value",
"try:\n catalog = ServiceCatalog.objects.get(id=value)\n if catalog.... | <|body_start_0|>
if not isinstance(value, list) and len(value) > 0:
raise serializers.ValidationError(_('请选择至少一项服务'))
if Service.objects.filter(id__in=value).count() != len(value):
raise serializers.ValidationError(_('部分服务不存在'))
return value
<|end_body_0|>
<|body_start_1... | 服务目录关联操作序列化 | CatalogServiceEditSerializer | [
"MIT",
"LGPL-2.1-or-later",
"LGPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CatalogServiceEditSerializer:
"""服务目录关联操作序列化"""
def validate_services(self, value):
"""Check services"""
<|body_0|>
def validate_catalog_id(self, value):
"""Check catalog_id"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not isinstance(value... | stack_v2_sparse_classes_36k_train_014609 | 30,704 | permissive | [
{
"docstring": "Check services",
"name": "validate_services",
"signature": "def validate_services(self, value)"
},
{
"docstring": "Check catalog_id",
"name": "validate_catalog_id",
"signature": "def validate_catalog_id(self, value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016421 | Implement the Python class `CatalogServiceEditSerializer` described below.
Class description:
服务目录关联操作序列化
Method signatures and docstrings:
- def validate_services(self, value): Check services
- def validate_catalog_id(self, value): Check catalog_id | Implement the Python class `CatalogServiceEditSerializer` described below.
Class description:
服务目录关联操作序列化
Method signatures and docstrings:
- def validate_services(self, value): Check services
- def validate_catalog_id(self, value): Check catalog_id
<|skeleton|>
class CatalogServiceEditSerializer:
"""服务目录关联操作序列化... | 2d708bd0d869d391456e0fb8d644af3b9f031acf | <|skeleton|>
class CatalogServiceEditSerializer:
"""服务目录关联操作序列化"""
def validate_services(self, value):
"""Check services"""
<|body_0|>
def validate_catalog_id(self, value):
"""Check catalog_id"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CatalogServiceEditSerializer:
"""服务目录关联操作序列化"""
def validate_services(self, value):
"""Check services"""
if not isinstance(value, list) and len(value) > 0:
raise serializers.ValidationError(_('请选择至少一项服务'))
if Service.objects.filter(id__in=value).count() != len(value):
... | the_stack_v2_python_sparse | itsm/service/serializers.py | TencentBlueKing/bk-itsm | train | 100 |
0967af0d215ca8a37a9d94653f387d5a0445a2a4 | [
"self.destroy_cloned_task_state_vec = destroy_cloned_task_state_vec\nself.owner_restore_wrapper_proto = owner_restore_wrapper_proto\nself.perform_refresh_task_state_vec = perform_refresh_task_state_vec\nself.perform_restore_job_state = perform_restore_job_state\nself.perform_restore_task_state = perform_restore_tas... | <|body_start_0|>
self.destroy_cloned_task_state_vec = destroy_cloned_task_state_vec
self.owner_restore_wrapper_proto = owner_restore_wrapper_proto
self.perform_refresh_task_state_vec = perform_refresh_task_state_vec
self.perform_restore_job_state = perform_restore_job_state
self.... | Implementation of the 'RestoreWrapperProto' model. If this message is a checkpoint record in WAL-logging or if this message is used to send restore task info back to the user, it will contain the info of the restore job/task and the list of all destroy tasks (only when the record is for a restore task of type clone) as... | RestoreWrapperProto | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestoreWrapperProto:
"""Implementation of the 'RestoreWrapperProto' model. If this message is a checkpoint record in WAL-logging or if this message is used to send restore task info back to the user, it will contain the info of the restore job/task and the list of all destroy tasks (only when the... | stack_v2_sparse_classes_36k_train_014610 | 6,283 | permissive | [
{
"docstring": "Constructor for the RestoreWrapperProto class",
"name": "__init__",
"signature": "def __init__(self, destroy_cloned_task_state_vec=None, owner_restore_wrapper_proto=None, perform_refresh_task_state_vec=None, perform_restore_job_state=None, perform_restore_task_state=None, restore_sub_tas... | 2 | null | Implement the Python class `RestoreWrapperProto` described below.
Class description:
Implementation of the 'RestoreWrapperProto' model. If this message is a checkpoint record in WAL-logging or if this message is used to send restore task info back to the user, it will contain the info of the restore job/task and the l... | Implement the Python class `RestoreWrapperProto` described below.
Class description:
Implementation of the 'RestoreWrapperProto' model. If this message is a checkpoint record in WAL-logging or if this message is used to send restore task info back to the user, it will contain the info of the restore job/task and the l... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RestoreWrapperProto:
"""Implementation of the 'RestoreWrapperProto' model. If this message is a checkpoint record in WAL-logging or if this message is used to send restore task info back to the user, it will contain the info of the restore job/task and the list of all destroy tasks (only when the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RestoreWrapperProto:
"""Implementation of the 'RestoreWrapperProto' model. If this message is a checkpoint record in WAL-logging or if this message is used to send restore task info back to the user, it will contain the info of the restore job/task and the list of all destroy tasks (only when the record is fo... | the_stack_v2_python_sparse | cohesity_management_sdk/models/restore_wrapper_proto.py | cohesity/management-sdk-python | train | 24 |
73e5992754d792172c7819412d7d7f89c3659ac7 | [
"Editeur.__init__(self, pere, objet, attribut)\nself.ajouter_option('a', self.ajouter_resp)\nself.ajouter_option('s', self.suppr_resp)",
"evenement = self.objet\nmsg = '| |tit|' + 'Responsables de {}'.format(evenement.id).ljust(76)\nmsg += '|ff||\\n' + self.opts.separateur + '\\n'\nmsg += self.aide_courte\nmsg +=... | <|body_start_0|>
Editeur.__init__(self, pere, objet, attribut)
self.ajouter_option('a', self.ajouter_resp)
self.ajouter_option('s', self.suppr_resp)
<|end_body_0|>
<|body_start_1|>
evenement = self.objet
msg = '| |tit|' + 'Responsables de {}'.format(evenement.id).ljust(76)
... | Contexte-éditeur d'édition des responsables. | EdtResponsables | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EdtResponsables:
"""Contexte-éditeur d'édition des responsables."""
def __init__(self, pere, objet=None, attribut=None):
"""Constructeur de l'éditeur"""
<|body_0|>
def accueil(self):
"""Message d'accueil du contexte"""
<|body_1|>
def suppr_resp(self,... | stack_v2_sparse_classes_36k_train_014611 | 3,848 | permissive | [
{
"docstring": "Constructeur de l'éditeur",
"name": "__init__",
"signature": "def __init__(self, pere, objet=None, attribut=None)"
},
{
"docstring": "Message d'accueil du contexte",
"name": "accueil",
"signature": "def accueil(self)"
},
{
"docstring": "Supprime un responsable ; s... | 4 | stack_v2_sparse_classes_30k_train_019773 | Implement the Python class `EdtResponsables` described below.
Class description:
Contexte-éditeur d'édition des responsables.
Method signatures and docstrings:
- def __init__(self, pere, objet=None, attribut=None): Constructeur de l'éditeur
- def accueil(self): Message d'accueil du contexte
- def suppr_resp(self, arg... | Implement the Python class `EdtResponsables` described below.
Class description:
Contexte-éditeur d'édition des responsables.
Method signatures and docstrings:
- def __init__(self, pere, objet=None, attribut=None): Constructeur de l'éditeur
- def accueil(self): Message d'accueil du contexte
- def suppr_resp(self, arg... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class EdtResponsables:
"""Contexte-éditeur d'édition des responsables."""
def __init__(self, pere, objet=None, attribut=None):
"""Constructeur de l'éditeur"""
<|body_0|>
def accueil(self):
"""Message d'accueil du contexte"""
<|body_1|>
def suppr_resp(self,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EdtResponsables:
"""Contexte-éditeur d'édition des responsables."""
def __init__(self, pere, objet=None, attribut=None):
"""Constructeur de l'éditeur"""
Editeur.__init__(self, pere, objet, attribut)
self.ajouter_option('a', self.ajouter_resp)
self.ajouter_option('s', self.... | the_stack_v2_python_sparse | src/secondaires/calendrier/editeurs/evedit/edt_responsables.py | vincent-lg/tsunami | train | 5 |
d43164f09ede07ec05f89fe9c2dd44c52345f1c4 | [
"super(ScoSessionManager, self).__init__()\nself.getters.update({'cmi_core_lesson_location': 'get_general', 'cmi_core_lesson_status': 'get_general', 'cmi_core_score_max': 'get_general', 'cmi_core_score_min': 'get_general', 'shared_object': 'get_general', 'sco': 'get_foreign_key'})\nself.setters.update({})\nself.my_... | <|body_start_0|>
super(ScoSessionManager, self).__init__()
self.getters.update({'cmi_core_lesson_location': 'get_general', 'cmi_core_lesson_status': 'get_general', 'cmi_core_score_max': 'get_general', 'cmi_core_score_min': 'get_general', 'shared_object': 'get_general', 'sco': 'get_foreign_key'})
... | Manage ScoSessions in the Power Reg system. | ScoSessionManager | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScoSessionManager:
"""Manage ScoSessions in the Power Reg system."""
def __init__(self):
"""constructor"""
<|body_0|>
def create(self, auth_token, assignment):
"""Create a ScoSession :param assignment: foreign key for an Assignment :type assignment: int"""
... | stack_v2_sparse_classes_36k_train_014612 | 1,506 | permissive | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Create a ScoSession :param assignment: foreign key for an Assignment :type assignment: int",
"name": "create",
"signature": "def create(self, auth_token, assignment)"
}
] | 2 | null | Implement the Python class `ScoSessionManager` described below.
Class description:
Manage ScoSessions in the Power Reg system.
Method signatures and docstrings:
- def __init__(self): constructor
- def create(self, auth_token, assignment): Create a ScoSession :param assignment: foreign key for an Assignment :type assi... | Implement the Python class `ScoSessionManager` described below.
Class description:
Manage ScoSessions in the Power Reg system.
Method signatures and docstrings:
- def __init__(self): constructor
- def create(self, auth_token, assignment): Create a ScoSession :param assignment: foreign key for an Assignment :type assi... | a59457bc37f0501aea1f54d006a6de94ff80511c | <|skeleton|>
class ScoSessionManager:
"""Manage ScoSessions in the Power Reg system."""
def __init__(self):
"""constructor"""
<|body_0|>
def create(self, auth_token, assignment):
"""Create a ScoSession :param assignment: foreign key for an Assignment :type assignment: int"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ScoSessionManager:
"""Manage ScoSessions in the Power Reg system."""
def __init__(self):
"""constructor"""
super(ScoSessionManager, self).__init__()
self.getters.update({'cmi_core_lesson_location': 'get_general', 'cmi_core_lesson_status': 'get_general', 'cmi_core_score_max': 'get_... | the_stack_v2_python_sparse | pr_services/scorm_system/sco_session_manager.py | ninemoreminutes/openassign-server | train | 0 |
8bc93f26d98afe5eeb1033d318cf01e700104187 | [
"s1, t1 = (Counter(s), Counter(t))\ninter = t1 - s1\nreturn ''.join(inter.keys())",
"s = ''.join(sorted(s))\nt = ''.join(sorted(t))\nfor i in range(len(s)):\n if s[i] != t[i]:\n return t[i]\nreturn t[-1]",
"ans = 0\nfor c in s + t:\n ans ^= ord(c)\nreturn chr(ans)"
] | <|body_start_0|>
s1, t1 = (Counter(s), Counter(t))
inter = t1 - s1
return ''.join(inter.keys())
<|end_body_0|>
<|body_start_1|>
s = ''.join(sorted(s))
t = ''.join(sorted(t))
for i in range(len(s)):
if s[i] != t[i]:
return t[i]
return t... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findTheDifference(self, s, t):
""":type s: str :type t: str :rtype: str"""
<|body_0|>
def findTheDifference2(self, s, t):
""":type s: str :type t: str :rtype: str"""
<|body_1|>
def findTheDifference2(self, s, t):
""":type s: str :ty... | stack_v2_sparse_classes_36k_train_014613 | 1,091 | no_license | [
{
"docstring": ":type s: str :type t: str :rtype: str",
"name": "findTheDifference",
"signature": "def findTheDifference(self, s, t)"
},
{
"docstring": ":type s: str :type t: str :rtype: str",
"name": "findTheDifference2",
"signature": "def findTheDifference2(self, s, t)"
},
{
"d... | 3 | stack_v2_sparse_classes_30k_train_016656 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTheDifference(self, s, t): :type s: str :type t: str :rtype: str
- def findTheDifference2(self, s, t): :type s: str :type t: str :rtype: str
- def findTheDifference2(self... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTheDifference(self, s, t): :type s: str :type t: str :rtype: str
- def findTheDifference2(self, s, t): :type s: str :type t: str :rtype: str
- def findTheDifference2(self... | 0fc4c7af59246e3064db41989a45d9db413a624b | <|skeleton|>
class Solution:
def findTheDifference(self, s, t):
""":type s: str :type t: str :rtype: str"""
<|body_0|>
def findTheDifference2(self, s, t):
""":type s: str :type t: str :rtype: str"""
<|body_1|>
def findTheDifference2(self, s, t):
""":type s: str :ty... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findTheDifference(self, s, t):
""":type s: str :type t: str :rtype: str"""
s1, t1 = (Counter(s), Counter(t))
inter = t1 - s1
return ''.join(inter.keys())
def findTheDifference2(self, s, t):
""":type s: str :type t: str :rtype: str"""
s = ''.jo... | the_stack_v2_python_sparse | 389. Find the Difference/difference.py | Macielyoung/LeetCode | train | 1 | |
5f674cf87c5b696d0f292ad2d1570cd440d33f8b | [
"if hasattr(root, 'prepare_for_quant'):\n return root.prepare_for_quant()\nprep_fn = prepare_qat_fx if isinstance(self, QuantizationAwareTraining) else prepare_fx\nold_attrs = {attr: rgetattr(root, attr) for attr in attrs if rhasattr(root, attr)}\nprepared = root\nif '' in configs:\n prepared = prep_fn(root, ... | <|body_start_0|>
if hasattr(root, 'prepare_for_quant'):
return root.prepare_for_quant()
prep_fn = prepare_qat_fx if isinstance(self, QuantizationAwareTraining) else prepare_fx
old_attrs = {attr: rgetattr(root, attr) for attr in attrs if rhasattr(root, attr)}
prepared = root
... | Mixin defining an overrideable API for quantization customization. For example, suppose our model contains traceable and non-traceable modules: >>> class MyNonTraceableModel(LightningModule): ... def __init__(self): ... self.traceable = ... ... self.non_traceable = ... ... ... def forward(self, x): ... x = self.traceab... | QuantizationMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuantizationMixin:
"""Mixin defining an overrideable API for quantization customization. For example, suppose our model contains traceable and non-traceable modules: >>> class MyNonTraceableModel(LightningModule): ... def __init__(self): ... self.traceable = ... ... self.non_traceable = ... ... .... | stack_v2_sparse_classes_36k_train_014614 | 24,037 | permissive | [
{
"docstring": "Prepares the root user modules for quantization. By default, this tries to prepare the entire LightningModule. If this is not possible (eg, due to traceability, etc.), the recommended method to use is to override the `prepare` method to prepare the root as appropriate, and also override the `qua... | 2 | stack_v2_sparse_classes_30k_train_017853 | Implement the Python class `QuantizationMixin` described below.
Class description:
Mixin defining an overrideable API for quantization customization. For example, suppose our model contains traceable and non-traceable modules: >>> class MyNonTraceableModel(LightningModule): ... def __init__(self): ... self.traceable =... | Implement the Python class `QuantizationMixin` described below.
Class description:
Mixin defining an overrideable API for quantization customization. For example, suppose our model contains traceable and non-traceable modules: >>> class MyNonTraceableModel(LightningModule): ... def __init__(self): ... self.traceable =... | 23a644a1213ff19f32b3f106b271d41ff3148bd1 | <|skeleton|>
class QuantizationMixin:
"""Mixin defining an overrideable API for quantization customization. For example, suppose our model contains traceable and non-traceable modules: >>> class MyNonTraceableModel(LightningModule): ... def __init__(self): ... self.traceable = ... ... self.non_traceable = ... ... .... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QuantizationMixin:
"""Mixin defining an overrideable API for quantization customization. For example, suppose our model contains traceable and non-traceable modules: >>> class MyNonTraceableModel(LightningModule): ... def __init__(self): ... self.traceable = ... ... self.non_traceable = ... ... ... def forwar... | the_stack_v2_python_sparse | d2go/runner/callbacks/quantization.py | pankajkumar9797/d2go | train | 3 |
d1ac6c2a5969e92c683b86b29779337e14a7b82e | [
"if self.state_model.op_state in [DevState.ON, DevState.OFF, DevState.DISABLE]:\n tango.Except.throw_exception(f'Reset() is not allowed in current state {self.state_model.op_state}', 'Failed to invoke Reset command on CspSubarrayLeafNode.', 'cspsubarrayleafnode.Reset()', tango.ErrSeverity.ERR)\nreturn True",
"... | <|body_start_0|>
if self.state_model.op_state in [DevState.ON, DevState.OFF, DevState.DISABLE]:
tango.Except.throw_exception(f'Reset() is not allowed in current state {self.state_model.op_state}', 'Failed to invoke Reset command on CspSubarrayLeafNode.', 'cspsubarrayleafnode.Reset()', tango.ErrSever... | A class for CSPSubarrayLeafNode's Reset() command. Command to reset the current operation being done on the CSP Subarray Leaf Node. | ResetCommand | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResetCommand:
"""A class for CSPSubarrayLeafNode's Reset() command. Command to reset the current operation being done on the CSP Subarray Leaf Node."""
def check_allowed(self):
"""Checks whether this command is allowed to be run in current device state :return: True if this command i... | stack_v2_sparse_classes_36k_train_014615 | 2,419 | permissive | [
{
"docstring": "Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device state :rtype: boolean :raises: DevFailed if this command is not allowed to be run in current device state",
"name": "check_allowed",
"signature": ... | 2 | stack_v2_sparse_classes_30k_train_010504 | Implement the Python class `ResetCommand` described below.
Class description:
A class for CSPSubarrayLeafNode's Reset() command. Command to reset the current operation being done on the CSP Subarray Leaf Node.
Method signatures and docstrings:
- def check_allowed(self): Checks whether this command is allowed to be ru... | Implement the Python class `ResetCommand` described below.
Class description:
A class for CSPSubarrayLeafNode's Reset() command. Command to reset the current operation being done on the CSP Subarray Leaf Node.
Method signatures and docstrings:
- def check_allowed(self): Checks whether this command is allowed to be ru... | 7ee65a9c8dada9b28893144b372a398bd0646195 | <|skeleton|>
class ResetCommand:
"""A class for CSPSubarrayLeafNode's Reset() command. Command to reset the current operation being done on the CSP Subarray Leaf Node."""
def check_allowed(self):
"""Checks whether this command is allowed to be run in current device state :return: True if this command i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResetCommand:
"""A class for CSPSubarrayLeafNode's Reset() command. Command to reset the current operation being done on the CSP Subarray Leaf Node."""
def check_allowed(self):
"""Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to ... | the_stack_v2_python_sparse | temp_src/ska_tmc_cspsubarrayleafnode_mid/reset_command.py | ska-telescope/tmc-prototype | train | 4 |
28bd610d4947214d55c6adfad007405094c1abe5 | [
"\"\"\" Super users has access to all\"\"\"\nif self.request.user.is_superuser:\n return super().get_queryset()\nreturn self.request.user.team_set.all()",
"if self.request.user.is_superuser:\n return True\nreturn self.request.user.groups.count() > 0"
] | <|body_start_0|>
""" Super users has access to all"""
if self.request.user.is_superuser:
return super().get_queryset()
return self.request.user.team_set.all()
<|end_body_0|>
<|body_start_1|>
if self.request.user.is_superuser:
return True
return self.reque... | TeamListView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeamListView:
def get_queryset(self):
"""Only list teams the user is part of"""
<|body_0|>
def has_permission(self):
"""Allow viewing of teams if user is part of group"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
""" Super users has access to all... | stack_v2_sparse_classes_36k_train_014616 | 1,647 | no_license | [
{
"docstring": "Only list teams the user is part of",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "Allow viewing of teams if user is part of group",
"name": "has_permission",
"signature": "def has_permission(self)"
}
] | 2 | null | Implement the Python class `TeamListView` described below.
Class description:
Implement the TeamListView class.
Method signatures and docstrings:
- def get_queryset(self): Only list teams the user is part of
- def has_permission(self): Allow viewing of teams if user is part of group | Implement the Python class `TeamListView` described below.
Class description:
Implement the TeamListView class.
Method signatures and docstrings:
- def get_queryset(self): Only list teams the user is part of
- def has_permission(self): Allow viewing of teams if user is part of group
<|skeleton|>
class TeamListView:
... | ec47aa10750072b9df355a2c82f8f5f6471e8157 | <|skeleton|>
class TeamListView:
def get_queryset(self):
"""Only list teams the user is part of"""
<|body_0|>
def has_permission(self):
"""Allow viewing of teams if user is part of group"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TeamListView:
def get_queryset(self):
"""Only list teams the user is part of"""
""" Super users has access to all"""
if self.request.user.is_superuser:
return super().get_queryset()
return self.request.user.team_set.all()
def has_permission(self):
"""Al... | the_stack_v2_python_sparse | web/domains/team/views.py | PaoloC68/icms | train | 0 | |
8df9985608b2a9310d1b7175d79b3c793966dc94 | [
"if notes_gui.showing:\n ctx.tags = []\n notes_gui.hide()\nelse:\n update_notes()\n ctx.tags = ['user.notes_showing']\n notes_gui.show()",
"curtime = datetime.now().strftime('%Y-%m-%d %H%M%S')\nfile_path = NOTES_DIR / f'{curtime}.txt'\nfile_path.touch()\nsubprocess.Popen(['notepad', str(file_path)]... | <|body_start_0|>
if notes_gui.showing:
ctx.tags = []
notes_gui.hide()
else:
update_notes()
ctx.tags = ['user.notes_showing']
notes_gui.show()
<|end_body_0|>
<|body_start_1|>
curtime = datetime.now().strftime('%Y-%m-%d %H%M%S')
... | Actions | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Actions:
def notes_gui_toggle():
"""Toggle the notes gui"""
<|body_0|>
def create_note():
"""Create a new note"""
<|body_1|>
def delete_note(n: int):
"""Delete note number n"""
<|body_2|>
def show_note(n: int):
"""Show note n... | stack_v2_sparse_classes_36k_train_014617 | 3,193 | no_license | [
{
"docstring": "Toggle the notes gui",
"name": "notes_gui_toggle",
"signature": "def notes_gui_toggle()"
},
{
"docstring": "Create a new note",
"name": "create_note",
"signature": "def create_note()"
},
{
"docstring": "Delete note number n",
"name": "delete_note",
"signat... | 4 | stack_v2_sparse_classes_30k_train_010647 | Implement the Python class `Actions` described below.
Class description:
Implement the Actions class.
Method signatures and docstrings:
- def notes_gui_toggle(): Toggle the notes gui
- def create_note(): Create a new note
- def delete_note(n: int): Delete note number n
- def show_note(n: int): Show note number n | Implement the Python class `Actions` described below.
Class description:
Implement the Actions class.
Method signatures and docstrings:
- def notes_gui_toggle(): Toggle the notes gui
- def create_note(): Create a new note
- def delete_note(n: int): Delete note number n
- def show_note(n: int): Show note number n
<|s... | 03c6479989ab4231d8ae6bbab24ac8b57c3ef809 | <|skeleton|>
class Actions:
def notes_gui_toggle():
"""Toggle the notes gui"""
<|body_0|>
def create_note():
"""Create a new note"""
<|body_1|>
def delete_note(n: int):
"""Delete note number n"""
<|body_2|>
def show_note(n: int):
"""Show note n... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Actions:
def notes_gui_toggle():
"""Toggle the notes gui"""
if notes_gui.showing:
ctx.tags = []
notes_gui.hide()
else:
update_notes()
ctx.tags = ['user.notes_showing']
notes_gui.show()
def create_note():
"""Create... | the_stack_v2_python_sparse | gui/notes/notes_gui.py | mrob95/MR-talon | train | 15 | |
66f57efd2fb3b880082dc65d28211ae5996bfdbf | [
"d = devicemanage(self.driver)\nd.open_devicemanage()\nself.assertEqual(d.verify(), True)\nd.delete_obj()\nself.assertEqual(d.result(), '您确定要删除这条信息吗')\nd.confirm()\nself.assertEqual(d.result(), '删除成功')\nfunction.screenshot(self.driver, 'delete_device.jpg')",
"d = devicemanage(self.driver)\nd.open_devicemanage()\n... | <|body_start_0|>
d = devicemanage(self.driver)
d.open_devicemanage()
self.assertEqual(d.verify(), True)
d.delete_obj()
self.assertEqual(d.result(), '您确定要删除这条信息吗')
d.confirm()
self.assertEqual(d.result(), '删除成功')
function.screenshot(self.driver, 'delete_dev... | Test036_Device_Delete_P1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test036_Device_Delete_P1:
def test_delete(self):
"""删除设备"""
<|body_0|>
def test_cancle(self):
"""取消删除"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
d = devicemanage(self.driver)
d.open_devicemanage()
self.assertEqual(d.verify(), Tr... | stack_v2_sparse_classes_36k_train_014618 | 1,077 | no_license | [
{
"docstring": "删除设备",
"name": "test_delete",
"signature": "def test_delete(self)"
},
{
"docstring": "取消删除",
"name": "test_cancle",
"signature": "def test_cancle(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005231 | Implement the Python class `Test036_Device_Delete_P1` described below.
Class description:
Implement the Test036_Device_Delete_P1 class.
Method signatures and docstrings:
- def test_delete(self): 删除设备
- def test_cancle(self): 取消删除 | Implement the Python class `Test036_Device_Delete_P1` described below.
Class description:
Implement the Test036_Device_Delete_P1 class.
Method signatures and docstrings:
- def test_delete(self): 删除设备
- def test_cancle(self): 取消删除
<|skeleton|>
class Test036_Device_Delete_P1:
def test_delete(self):
"""删除设... | 6f42c25249fc642cecc270578a180820988d45b5 | <|skeleton|>
class Test036_Device_Delete_P1:
def test_delete(self):
"""删除设备"""
<|body_0|>
def test_cancle(self):
"""取消删除"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test036_Device_Delete_P1:
def test_delete(self):
"""删除设备"""
d = devicemanage(self.driver)
d.open_devicemanage()
self.assertEqual(d.verify(), True)
d.delete_obj()
self.assertEqual(d.result(), '您确定要删除这条信息吗')
d.confirm()
self.assertEqual(d.result(),... | the_stack_v2_python_sparse | GlxssLive_web/TestCase/Manage_Device/Test036_device_delete_P1.py | rrmiracle/GlxssLive | train | 0 | |
f26b3bed25a3f985b8e2299e4a2efbe94b7f9775 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn OnenotePage()",
"from .notebook import Notebook\nfrom .onenote_entity_schema_object_model import OnenoteEntitySchemaObjectModel\nfrom .onenote_section import OnenoteSection\nfrom .page_links import PageLinks\nfrom .notebook import Note... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return OnenotePage()
<|end_body_0|>
<|body_start_1|>
from .notebook import Notebook
from .onenote_entity_schema_object_model import OnenoteEntitySchemaObjectModel
from .onenote_section ... | OnenotePage | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OnenotePage:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenotePage:
"""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: On... | stack_v2_sparse_classes_36k_train_014619 | 5,456 | 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: OnenotePage",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(p... | 3 | null | Implement the Python class `OnenotePage` described below.
Class description:
Implement the OnenotePage class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenotePage: Creates a new instance of the appropriate class based on discriminator value Args:... | Implement the Python class `OnenotePage` described below.
Class description:
Implement the OnenotePage class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenotePage: Creates a new instance of the appropriate class based on discriminator value Args:... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class OnenotePage:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenotePage:
"""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: On... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OnenotePage:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenotePage:
"""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: OnenotePage"""
... | the_stack_v2_python_sparse | msgraph/generated/models/onenote_page.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
b2b33fe7da0ad7f7f2b1b5b0c82ffbb3250a5fdf | [
"self.__pHardwareComm = pHardwareComm\nself.__nPressureRegulator = nPressureRegulator\nself.__nStartPressure = nStartPressure\nself.__nTargetPressure = nTargetPressure\nlog.debug('Starting Pressure Regulator Thread')",
"try:\n log.debug('Running Pressure Regulator Thread')\n nPressure = self.__nStartPressur... | <|body_start_0|>
self.__pHardwareComm = pHardwareComm
self.__nPressureRegulator = nPressureRegulator
self.__nStartPressure = nStartPressure
self.__nTargetPressure = nTargetPressure
log.debug('Starting Pressure Regulator Thread')
<|end_body_0|>
<|body_start_1|>
try:
... | PressureRegulatorThread | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PressureRegulatorThread:
def SetParameters(self, pHardwareComm, nPressureRegulator, nStartPressure, nTargetPressure):
"""Sets the pressure regulator thread parameters"""
<|body_0|>
def run(self):
"""Thread entry point"""
<|body_1|>
<|end_skeleton|>
<|body_s... | stack_v2_sparse_classes_36k_train_014620 | 1,903 | no_license | [
{
"docstring": "Sets the pressure regulator thread parameters",
"name": "SetParameters",
"signature": "def SetParameters(self, pHardwareComm, nPressureRegulator, nStartPressure, nTargetPressure)"
},
{
"docstring": "Thread entry point",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017874 | Implement the Python class `PressureRegulatorThread` described below.
Class description:
Implement the PressureRegulatorThread class.
Method signatures and docstrings:
- def SetParameters(self, pHardwareComm, nPressureRegulator, nStartPressure, nTargetPressure): Sets the pressure regulator thread parameters
- def run... | Implement the Python class `PressureRegulatorThread` described below.
Class description:
Implement the PressureRegulatorThread class.
Method signatures and docstrings:
- def SetParameters(self, pHardwareComm, nPressureRegulator, nStartPressure, nTargetPressure): Sets the pressure regulator thread parameters
- def run... | c6954ca0fff935ce1eb8154744f6307743765dc5 | <|skeleton|>
class PressureRegulatorThread:
def SetParameters(self, pHardwareComm, nPressureRegulator, nStartPressure, nTargetPressure):
"""Sets the pressure regulator thread parameters"""
<|body_0|>
def run(self):
"""Thread entry point"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PressureRegulatorThread:
def SetParameters(self, pHardwareComm, nPressureRegulator, nStartPressure, nTargetPressure):
"""Sets the pressure regulator thread parameters"""
self.__pHardwareComm = pHardwareComm
self.__nPressureRegulator = nPressureRegulator
self.__nStartPressure = ... | the_stack_v2_python_sparse | server/hardware/fakeplc/PressureRegulatorThread.py | henryeherman/elixys | train | 1 | |
e09396c2dc74aae9fe58864b3456d8411454ca82 | [
"self.feedback_type = feedback\nif const.FEEDBACK_PV in self.feedback_type:\n self.detector = detector\n feedback_pvs = utils.get_feedback_pvs(quality_checks)\n for fb_pv in feedback_pvs:\n caput(self.detector + ':data_' + fb_pv + '_ctr', 0)\nif const.FEEDBACK_LOG in self.feedback_type:\n self.lo... | <|body_start_0|>
self.feedback_type = feedback
if const.FEEDBACK_PV in self.feedback_type:
self.detector = detector
feedback_pvs = utils.get_feedback_pvs(quality_checks)
for fb_pv in feedback_pvs:
caput(self.detector + ':data_' + fb_pv + '_ctr', 0)
... | This class is a container of real-time feedback related information. | Feedback | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Feedback:
"""This class is a container of real-time feedback related information."""
def __init__(self, feedback, detector, quality_checks, logger):
"""Constructor Parameters ---------- feedback_type : list a list of configured feedbac types. Possible options: console, log, and pv"""... | stack_v2_sparse_classes_36k_train_014621 | 2,461 | no_license | [
{
"docstring": "Constructor Parameters ---------- feedback_type : list a list of configured feedbac types. Possible options: console, log, and pv",
"name": "__init__",
"signature": "def __init__(self, feedback, detector, quality_checks, logger)"
},
{
"docstring": "This function provides feedback... | 2 | stack_v2_sparse_classes_30k_train_003854 | Implement the Python class `Feedback` described below.
Class description:
This class is a container of real-time feedback related information.
Method signatures and docstrings:
- def __init__(self, feedback, detector, quality_checks, logger): Constructor Parameters ---------- feedback_type : list a list of configured... | Implement the Python class `Feedback` described below.
Class description:
This class is a container of real-time feedback related information.
Method signatures and docstrings:
- def __init__(self, feedback, detector, quality_checks, logger): Constructor Parameters ---------- feedback_type : list a list of configured... | c8e9ef7c9cba497479faf60136f6810c41d8bd3c | <|skeleton|>
class Feedback:
"""This class is a container of real-time feedback related information."""
def __init__(self, feedback, detector, quality_checks, logger):
"""Constructor Parameters ---------- feedback_type : list a list of configured feedbac types. Possible options: console, log, and pv"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Feedback:
"""This class is a container of real-time feedback related information."""
def __init__(self, feedback, detector, quality_checks, logger):
"""Constructor Parameters ---------- feedback_type : list a list of configured feedbac types. Possible options: console, log, and pv"""
self... | the_stack_v2_python_sparse | dquality/clients/fb_client/simple_feedback.py | AdvancedPhotonSource/data-quality | train | 2 |
667d9009bf990585e8813eeccfe0b9f01b10fd82 | [
"super().__init__(*args, **kwargs)\nself.one_label = one_label\nself.zero_label = zero_label",
"p = np.squeeze(prediction)\nif p.ndim > 1:\n raise ValueError(f'{typename(self)} expects prediction has ndim=1, but receiving ndim={p.ndim}')\nreturn [self.one_label if v else self.zero_label for v in p.astype(bool)... | <|body_start_0|>
super().__init__(*args, **kwargs)
self.one_label = one_label
self.zero_label = zero_label
<|end_body_0|>
<|body_start_1|>
p = np.squeeze(prediction)
if p.ndim > 1:
raise ValueError(f'{typename(self)} expects prediction has ndim=1, but receiving ndim=... | Converts binary prediction into string label. This is often used with binary classifier. | BinaryPredictDriver | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BinaryPredictDriver:
"""Converts binary prediction into string label. This is often used with binary classifier."""
def __init__(self, one_label: str='yes', zero_label: str='no', *args, **kwargs):
""":param one_label: label when prediction is one :param zero_label: label when predict... | stack_v2_sparse_classes_36k_train_014622 | 5,042 | permissive | [
{
"docstring": ":param one_label: label when prediction is one :param zero_label: label when prediction is zero :param *args: :param **kwargs:",
"name": "__init__",
"signature": "def __init__(self, one_label: str='yes', zero_label: str='no', *args, **kwargs)"
},
{
"docstring": ":param prediction... | 2 | null | Implement the Python class `BinaryPredictDriver` described below.
Class description:
Converts binary prediction into string label. This is often used with binary classifier.
Method signatures and docstrings:
- def __init__(self, one_label: str='yes', zero_label: str='no', *args, **kwargs): :param one_label: label whe... | Implement the Python class `BinaryPredictDriver` described below.
Class description:
Converts binary prediction into string label. This is often used with binary classifier.
Method signatures and docstrings:
- def __init__(self, one_label: str='yes', zero_label: str='no', *args, **kwargs): :param one_label: label whe... | 97f9e97a4a678a28bdeacbc7346eaf7bbd2aeb89 | <|skeleton|>
class BinaryPredictDriver:
"""Converts binary prediction into string label. This is often used with binary classifier."""
def __init__(self, one_label: str='yes', zero_label: str='no', *args, **kwargs):
""":param one_label: label when prediction is one :param zero_label: label when predict... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BinaryPredictDriver:
"""Converts binary prediction into string label. This is often used with binary classifier."""
def __init__(self, one_label: str='yes', zero_label: str='no', *args, **kwargs):
""":param one_label: label when prediction is one :param zero_label: label when prediction is zero :... | the_stack_v2_python_sparse | jina/drivers/predict.py | deepampatel/jina | train | 2 |
db205936303c8a589fd841c1d589a4c2a48b2049 | [
"self.player1 = player1\nself.player2 = player2\nself.game = game\nself.display = display",
"players = [self.player2, None, self.player1]\ncurPlayer = 1\nboard = self.game.getInitBoard()\nit = 0\nwhile self.game.getGameEnded(board, curPlayer) == 0:\n it += 1\n if verbose:\n assert self.display\n ... | <|body_start_0|>
self.player1 = player1
self.player2 = player2
self.game = game
self.display = display
<|end_body_0|>
<|body_start_1|>
players = [self.player2, None, self.player1]
curPlayer = 1
board = self.game.getInitBoard()
it = 0
while self.ga... | An Arena class where any 2 agents can be pit against each other. | Arena | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Arena:
"""An Arena class where any 2 agents can be pit against each other."""
def __init__(self, player1, player2, game, display=None):
"""Input: player 1,2: two functions that takes board as input, return action game: Game object display: a function that takes board as input and pri... | stack_v2_sparse_classes_36k_train_014623 | 3,459 | permissive | [
{
"docstring": "Input: player 1,2: two functions that takes board as input, return action game: Game object display: a function that takes board as input and prints it (e.g. display in othello/OthelloGame). Is necessary for verbose mode. see othello/OthelloPlayers.py for an example. See pit.py for pitting human... | 3 | null | Implement the Python class `Arena` described below.
Class description:
An Arena class where any 2 agents can be pit against each other.
Method signatures and docstrings:
- def __init__(self, player1, player2, game, display=None): Input: player 1,2: two functions that takes board as input, return action game: Game obj... | Implement the Python class `Arena` described below.
Class description:
An Arena class where any 2 agents can be pit against each other.
Method signatures and docstrings:
- def __init__(self, player1, player2, game, display=None): Input: player 1,2: two functions that takes board as input, return action game: Game obj... | 3bb5fe36d245f4d69bae0710dc1dc9d1a172f64d | <|skeleton|>
class Arena:
"""An Arena class where any 2 agents can be pit against each other."""
def __init__(self, player1, player2, game, display=None):
"""Input: player 1,2: two functions that takes board as input, return action game: Game object display: a function that takes board as input and pri... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Arena:
"""An Arena class where any 2 agents can be pit against each other."""
def __init__(self, player1, player2, game, display=None):
"""Input: player 1,2: two functions that takes board as input, return action game: Game object display: a function that takes board as input and prints it (e.g. ... | the_stack_v2_python_sparse | benchmark/torch/AlphaZero/Arena.py | PaddlePaddle/PARL | train | 3,818 |
324403c2c62528c8abb75599efdfa27c65cb4b32 | [
"if not cls.objects.filter(user=user, external_id_type__name=type_name).exists():\n return False\nreturn True",
"try:\n type_obj = ExternalIdType.objects.get(name=type_name)\nexcept ExternalIdType.DoesNotExist:\n LOGGER.info('External ID Creation failed for user {user}, no external id type of {type}'.for... | <|body_start_0|>
if not cls.objects.filter(user=user, external_id_type__name=type_name).exists():
return False
return True
<|end_body_0|>
<|body_start_1|>
try:
type_obj = ExternalIdType.objects.get(name=type_name)
except ExternalIdType.DoesNotExist:
L... | External ids are sent to systems or companies outside of Open edX. This allows us to limit the exposure of any given id. An external id is linked to an internal id, so that users may be re-identified if the external id is sent back to Open edX. .. no_pii: We store external_user_id here, but do not consider that PII und... | ExternalId | [
"AGPL-3.0-only",
"AGPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExternalId:
"""External ids are sent to systems or companies outside of Open edX. This allows us to limit the exposure of any given id. An external id is linked to an internal id, so that users may be re-identified if the external id is sent back to Open edX. .. no_pii: We store external_user_id ... | stack_v2_sparse_classes_36k_train_014624 | 5,662 | permissive | [
{
"docstring": "Checks if a user has an ExternalId of the type_name provided Arguments: user: User to search for type_name (str): Name of the type of ExternalId Returns: (Bool): True if the user already has an external ID, False otherwise.",
"name": "user_has_external_id",
"signature": "def user_has_ext... | 3 | stack_v2_sparse_classes_30k_train_017778 | Implement the Python class `ExternalId` described below.
Class description:
External ids are sent to systems or companies outside of Open edX. This allows us to limit the exposure of any given id. An external id is linked to an internal id, so that users may be re-identified if the external id is sent back to Open edX... | Implement the Python class `ExternalId` described below.
Class description:
External ids are sent to systems or companies outside of Open edX. This allows us to limit the exposure of any given id. An external id is linked to an internal id, so that users may be re-identified if the external id is sent back to Open edX... | 5809eaca7079a15ee56b0b7fcfea425337046c97 | <|skeleton|>
class ExternalId:
"""External ids are sent to systems or companies outside of Open edX. This allows us to limit the exposure of any given id. An external id is linked to an internal id, so that users may be re-identified if the external id is sent back to Open edX. .. no_pii: We store external_user_id ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExternalId:
"""External ids are sent to systems or companies outside of Open edX. This allows us to limit the exposure of any given id. An external id is linked to an internal id, so that users may be re-identified if the external id is sent back to Open edX. .. no_pii: We store external_user_id here, but do ... | the_stack_v2_python_sparse | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/external_user_ids/models.py | luque/better-ways-of-thinking-about-software | train | 3 |
c9f14608294f5c509f2a1a1bae790550b007c609 | [
"candidates = (('https://example.com/with/a/path', 'https://example.com'), ('http://example.com/path?and=querystring#andfragment', 'http://example.com'), ('http://example.com:12345', 'http://example.com:12345'), ('http://a.b.c.example.com', 'http://a.b.c.example.com'), ('site1.example.com', 'http://site1.example.co... | <|body_start_0|>
candidates = (('https://example.com/with/a/path', 'https://example.com'), ('http://example.com/path?and=querystring#andfragment', 'http://example.com'), ('http://example.com:12345', 'http://example.com:12345'), ('http://a.b.c.example.com', 'http://a.b.c.example.com'), ('site1.example.com', 'htt... | Tests for the Url resource. | TestUrlResource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestUrlResource:
"""Tests for the Url resource."""
def test_base_address(self) -> None:
"""The address can be reduced to a root URL."""
<|body_0|>
def test_path_case_preservation(self) -> None:
"""Paths are allowed to be case-sensitive."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_014625 | 1,476 | no_license | [
{
"docstring": "The address can be reduced to a root URL.",
"name": "test_base_address",
"signature": "def test_base_address(self) -> None"
},
{
"docstring": "Paths are allowed to be case-sensitive.",
"name": "test_path_case_preservation",
"signature": "def test_path_case_preservation(se... | 3 | stack_v2_sparse_classes_30k_train_016264 | Implement the Python class `TestUrlResource` described below.
Class description:
Tests for the Url resource.
Method signatures and docstrings:
- def test_base_address(self) -> None: The address can be reduced to a root URL.
- def test_path_case_preservation(self) -> None: Paths are allowed to be case-sensitive.
- def... | Implement the Python class `TestUrlResource` described below.
Class description:
Tests for the Url resource.
Method signatures and docstrings:
- def test_base_address(self) -> None: The address can be reduced to a root URL.
- def test_path_case_preservation(self) -> None: Paths are allowed to be case-sensitive.
- def... | 7129415303b94d5d10b2c29ec432f0c7d41cc651 | <|skeleton|>
class TestUrlResource:
"""Tests for the Url resource."""
def test_base_address(self) -> None:
"""The address can be reduced to a root URL."""
<|body_0|>
def test_path_case_preservation(self) -> None:
"""Paths are allowed to be case-sensitive."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestUrlResource:
"""Tests for the Url resource."""
def test_base_address(self) -> None:
"""The address can be reduced to a root URL."""
candidates = (('https://example.com/with/a/path', 'https://example.com'), ('http://example.com/path?and=querystring#andfragment', 'http://example.com'), ... | the_stack_v2_python_sparse | resources/url_test.py | lovett/medley | train | 6 |
417ee5ce1baff2951ff326296fd3ca72b746f0cd | [
"for argument, variable, instance_type in zip(('first', 'second', 'third'), (trap_calibration, baseline_force1, baseline_force2), (DistanceCalibration, ForceBaseLine, ForceBaseLine)):\n if variable is not None and (not isinstance(variable, instance_type)):\n raise TypeError(f'Expected {instance_type.__nam... | <|body_start_0|>
for argument, variable, instance_type in zip(('first', 'second', 'third'), (trap_calibration, baseline_force1, baseline_force2), (DistanceCalibration, ForceBaseLine, ForceBaseLine)):
if variable is not None and (not isinstance(variable, instance_type)):
raise TypeErr... | Class to determine both piezo distance and baseline corrected force | PiezoForceDistance | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PiezoForceDistance:
"""Class to determine both piezo distance and baseline corrected force"""
def __init__(self, trap_calibration, baseline_force1=None, baseline_force2=None, signs=(1, -1)):
"""Set up piezo force distance data trap_calibration : DistanceCalibration Calibration from t... | stack_v2_sparse_classes_36k_train_014626 | 8,607 | permissive | [
{
"docstring": "Set up piezo force distance data trap_calibration : DistanceCalibration Calibration from trap position to trap to trap distance. baseline_force1 : ForceBaseline Baseline for force1 (optional) baseline_force2 : ForceBaseline Baseline for force2 (optional) signs : tuple(float, float) Sign conventi... | 3 | null | Implement the Python class `PiezoForceDistance` described below.
Class description:
Class to determine both piezo distance and baseline corrected force
Method signatures and docstrings:
- def __init__(self, trap_calibration, baseline_force1=None, baseline_force2=None, signs=(1, -1)): Set up piezo force distance data ... | Implement the Python class `PiezoForceDistance` described below.
Class description:
Class to determine both piezo distance and baseline corrected force
Method signatures and docstrings:
- def __init__(self, trap_calibration, baseline_force1=None, baseline_force2=None, signs=(1, -1)): Set up piezo force distance data ... | 5b7331f23f261b968b9dada3ddea2378cb07ac4c | <|skeleton|>
class PiezoForceDistance:
"""Class to determine both piezo distance and baseline corrected force"""
def __init__(self, trap_calibration, baseline_force1=None, baseline_force2=None, signs=(1, -1)):
"""Set up piezo force distance data trap_calibration : DistanceCalibration Calibration from t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PiezoForceDistance:
"""Class to determine both piezo distance and baseline corrected force"""
def __init__(self, trap_calibration, baseline_force1=None, baseline_force2=None, signs=(1, -1)):
"""Set up piezo force distance data trap_calibration : DistanceCalibration Calibration from trap position ... | the_stack_v2_python_sparse | lumicks/pylake/piezo_tracking/piezo_tracking.py | lumicks/pylake | train | 16 |
e9b7380f22a3d65fbcbd8fb6363b7a2ad1e58156 | [
"self._sess = sess\nself._grammar = grammar\nself._max_length = max_length\nconditions = {}\nif symbolic_properties_dict is not None:\n conditions.update({key: np.array([value], dtype=np.float32) for key, value in symbolic_properties_dict.iteritems()})\nself._conditions = conditions",
"if not isinstance(state,... | <|body_start_0|>
self._sess = sess
self._grammar = grammar
self._max_length = max_length
conditions = {}
if symbolic_properties_dict is not None:
conditions.update({key: np.array([value], dtype=np.float32) for key, value in symbolic_properties_dict.iteritems()})
... | Appends a valid production rule on existing list of production rules. The probabilities of the actions will be determined by the partial sequence model. | NeuralProductionRuleAppendPolicy | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NeuralProductionRuleAppendPolicy:
"""Appends a valid production rule on existing list of production rules. The probabilities of the actions will be determined by the partial sequence model."""
def __init__(self, sess, grammar, max_length, symbolic_properties_dict):
"""Initializer. Ar... | stack_v2_sparse_classes_36k_train_014627 | 12,289 | permissive | [
{
"docstring": "Initializer. Args: sess: tf.Session, the session contains the trained model to predict next production rule from input partial sequence. If None, each step will be selected randomly. grammar: arithmetic_grammar.Grammar object. max_length: Integer, the max length of production rule sequence. symb... | 2 | stack_v2_sparse_classes_30k_train_018754 | Implement the Python class `NeuralProductionRuleAppendPolicy` described below.
Class description:
Appends a valid production rule on existing list of production rules. The probabilities of the actions will be determined by the partial sequence model.
Method signatures and docstrings:
- def __init__(self, sess, gramma... | Implement the Python class `NeuralProductionRuleAppendPolicy` described below.
Class description:
Appends a valid production rule on existing list of production rules. The probabilities of the actions will be determined by the partial sequence model.
Method signatures and docstrings:
- def __init__(self, sess, gramma... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class NeuralProductionRuleAppendPolicy:
"""Appends a valid production rule on existing list of production rules. The probabilities of the actions will be determined by the partial sequence model."""
def __init__(self, sess, grammar, max_length, symbolic_properties_dict):
"""Initializer. Ar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NeuralProductionRuleAppendPolicy:
"""Appends a valid production rule on existing list of production rules. The probabilities of the actions will be determined by the partial sequence model."""
def __init__(self, sess, grammar, max_length, symbolic_properties_dict):
"""Initializer. Args: sess: tf.... | the_stack_v2_python_sparse | neural_guided_symbolic_regression/models/mcts.py | Jimmy-INL/google-research | train | 1 |
c1d4a26575d358c48d735b1e40bca87c08efb349 | [
"self.cookie = cookie\nself.quota_and_usage_in_all_views = quota_and_usage_in_all_views\nself.summary_for_user = summary_for_user\nself.summary_for_view = summary_for_view\nself.user_quota_settings = user_quota_settings\nself.users_quota_and_usage = users_quota_and_usage",
"if dictionary is None:\n return None... | <|body_start_0|>
self.cookie = cookie
self.quota_and_usage_in_all_views = quota_and_usage_in_all_views
self.summary_for_user = summary_for_user
self.summary_for_view = summary_for_view
self.user_quota_settings = user_quota_settings
self.users_quota_and_usage = users_quota... | Implementation of the 'ViewUserQuotas' model. Specifies the Result parameters for all user quotas of a view. Attributes: cookie (string): This cookie can be used in the succeeding call to list user quotas and usages to get the next set of user quota overrides. If set to nil, it means that there's no more results that t... | ViewUserQuotas | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ViewUserQuotas:
"""Implementation of the 'ViewUserQuotas' model. Specifies the Result parameters for all user quotas of a view. Attributes: cookie (string): This cookie can be used in the succeeding call to list user quotas and usages to get the next set of user quota overrides. If set to nil, it... | stack_v2_sparse_classes_36k_train_014628 | 4,761 | permissive | [
{
"docstring": "Constructor for the ViewUserQuotas class",
"name": "__init__",
"signature": "def __init__(self, cookie=None, quota_and_usage_in_all_views=None, summary_for_user=None, summary_for_view=None, user_quota_settings=None, users_quota_and_usage=None)"
},
{
"docstring": "Creates an insta... | 2 | stack_v2_sparse_classes_30k_train_020674 | Implement the Python class `ViewUserQuotas` described below.
Class description:
Implementation of the 'ViewUserQuotas' model. Specifies the Result parameters for all user quotas of a view. Attributes: cookie (string): This cookie can be used in the succeeding call to list user quotas and usages to get the next set of ... | Implement the Python class `ViewUserQuotas` described below.
Class description:
Implementation of the 'ViewUserQuotas' model. Specifies the Result parameters for all user quotas of a view. Attributes: cookie (string): This cookie can be used in the succeeding call to list user quotas and usages to get the next set of ... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ViewUserQuotas:
"""Implementation of the 'ViewUserQuotas' model. Specifies the Result parameters for all user quotas of a view. Attributes: cookie (string): This cookie can be used in the succeeding call to list user quotas and usages to get the next set of user quota overrides. If set to nil, it... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ViewUserQuotas:
"""Implementation of the 'ViewUserQuotas' model. Specifies the Result parameters for all user quotas of a view. Attributes: cookie (string): This cookie can be used in the succeeding call to list user quotas and usages to get the next set of user quota overrides. If set to nil, it means that t... | the_stack_v2_python_sparse | cohesity_management_sdk/models/view_user_quotas.py | cohesity/management-sdk-python | train | 24 |
f3415809b242166c545870e6439af3168791a1bc | [
"if not is_two_file:\n _, data = self.split_metadata(data, post, lang)\nnew_data, shortcodes = sc.extract_shortcodes(data)\nreturn self.site.apply_shortcodes_uuid(new_data, shortcodes, filename=source_path, extra_context={'post': post})",
"makedirs(os.path.dirname(dest))\nwith io.open(dest, 'w+', encoding='utf... | <|body_start_0|>
if not is_two_file:
_, data = self.split_metadata(data, post, lang)
new_data, shortcodes = sc.extract_shortcodes(data)
return self.site.apply_shortcodes_uuid(new_data, shortcodes, filename=source_path, extra_context={'post': post})
<|end_body_0|>
<|body_start_1|>
... | Compile Observable Notebooks into HTML. | CompileObservable | [
"MIT",
"BSD-3-Clause",
"Apache-2.0",
"BSD-2-Clause",
"LGPL-2.0-or-later",
"LicenseRef-scancode-free-unknown",
"GPL-1.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompileObservable:
"""Compile Observable Notebooks into HTML."""
def compile_string(self, data, source_path=None, is_two_file=True, post=None, lang=None):
"""Compile notebook into HTML strings, with shortcode support."""
<|body_0|>
def compile(self, source, dest, is_two_... | stack_v2_sparse_classes_36k_train_014629 | 4,275 | permissive | [
{
"docstring": "Compile notebook into HTML strings, with shortcode support.",
"name": "compile_string",
"signature": "def compile_string(self, data, source_path=None, is_two_file=True, post=None, lang=None)"
},
{
"docstring": "Compile the source file into HTML and save as dest.",
"name": "co... | 3 | stack_v2_sparse_classes_30k_train_003102 | Implement the Python class `CompileObservable` described below.
Class description:
Compile Observable Notebooks into HTML.
Method signatures and docstrings:
- def compile_string(self, data, source_path=None, is_two_file=True, post=None, lang=None): Compile notebook into HTML strings, with shortcode support.
- def com... | Implement the Python class `CompileObservable` described below.
Class description:
Compile Observable Notebooks into HTML.
Method signatures and docstrings:
- def compile_string(self, data, source_path=None, is_two_file=True, post=None, lang=None): Compile notebook into HTML strings, with shortcode support.
- def com... | 9de663884ba5f15153d37e527ade6f55e42661a3 | <|skeleton|>
class CompileObservable:
"""Compile Observable Notebooks into HTML."""
def compile_string(self, data, source_path=None, is_two_file=True, post=None, lang=None):
"""Compile notebook into HTML strings, with shortcode support."""
<|body_0|>
def compile(self, source, dest, is_two_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CompileObservable:
"""Compile Observable Notebooks into HTML."""
def compile_string(self, data, source_path=None, is_two_file=True, post=None, lang=None):
"""Compile notebook into HTML strings, with shortcode support."""
if not is_two_file:
_, data = self.split_metadata(data, ... | the_stack_v2_python_sparse | v8/observable/observable.py | getnikola/plugins | train | 62 |
2125a96c457e30f7a521b353492202f6b2507c2b | [
"if not no_staleness:\n self.addStalenessPeriods()\nimporter = ImportCmd()\nfor filename in glob.glob(os.path.join(EGG_DIR, '*.json')):\n importer.run(filename, listName=self.getListName(filename))",
"previousPeriod = None\nfor days in [180, 90, 30, 14, 7]:\n if previousPeriod is not None:\n perio... | <|body_start_0|>
if not no_staleness:
self.addStalenessPeriods()
importer = ImportCmd()
for filename in glob.glob(os.path.join(EGG_DIR, '*.json')):
importer.run(filename, listName=self.getListName(filename))
<|end_body_0|>
<|body_start_1|>
previousPeriod = None
... | Command to seed the database with all available resource files | Seed | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Seed:
"""Command to seed the database with all available resource files"""
def run(self, *, no_staleness=False):
"""Create the new log entry"""
<|body_0|>
def addStalenessPeriods(self):
"""Add the staleness periods"""
<|body_1|>
def getListName(self,... | stack_v2_sparse_classes_36k_train_014630 | 1,798 | no_license | [
{
"docstring": "Create the new log entry",
"name": "run",
"signature": "def run(self, *, no_staleness=False)"
},
{
"docstring": "Add the staleness periods",
"name": "addStalenessPeriods",
"signature": "def addStalenessPeriods(self)"
},
{
"docstring": "Return the list name for the... | 3 | null | Implement the Python class `Seed` described below.
Class description:
Command to seed the database with all available resource files
Method signatures and docstrings:
- def run(self, *, no_staleness=False): Create the new log entry
- def addStalenessPeriods(self): Add the staleness periods
- def getListName(self, fil... | Implement the Python class `Seed` described below.
Class description:
Command to seed the database with all available resource files
Method signatures and docstrings:
- def run(self, *, no_staleness=False): Create the new log entry
- def addStalenessPeriods(self): Add the staleness periods
- def getListName(self, fil... | f08dc4465b7e4fb32235e1647c46edd4472f9093 | <|skeleton|>
class Seed:
"""Command to seed the database with all available resource files"""
def run(self, *, no_staleness=False):
"""Create the new log entry"""
<|body_0|>
def addStalenessPeriods(self):
"""Add the staleness periods"""
<|body_1|>
def getListName(self,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Seed:
"""Command to seed the database with all available resource files"""
def run(self, *, no_staleness=False):
"""Create the new log entry"""
if not no_staleness:
self.addStalenessPeriods()
importer = ImportCmd()
for filename in glob.glob(os.path.join(EGG_DIR... | the_stack_v2_python_sparse | src/Driver/Commands/seed.py | cloew/VocabTester | train | 0 |
33ec09ba13f6846d5027bb4199082f3bab99bd67 | [
"if not l or not r or r < l:\n return list()\nreturn [i for i in range(l, r + 1, 1) if self.is_self_dividing(i)]",
"if not i:\n return False\np = i\nwhile p > 0:\n p, d = divmod(p, 10)\n if d == 0 or i % d != 0:\n return False\nreturn True"
] | <|body_start_0|>
if not l or not r or r < l:
return list()
return [i for i in range(l, r + 1, 1) if self.is_self_dividing(i)]
<|end_body_0|>
<|body_start_1|>
if not i:
return False
p = i
while p > 0:
p, d = divmod(p, 10)
if d == 0 ... | Pythonic iteration over all integers in target range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range | Solution | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Pythonic iteration over all integers in target range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range"""
def find_self_dividing_nums(self, l, r):
"""Determines all self-d... | stack_v2_sparse_classes_36k_train_014631 | 3,918 | permissive | [
{
"docstring": "Determines all self-dividing numbers within target limits (inclusive). :param int l: lower limit of target range :param int r: upper limit of target range :return: array of all self-dividing numbers in range :rtype: list[int]",
"name": "find_self_dividing_nums",
"signature": "def find_se... | 2 | stack_v2_sparse_classes_30k_train_013399 | Implement the Python class `Solution` described below.
Class description:
Pythonic iteration over all integers in target range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range
Method signatures and docstrings:
- def f... | Implement the Python class `Solution` described below.
Class description:
Pythonic iteration over all integers in target range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range
Method signatures and docstrings:
- def f... | 69f90877c5466927e8b081c4268cbcda074813ec | <|skeleton|>
class Solution:
"""Pythonic iteration over all integers in target range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range"""
def find_self_dividing_nums(self, l, r):
"""Determines all self-d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""Pythonic iteration over all integers in target range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range"""
def find_self_dividing_nums(self, l, r):
"""Determines all self-dividing numbe... | the_stack_v2_python_sparse | 0728_self_dividing_numbers/python_source.py | arthurdysart/LeetCode | train | 0 |
ca0d77c1d52fd1ab79fbd6ac5a9e59996c39377d | [
"from collections import deque\nif not grid:\n return 0\nrows, cols, island_count = (len(grid), len(grid[0]), 0)\nq = deque([])\n\ndef helper(grid: List[List[str]], q: 'deque'):\n while q:\n r, c = q.popleft()\n for dr, dc in ((r + 1, c), (r - 1, c), (r, c + 1), (r, c - 1)):\n if 0 <=... | <|body_start_0|>
from collections import deque
if not grid:
return 0
rows, cols, island_count = (len(grid), len(grid[0]), 0)
q = deque([])
def helper(grid: List[List[str]], q: 'deque'):
while q:
r, c = q.popleft()
for dr, d... | Islands | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Islands:
def total_number_(self, grid: List[List[str]]) -> str:
"""Approach: BFS Time Complexity: O(M*N) Space Complexity: O(min(M,N)) :param grid: :return:"""
<|body_0|>
def total_number(self, grid: List[List[str]]) -> str:
"""Approach: DFS/ Back tracking Time Compl... | stack_v2_sparse_classes_36k_train_014632 | 2,392 | no_license | [
{
"docstring": "Approach: BFS Time Complexity: O(M*N) Space Complexity: O(min(M,N)) :param grid: :return:",
"name": "total_number_",
"signature": "def total_number_(self, grid: List[List[str]]) -> str"
},
{
"docstring": "Approach: DFS/ Back tracking Time Complexity: O(M*N) Space Complexity: O(M*... | 2 | stack_v2_sparse_classes_30k_test_000273 | Implement the Python class `Islands` described below.
Class description:
Implement the Islands class.
Method signatures and docstrings:
- def total_number_(self, grid: List[List[str]]) -> str: Approach: BFS Time Complexity: O(M*N) Space Complexity: O(min(M,N)) :param grid: :return:
- def total_number(self, grid: List... | Implement the Python class `Islands` described below.
Class description:
Implement the Islands class.
Method signatures and docstrings:
- def total_number_(self, grid: List[List[str]]) -> str: Approach: BFS Time Complexity: O(M*N) Space Complexity: O(min(M,N)) :param grid: :return:
- def total_number(self, grid: List... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Islands:
def total_number_(self, grid: List[List[str]]) -> str:
"""Approach: BFS Time Complexity: O(M*N) Space Complexity: O(min(M,N)) :param grid: :return:"""
<|body_0|>
def total_number(self, grid: List[List[str]]) -> str:
"""Approach: DFS/ Back tracking Time Compl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Islands:
def total_number_(self, grid: List[List[str]]) -> str:
"""Approach: BFS Time Complexity: O(M*N) Space Complexity: O(min(M,N)) :param grid: :return:"""
from collections import deque
if not grid:
return 0
rows, cols, island_count = (len(grid), len(grid[0]), 0... | the_stack_v2_python_sparse | revisited_2021/2d_array/number_of_islands.py | Shiv2157k/leet_code | train | 1 | |
f4b26ff15f55031f782a57b94e9011210b35d245 | [
"self = object.__new__(cls)\nself.name = cls.DEFAULT_NAME\nself.value = value\nself.deserializer = cls.none.deserializer\nself.serializer = cls.none.serializer\nreturn self",
"self.value = value\nself.name = name\nself.deserializer = deserializer\nself.serializer = serializer\nself.INSTANCES[value] = self"
] | <|body_start_0|>
self = object.__new__(cls)
self.name = cls.DEFAULT_NAME
self.value = value
self.deserializer = cls.none.deserializer
self.serializer = cls.none.serializer
return self
<|end_body_0|>
<|body_start_1|>
self.value = value
self.name = name
... | Type information for application role connection metadata values'. > This type is wrapper side only. Attributes ---------- name : `str` The name of the value type. value : `int` The identifier of the value type. deserializer : `FunctionType` Function used to deserialize values. serializer : `FunctionType` Function used... | ApplicationRoleConnectionValueType | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApplicationRoleConnectionValueType:
"""Type information for application role connection metadata values'. > This type is wrapper side only. Attributes ---------- name : `str` The name of the value type. value : `int` The identifier of the value type. deserializer : `FunctionType` Function used to... | stack_v2_sparse_classes_36k_train_014633 | 9,302 | permissive | [
{
"docstring": "Creates a new application role connection value type with the given value. Parameters ---------- value : `int` The application role connection value type's identifier value. Returns ------- self : ``ApplicationRoleConnectionValueType`` The created instance.",
"name": "_from_value",
"sign... | 2 | null | Implement the Python class `ApplicationRoleConnectionValueType` described below.
Class description:
Type information for application role connection metadata values'. > This type is wrapper side only. Attributes ---------- name : `str` The name of the value type. value : `int` The identifier of the value type. deseria... | Implement the Python class `ApplicationRoleConnectionValueType` described below.
Class description:
Type information for application role connection metadata values'. > This type is wrapper side only. Attributes ---------- name : `str` The name of the value type. value : `int` The identifier of the value type. deseria... | 53f24fdb38459dc5a4fd04f11bdbfee8295b76a4 | <|skeleton|>
class ApplicationRoleConnectionValueType:
"""Type information for application role connection metadata values'. > This type is wrapper side only. Attributes ---------- name : `str` The name of the value type. value : `int` The identifier of the value type. deserializer : `FunctionType` Function used to... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ApplicationRoleConnectionValueType:
"""Type information for application role connection metadata values'. > This type is wrapper side only. Attributes ---------- name : `str` The name of the value type. value : `int` The identifier of the value type. deserializer : `FunctionType` Function used to deserialize ... | the_stack_v2_python_sparse | hata/discord/application/application_role_connection_metadata/preinstanced.py | HuyaneMatsu/hata | train | 3 |
1053ed374a79e18aa796f9961319a43862d6949f | [
"super(CompetitiveDenseBlockInput, self).__init__()\npadding_h = int((params['kernel_h'] - 1) / 2)\npadding_w = int((params['kernel_w'] - 1) / 2)\nconv0_in_size = int(params['num_channels'])\nconv1_in_size = int(params['num_filters'])\nconv2_in_size = int(params['num_filters'])\nself.conv0 = nn.Conv2d(in_channels=c... | <|body_start_0|>
super(CompetitiveDenseBlockInput, self).__init__()
padding_h = int((params['kernel_h'] - 1) / 2)
padding_w = int((params['kernel_w'] - 1) / 2)
conv0_in_size = int(params['num_channels'])
conv1_in_size = int(params['num_filters'])
conv2_in_size = int(param... | Function to define a competitive dense block comprising of 3 convolutional layers, with BN/ReLU for input Inputs: -- Params params = {'num_channels': 1, 'num_filters': 64, 'kernel_h': 5, 'kernel_w': 5, 'stride_conv': 1, 'pool': 2, 'stride_pool': 2, 'num_classes': 44 'kernel_c':1 'input':True } | CompetitiveDenseBlockInput | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompetitiveDenseBlockInput:
"""Function to define a competitive dense block comprising of 3 convolutional layers, with BN/ReLU for input Inputs: -- Params params = {'num_channels': 1, 'num_filters': 64, 'kernel_h': 5, 'kernel_w': 5, 'stride_conv': 1, 'pool': 2, 'stride_pool': 2, 'num_classes': 44... | stack_v2_sparse_classes_36k_train_014634 | 12,544 | permissive | [
{
"docstring": "Constructor to initialize the Competitive Dense Block :param dict params: dictionary with parameters specifiying block architecture",
"name": "__init__",
"signature": "def __init__(self, params)"
},
{
"docstring": "CompetitiveDenseBlockInput's computational Graph in -> BN -> {Con... | 2 | stack_v2_sparse_classes_30k_val_000386 | Implement the Python class `CompetitiveDenseBlockInput` described below.
Class description:
Function to define a competitive dense block comprising of 3 convolutional layers, with BN/ReLU for input Inputs: -- Params params = {'num_channels': 1, 'num_filters': 64, 'kernel_h': 5, 'kernel_w': 5, 'stride_conv': 1, 'pool':... | Implement the Python class `CompetitiveDenseBlockInput` described below.
Class description:
Function to define a competitive dense block comprising of 3 convolutional layers, with BN/ReLU for input Inputs: -- Params params = {'num_channels': 1, 'num_filters': 64, 'kernel_h': 5, 'kernel_w': 5, 'stride_conv': 1, 'pool':... | 1f20d60d4e81332715f7e50d82ad6779963fe30a | <|skeleton|>
class CompetitiveDenseBlockInput:
"""Function to define a competitive dense block comprising of 3 convolutional layers, with BN/ReLU for input Inputs: -- Params params = {'num_channels': 1, 'num_filters': 64, 'kernel_h': 5, 'kernel_w': 5, 'stride_conv': 1, 'pool': 2, 'stride_pool': 2, 'num_classes': 44... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CompetitiveDenseBlockInput:
"""Function to define a competitive dense block comprising of 3 convolutional layers, with BN/ReLU for input Inputs: -- Params params = {'num_channels': 1, 'num_filters': 64, 'kernel_h': 5, 'kernel_w': 5, 'stride_conv': 1, 'pool': 2, 'stride_pool': 2, 'num_classes': 44 'kernel_c':1... | the_stack_v2_python_sparse | FastSurferCNN/models/sub_module.py | abdullahbas/FastSurfer | train | 0 |
67d3d0b2492fc931ad1664945d659bce4cd98a7a | [
"if lambtha <= 0:\n raise ValueError('lambtha must be a positive value')\nelif data is None:\n self.lambtha = toFloat(lambtha)\nelif type(data) is not list:\n raise TypeError('data must be a list')\nelif len(data) < 2:\n raise ValueError('data must contain multiple values')\nelse:\n self.lambtha = fl... | <|body_start_0|>
if lambtha <= 0:
raise ValueError('lambtha must be a positive value')
elif data is None:
self.lambtha = toFloat(lambtha)
elif type(data) is not list:
raise TypeError('data must be a list')
elif len(data) < 2:
raise ValueErr... | Exponential class | Exponential | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Exponential:
"""Exponential class"""
def __init__(self, data=None, lambtha=1.0):
""":param data: is a list of the data to be used to estimate the distribution :param lambtha: is the expected number of occurences in a given time frame"""
<|body_0|>
def pdf(self, x):
... | stack_v2_sparse_classes_36k_train_014635 | 1,519 | no_license | [
{
"docstring": ":param data: is a list of the data to be used to estimate the distribution :param lambtha: is the expected number of occurences in a given time frame",
"name": "__init__",
"signature": "def __init__(self, data=None, lambtha=1.0)"
},
{
"docstring": ":param x: time period :return: ... | 3 | stack_v2_sparse_classes_30k_train_001993 | Implement the Python class `Exponential` described below.
Class description:
Exponential class
Method signatures and docstrings:
- def __init__(self, data=None, lambtha=1.0): :param data: is a list of the data to be used to estimate the distribution :param lambtha: is the expected number of occurences in a given time... | Implement the Python class `Exponential` described below.
Class description:
Exponential class
Method signatures and docstrings:
- def __init__(self, data=None, lambtha=1.0): :param data: is a list of the data to be used to estimate the distribution :param lambtha: is the expected number of occurences in a given time... | a381edc7c843abb6458d5a70ae91d4f6823c176b | <|skeleton|>
class Exponential:
"""Exponential class"""
def __init__(self, data=None, lambtha=1.0):
""":param data: is a list of the data to be used to estimate the distribution :param lambtha: is the expected number of occurences in a given time frame"""
<|body_0|>
def pdf(self, x):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Exponential:
"""Exponential class"""
def __init__(self, data=None, lambtha=1.0):
""":param data: is a list of the data to be used to estimate the distribution :param lambtha: is the expected number of occurences in a given time frame"""
if lambtha <= 0:
raise ValueError('lambt... | the_stack_v2_python_sparse | math/0x03-probability/exponential.py | jhonatang1988/holbertonschool-machine_learning | train | 0 |
9144e5d189ed704f69eb27ad0845f1b4f7edcee1 | [
"PygameScreen.__init__(self)\nself.attacksMenu = attacksMenu\nself.lastScreen = lastScreen",
"previousScreenSurface = self.lastScreen.draw()\nself.drawOnSurface(previousScreenSurface, left=0, top=0)\nmenuSurface = self.attacksMenu.draw()\nself.drawOnSurface(menuSurface, left=0.05, top=0.7)"
] | <|body_start_0|>
PygameScreen.__init__(self)
self.attacksMenu = attacksMenu
self.lastScreen = lastScreen
<|end_body_0|>
<|body_start_1|>
previousScreenSurface = self.lastScreen.draw()
self.drawOnSurface(previousScreenSurface, left=0, top=0)
menuSurface = self.attacksMenu... | Represents the screen for a Picking an Attack | AttackPickerScreen | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttackPickerScreen:
"""Represents the screen for a Picking an Attack"""
def __init__(self, attacksMenu, lastScreen):
"""Initialize the screen"""
<|body_0|>
def drawSurface(self):
"""Draws the screen"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_014636 | 675 | no_license | [
{
"docstring": "Initialize the screen",
"name": "__init__",
"signature": "def __init__(self, attacksMenu, lastScreen)"
},
{
"docstring": "Draws the screen",
"name": "drawSurface",
"signature": "def drawSurface(self)"
}
] | 2 | null | Implement the Python class `AttackPickerScreen` described below.
Class description:
Represents the screen for a Picking an Attack
Method signatures and docstrings:
- def __init__(self, attacksMenu, lastScreen): Initialize the screen
- def drawSurface(self): Draws the screen | Implement the Python class `AttackPickerScreen` described below.
Class description:
Represents the screen for a Picking an Attack
Method signatures and docstrings:
- def __init__(self, attacksMenu, lastScreen): Initialize the screen
- def drawSurface(self): Draws the screen
<|skeleton|>
class AttackPickerScreen:
... | 3931eee5fd04e18bb1738a0b27a4c6979dc4db01 | <|skeleton|>
class AttackPickerScreen:
"""Represents the screen for a Picking an Attack"""
def __init__(self, attacksMenu, lastScreen):
"""Initialize the screen"""
<|body_0|>
def drawSurface(self):
"""Draws the screen"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AttackPickerScreen:
"""Represents the screen for a Picking an Attack"""
def __init__(self, attacksMenu, lastScreen):
"""Initialize the screen"""
PygameScreen.__init__(self)
self.attacksMenu = attacksMenu
self.lastScreen = lastScreen
def drawSurface(self):
"""D... | the_stack_v2_python_sparse | src/Screen/Pygame/Event/LearnAttack/attack_picker_screen.py | sgtnourry/Pokemon-Project | train | 0 |
a7e55ac71a8cfb54711cc724f5fc8a03abb52f08 | [
"letters = {'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': 7, 'H': 8, 'I': 9, 'J': 10, 'K': 11, 'L': 12, 'M': 13, 'N': 14, 'O': 15, 'P': 16, 'Q': 17, 'R': 18, 'S': 19, 'T': 20, 'U': 21, 'V': 22, 'W': 23, 'X': 24, 'Y': 25, 'Z': 26}\ns = s.upper()\nret = 0\nb = 0\nfor c in reversed(s):\n ret += letters[c] * ... | <|body_start_0|>
letters = {'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': 7, 'H': 8, 'I': 9, 'J': 10, 'K': 11, 'L': 12, 'M': 13, 'N': 14, 'O': 15, 'P': 16, 'Q': 17, 'R': 18, 'S': 19, 'T': 20, 'U': 21, 'V': 22, 'W': 23, 'X': 24, 'Y': 25, 'Z': 26}
s = s.upper()
ret = 0
b = 0
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def titleToNumber(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def titleToNumber2(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
letters = {'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': ... | stack_v2_sparse_classes_36k_train_014637 | 1,010 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "titleToNumber",
"signature": "def titleToNumber(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "titleToNumber2",
"signature": "def titleToNumber2(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016060 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def titleToNumber(self, s): :type s: str :rtype: int
- def titleToNumber2(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def titleToNumber(self, s): :type s: str :rtype: int
- def titleToNumber2(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def titleToNumber(self, s):
... | 434889037fe3e405a8cbc71cd822eb1bda9aa606 | <|skeleton|>
class Solution:
def titleToNumber(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def titleToNumber2(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def titleToNumber(self, s):
""":type s: str :rtype: int"""
letters = {'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': 7, 'H': 8, 'I': 9, 'J': 10, 'K': 11, 'L': 12, 'M': 13, 'N': 14, 'O': 15, 'P': 16, 'Q': 17, 'R': 18, 'S': 19, 'T': 20, 'U': 21, 'V': 22, 'W': 23, 'X': 24, 'Y': 25... | the_stack_v2_python_sparse | python/0171.excel-sheet-column-number/excel-sheet-column-number.py | ysmintor/leetcode | train | 0 | |
57febc7b7d328744369c68beae40c2f58295da73 | [
"if isinstance(uvbeam, str):\n uvb = UVBeam()\n uvb.read_beamfits(uvbeam, use_future_array_shapes=True)\nelse:\n uvb = uvbeam\n uvb.use_future_array_shapes()\nself.beam_freqs = uvb.freq_array\nif cosmo is not None:\n self.cosmo = cosmo\nelse:\n self.cosmo = conversions.Cosmo_Conversions()\nself.pr... | <|body_start_0|>
if isinstance(uvbeam, str):
uvb = UVBeam()
uvb.read_beamfits(uvbeam, use_future_array_shapes=True)
else:
uvb = uvbeam
uvb.use_future_array_shapes()
self.beam_freqs = uvb.freq_array
if cosmo is not None:
self.cos... | PSpecBeamUV | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PSpecBeamUV:
def __init__(self, uvbeam, cosmo=None):
"""Object to store the primary beam for a pspec observation. This is subclassed from PSpecBeamBase to take in a pyuvdata UVBeam filepath or object. Note: If one wants to use this object for linear dipole polarizations (e.g. XX, XY, YX,... | stack_v2_sparse_classes_36k_train_014638 | 29,545 | permissive | [
{
"docstring": "Object to store the primary beam for a pspec observation. This is subclassed from PSpecBeamBase to take in a pyuvdata UVBeam filepath or object. Note: If one wants to use this object for linear dipole polarizations (e.g. XX, XY, YX, YY) then one can feed uvbeam as a dipole power beam or an efiel... | 4 | stack_v2_sparse_classes_30k_train_007878 | Implement the Python class `PSpecBeamUV` described below.
Class description:
Implement the PSpecBeamUV class.
Method signatures and docstrings:
- def __init__(self, uvbeam, cosmo=None): Object to store the primary beam for a pspec observation. This is subclassed from PSpecBeamBase to take in a pyuvdata UVBeam filepat... | Implement the Python class `PSpecBeamUV` described below.
Class description:
Implement the PSpecBeamUV class.
Method signatures and docstrings:
- def __init__(self, uvbeam, cosmo=None): Object to store the primary beam for a pspec observation. This is subclassed from PSpecBeamBase to take in a pyuvdata UVBeam filepat... | 482c31c5b1ead911d521f514b6e6a700b9fab17e | <|skeleton|>
class PSpecBeamUV:
def __init__(self, uvbeam, cosmo=None):
"""Object to store the primary beam for a pspec observation. This is subclassed from PSpecBeamBase to take in a pyuvdata UVBeam filepath or object. Note: If one wants to use this object for linear dipole polarizations (e.g. XX, XY, YX,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PSpecBeamUV:
def __init__(self, uvbeam, cosmo=None):
"""Object to store the primary beam for a pspec observation. This is subclassed from PSpecBeamBase to take in a pyuvdata UVBeam filepath or object. Note: If one wants to use this object for linear dipole polarizations (e.g. XX, XY, YX, YY) then one ... | the_stack_v2_python_sparse | hera_pspec/pspecbeam.py | HERA-Team/hera_pspec | train | 11 | |
9cb79d0b5ef5ae4005c29fd97208432b06dc481b | [
"super(NetworkXFigure, self).__init__(name=name, width=width, height=height, interactive=interactive, font=font, logging=logging, template=template, port=port, **kwargs)\nself.G = graph\nself._save_data()",
"data = json_graph.node_link_data(self.G)\ns = json.dumps(data)\nreturn s"
] | <|body_start_0|>
super(NetworkXFigure, self).__init__(name=name, width=width, height=height, interactive=interactive, font=font, logging=logging, template=template, port=port, **kwargs)
self.G = graph
self._save_data()
<|end_body_0|>
<|body_start_1|>
data = json_graph.node_link_data(sel... | NetworkXFigure | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NetworkXFigure:
def __init__(self, graph, name='figure', width=400, height=100, interactive=True, font='Asap', logging=False, template=None, port=8000, **kwargs):
"""data : networkx gprah networkx graph used for the plot. name : string name of visualisation. This will appear in the title... | stack_v2_sparse_classes_36k_train_014639 | 1,847 | no_license | [
{
"docstring": "data : networkx gprah networkx graph used for the plot. name : string name of visualisation. This will appear in the title bar of the webpage, and is the name of the folder where your files will be stored. width : int width of the figure in pixels (default is 400) height : int height of the figu... | 2 | stack_v2_sparse_classes_30k_train_011087 | Implement the Python class `NetworkXFigure` described below.
Class description:
Implement the NetworkXFigure class.
Method signatures and docstrings:
- def __init__(self, graph, name='figure', width=400, height=100, interactive=True, font='Asap', logging=False, template=None, port=8000, **kwargs): data : networkx gpr... | Implement the Python class `NetworkXFigure` described below.
Class description:
Implement the NetworkXFigure class.
Method signatures and docstrings:
- def __init__(self, graph, name='figure', width=400, height=100, interactive=True, font='Asap', logging=False, template=None, port=8000, **kwargs): data : networkx gpr... | 50aa44b1c893abdfdf4e8a6510ac9f54706c3554 | <|skeleton|>
class NetworkXFigure:
def __init__(self, graph, name='figure', width=400, height=100, interactive=True, font='Asap', logging=False, template=None, port=8000, **kwargs):
"""data : networkx gprah networkx graph used for the plot. name : string name of visualisation. This will appear in the title... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NetworkXFigure:
def __init__(self, graph, name='figure', width=400, height=100, interactive=True, font='Asap', logging=False, template=None, port=8000, **kwargs):
"""data : networkx gprah networkx graph used for the plot. name : string name of visualisation. This will appear in the title bar of the we... | the_stack_v2_python_sparse | d3py/networkx_figure.py | bigsnarfdude/d3py | train | 4 | |
101d06cbde415cddfdcc20d47670c3d7214a2114 | [
"template_values = dict(form=self.form_class(), breadcrumbs=self.breadcrumbs)\ntemplate_values = users.view_util.fill_template_values(request, **template_values)\nreturn render(request, self.template_name, template_values)",
"form = self.form_class(request.POST)\ntemplate_values = dict(form=form, breadcrumbs=self... | <|body_start_0|>
template_values = dict(form=self.form_class(), breadcrumbs=self.breadcrumbs)
template_values = users.view_util.fill_template_values(request, **template_values)
return render(request, self.template_name, template_values)
<|end_body_0|>
<|body_start_1|>
form = self.form_c... | Compute capacity and charge rates. | ChargeRateView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChargeRateView:
"""Compute capacity and charge rates."""
def get(self, request, *args, **kwargs):
"""Process a GET request"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Process a POST request"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_014640 | 1,850 | permissive | [
{
"docstring": "Process a GET request",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Process a POST request",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013140 | Implement the Python class `ChargeRateView` described below.
Class description:
Compute capacity and charge rates.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Process a GET request
- def post(self, request, *args, **kwargs): Process a POST request | Implement the Python class `ChargeRateView` described below.
Class description:
Compute capacity and charge rates.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Process a GET request
- def post(self, request, *args, **kwargs): Process a POST request
<|skeleton|>
class ChargeRateView:
... | 8381a0a1e64fb8df89a28e4729cb2957e0ebce57 | <|skeleton|>
class ChargeRateView:
"""Compute capacity and charge rates."""
def get(self, request, *args, **kwargs):
"""Process a GET request"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Process a POST request"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChargeRateView:
"""Compute capacity and charge rates."""
def get(self, request, *args, **kwargs):
"""Process a GET request"""
template_values = dict(form=self.form_class(), breadcrumbs=self.breadcrumbs)
template_values = users.view_util.fill_template_values(request, **template_val... | the_stack_v2_python_sparse | web_reflectivity/tools/views.py | neutrons/web_reflectivity | train | 1 |
dec8e986527daa2053b68695b07d7c8b1d94373b | [
"load_dotenv(find_dotenv())\nCONSUMER_KEY = os.getenv('TWITTER_CONSUMER_KEY')\nCONSUMER_SECRET = os.getenv('TWITTER_CONSUMER_SECRET')\nACCESS_TOKEN_KEY = os.getenv('TWITTER_ACCESS_TOKEN_KEY')\nACCESS_TOKEN_SECRET = os.getenv('TWITTER_ACCESS_TOKEN_SECRET')\nself.api = twitter.Api(consumer_key=CONSUMER_KEY, consumer_... | <|body_start_0|>
load_dotenv(find_dotenv())
CONSUMER_KEY = os.getenv('TWITTER_CONSUMER_KEY')
CONSUMER_SECRET = os.getenv('TWITTER_CONSUMER_SECRET')
ACCESS_TOKEN_KEY = os.getenv('TWITTER_ACCESS_TOKEN_KEY')
ACCESS_TOKEN_SECRET = os.getenv('TWITTER_ACCESS_TOKEN_SECRET')
self... | Class for fetching tweets from the public Twitter API. | TweetCollector | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TweetCollector:
"""Class for fetching tweets from the public Twitter API."""
def __init__(self):
"""Initialize API connection"""
<|body_0|>
def get_tweets(self, user_ids, start, end, update_interval=50):
"""Fetches tweets from the given time frame for the specifi... | stack_v2_sparse_classes_36k_train_014641 | 3,006 | no_license | [
{
"docstring": "Initialize API connection",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Fetches tweets from the given time frame for the specified users. Args: user_ids: Array of integers representing the users start: non-naive datetime (including timezone info) end:... | 3 | null | Implement the Python class `TweetCollector` described below.
Class description:
Class for fetching tweets from the public Twitter API.
Method signatures and docstrings:
- def __init__(self): Initialize API connection
- def get_tweets(self, user_ids, start, end, update_interval=50): Fetches tweets from the given time ... | Implement the Python class `TweetCollector` described below.
Class description:
Class for fetching tweets from the public Twitter API.
Method signatures and docstrings:
- def __init__(self): Initialize API connection
- def get_tweets(self, user_ids, start, end, update_interval=50): Fetches tweets from the given time ... | 28b880cc0f4f4a72c910a5534323028576d2d80f | <|skeleton|>
class TweetCollector:
"""Class for fetching tweets from the public Twitter API."""
def __init__(self):
"""Initialize API connection"""
<|body_0|>
def get_tweets(self, user_ids, start, end, update_interval=50):
"""Fetches tweets from the given time frame for the specifi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TweetCollector:
"""Class for fetching tweets from the public Twitter API."""
def __init__(self):
"""Initialize API connection"""
load_dotenv(find_dotenv())
CONSUMER_KEY = os.getenv('TWITTER_CONSUMER_KEY')
CONSUMER_SECRET = os.getenv('TWITTER_CONSUMER_SECRET')
ACCES... | the_stack_v2_python_sparse | tep/tweetCollector.py | felixpeters/tweet-engagement-prediction | train | 6 |
d8e2f479fc6f85e15e2a8e58ffb4a0991d805a9b | [
"super(NAT, self).__init__(name, **params)\nself.subnet = subnet\nself.localIntf = localIntf\nself.flush = flush\nself.forwardState = self.cmd('sysctl -n net.ipv4.ip_forward').strip()",
"super(NAT, self).config(**params)\nif not self.localIntf:\n self.localIntf = self.defaultIntf()\nif self.flush:\n self.cm... | <|body_start_0|>
super(NAT, self).__init__(name, **params)
self.subnet = subnet
self.localIntf = localIntf
self.flush = flush
self.forwardState = self.cmd('sysctl -n net.ipv4.ip_forward').strip()
<|end_body_0|>
<|body_start_1|>
super(NAT, self).config(**params)
i... | NAT: Provides connectivity to external network | NAT | [
"LicenseRef-scancode-x11-stanford",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NAT:
"""NAT: Provides connectivity to external network"""
def __init__(self, name, subnet='10.0/8', localIntf=None, flush=False, **params):
"""Start NAT/forwarding between Mininet and external network subnet: Mininet subnet (default 10.0/8) flush: flush iptables before installing NAT... | stack_v2_sparse_classes_36k_train_014642 | 5,539 | permissive | [
{
"docstring": "Start NAT/forwarding between Mininet and external network subnet: Mininet subnet (default 10.0/8) flush: flush iptables before installing NAT rules",
"name": "__init__",
"signature": "def __init__(self, name, subnet='10.0/8', localIntf=None, flush=False, **params)"
},
{
"docstrin... | 3 | stack_v2_sparse_classes_30k_train_016283 | Implement the Python class `NAT` described below.
Class description:
NAT: Provides connectivity to external network
Method signatures and docstrings:
- def __init__(self, name, subnet='10.0/8', localIntf=None, flush=False, **params): Start NAT/forwarding between Mininet and external network subnet: Mininet subnet (de... | Implement the Python class `NAT` described below.
Class description:
NAT: Provides connectivity to external network
Method signatures and docstrings:
- def __init__(self, name, subnet='10.0/8', localIntf=None, flush=False, **params): Start NAT/forwarding between Mininet and external network subnet: Mininet subnet (de... | 4b4edc8ec23a8ce997eb1ebd55764d897818fd0d | <|skeleton|>
class NAT:
"""NAT: Provides connectivity to external network"""
def __init__(self, name, subnet='10.0/8', localIntf=None, flush=False, **params):
"""Start NAT/forwarding between Mininet and external network subnet: Mininet subnet (default 10.0/8) flush: flush iptables before installing NAT... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NAT:
"""NAT: Provides connectivity to external network"""
def __init__(self, name, subnet='10.0/8', localIntf=None, flush=False, **params):
"""Start NAT/forwarding between Mininet and external network subnet: Mininet subnet (default 10.0/8) flush: flush iptables before installing NAT rules"""
... | the_stack_v2_python_sparse | mininet/mininet/nodelib.py | Giuseppe1992/Distrinet | train | 20 |
4d794a4365ba31422de5927118c4608dfeb53c46 | [
"super(EncodedTextReader, self).__init__()\nself._buffer = ''\nself._buffer_size = buffer_size\nself._current_offset = 0\nself._encoding = encoding\nself.lines = ''",
"if len(self._buffer) < self._buffer_size:\n content = file_object.read(self._buffer_size)\n content = content.decode(self._encoding)\n se... | <|body_start_0|>
super(EncodedTextReader, self).__init__()
self._buffer = ''
self._buffer_size = buffer_size
self._current_offset = 0
self._encoding = encoding
self.lines = ''
<|end_body_0|>
<|body_start_1|>
if len(self._buffer) < self._buffer_size:
c... | Encoded text reader. | EncodedTextReader | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EncodedTextReader:
"""Encoded text reader."""
def __init__(self, encoding, buffer_size=2048):
"""Initializes the encoded text reader object. Args: encoding (str): encoding. buffer_size (Optional[int]): buffer size."""
<|body_0|>
def _ReadLine(self, file_object):
... | stack_v2_sparse_classes_36k_train_014643 | 24,154 | permissive | [
{
"docstring": "Initializes the encoded text reader object. Args: encoding (str): encoding. buffer_size (Optional[int]): buffer size.",
"name": "__init__",
"signature": "def __init__(self, encoding, buffer_size=2048)"
},
{
"docstring": "Reads a line from the file object. Args: file_object (dfvfs... | 6 | stack_v2_sparse_classes_30k_train_011001 | Implement the Python class `EncodedTextReader` described below.
Class description:
Encoded text reader.
Method signatures and docstrings:
- def __init__(self, encoding, buffer_size=2048): Initializes the encoded text reader object. Args: encoding (str): encoding. buffer_size (Optional[int]): buffer size.
- def _ReadL... | Implement the Python class `EncodedTextReader` described below.
Class description:
Encoded text reader.
Method signatures and docstrings:
- def __init__(self, encoding, buffer_size=2048): Initializes the encoded text reader object. Args: encoding (str): encoding. buffer_size (Optional[int]): buffer size.
- def _ReadL... | c69b2952b608cfce47ff8fd0d1409d856be35cb1 | <|skeleton|>
class EncodedTextReader:
"""Encoded text reader."""
def __init__(self, encoding, buffer_size=2048):
"""Initializes the encoded text reader object. Args: encoding (str): encoding. buffer_size (Optional[int]): buffer size."""
<|body_0|>
def _ReadLine(self, file_object):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EncodedTextReader:
"""Encoded text reader."""
def __init__(self, encoding, buffer_size=2048):
"""Initializes the encoded text reader object. Args: encoding (str): encoding. buffer_size (Optional[int]): buffer size."""
super(EncodedTextReader, self).__init__()
self._buffer = ''
... | the_stack_v2_python_sparse | plaso/parsers/text_parser.py | cyb3rfox/plaso | train | 3 |
a02c67e9134a4df7e07476043ada139d2fbccc58 | [
"self.k = k\nself.min_heap = []\nfor i, n in enumerate(nums):\n if i < k:\n heapq.heappush(self.min_heap, n)\n elif n > self.min_heap[0]:\n heapq.heapreplace(self.min_heap, n)",
"if len(self.min_heap) < self.k:\n heapq.heappush(self.min_heap, val)\nelif val > self.min_heap[0]:\n heapq.he... | <|body_start_0|>
self.k = k
self.min_heap = []
for i, n in enumerate(nums):
if i < k:
heapq.heappush(self.min_heap, n)
elif n > self.min_heap[0]:
heapq.heapreplace(self.min_heap, n)
<|end_body_0|>
<|body_start_1|>
if len(self.min_h... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.k = k
self.min_heap = []
for i, n in ... | stack_v2_sparse_classes_36k_train_014644 | 1,257 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | null | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | e00cf94c5b86c8cca27e3bee69ad21e727b7679b | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.k = k
self.min_heap = []
for i, n in enumerate(nums):
if i < k:
heapq.heappush(self.min_heap, n)
elif n > self.min_heap[0]:
heapq.heapr... | the_stack_v2_python_sparse | heap/prob703.py | binchen15/leet-python | train | 1 | |
202b121e811198b5c9a55d8209d1a9fff43f5759 | [
"subs = set()\nfor n in nums:\n subs |= set([sub + (n,) for sub in subs if n >= sub[-1]])\n subs.add((n,))\nreturn [list(sub) for sub in subs if len(sub) >= 2]",
"l = len(nums)\nF = [[(nums[i],)] for i in range(l)]\nret = set()\nfor i in range(1, l):\n for j in range(i):\n if nums[i] >= nums[j]:\n... | <|body_start_0|>
subs = set()
for n in nums:
subs |= set([sub + (n,) for sub in subs if n >= sub[-1]])
subs.add((n,))
return [list(sub) for sub in subs if len(sub) >= 2]
<|end_body_0|>
<|body_start_1|>
l = len(nums)
F = [[(nums[i],)] for i in range(l)]
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findSubsequences(self, nums):
"""2nd approach Maintain the current increasing subsequence and iterate them to grow it Same complexity as the 1st approach since both needs to iterate the subsequences :type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
de... | stack_v2_sparse_classes_36k_train_014645 | 1,922 | permissive | [
{
"docstring": "2nd approach Maintain the current increasing subsequence and iterate them to grow it Same complexity as the 1st approach since both needs to iterate the subsequences :type nums: List[int] :rtype: List[List[int]]",
"name": "findSubsequences",
"signature": "def findSubsequences(self, nums)... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findSubsequences(self, nums): 2nd approach Maintain the current increasing subsequence and iterate them to grow it Same complexity as the 1st approach since both needs to ite... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findSubsequences(self, nums): 2nd approach Maintain the current increasing subsequence and iterate them to grow it Same complexity as the 1st approach since both needs to ite... | cbbd4a67ab342ada2421e13f82d660b1d47d4d20 | <|skeleton|>
class Solution:
def findSubsequences(self, nums):
"""2nd approach Maintain the current increasing subsequence and iterate them to grow it Same complexity as the 1st approach since both needs to iterate the subsequences :type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findSubsequences(self, nums):
"""2nd approach Maintain the current increasing subsequence and iterate them to grow it Same complexity as the 1st approach since both needs to iterate the subsequences :type nums: List[int] :rtype: List[List[int]]"""
subs = set()
for n in nu... | the_stack_v2_python_sparse | 491 Increasing Subsequences.py | Aminaba123/LeetCode | train | 1 | |
bf8ef45c14e5749f4023d9ebcb497e59a4bfd861 | [
"workflow_collection_subscription = WorkflowCollectionSubscription.objects.create(user=validated_data['user'], active=validated_data['active'] if validated_data.get('active') else True, workflow_collection=validated_data['workflow_collection'])\nworkflowcollectionsubscriptionschedule_data = validated_data.pop('work... | <|body_start_0|>
workflow_collection_subscription = WorkflowCollectionSubscription.objects.create(user=validated_data['user'], active=validated_data['active'] if validated_data.get('active') else True, workflow_collection=validated_data['workflow_collection'])
workflowcollectionsubscriptionschedule_data... | ModelSerializer for Workflow Collection Subscription Objects. | WorkflowCollectionSubscriptionSummarySerializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkflowCollectionSubscriptionSummarySerializer:
"""ModelSerializer for Workflow Collection Subscription Objects."""
def create(self, validated_data):
"""Override create() method to be able to handle nested WorkflowCollectionSubscriptionSchedule object creations."""
<|body_0|... | stack_v2_sparse_classes_36k_train_014646 | 4,366 | permissive | [
{
"docstring": "Override create() method to be able to handle nested WorkflowCollectionSubscriptionSchedule object creations.",
"name": "create",
"signature": "def create(self, validated_data)"
},
{
"docstring": "Update WorkflowCollectionSubscription and WorkflowCollectionSubscriptionSchedule ob... | 2 | null | Implement the Python class `WorkflowCollectionSubscriptionSummarySerializer` described below.
Class description:
ModelSerializer for Workflow Collection Subscription Objects.
Method signatures and docstrings:
- def create(self, validated_data): Override create() method to be able to handle nested WorkflowCollectionSu... | Implement the Python class `WorkflowCollectionSubscriptionSummarySerializer` described below.
Class description:
ModelSerializer for Workflow Collection Subscription Objects.
Method signatures and docstrings:
- def create(self, validated_data): Override create() method to be able to handle nested WorkflowCollectionSu... | dc0e8807263266713d3d7fa46e240e8d72db28d1 | <|skeleton|>
class WorkflowCollectionSubscriptionSummarySerializer:
"""ModelSerializer for Workflow Collection Subscription Objects."""
def create(self, validated_data):
"""Override create() method to be able to handle nested WorkflowCollectionSubscriptionSchedule object creations."""
<|body_0|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WorkflowCollectionSubscriptionSummarySerializer:
"""ModelSerializer for Workflow Collection Subscription Objects."""
def create(self, validated_data):
"""Override create() method to be able to handle nested WorkflowCollectionSubscriptionSchedule object creations."""
workflow_collection_su... | the_stack_v2_python_sparse | django_workflow_system/api/serializers/user/workflows/subscription.py | kwang1971/django-workflow-system | train | 0 |
15f775824d1a77b6451160c08c7eaf4b047d9f1b | [
"from collections import defaultdict\ncourseDict = defaultdict(list)\nfor relation in prerequisites:\n nextCourse, prevCourse = (relation[0], relation[1])\n courseDict[prevCourse].append(nextCourse)\npath = [False] * numCourses\nfor currCourse in range(numCourses):\n if self.isCyclic(currCourse, courseDict... | <|body_start_0|>
from collections import defaultdict
courseDict = defaultdict(list)
for relation in prerequisites:
nextCourse, prevCourse = (relation[0], relation[1])
courseDict[prevCourse].append(nextCourse)
path = [False] * numCourses
for currCourse in r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canFinish(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool"""
<|body_0|>
def isCyclic(self, currCourse, courseDict, path):
"""backtracking method to check that no cycle would be formed starting... | stack_v2_sparse_classes_36k_train_014647 | 26,504 | no_license | [
{
"docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool",
"name": "canFinish",
"signature": "def canFinish(self, numCourses, prerequisites)"
},
{
"docstring": "backtracking method to check that no cycle would be formed starting from currCourse",
"name": "isCyc... | 2 | stack_v2_sparse_classes_30k_train_008321 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canFinish(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool
- def isCyclic(self, currCourse, courseDict, path): backtr... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canFinish(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool
- def isCyclic(self, currCourse, courseDict, path): backtr... | 035ef08434fa1ca781a6fb2f9eed3538b7d20c02 | <|skeleton|>
class Solution:
def canFinish(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool"""
<|body_0|>
def isCyclic(self, currCourse, courseDict, path):
"""backtracking method to check that no cycle would be formed starting... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def canFinish(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool"""
from collections import defaultdict
courseDict = defaultdict(list)
for relation in prerequisites:
nextCourse, prevCourse = (relati... | the_stack_v2_python_sparse | leetcode_python/Breadth-First-Search/course-schedule.py | yennanliu/CS_basics | train | 64 | |
4f75439eb27400a8b6b17d21280ac08702b211bc | [
"functools.update_wrapper(self, func)\nself.func = func\nself.num_calls = 0",
"self.num_calls += 1\nprint(f'call {self.num_calls} of {self.func.__name__!r}')\nreturn self.func(*args, **kwargs)"
] | <|body_start_0|>
functools.update_wrapper(self, func)
self.func = func
self.num_calls = 0
<|end_body_0|>
<|body_start_1|>
self.num_calls += 1
print(f'call {self.num_calls} of {self.func.__name__!r}')
return self.func(*args, **kwargs)
<|end_body_1|>
| CountCalls | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CountCalls:
def __init__(self, func):
"""The .__init__() method must store a reference to the function and can do any other necessary initialization. Note that you need to use the functools.update_wrapper() function instead of @functools.wraps. :param func:"""
<|body_0|>
def... | stack_v2_sparse_classes_36k_train_014648 | 1,237 | no_license | [
{
"docstring": "The .__init__() method must store a reference to the function and can do any other necessary initialization. Note that you need to use the functools.update_wrapper() function instead of @functools.wraps. :param func:",
"name": "__init__",
"signature": "def __init__(self, func)"
},
{
... | 2 | stack_v2_sparse_classes_30k_test_000175 | Implement the Python class `CountCalls` described below.
Class description:
Implement the CountCalls class.
Method signatures and docstrings:
- def __init__(self, func): The .__init__() method must store a reference to the function and can do any other necessary initialization. Note that you need to use the functools... | Implement the Python class `CountCalls` described below.
Class description:
Implement the CountCalls class.
Method signatures and docstrings:
- def __init__(self, func): The .__init__() method must store a reference to the function and can do any other necessary initialization. Note that you need to use the functools... | 9d991e3dd9647adc55ae1f343fedfc3faa202b01 | <|skeleton|>
class CountCalls:
def __init__(self, func):
"""The .__init__() method must store a reference to the function and can do any other necessary initialization. Note that you need to use the functools.update_wrapper() function instead of @functools.wraps. :param func:"""
<|body_0|>
def... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CountCalls:
def __init__(self, func):
"""The .__init__() method must store a reference to the function and can do any other necessary initialization. Note that you need to use the functools.update_wrapper() function instead of @functools.wraps. :param func:"""
functools.update_wrapper(self, fu... | the_stack_v2_python_sparse | scratches/class_decorator.py | atrox3d/python-corey-schafer-tutorials | train | 0 | |
a43e6143cf82a635880378a8d3048b8fb80a0916 | [
"def countOne(num: int) -> int:\n \"\"\" 计算 num 的 1 的个数 \"\"\"\n c = 0\n while num > 0:\n num &= num - 1\n c += 1\n return c\narr = []\nfor i in range(num + 1):\n arr.append(countOne(i))\nreturn arr",
"dp = list()\ndp.append(0)\nfor i in range(1, num + 1):\n if i & 1 == 1:\n ... | <|body_start_0|>
def countOne(num: int) -> int:
""" 计算 num 的 1 的个数 """
c = 0
while num > 0:
num &= num - 1
c += 1
return c
arr = []
for i in range(num + 1):
arr.append(countOne(i))
return arr
<|en... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countBitsList(self, num: int) -> List[int]:
"""一般方法"""
<|body_0|>
def countBits_dp(self, num: int) -> List[int]:
"""动态转移方程 奇数:i(奇数)的二进制的 1 的个数 = ( i-1 (偶数) 的二进制的 1 的个数) + 1。eg: count(i) = count(i-1) + 1 偶数:j (偶数) 的二进制的 1 的个数 = j/2 的二进制 1 的个数。eg: count(j... | stack_v2_sparse_classes_36k_train_014649 | 2,112 | no_license | [
{
"docstring": "一般方法",
"name": "countBitsList",
"signature": "def countBitsList(self, num: int) -> List[int]"
},
{
"docstring": "动态转移方程 奇数:i(奇数)的二进制的 1 的个数 = ( i-1 (偶数) 的二进制的 1 的个数) + 1。eg: count(i) = count(i-1) + 1 偶数:j (偶数) 的二进制的 1 的个数 = j/2 的二进制 1 的个数。eg: count(j) = count(j/2)",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_000742 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countBitsList(self, num: int) -> List[int]: 一般方法
- def countBits_dp(self, num: int) -> List[int]: 动态转移方程 奇数:i(奇数)的二进制的 1 的个数 = ( i-1 (偶数) 的二进制的 1 的个数) + 1。eg: count(i) = coun... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countBitsList(self, num: int) -> List[int]: 一般方法
- def countBits_dp(self, num: int) -> List[int]: 动态转移方程 奇数:i(奇数)的二进制的 1 的个数 = ( i-1 (偶数) 的二进制的 1 的个数) + 1。eg: count(i) = coun... | 91d0a4145b066c885272cf1896b5564439f855fa | <|skeleton|>
class Solution:
def countBitsList(self, num: int) -> List[int]:
"""一般方法"""
<|body_0|>
def countBits_dp(self, num: int) -> List[int]:
"""动态转移方程 奇数:i(奇数)的二进制的 1 的个数 = ( i-1 (偶数) 的二进制的 1 的个数) + 1。eg: count(i) = count(i-1) + 1 偶数:j (偶数) 的二进制的 1 的个数 = j/2 的二进制 1 的个数。eg: count(j... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def countBitsList(self, num: int) -> List[int]:
"""一般方法"""
def countOne(num: int) -> int:
""" 计算 num 的 1 的个数 """
c = 0
while num > 0:
num &= num - 1
c += 1
return c
arr = []
for i in range... | the_stack_v2_python_sparse | DP问题/leetcode338_比特位计数.py | Deaseyy/algorithm | train | 0 | |
529abcb1262ec20cdf3047bc678ff7e13774d26c | [
"want_dynamic_group = self.is_audio_group\nhave_dynamic_group = self.is_dynamic_group is not None\nhave_all_except_dynamic_group = all(attr.astuple(self, filter=attr.filters.exclude(attr.fields(ChromecastInfo).is_dynamic_group)))\nreturn have_all_except_dynamic_group and (not want_dynamic_group or have_dynamic_grou... | <|body_start_0|>
want_dynamic_group = self.is_audio_group
have_dynamic_group = self.is_dynamic_group is not None
have_all_except_dynamic_group = all(attr.astuple(self, filter=attr.filters.exclude(attr.fields(ChromecastInfo).is_dynamic_group)))
return have_all_except_dynamic_group and (no... | Class to hold all data about a chromecast for creating connections. This also has the same attributes as the mDNS fields by zeroconf. | ChromecastInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChromecastInfo:
"""Class to hold all data about a chromecast for creating connections. This also has the same attributes as the mDNS fields by zeroconf."""
def is_information_complete(self) -> bool:
"""Return if all information is filled out."""
<|body_0|>
def manufactur... | stack_v2_sparse_classes_36k_train_014650 | 6,736 | permissive | [
{
"docstring": "Return if all information is filled out.",
"name": "is_information_complete",
"signature": "def is_information_complete(self) -> bool"
},
{
"docstring": "Return the manufacturer.",
"name": "manufacturer",
"signature": "def manufacturer(self) -> str | None"
},
{
"d... | 3 | stack_v2_sparse_classes_30k_train_001877 | Implement the Python class `ChromecastInfo` described below.
Class description:
Class to hold all data about a chromecast for creating connections. This also has the same attributes as the mDNS fields by zeroconf.
Method signatures and docstrings:
- def is_information_complete(self) -> bool: Return if all information... | Implement the Python class `ChromecastInfo` described below.
Class description:
Class to hold all data about a chromecast for creating connections. This also has the same attributes as the mDNS fields by zeroconf.
Method signatures and docstrings:
- def is_information_complete(self) -> bool: Return if all information... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class ChromecastInfo:
"""Class to hold all data about a chromecast for creating connections. This also has the same attributes as the mDNS fields by zeroconf."""
def is_information_complete(self) -> bool:
"""Return if all information is filled out."""
<|body_0|>
def manufactur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChromecastInfo:
"""Class to hold all data about a chromecast for creating connections. This also has the same attributes as the mDNS fields by zeroconf."""
def is_information_complete(self) -> bool:
"""Return if all information is filled out."""
want_dynamic_group = self.is_audio_group
... | the_stack_v2_python_sparse | homeassistant/components/cast/helpers.py | BenWoodford/home-assistant | train | 11 |
4f65af0054767cf8d8ee8b2da1963e05c8b35727 | [
"super(Network, self).__init__()\nself.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=5, stride=2, padding=2)\nself.conv2 = nn.Conv2d(in_channels=32, out_channels=32, kernel_size=5, stride=2, padding=2)\nself.conv3 = nn.Conv2d(in_channels=32, out_channels=64, kernel_size=5, stride=2, padding=2)\nself... | <|body_start_0|>
super(Network, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=5, stride=2, padding=2)
self.conv2 = nn.Conv2d(in_channels=32, out_channels=32, kernel_size=5, stride=2, padding=2)
self.conv3 = nn.Conv2d(in_channels=32, out_channels=64, ... | Network | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Network:
def __init__(self):
"""Define the NN layers and the initialization for the layers with parameters."""
<|body_0|>
def forward(self, x):
"""The forward pass of the network. :param x: Input to the NN :return: return the output of the network"""
<|body_1... | stack_v2_sparse_classes_36k_train_014651 | 3,180 | no_license | [
{
"docstring": "Define the NN layers and the initialization for the layers with parameters.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "The forward pass of the network. :param x: Input to the NN :return: return the output of the network",
"name": "forward",
... | 2 | stack_v2_sparse_classes_30k_train_006216 | Implement the Python class `Network` described below.
Class description:
Implement the Network class.
Method signatures and docstrings:
- def __init__(self): Define the NN layers and the initialization for the layers with parameters.
- def forward(self, x): The forward pass of the network. :param x: Input to the NN :... | Implement the Python class `Network` described below.
Class description:
Implement the Network class.
Method signatures and docstrings:
- def __init__(self): Define the NN layers and the initialization for the layers with parameters.
- def forward(self, x): The forward pass of the network. :param x: Input to the NN :... | e55e1e5a5e31dc2d9ad3f59b53fe8d2008c6dedf | <|skeleton|>
class Network:
def __init__(self):
"""Define the NN layers and the initialization for the layers with parameters."""
<|body_0|>
def forward(self, x):
"""The forward pass of the network. :param x: Input to the NN :return: return the output of the network"""
<|body_1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Network:
def __init__(self):
"""Define the NN layers and the initialization for the layers with parameters."""
super(Network, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=5, stride=2, padding=2)
self.conv2 = nn.Conv2d(in_channels=32, out_c... | the_stack_v2_python_sparse | profiler/test.py | adastimes/code | train | 0 | |
f203697523c7562a2e3fb2378b69f012f8a5efd4 | [
"log = gen.getLogger(gen.getClassName(self))\nlog.info('start evaluating all [JJA]')\nself.minima_error_file = 'min_max_error.csv'\nself.nan_error_file = 'nan_error.csv'\nobj = aos.DataObject(('EvaluateAll [JJA]', n))\nif obj.load():\n obj.copy(self)\n return None\nself.n = n\nself.min_length = min_length\nse... | <|body_start_0|>
log = gen.getLogger(gen.getClassName(self))
log.info('start evaluating all [JJA]')
self.minima_error_file = 'min_max_error.csv'
self.nan_error_file = 'nan_error.csv'
obj = aos.DataObject(('EvaluateAll [JJA]', n))
if obj.load():
obj.copy(self)
... | Class to evaluate all calculations. For each window, one evaluation is required, this class runs all the evaluations and processes the results which are all returned at the same time from a single call. Attributes ---------- fitness : float The correlation value. length : np.array(int) Length of the longitude averaging... | EvaluateAll | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EvaluateAll:
"""Class to evaluate all calculations. For each window, one evaluation is required, this class runs all the evaluations and processes the results which are all returned at the same time from a single call. Attributes ---------- fitness : float The correlation value. length : np.array... | stack_v2_sparse_classes_36k_train_014652 | 16,507 | no_license | [
{
"docstring": "Class initialization Parameters ---------- e : class Evaluation class for a single evaluation to run n : int, optional Range of starting degrees [0, 360]. max_length : int, optional Maximum size of averaging window [1, 360). min_length : int, optional Minumum size of averaging window [1, 359). R... | 4 | stack_v2_sparse_classes_30k_train_019528 | Implement the Python class `EvaluateAll` described below.
Class description:
Class to evaluate all calculations. For each window, one evaluation is required, this class runs all the evaluations and processes the results which are all returned at the same time from a single call. Attributes ---------- fitness : float T... | Implement the Python class `EvaluateAll` described below.
Class description:
Class to evaluate all calculations. For each window, one evaluation is required, this class runs all the evaluations and processes the results which are all returned at the same time from a single call. Attributes ---------- fitness : float T... | 21605484008656ad7e90650d94e7abb78a1c6f0b | <|skeleton|>
class EvaluateAll:
"""Class to evaluate all calculations. For each window, one evaluation is required, this class runs all the evaluations and processes the results which are all returned at the same time from a single call. Attributes ---------- fitness : float The correlation value. length : np.array... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EvaluateAll:
"""Class to evaluate all calculations. For each window, one evaluation is required, this class runs all the evaluations and processes the results which are all returned at the same time from a single call. Attributes ---------- fitness : float The correlation value. length : np.array(int) Length ... | the_stack_v2_python_sparse | modules/evaluate.py | bjornarjensen/columbia-ga | train | 0 |
8ed98201369c7481a0eeea69651201c3e97d130d | [
"links = ['/bin', '/sbin', '/lib']\nfor l in links:\n status, output = self.target.run('readlink %s' % l)\n self.assertEqual(status, 0, 'usrmerge error: %s should be a symbolic link' % l)",
"binaries = ['/usr/bin/flatpak', '/usr/bin/gpgme-tool', '/usr/bin/gpg']\nfor b in binaries:\n status, output = self... | <|body_start_0|>
links = ['/bin', '/sbin', '/lib']
for l in links:
status, output = self.target.run('readlink %s' % l)
self.assertEqual(status, 0, 'usrmerge error: %s should be a symbolic link' % l)
<|end_body_0|>
<|body_start_1|>
binaries = ['/usr/bin/flatpak', '/usr/bi... | flatpak sanity tests | SanityTestFlatpak | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SanityTestFlatpak:
"""flatpak sanity tests"""
def test_flatpak_usrmerge(self):
"""check if / and /usr are properly merged"""
<|body_0|>
def test_basic_binaries(self):
"""check if basic flatpak binaries exist"""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_36k_train_014653 | 1,063 | permissive | [
{
"docstring": "check if / and /usr are properly merged",
"name": "test_flatpak_usrmerge",
"signature": "def test_flatpak_usrmerge(self)"
},
{
"docstring": "check if basic flatpak binaries exist",
"name": "test_basic_binaries",
"signature": "def test_basic_binaries(self)"
}
] | 2 | null | Implement the Python class `SanityTestFlatpak` described below.
Class description:
flatpak sanity tests
Method signatures and docstrings:
- def test_flatpak_usrmerge(self): check if / and /usr are properly merged
- def test_basic_binaries(self): check if basic flatpak binaries exist | Implement the Python class `SanityTestFlatpak` described below.
Class description:
flatpak sanity tests
Method signatures and docstrings:
- def test_flatpak_usrmerge(self): check if / and /usr are properly merged
- def test_basic_binaries(self): check if basic flatpak binaries exist
<|skeleton|>
class SanityTestFlat... | 786a4de29c30b47f885d8ad9cb2d110a08919ebd | <|skeleton|>
class SanityTestFlatpak:
"""flatpak sanity tests"""
def test_flatpak_usrmerge(self):
"""check if / and /usr are properly merged"""
<|body_0|>
def test_basic_binaries(self):
"""check if basic flatpak binaries exist"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SanityTestFlatpak:
"""flatpak sanity tests"""
def test_flatpak_usrmerge(self):
"""check if / and /usr are properly merged"""
links = ['/bin', '/sbin', '/lib']
for l in links:
status, output = self.target.run('readlink %s' % l)
self.assertEqual(status, 0, 'u... | the_stack_v2_python_sparse | meta-iotqa/lib/oeqa/runtime/sanity/flatpak.py | intel/intel-iot-refkit | train | 38 |
c9a663c85bab3e44f79a3548d2329cc05a1271a0 | [
"data = get_inventory_row_by_id(pk)\nif not data:\n raise NotFound\nresult = marshal(data, fields_item_inventory, envelope=structure_key_item)\nreturn jsonify(result)",
"result = delete_inventory(pk)\nif result:\n success_msg = SUCCESS_MSG.copy()\n return make_response(jsonify(success_msg), 204)\nelse:\n... | <|body_start_0|>
data = get_inventory_row_by_id(pk)
if not data:
raise NotFound
result = marshal(data, fields_item_inventory, envelope=structure_key_item)
return jsonify(result)
<|end_body_0|>
<|body_start_1|>
result = delete_inventory(pk)
if result:
... | InventoryResource | InventoryResource | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InventoryResource:
"""InventoryResource"""
def get(self, pk):
"""Example: curl http://0.0.0.0:5000/bearings/inventory/1 :param pk: :return:"""
<|body_0|>
def delete(self, pk):
"""Example: curl http://0.0.0.0:5000/bearings/inventory/1 -X DELETE :param pk: :return:... | stack_v2_sparse_classes_36k_train_014654 | 5,543 | permissive | [
{
"docstring": "Example: curl http://0.0.0.0:5000/bearings/inventory/1 :param pk: :return:",
"name": "get",
"signature": "def get(self, pk)"
},
{
"docstring": "Example: curl http://0.0.0.0:5000/bearings/inventory/1 -X DELETE :param pk: :return:",
"name": "delete",
"signature": "def delet... | 3 | stack_v2_sparse_classes_30k_train_015441 | Implement the Python class `InventoryResource` described below.
Class description:
InventoryResource
Method signatures and docstrings:
- def get(self, pk): Example: curl http://0.0.0.0:5000/bearings/inventory/1 :param pk: :return:
- def delete(self, pk): Example: curl http://0.0.0.0:5000/bearings/inventory/1 -X DELET... | Implement the Python class `InventoryResource` described below.
Class description:
InventoryResource
Method signatures and docstrings:
- def get(self, pk): Example: curl http://0.0.0.0:5000/bearings/inventory/1 :param pk: :return:
- def delete(self, pk): Example: curl http://0.0.0.0:5000/bearings/inventory/1 -X DELET... | 6ef54f3f7efbbaff6169e963dcf45ab25e11e593 | <|skeleton|>
class InventoryResource:
"""InventoryResource"""
def get(self, pk):
"""Example: curl http://0.0.0.0:5000/bearings/inventory/1 :param pk: :return:"""
<|body_0|>
def delete(self, pk):
"""Example: curl http://0.0.0.0:5000/bearings/inventory/1 -X DELETE :param pk: :return:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InventoryResource:
"""InventoryResource"""
def get(self, pk):
"""Example: curl http://0.0.0.0:5000/bearings/inventory/1 :param pk: :return:"""
data = get_inventory_row_by_id(pk)
if not data:
raise NotFound
result = marshal(data, fields_item_inventory, envelope=... | the_stack_v2_python_sparse | web_api/bearings/resources/inventory.py | zhanghe06/flask_restful | train | 2 |
03e838c9d32770daa684acfa8c610e6d1f535f86 | [
"self.world: BulletWorld = world if world else BulletWorld.current_bullet_world\nself.object: Object = object\nself.link: str = urdf_link_name\nself.resolution: float = resolution\nself.origin: Pose = object.get_link_pose(urdf_link_name)\nself.height: int = 0\nself.width: int = 0\nself.map: np.ndarray = []\nself.ge... | <|body_start_0|>
self.world: BulletWorld = world if world else BulletWorld.current_bullet_world
self.object: Object = object
self.link: str = urdf_link_name
self.resolution: float = resolution
self.origin: Pose = object.get_link_pose(urdf_link_name)
self.height: int = 0
... | Semantic Costmaps represent a 2D distribution over a link of an Object. An example of this would be a Costmap for a table surface. | SemanticCostmap | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SemanticCostmap:
"""Semantic Costmaps represent a 2D distribution over a link of an Object. An example of this would be a Costmap for a table surface."""
def __init__(self, object, urdf_link_name, size=100, resolution=0.02, world=None):
"""Creates a semantic costmap for the given par... | stack_v2_sparse_classes_36k_train_014655 | 37,310 | no_license | [
{
"docstring": "Creates a semantic costmap for the given parameter. The semantic costmap will be on top of the link of the given Object. :param object: The object of which the link is a part :param urdf_link_name: The link name, as stated in the URDF :param resolution: Resolution of the final costmap :param wor... | 3 | stack_v2_sparse_classes_30k_train_019399 | Implement the Python class `SemanticCostmap` described below.
Class description:
Semantic Costmaps represent a 2D distribution over a link of an Object. An example of this would be a Costmap for a table surface.
Method signatures and docstrings:
- def __init__(self, object, urdf_link_name, size=100, resolution=0.02, ... | Implement the Python class `SemanticCostmap` described below.
Class description:
Semantic Costmaps represent a 2D distribution over a link of an Object. An example of this would be a Costmap for a table surface.
Method signatures and docstrings:
- def __init__(self, object, urdf_link_name, size=100, resolution=0.02, ... | f9ef666d6d4685660c9517652f2c568ed2c9367c | <|skeleton|>
class SemanticCostmap:
"""Semantic Costmaps represent a 2D distribution over a link of an Object. An example of this would be a Costmap for a table surface."""
def __init__(self, object, urdf_link_name, size=100, resolution=0.02, world=None):
"""Creates a semantic costmap for the given par... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SemanticCostmap:
"""Semantic Costmaps represent a 2D distribution over a link of an Object. An example of this would be a Costmap for a table surface."""
def __init__(self, object, urdf_link_name, size=100, resolution=0.02, world=None):
"""Creates a semantic costmap for the given parameter. The s... | the_stack_v2_python_sparse | src/pycram/costmaps.py | cram2/pycram | train | 12 |
e6518ed8cd5ce31aac5968fdea32d14bfcc6d5fc | [
"for method in cls.methods:\n method_name = method.lower()\n decorated_method_func = decorator(getattr(cls, method_name))\n setattr(cls, method_name, decorated_method_func)",
"method_funcs = [getattr(self, m.lower()) for m in self.methods]\nallowed_methods = []\nrequest_oauth_backup = getattr(flask.reque... | <|body_start_0|>
for method in cls.methods:
method_name = method.lower()
decorated_method_func = decorator(getattr(cls, method_name))
setattr(cls, method_name, decorated_method_func)
<|end_body_0|>
<|body_start_1|>
method_funcs = [getattr(self, m.lower()) for m in se... | Extended Flast-RESTPlus Resource to add options method | Resource | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Resource:
"""Extended Flast-RESTPlus Resource to add options method"""
def _apply_decorator_to_methods(cls, decorator):
"""This helper can apply a given decorator to all methods on the current Resource. NOTE: In contrast to ``Resource.method_decorators``, which has a similar use-case... | stack_v2_sparse_classes_36k_train_014656 | 3,366 | permissive | [
{
"docstring": "This helper can apply a given decorator to all methods on the current Resource. NOTE: In contrast to ``Resource.method_decorators``, which has a similar use-case, this method applies decorators directly and override methods in-place, while the decorators listed in ``Resource.method_decorators`` ... | 2 | stack_v2_sparse_classes_30k_test_000239 | Implement the Python class `Resource` described below.
Class description:
Extended Flast-RESTPlus Resource to add options method
Method signatures and docstrings:
- def _apply_decorator_to_methods(cls, decorator): This helper can apply a given decorator to all methods on the current Resource. NOTE: In contrast to ``R... | Implement the Python class `Resource` described below.
Class description:
Extended Flast-RESTPlus Resource to add options method
Method signatures and docstrings:
- def _apply_decorator_to_methods(cls, decorator): This helper can apply a given decorator to all methods on the current Resource. NOTE: In contrast to ``R... | 53a3a156cc9df414537860ed677bd0cc98dd2271 | <|skeleton|>
class Resource:
"""Extended Flast-RESTPlus Resource to add options method"""
def _apply_decorator_to_methods(cls, decorator):
"""This helper can apply a given decorator to all methods on the current Resource. NOTE: In contrast to ``Resource.method_decorators``, which has a similar use-case... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Resource:
"""Extended Flast-RESTPlus Resource to add options method"""
def _apply_decorator_to_methods(cls, decorator):
"""This helper can apply a given decorator to all methods on the current Resource. NOTE: In contrast to ``Resource.method_decorators``, which has a similar use-case, this method... | the_stack_v2_python_sparse | flask_restplus_patched/resource.py | frol/flask-restplus-server-example | train | 1,487 |
0616caef67ad4bf6588f2c3a42f9fbe57b85fcec | [
"ret_list = [start_node.value]\nstart_node.visited = True\nedges_out = [e for e in start_node.edges if e.node_to.value != start_node.value]\nfor edge in edges_out:\n if not edge.node_to.visited:\n ret_list.extend(self.dfs_helper(edge.node_to))\nreturn ret_list",
"node = self.find_node(start_node_num)\ns... | <|body_start_0|>
ret_list = [start_node.value]
start_node.visited = True
edges_out = [e for e in start_node.edges if e.node_to.value != start_node.value]
for edge in edges_out:
if not edge.node_to.visited:
ret_list.extend(self.dfs_helper(edge.node_to))
... | Graph | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Graph:
def dfs_helper(self, start_node):
"""The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corresponding to the values of the traversed nodes. ARGUMENTS: start_node is the starting Node REQ... | stack_v2_sparse_classes_36k_train_014657 | 2,095 | permissive | [
{
"docstring": "The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corresponding to the values of the traversed nodes. ARGUMENTS: start_node is the starting Node REQUIRES: self._clear_visited() to be called before MOD... | 2 | stack_v2_sparse_classes_30k_train_019004 | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def dfs_helper(self, start_node): The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corr... | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def dfs_helper(self, start_node): The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corr... | eae5ee9dd6829d52644c4df489d5514a0e0c8728 | <|skeleton|>
class Graph:
def dfs_helper(self, start_node):
"""The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corresponding to the values of the traversed nodes. ARGUMENTS: start_node is the starting Node REQ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Graph:
def dfs_helper(self, start_node):
"""The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corresponding to the values of the traversed nodes. ARGUMENTS: start_node is the starting Node REQUIRES: self._c... | the_stack_v2_python_sparse | udacity_tech_interview/graph_traversal_practice.py | sgrade/pytest | train | 0 | |
d7f204c601ff63132a845bbd79bea5bf2a8e570e | [
"print('\\n 请选择功能:1、登录 2、注册\\n 测试账号:spf 密码:123\\n ')\nview = {'1': 'login', '2': 'register'}\nwhile 1:\n ch = input('请选择功能(输入功能ID):').strip()\n if not ch:\n continue\n if ch in view:\n try:\n Choice.start(view[ch])\n except pymysql.err.IntegrityE... | <|body_start_0|>
print('\n 请选择功能:1、登录 2、注册\n 测试账号:spf 密码:123\n ')
view = {'1': 'login', '2': 'register'}
while 1:
ch = input('请选择功能(输入功能ID):').strip()
if not ch:
continue
if ch in view:
try:
... | Choice | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Choice:
def choice():
"""功能选择,登录或者注册 :return:"""
<|body_0|>
def start(obj):
"""用户登录/注册 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
print('\n 请选择功能:1、登录 2、注册\n 测试账号:spf 密码:123\n ')
view = {'1': 'login... | stack_v2_sparse_classes_36k_train_014658 | 1,596 | no_license | [
{
"docstring": "功能选择,登录或者注册 :return:",
"name": "choice",
"signature": "def choice()"
},
{
"docstring": "用户登录/注册 :return:",
"name": "start",
"signature": "def start(obj)"
}
] | 2 | null | Implement the Python class `Choice` described below.
Class description:
Implement the Choice class.
Method signatures and docstrings:
- def choice(): 功能选择,登录或者注册 :return:
- def start(obj): 用户登录/注册 :return: | Implement the Python class `Choice` described below.
Class description:
Implement the Choice class.
Method signatures and docstrings:
- def choice(): 功能选择,登录或者注册 :return:
- def start(obj): 用户登录/注册 :return:
<|skeleton|>
class Choice:
def choice():
"""功能选择,登录或者注册 :return:"""
<|body_0|>
def st... | d7fc68d3d23345df5bfb09d4a84686c8b49a5ad7 | <|skeleton|>
class Choice:
def choice():
"""功能选择,登录或者注册 :return:"""
<|body_0|>
def start(obj):
"""用户登录/注册 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Choice:
def choice():
"""功能选择,登录或者注册 :return:"""
print('\n 请选择功能:1、登录 2、注册\n 测试账号:spf 密码:123\n ')
view = {'1': 'login', '2': 'register'}
while 1:
ch = input('请选择功能(输入功能ID):').strip()
if not ch:
continue
... | the_stack_v2_python_sparse | day15/homework/core/choice.py | 214031230/Python21 | train | 0 | |
c77e5b068c9a2464ad0e90b3a690f6fcc6ab8f4c | [
"self.P = _P\nself.Q = _Q\nself.k = 20\nself.l_0 = 1 / 100",
"inv = -1 if invert_y else 1\nspring_thickness = 3\nreturn cv2.line(frame, (Utils.ConvertX(self.P.x + offset.x), Utils.ConvertY(inv * self.P.y + offset.y)), (Utils.ConvertX(self.Q.x + offset.x), Utils.ConvertY(inv * self.Q.y + offset.y)), (0, 100, 100),... | <|body_start_0|>
self.P = _P
self.Q = _Q
self.k = 20
self.l_0 = 1 / 100
<|end_body_0|>
<|body_start_1|>
inv = -1 if invert_y else 1
spring_thickness = 3
return cv2.line(frame, (Utils.ConvertX(self.P.x + offset.x), Utils.ConvertY(inv * self.P.y + offset.y)), (Util... | Spring | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Spring:
def __init__(self, _P, _Q):
"""Define a spring between two blocks. Parameters ---------- _P : Coordinates Coordinates of the anchor on the bottom block for the spring in Joint reference frame _Q : Coordinates Coordinates of the anchor on the top block for the spring in Joint refe... | stack_v2_sparse_classes_36k_train_014659 | 2,050 | permissive | [
{
"docstring": "Define a spring between two blocks. Parameters ---------- _P : Coordinates Coordinates of the anchor on the bottom block for the spring in Joint reference frame _Q : Coordinates Coordinates of the anchor on the top block for the spring in Joint reference frame",
"name": "__init__",
"sign... | 2 | stack_v2_sparse_classes_30k_train_000034 | Implement the Python class `Spring` described below.
Class description:
Implement the Spring class.
Method signatures and docstrings:
- def __init__(self, _P, _Q): Define a spring between two blocks. Parameters ---------- _P : Coordinates Coordinates of the anchor on the bottom block for the spring in Joint reference... | Implement the Python class `Spring` described below.
Class description:
Implement the Spring class.
Method signatures and docstrings:
- def __init__(self, _P, _Q): Define a spring between two blocks. Parameters ---------- _P : Coordinates Coordinates of the anchor on the bottom block for the spring in Joint reference... | 6ebf644eb0fc9493a0637893b0a37789c727213e | <|skeleton|>
class Spring:
def __init__(self, _P, _Q):
"""Define a spring between two blocks. Parameters ---------- _P : Coordinates Coordinates of the anchor on the bottom block for the spring in Joint reference frame _Q : Coordinates Coordinates of the anchor on the top block for the spring in Joint refe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Spring:
def __init__(self, _P, _Q):
"""Define a spring between two blocks. Parameters ---------- _P : Coordinates Coordinates of the anchor on the bottom block for the spring in Joint reference frame _Q : Coordinates Coordinates of the anchor on the top block for the spring in Joint reference frame"""... | the_stack_v2_python_sparse | robot/models/spring.py | sven-borden/rlrobotics | train | 0 | |
75c3d1d79c7515d17cf7e5e359c1b00e460d0d58 | [
"self.wifi_macs = wifi_macs\nself.ids = ids\nself.serials = serials\nself.scope = scope\nself.tags = tags\nself.update_action = update_action",
"if dictionary is None:\n return None\ntags = dictionary.get('tags')\nupdate_action = dictionary.get('updateAction')\nwifi_macs = dictionary.get('wifiMacs')\nids = dic... | <|body_start_0|>
self.wifi_macs = wifi_macs
self.ids = ids
self.serials = serials
self.scope = scope
self.tags = tags
self.update_action = update_action
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
tags = dictionary.get('... | Implementation of the 'updateNetworkSmDevicesTags' model. TODO: type model description here. Attributes: wifi_macs (string): The wifiMacs of the devices to be modified. ids (string): The ids of the devices to be modified. serials (string): The serials of the devices to be modified. scope (string): The scope (one of all... | UpdateNetworkSmDevicesTagsModel | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateNetworkSmDevicesTagsModel:
"""Implementation of the 'updateNetworkSmDevicesTags' model. TODO: type model description here. Attributes: wifi_macs (string): The wifiMacs of the devices to be modified. ids (string): The ids of the devices to be modified. serials (string): The serials of the de... | stack_v2_sparse_classes_36k_train_014660 | 2,806 | permissive | [
{
"docstring": "Constructor for the UpdateNetworkSmDevicesTagsModel class",
"name": "__init__",
"signature": "def __init__(self, tags=None, update_action=None, wifi_macs=None, ids=None, serials=None, scope=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictio... | 2 | stack_v2_sparse_classes_30k_test_000446 | Implement the Python class `UpdateNetworkSmDevicesTagsModel` described below.
Class description:
Implementation of the 'updateNetworkSmDevicesTags' model. TODO: type model description here. Attributes: wifi_macs (string): The wifiMacs of the devices to be modified. ids (string): The ids of the devices to be modified. ... | Implement the Python class `UpdateNetworkSmDevicesTagsModel` described below.
Class description:
Implementation of the 'updateNetworkSmDevicesTags' model. TODO: type model description here. Attributes: wifi_macs (string): The wifiMacs of the devices to be modified. ids (string): The ids of the devices to be modified. ... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class UpdateNetworkSmDevicesTagsModel:
"""Implementation of the 'updateNetworkSmDevicesTags' model. TODO: type model description here. Attributes: wifi_macs (string): The wifiMacs of the devices to be modified. ids (string): The ids of the devices to be modified. serials (string): The serials of the de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdateNetworkSmDevicesTagsModel:
"""Implementation of the 'updateNetworkSmDevicesTags' model. TODO: type model description here. Attributes: wifi_macs (string): The wifiMacs of the devices to be modified. ids (string): The ids of the devices to be modified. serials (string): The serials of the devices to be m... | the_stack_v2_python_sparse | meraki_sdk/models/update_network_sm_devices_tags_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
49aff6291c61577a333a1076a1a01a3c37fde043 | [
"super(CameraComponent, self).__init__(ns=ns, componentMData=componentMData, parent=parent)\nself.cameraTransform = None\nself.cameraShape = None",
"cameras = pm.ls(type='camera', l=True)\nstartup_cameras = [camera for camera in cameras if pm.camera(camera.parent(0), startupCamera=True, q=True)]\ncameraShape = li... | <|body_start_0|>
super(CameraComponent, self).__init__(ns=ns, componentMData=componentMData, parent=parent)
self.cameraTransform = None
self.cameraShape = None
<|end_body_0|>
<|body_start_1|>
cameras = pm.ls(type='camera', l=True)
startup_cameras = [camera for camera in cameras ... | CameraComponent | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CameraComponent:
def __init__(self, ns, componentMData, parent=None):
""":param ns: str :param componentMData: dict :param parent: api.Item"""
<|body_0|>
def wrapData(self):
"""Get the camera name from the scene :return:"""
<|body_1|>
def addToScene(self... | stack_v2_sparse_classes_36k_train_014661 | 2,499 | no_license | [
{
"docstring": ":param ns: str :param componentMData: dict :param parent: api.Item",
"name": "__init__",
"signature": "def __init__(self, ns, componentMData, parent=None)"
},
{
"docstring": "Get the camera name from the scene :return:",
"name": "wrapData",
"signature": "def wrapData(self... | 5 | stack_v2_sparse_classes_30k_train_002879 | Implement the Python class `CameraComponent` described below.
Class description:
Implement the CameraComponent class.
Method signatures and docstrings:
- def __init__(self, ns, componentMData, parent=None): :param ns: str :param componentMData: dict :param parent: api.Item
- def wrapData(self): Get the camera name fr... | Implement the Python class `CameraComponent` described below.
Class description:
Implement the CameraComponent class.
Method signatures and docstrings:
- def __init__(self, ns, componentMData, parent=None): :param ns: str :param componentMData: dict :param parent: api.Item
- def wrapData(self): Get the camera name fr... | b061691f0032b61d7eeb43c6b0cc083a57730048 | <|skeleton|>
class CameraComponent:
def __init__(self, ns, componentMData, parent=None):
""":param ns: str :param componentMData: dict :param parent: api.Item"""
<|body_0|>
def wrapData(self):
"""Get the camera name from the scene :return:"""
<|body_1|>
def addToScene(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CameraComponent:
def __init__(self, ns, componentMData, parent=None):
""":param ns: str :param componentMData: dict :param parent: api.Item"""
super(CameraComponent, self).__init__(ns=ns, componentMData=componentMData, parent=parent)
self.cameraTransform = None
self.cameraShape... | the_stack_v2_python_sparse | api/cameraComponent.py | leocadavalHome/lcPipe | train | 0 | |
748064b34224df77d43938dfc2346d32ee38bc59 | [
"visited = [[False for _ in range(len(board[0]))] for _ in range(len(board))]\nfor i in range(len(board)):\n for j in range(len(board[0])):\n if self.dfs(board, i, j, 0, word, visited):\n return True\nreturn False",
"if index == len(word):\n return True\nif row < 0 or row > len(board) - 1 ... | <|body_start_0|>
visited = [[False for _ in range(len(board[0]))] for _ in range(len(board))]
for i in range(len(board)):
for j in range(len(board[0])):
if self.dfs(board, i, j, 0, word, visited):
return True
return False
<|end_body_0|>
<|body_sta... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def exist(self, board, word):
"""Args: board: list[list[str]] word: str Return: bool"""
<|body_0|>
def dfs(self, board, row, col, index, word, visited):
"""Args: board: list[list[str]] row: int col: int path: list[str] word: str visited: list[list[bool]] Re... | stack_v2_sparse_classes_36k_train_014662 | 1,510 | no_license | [
{
"docstring": "Args: board: list[list[str]] word: str Return: bool",
"name": "exist",
"signature": "def exist(self, board, word)"
},
{
"docstring": "Args: board: list[list[str]] row: int col: int path: list[str] word: str visited: list[list[bool]] Return: bool",
"name": "dfs",
"signatur... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def exist(self, board, word): Args: board: list[list[str]] word: str Return: bool
- def dfs(self, board, row, col, index, word, visited): Args: board: list[list[str]] row: int co... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def exist(self, board, word): Args: board: list[list[str]] word: str Return: bool
- def dfs(self, board, row, col, index, word, visited): Args: board: list[list[str]] row: int co... | 101bce2fac8b188a4eb2f5e017293d21ad0ecb21 | <|skeleton|>
class Solution:
def exist(self, board, word):
"""Args: board: list[list[str]] word: str Return: bool"""
<|body_0|>
def dfs(self, board, row, col, index, word, visited):
"""Args: board: list[list[str]] row: int col: int path: list[str] word: str visited: list[list[bool]] Re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def exist(self, board, word):
"""Args: board: list[list[str]] word: str Return: bool"""
visited = [[False for _ in range(len(board[0]))] for _ in range(len(board))]
for i in range(len(board)):
for j in range(len(board[0])):
if self.dfs(board, i, j,... | the_stack_v2_python_sparse | 剑指offer/剑指 Offer 12. 矩阵中的路径.py | AiZhanghan/Leetcode | train | 0 | |
69ad4d5f06405ffb56f55103676906f28cf6b92a | [
"super().__init__(**kwargs)\nself.manual_tick_labels = manual_tick_labels\nself.manual_tick_values = manual_tick_values",
"if self.manual_tick_values is None and self.manual_tick_labels is None:\n cb = plt.colorbar(**self.config_dict)\nelif self.manual_tick_values is not None and self.manual_tick_labels is not... | <|body_start_0|>
super().__init__(**kwargs)
self.manual_tick_labels = manual_tick_labels
self.manual_tick_values = manual_tick_values
<|end_body_0|>
<|body_start_1|>
if self.manual_tick_values is None and self.manual_tick_labels is None:
cb = plt.colorbar(**self.config_dict)... | Colorbar | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Colorbar:
def __init__(self, manual_tick_labels: typing.Optional[typing.List[float]]=None, manual_tick_values: typing.Optional[typing.List[float]]=None, **kwargs):
"""Customizes the colorbar of the plotted figure. This object wraps the following Matplotlib method: plt.colorbar: https://m... | stack_v2_sparse_classes_36k_train_014663 | 30,885 | permissive | [
{
"docstring": "Customizes the colorbar of the plotted figure. This object wraps the following Matplotlib method: plt.colorbar: https://matplotlib.org/3.3.2/api/_as_gen/matplotlib.pyplot.colorbar.html The colorbar object `cb` that is created is also customized using the following methods: cb.set_yticklabels: ht... | 3 | null | Implement the Python class `Colorbar` described below.
Class description:
Implement the Colorbar class.
Method signatures and docstrings:
- def __init__(self, manual_tick_labels: typing.Optional[typing.List[float]]=None, manual_tick_values: typing.Optional[typing.List[float]]=None, **kwargs): Customizes the colorbar ... | Implement the Python class `Colorbar` described below.
Class description:
Implement the Colorbar class.
Method signatures and docstrings:
- def __init__(self, manual_tick_labels: typing.Optional[typing.List[float]]=None, manual_tick_values: typing.Optional[typing.List[float]]=None, **kwargs): Customizes the colorbar ... | 324007a6bbda32baf94f09918e0aef04fda0c7d0 | <|skeleton|>
class Colorbar:
def __init__(self, manual_tick_labels: typing.Optional[typing.List[float]]=None, manual_tick_values: typing.Optional[typing.List[float]]=None, **kwargs):
"""Customizes the colorbar of the plotted figure. This object wraps the following Matplotlib method: plt.colorbar: https://m... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Colorbar:
def __init__(self, manual_tick_labels: typing.Optional[typing.List[float]]=None, manual_tick_values: typing.Optional[typing.List[float]]=None, **kwargs):
"""Customizes the colorbar of the plotted figure. This object wraps the following Matplotlib method: plt.colorbar: https://matplotlib.org/... | the_stack_v2_python_sparse | autofit/plot/mat_wrap/wrap/wrap_base.py | philastrophist/PyAutoFit | train | 0 | |
5dcc8b9c26bfe26c43fcd67ffb72fcab4c1ca795 | [
"path = self._get_path()\nfor trait_name, value in self._changed.items():\n if self._is_preference_trait(trait_name):\n self.preferences.set('%s.%s' % (path, trait_name), value)\nself._changed.clear()",
"if self._is_preference_trait(trait_name):\n self._changed[trait_name] = new\nelif trait_name.ends... | <|body_start_0|>
path = self._get_path()
for trait_name, value in self._changed.items():
if self._is_preference_trait(trait_name):
self.preferences.set('%s.%s' % (path, trait_name), value)
self._changed.clear()
<|end_body_0|>
<|body_start_1|>
if self._is_pref... | A page in a preferences dialog. | PreferencesPage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PreferencesPage:
"""A page in a preferences dialog."""
def apply(self):
"""Apply the page's preferences."""
<|body_0|>
def _anytrait_changed(self, trait_name, old, new):
"""Static trait change handler. This is an important override! In the base-class when a trait... | stack_v2_sparse_classes_36k_train_014664 | 3,857 | no_license | [
{
"docstring": "Apply the page's preferences.",
"name": "apply",
"signature": "def apply(self)"
},
{
"docstring": "Static trait change handler. This is an important override! In the base-class when a trait is changed the preferences node is updated too. Here, we stop that from happening and just... | 3 | stack_v2_sparse_classes_30k_train_000244 | Implement the Python class `PreferencesPage` described below.
Class description:
A page in a preferences dialog.
Method signatures and docstrings:
- def apply(self): Apply the page's preferences.
- def _anytrait_changed(self, trait_name, old, new): Static trait change handler. This is an important override! In the ba... | Implement the Python class `PreferencesPage` described below.
Class description:
A page in a preferences dialog.
Method signatures and docstrings:
- def apply(self): Apply the page's preferences.
- def _anytrait_changed(self, trait_name, old, new): Static trait change handler. This is an important override! In the ba... | 08218b697db91e55e8e0c49664a0b0cb44b4ab93 | <|skeleton|>
class PreferencesPage:
"""A page in a preferences dialog."""
def apply(self):
"""Apply the page's preferences."""
<|body_0|>
def _anytrait_changed(self, trait_name, old, new):
"""Static trait change handler. This is an important override! In the base-class when a trait... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PreferencesPage:
"""A page in a preferences dialog."""
def apply(self):
"""Apply the page's preferences."""
path = self._get_path()
for trait_name, value in self._changed.items():
if self._is_preference_trait(trait_name):
self.preferences.set('%s.%s' % ... | the_stack_v2_python_sparse | .venv/Lib/site-packages/apptools/preferences/ui/preferences_page.py | Bdye15/Sample_Programs | train | 0 |
1e0dcb2ef7912027ccf374c866a4fff9cdec23d3 | [
"UsernamePasswordMako.__init__(self, srv, mako_template, template_lookup, None, return_to)\nself.ldap = ldap.initialize(ldapsrv)\nself.ldap.protocol_version = 3\nself.ldap.set_option(ldap.OPT_REFERRALS, 0)\nself.dn_pattern = dn_pattern",
"_dn = self.dn_pattern % user\ntry:\n self.ldap.simple_bind_s(_dn, pwd)\n... | <|body_start_0|>
UsernamePasswordMako.__init__(self, srv, mako_template, template_lookup, None, return_to)
self.ldap = ldap.initialize(ldapsrv)
self.ldap.protocol_version = 3
self.ldap.set_option(ldap.OPT_REFERRALS, 0)
self.dn_pattern = dn_pattern
<|end_body_0|>
<|body_start_1|>... | LDAPAuthn | [
"Apache-2.0",
"CC-BY-3.0",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"ZPL-2.0",
"Unlicense",
"LGPL-3.0-only",
"CC0-1.0",
"LicenseRef-scancode-other-permissive",
"CNRI-Python",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-2.0-or-later",
"Python-... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LDAPAuthn:
def __init__(self, srv, ldapsrv, return_to, dn_pattern, mako_template, template_lookup):
""":param srv: The server instance :param ldapsrv: Which LDAP server to us :param return_to: Where to send the user after authentication :return:"""
<|body_0|>
def _verify(sel... | stack_v2_sparse_classes_36k_train_014665 | 8,302 | permissive | [
{
"docstring": ":param srv: The server instance :param ldapsrv: Which LDAP server to us :param return_to: Where to send the user after authentication :return:",
"name": "__init__",
"signature": "def __init__(self, srv, ldapsrv, return_to, dn_pattern, mako_template, template_lookup)"
},
{
"docstr... | 2 | null | Implement the Python class `LDAPAuthn` described below.
Class description:
Implement the LDAPAuthn class.
Method signatures and docstrings:
- def __init__(self, srv, ldapsrv, return_to, dn_pattern, mako_template, template_lookup): :param srv: The server instance :param ldapsrv: Which LDAP server to us :param return_t... | Implement the Python class `LDAPAuthn` described below.
Class description:
Implement the LDAPAuthn class.
Method signatures and docstrings:
- def __init__(self, srv, ldapsrv, return_to, dn_pattern, mako_template, template_lookup): :param srv: The server instance :param ldapsrv: Which LDAP server to us :param return_t... | dccb9467675c67b9c3399fc76c5de6d31bfb8255 | <|skeleton|>
class LDAPAuthn:
def __init__(self, srv, ldapsrv, return_to, dn_pattern, mako_template, template_lookup):
""":param srv: The server instance :param ldapsrv: Which LDAP server to us :param return_to: Where to send the user after authentication :return:"""
<|body_0|>
def _verify(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LDAPAuthn:
def __init__(self, srv, ldapsrv, return_to, dn_pattern, mako_template, template_lookup):
""":param srv: The server instance :param ldapsrv: Which LDAP server to us :param return_to: Where to send the user after authentication :return:"""
UsernamePasswordMako.__init__(self, srv, mako... | the_stack_v2_python_sparse | desktop/core/ext-py3/pysaml2-7.3.1/src/saml2/authn.py | cloudera/hue | train | 5,655 | |
32c41b53e0ebdf789c4af0cc8c15fc3b2832543d | [
"head = cur = ListNode(0)\nwhile l1 and l2:\n if l1.val < l2.val:\n cur.next = l1\n l1 = l1.next\n else:\n cur.next = l2\n l2 = l2.next\n cur = cur.next\ncur.next = l1 or l2\nreturn head.next",
"if not l1 or not l2:\n return l1 or l2\nif l1.val < l2.val:\n l1.next = self... | <|body_start_0|>
head = cur = ListNode(0)
while l1 and l2:
if l1.val < l2.val:
cur.next = l1
l1 = l1.next
else:
cur.next = l2
l2 = l2.next
cur = cur.next
cur.next = l1 or l2
return head.ne... | I am not familiar with the operation with linked list, pay attention to this! | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""I am not familiar with the operation with linked list, pay attention to this!"""
def merge(self, l1, l2):
"""add a third linked list to simplify. Iterately."""
<|body_0|>
def merge2(self, l1, l2):
"""Recursively."""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_36k_train_014666 | 1,257 | no_license | [
{
"docstring": "add a third linked list to simplify. Iterately.",
"name": "merge",
"signature": "def merge(self, l1, l2)"
},
{
"docstring": "Recursively.",
"name": "merge2",
"signature": "def merge2(self, l1, l2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013372 | Implement the Python class `Solution` described below.
Class description:
I am not familiar with the operation with linked list, pay attention to this!
Method signatures and docstrings:
- def merge(self, l1, l2): add a third linked list to simplify. Iterately.
- def merge2(self, l1, l2): Recursively. | Implement the Python class `Solution` described below.
Class description:
I am not familiar with the operation with linked list, pay attention to this!
Method signatures and docstrings:
- def merge(self, l1, l2): add a third linked list to simplify. Iterately.
- def merge2(self, l1, l2): Recursively.
<|skeleton|>
cl... | eafadd711f6ec1b60d78442280f1c44b6296209d | <|skeleton|>
class Solution:
"""I am not familiar with the operation with linked list, pay attention to this!"""
def merge(self, l1, l2):
"""add a third linked list to simplify. Iterately."""
<|body_0|>
def merge2(self, l1, l2):
"""Recursively."""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""I am not familiar with the operation with linked list, pay attention to this!"""
def merge(self, l1, l2):
"""add a third linked list to simplify. Iterately."""
head = cur = ListNode(0)
while l1 and l2:
if l1.val < l2.val:
cur.next = l1
... | the_stack_v2_python_sparse | cyc/linked_list/21.py | Veraph/LeetCode_Practice | train | 0 |
32c1571a62386f6d4fb490056be5dc4bfd9763d7 | [
"super(CaffeGraphConverter, self).__init__(framework, base_path)\nprint('{} bmodel converter init'.format(model_name))\nself.model_name = model_name\nself.models_path = models_path\nself.weights_path = weights_path\nself.shapes = shapes\nself.dyns = dyns\nself.outdirs = outdirs\nself.target = target\nself.bmodel_co... | <|body_start_0|>
super(CaffeGraphConverter, self).__init__(framework, base_path)
print('{} bmodel converter init'.format(model_name))
self.model_name = model_name
self.models_path = models_path
self.weights_path = weights_path
self.shapes = shapes
self.dyns = dyns... | caffe graph bmodel converter | CaffeGraphConverter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CaffeGraphConverter:
"""caffe graph bmodel converter"""
def __init__(self, model_name, base_path, models_path, weights_path, shapes, dyns, outdirs, framework, target, bmodel_combine):
"""Init caffe graph bmodel converter"""
<|body_0|>
def converter(self):
"""conv... | stack_v2_sparse_classes_36k_train_014667 | 15,723 | permissive | [
{
"docstring": "Init caffe graph bmodel converter",
"name": "__init__",
"signature": "def __init__(self, model_name, base_path, models_path, weights_path, shapes, dyns, outdirs, framework, target, bmodel_combine)"
},
{
"docstring": "convert caffe graph",
"name": "converter",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_019185 | Implement the Python class `CaffeGraphConverter` described below.
Class description:
caffe graph bmodel converter
Method signatures and docstrings:
- def __init__(self, model_name, base_path, models_path, weights_path, shapes, dyns, outdirs, framework, target, bmodel_combine): Init caffe graph bmodel converter
- def ... | Implement the Python class `CaffeGraphConverter` described below.
Class description:
caffe graph bmodel converter
Method signatures and docstrings:
- def __init__(self, model_name, base_path, models_path, weights_path, shapes, dyns, outdirs, framework, target, bmodel_combine): Init caffe graph bmodel converter
- def ... | c9fa07851da663dda4953dba72e1d3937299a4ea | <|skeleton|>
class CaffeGraphConverter:
"""caffe graph bmodel converter"""
def __init__(self, model_name, base_path, models_path, weights_path, shapes, dyns, outdirs, framework, target, bmodel_combine):
"""Init caffe graph bmodel converter"""
<|body_0|>
def converter(self):
"""conv... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CaffeGraphConverter:
"""caffe graph bmodel converter"""
def __init__(self, model_name, base_path, models_path, weights_path, shapes, dyns, outdirs, framework, target, bmodel_combine):
"""Init caffe graph bmodel converter"""
super(CaffeGraphConverter, self).__init__(framework, base_path)
... | the_stack_v2_python_sparse | modules/utils/bmodel_converter.py | sophon-ai-algo/sophon-inference | train | 32 |
e98c17b010c1258e3c9b144718ae074979299732 | [
"if self.op.mode in (constants.IALLOCATOR_MODE_ALLOC, constants.IALLOCATOR_MODE_MULTI_ALLOC):\n self.inst_uuid, iname = self.cfg.ExpandInstanceName(self.op.name)\n if iname is not None:\n raise errors.OpPrereqError(\"Instance '%s' already in the cluster\" % iname, errors.ECODE_EXISTS)\n for row in s... | <|body_start_0|>
if self.op.mode in (constants.IALLOCATOR_MODE_ALLOC, constants.IALLOCATOR_MODE_MULTI_ALLOC):
self.inst_uuid, iname = self.cfg.ExpandInstanceName(self.op.name)
if iname is not None:
raise errors.OpPrereqError("Instance '%s' already in the cluster" % iname,... | Run allocator tests. This LU runs the allocator tests | LUTestAllocator | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LUTestAllocator:
"""Run allocator tests. This LU runs the allocator tests"""
def CheckPrereq(self):
"""Check prerequisites. This checks the opcode parameters depending on the director and mode test."""
<|body_0|>
def Exec(self, feedback_fn):
"""Run the allocator ... | stack_v2_sparse_classes_36k_train_014668 | 16,228 | permissive | [
{
"docstring": "Check prerequisites. This checks the opcode parameters depending on the director and mode test.",
"name": "CheckPrereq",
"signature": "def CheckPrereq(self)"
},
{
"docstring": "Run the allocator test.",
"name": "Exec",
"signature": "def Exec(self, feedback_fn)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019409 | Implement the Python class `LUTestAllocator` described below.
Class description:
Run allocator tests. This LU runs the allocator tests
Method signatures and docstrings:
- def CheckPrereq(self): Check prerequisites. This checks the opcode parameters depending on the director and mode test.
- def Exec(self, feedback_fn... | Implement the Python class `LUTestAllocator` described below.
Class description:
Run allocator tests. This LU runs the allocator tests
Method signatures and docstrings:
- def CheckPrereq(self): Check prerequisites. This checks the opcode parameters depending on the director and mode test.
- def Exec(self, feedback_fn... | 456ea285a7583183c2c8e5bcffe9006ec8a9d658 | <|skeleton|>
class LUTestAllocator:
"""Run allocator tests. This LU runs the allocator tests"""
def CheckPrereq(self):
"""Check prerequisites. This checks the opcode parameters depending on the director and mode test."""
<|body_0|>
def Exec(self, feedback_fn):
"""Run the allocator ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LUTestAllocator:
"""Run allocator tests. This LU runs the allocator tests"""
def CheckPrereq(self):
"""Check prerequisites. This checks the opcode parameters depending on the director and mode test."""
if self.op.mode in (constants.IALLOCATOR_MODE_ALLOC, constants.IALLOCATOR_MODE_MULTI_AL... | the_stack_v2_python_sparse | lib/cmdlib/test.py | ganeti/ganeti | train | 465 |
e6bfa81ab9d5ae2f9b8ecf3d43ef51425c5828ea | [
"self.wavelength = wavelength if wavelength is not None else default_wavelength\nself.position = position if position is not None else default_position\nself.direction = direction if direction is not None else default_direction\nself.name = name",
"if num_rays is None or num_rays == 0:\n return\ncount = 0\nwhi... | <|body_start_0|>
self.wavelength = wavelength if wavelength is not None else default_wavelength
self.position = position if position is not None else default_position
self.direction = direction if direction is not None else default_direction
self.name = name
<|end_body_0|>
<|body_start_... | Generic light source object which calls delegate functions to help generate rays that sample statistical distributions. Examples -------- Light of 555nm from the origin or the light's node along direction (0, 0, 1):: Light() Light with isotropic direction:: from pvtrace.material.utils import isotropic Light(direction=i... | Light | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Light:
"""Generic light source object which calls delegate functions to help generate rays that sample statistical distributions. Examples -------- Light of 555nm from the origin or the light's node along direction (0, 0, 1):: Light() Light with isotropic direction:: from pvtrace.material.utils i... | stack_v2_sparse_classes_36k_train_014669 | 5,381 | no_license | [
{
"docstring": "Returns a light source emitting along the positive z direction of the coordinate system the light is attached to. Delegate functions can be used modify the wavelength, position and direction of the emitted ray. Parameters ---------- wavelength: callable or None A callable which returns the ray's... | 2 | stack_v2_sparse_classes_30k_val_000879 | Implement the Python class `Light` described below.
Class description:
Generic light source object which calls delegate functions to help generate rays that sample statistical distributions. Examples -------- Light of 555nm from the origin or the light's node along direction (0, 0, 1):: Light() Light with isotropic di... | Implement the Python class `Light` described below.
Class description:
Generic light source object which calls delegate functions to help generate rays that sample statistical distributions. Examples -------- Light of 555nm from the origin or the light's node along direction (0, 0, 1):: Light() Light with isotropic di... | 1f89db30f9f2e3d61a2bd9f5ab1a1742f897ad87 | <|skeleton|>
class Light:
"""Generic light source object which calls delegate functions to help generate rays that sample statistical distributions. Examples -------- Light of 555nm from the origin or the light's node along direction (0, 0, 1):: Light() Light with isotropic direction:: from pvtrace.material.utils i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Light:
"""Generic light source object which calls delegate functions to help generate rays that sample statistical distributions. Examples -------- Light of 555nm from the origin or the light's node along direction (0, 0, 1):: Light() Light with isotropic direction:: from pvtrace.material.utils import isotrop... | the_stack_v2_python_sparse | pvtrace/light/light.py | pcyc/pvtrace | train | 0 |
0e314ab7528a2d8d17afa7f27ca105a2f4e07b22 | [
"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... | Proto file describing the Conversion Action service. Service to manage conversion actions. | ConversionActionServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConversionActionServiceServicer:
"""Proto file describing the Conversion Action service. Service to manage conversion actions."""
def GetConversionAction(self, request, context):
"""Returns the requested conversion action."""
<|body_0|>
def MutateConversionActions(self, ... | stack_v2_sparse_classes_36k_train_014670 | 5,783 | permissive | [
{
"docstring": "Returns the requested conversion action.",
"name": "GetConversionAction",
"signature": "def GetConversionAction(self, request, context)"
},
{
"docstring": "Creates, updates or removes conversion actions. Operation statuses are returned.",
"name": "MutateConversionActions",
... | 2 | null | Implement the Python class `ConversionActionServiceServicer` described below.
Class description:
Proto file describing the Conversion Action service. Service to manage conversion actions.
Method signatures and docstrings:
- def GetConversionAction(self, request, context): Returns the requested conversion action.
- de... | Implement the Python class `ConversionActionServiceServicer` described below.
Class description:
Proto file describing the Conversion Action service. Service to manage conversion actions.
Method signatures and docstrings:
- def GetConversionAction(self, request, context): Returns the requested conversion action.
- de... | a5b6cede64f4d9912ae6ad26927a54e40448c9fe | <|skeleton|>
class ConversionActionServiceServicer:
"""Proto file describing the Conversion Action service. Service to manage conversion actions."""
def GetConversionAction(self, request, context):
"""Returns the requested conversion action."""
<|body_0|>
def MutateConversionActions(self, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConversionActionServiceServicer:
"""Proto file describing the Conversion Action service. Service to manage conversion actions."""
def GetConversionAction(self, request, context):
"""Returns the requested conversion action."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context... | the_stack_v2_python_sparse | google/ads/google_ads/v5/proto/services/conversion_action_service_pb2_grpc.py | fiboknacky/google-ads-python | train | 0 |
ee8f359bb640c4a031ca203cfef6555d929d38ee | [
"super(PreTwoStem, self).__init__()\nself._C = desc.C\nself.stems = nn.ModuleList()\nstem0 = nn.Sequential(nn.Conv2d(3, self._C // 2, kernel_size=3, stride=2, padding=1, bias=False), nn.BatchNorm2d(self._C // 2), nn.ReLU(inplace=True), nn.Conv2d(self._C // 2, self._C, 3, stride=2, padding=1, bias=False), nn.BatchNo... | <|body_start_0|>
super(PreTwoStem, self).__init__()
self._C = desc.C
self.stems = nn.ModuleList()
stem0 = nn.Sequential(nn.Conv2d(3, self._C // 2, kernel_size=3, stride=2, padding=1, bias=False), nn.BatchNorm2d(self._C // 2), nn.ReLU(inplace=True), nn.Conv2d(self._C // 2, self._C, 3, str... | Class of two stems convolution. :param desc: description of PreTwoStem :type desc: Config | PreTwoStem | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PreTwoStem:
"""Class of two stems convolution. :param desc: description of PreTwoStem :type desc: Config"""
def __init__(self, desc):
"""Init PreTwoStem."""
<|body_0|>
def forward(self, x):
"""Forward function of PreTwoStem."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k_train_014671 | 7,297 | permissive | [
{
"docstring": "Init PreTwoStem.",
"name": "__init__",
"signature": "def __init__(self, desc)"
},
{
"docstring": "Forward function of PreTwoStem.",
"name": "forward",
"signature": "def forward(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003474 | Implement the Python class `PreTwoStem` described below.
Class description:
Class of two stems convolution. :param desc: description of PreTwoStem :type desc: Config
Method signatures and docstrings:
- def __init__(self, desc): Init PreTwoStem.
- def forward(self, x): Forward function of PreTwoStem. | Implement the Python class `PreTwoStem` described below.
Class description:
Class of two stems convolution. :param desc: description of PreTwoStem :type desc: Config
Method signatures and docstrings:
- def __init__(self, desc): Init PreTwoStem.
- def forward(self, x): Forward function of PreTwoStem.
<|skeleton|>
cla... | df51ed9c1d6dbde1deef63f2a037a369f8554406 | <|skeleton|>
class PreTwoStem:
"""Class of two stems convolution. :param desc: description of PreTwoStem :type desc: Config"""
def __init__(self, desc):
"""Init PreTwoStem."""
<|body_0|>
def forward(self, x):
"""Forward function of PreTwoStem."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PreTwoStem:
"""Class of two stems convolution. :param desc: description of PreTwoStem :type desc: Config"""
def __init__(self, desc):
"""Init PreTwoStem."""
super(PreTwoStem, self).__init__()
self._C = desc.C
self.stems = nn.ModuleList()
stem0 = nn.Sequential(nn.Co... | the_stack_v2_python_sparse | built-in/TensorFlow/Research/cv/image_classification/Darts_for_TensorFlow/automl/vega/search_space/networks/pytorch/blocks/darts_ops.py | Huawei-Ascend/modelzoo | train | 1 |
95a6787f51184d6ab5127eaed5204cd83b395b37 | [
"self.m1 = {}\nself.m2 = {}\nself.nextid = 0",
"if val not in self.m1:\n self.m1[val] = self.nextid\n self.m2[self.nextid] = val\n self.nextid += 1\n return True\nreturn False",
"if val in self.m1:\n nid = self.m1.pop(val)\n self.m2.pop(nid)\n return True\nreturn False",
"idx = random.ran... | <|body_start_0|>
self.m1 = {}
self.m2 = {}
self.nextid = 0
<|end_body_0|>
<|body_start_1|>
if val not in self.m1:
self.m1[val] = self.nextid
self.m2[self.nextid] = val
self.nextid += 1
return True
return False
<|end_body_1|>
<|bod... | RandomizedSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, val):
"""Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_014672 | 5,825 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool",
"name": "insert",
"signature": ... | 4 | null | Implement the Python class `RandomizedSet` described below.
Class description:
Implement the RandomizedSet class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, val): Inserts a value to the set. Returns true if the set did not already contain the specif... | Implement the Python class `RandomizedSet` described below.
Class description:
Implement the RandomizedSet class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, val): Inserts a value to the set. Returns true if the set did not already contain the specif... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, val):
"""Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
self.m1 = {}
self.m2 = {}
self.nextid = 0
def insert(self, val):
"""Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtyp... | the_stack_v2_python_sparse | I/InsertDeleteGetRandomO1.py | bssrdf/pyleet | train | 2 | |
d014990f8e5568ad24b526a26265e120d2b29eca | [
"self.resources = resources\nself.object_map = {}\nfor k, v in object_map.items():\n seen = set()\n while v in object_map:\n idv = id(v)\n if idv in seen:\n raise Exception(f'Operation {v} maps to itself.')\n seen.add(idv)\n v = object_map[v]\n self.object_map[k] = _U... | <|body_start_0|>
self.resources = resources
self.object_map = {}
for k, v in object_map.items():
seen = set()
while v in object_map:
idv = id(v)
if idv in seen:
raise Exception(f'Operation {v} maps to itself.')
... | Convert a Python object into an object that can be in a Myia graph. | ConverterResource | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConverterResource:
"""Convert a Python object into an object that can be in a Myia graph."""
def __init__(self, resources, object_map):
"""Initialize a Converter."""
<|body_0|>
def __call__(self, value):
"""Convert a value."""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_36k_train_014673 | 6,967 | permissive | [
{
"docstring": "Initialize a Converter.",
"name": "__init__",
"signature": "def __init__(self, resources, object_map)"
},
{
"docstring": "Convert a value.",
"name": "__call__",
"signature": "def __call__(self, value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009471 | Implement the Python class `ConverterResource` described below.
Class description:
Convert a Python object into an object that can be in a Myia graph.
Method signatures and docstrings:
- def __init__(self, resources, object_map): Initialize a Converter.
- def __call__(self, value): Convert a value. | Implement the Python class `ConverterResource` described below.
Class description:
Convert a Python object into an object that can be in a Myia graph.
Method signatures and docstrings:
- def __init__(self, resources, object_map): Initialize a Converter.
- def __call__(self, value): Convert a value.
<|skeleton|>
clas... | 0aa38aa3c43648ee408dc031352ba442f6bed59f | <|skeleton|>
class ConverterResource:
"""Convert a Python object into an object that can be in a Myia graph."""
def __init__(self, resources, object_map):
"""Initialize a Converter."""
<|body_0|>
def __call__(self, value):
"""Convert a value."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConverterResource:
"""Convert a Python object into an object that can be in a Myia graph."""
def __init__(self, resources, object_map):
"""Initialize a Converter."""
self.resources = resources
self.object_map = {}
for k, v in object_map.items():
seen = set()
... | the_stack_v2_python_sparse | myia/pipeline/resources.py | zangmunger/myia | train | 0 |
0a4bbda0cacbb4ac7a64abac75fece18d8d00fb1 | [
"self.action_vec = action_vec\nself.condition_vec = condition_vec\nself.is_allow = is_allow\nself.negate_action_vec = negate_action_vec\nself.negate_principal = negate_principal\nself.negate_resource_vec = negate_resource_vec\nself.principal = principal\nself.resource_vec = resource_vec\nself.sid = sid",
"if dict... | <|body_start_0|>
self.action_vec = action_vec
self.condition_vec = condition_vec
self.is_allow = is_allow
self.negate_action_vec = negate_action_vec
self.negate_principal = negate_principal
self.negate_resource_vec = negate_resource_vec
self.principal = principal
... | Implementation of the 'Statement' model. TODO: type description here. Attributes: action_vec (list of string): This field includes keyword which map to permission for each S3 operation. We support wildcard('*' and '?') for this field. Some of the valid formats are : "*", "s3:*", "s3:*Object" condition_vec (list of Cond... | Statement | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Statement:
"""Implementation of the 'Statement' model. TODO: type description here. Attributes: action_vec (list of string): This field includes keyword which map to permission for each S3 operation. We support wildcard('*' and '?') for this field. Some of the valid formats are : "*", "s3:*", "s3... | stack_v2_sparse_classes_36k_train_014674 | 5,114 | permissive | [
{
"docstring": "Constructor for the Statement class",
"name": "__init__",
"signature": "def __init__(self, action_vec=None, condition_vec=None, is_allow=None, negate_action_vec=None, negate_principal=None, negate_resource_vec=None, principal=None, resource_vec=None, sid=None)"
},
{
"docstring": ... | 2 | null | Implement the Python class `Statement` described below.
Class description:
Implementation of the 'Statement' model. TODO: type description here. Attributes: action_vec (list of string): This field includes keyword which map to permission for each S3 operation. We support wildcard('*' and '?') for this field. Some of t... | Implement the Python class `Statement` described below.
Class description:
Implementation of the 'Statement' model. TODO: type description here. Attributes: action_vec (list of string): This field includes keyword which map to permission for each S3 operation. We support wildcard('*' and '?') for this field. Some of t... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class Statement:
"""Implementation of the 'Statement' model. TODO: type description here. Attributes: action_vec (list of string): This field includes keyword which map to permission for each S3 operation. We support wildcard('*' and '?') for this field. Some of the valid formats are : "*", "s3:*", "s3... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Statement:
"""Implementation of the 'Statement' model. TODO: type description here. Attributes: action_vec (list of string): This field includes keyword which map to permission for each S3 operation. We support wildcard('*' and '?') for this field. Some of the valid formats are : "*", "s3:*", "s3:*Object" con... | the_stack_v2_python_sparse | cohesity_management_sdk/models/statement.py | cohesity/management-sdk-python | train | 24 |
fc63e69a02c228ba2121691b51d8be44b8102992 | [
"EventHandler.__init__(self)\nself._key = Key()\nself._key.addTo(win)\nself._done = Done(win)\nself._done.addTo(win)\nself._challenge = Challenge(win)\nself._challenge.addTo(win)\nself._holder = Holder(1)\nself._holder.addTo(win)\nself._directions = Directions()\nself._directions.addTo(win)\nself._board = Board(win... | <|body_start_0|>
EventHandler.__init__(self)
self._key = Key()
self._key.addTo(win)
self._done = Done(win)
self._done.addTo(win)
self._challenge = Challenge(win)
self._challenge.addTo(win)
self._holder = Holder(1)
self._holder.addTo(win)
se... | Class that controlls what happens during the game and what actions are taken | Controller | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Controller:
"""Class that controlls what happens during the game and what actions are taken"""
def __init__(self, win):
"""Initializes each class and adds it to the window"""
<|body_0|>
def starting(self, win):
"""Starts the game by dealing 7 pieces to the proper... | stack_v2_sparse_classes_36k_train_014675 | 23,085 | no_license | [
{
"docstring": "Initializes each class and adds it to the window",
"name": "__init__",
"signature": "def __init__(self, win)"
},
{
"docstring": "Starts the game by dealing 7 pieces to the proper locations in the holders for both players",
"name": "starting",
"signature": "def starting(se... | 3 | null | Implement the Python class `Controller` described below.
Class description:
Class that controlls what happens during the game and what actions are taken
Method signatures and docstrings:
- def __init__(self, win): Initializes each class and adds it to the window
- def starting(self, win): Starts the game by dealing 7... | Implement the Python class `Controller` described below.
Class description:
Class that controlls what happens during the game and what actions are taken
Method signatures and docstrings:
- def __init__(self, win): Initializes each class and adds it to the window
- def starting(self, win): Starts the game by dealing 7... | e5d96a65fc84481b85072cfb55dea9a0666634b5 | <|skeleton|>
class Controller:
"""Class that controlls what happens during the game and what actions are taken"""
def __init__(self, win):
"""Initializes each class and adds it to the window"""
<|body_0|>
def starting(self, win):
"""Starts the game by dealing 7 pieces to the proper... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Controller:
"""Class that controlls what happens during the game and what actions are taken"""
def __init__(self, win):
"""Initializes each class and adds it to the window"""
EventHandler.__init__(self)
self._key = Key()
self._key.addTo(win)
self._done = Done(win)
... | the_stack_v2_python_sparse | Games-2017/21/Game.py | paulmagnus/CSPy | train | 0 |
ffcaa5722a251f5bc6c902d035ce761e7bceef63 | [
"discussion = Discussion.query.filter_by(id=id).first()\nif discussion is None:\n return ({'message': 'Discussion does not exist'}, 404)\ndiscussion.view_count += 1\ntry:\n db.session.commit()\nexcept Exception:\n return ({'message': 'Unable to update Discussion view count'}, 500)\nreturn discussion_schema... | <|body_start_0|>
discussion = Discussion.query.filter_by(id=id).first()
if discussion is None:
return ({'message': 'Discussion does not exist'}, 404)
discussion.view_count += 1
try:
db.session.commit()
except Exception:
return ({'message': 'Una... | SingleDiscussion | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SingleDiscussion:
def get(self, id):
"""Get Discussion by id"""
<|body_0|>
def patch(self, id):
"""Update a Discussion"""
<|body_1|>
def delete(self, id):
"""Delete a Discussion by id"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_014676 | 4,368 | no_license | [
{
"docstring": "Get Discussion by id",
"name": "get",
"signature": "def get(self, id)"
},
{
"docstring": "Update a Discussion",
"name": "patch",
"signature": "def patch(self, id)"
},
{
"docstring": "Delete a Discussion by id",
"name": "delete",
"signature": "def delete(se... | 3 | stack_v2_sparse_classes_30k_train_018579 | Implement the Python class `SingleDiscussion` described below.
Class description:
Implement the SingleDiscussion class.
Method signatures and docstrings:
- def get(self, id): Get Discussion by id
- def patch(self, id): Update a Discussion
- def delete(self, id): Delete a Discussion by id | Implement the Python class `SingleDiscussion` described below.
Class description:
Implement the SingleDiscussion class.
Method signatures and docstrings:
- def get(self, id): Get Discussion by id
- def patch(self, id): Update a Discussion
- def delete(self, id): Delete a Discussion by id
<|skeleton|>
class SingleDis... | ae78fff9888b0f68d9403d7f65cba086dabb3802 | <|skeleton|>
class SingleDiscussion:
def get(self, id):
"""Get Discussion by id"""
<|body_0|>
def patch(self, id):
"""Update a Discussion"""
<|body_1|>
def delete(self, id):
"""Delete a Discussion by id"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SingleDiscussion:
def get(self, id):
"""Get Discussion by id"""
discussion = Discussion.query.filter_by(id=id).first()
if discussion is None:
return ({'message': 'Discussion does not exist'}, 404)
discussion.view_count += 1
try:
db.session.commit... | the_stack_v2_python_sparse | api/v1/discussions.py | mythril-io/flask-api | train | 0 | |
96fcc3791c667e30c2cae0720a0cb138284f074b | [
"super().save_model(request, obj, form, change)\nfrom celery_tasks.tasks import generate_static_index_html\ngenerate_static_index_html.delay()\ncache.delete('index_page_data')",
"super().delete_model(request, obj)\nfrom celery_tasks.tasks import generate_static_index_html\ngenerate_static_index_html.delay()\ncach... | <|body_start_0|>
super().save_model(request, obj, form, change)
from celery_tasks.tasks import generate_static_index_html
generate_static_index_html.delay()
cache.delete('index_page_data')
<|end_body_0|>
<|body_start_1|>
super().delete_model(request, obj)
from celery_tas... | 商品种类模型管理器类 | BaseModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseModel:
"""商品种类模型管理器类"""
def save_model(self, request, obj, form, change):
"""新增或更新表中的数据时调用"""
<|body_0|>
def delete_model(self, request, obj):
"""删除表中的数据时调用"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().save_model(request, obj, for... | stack_v2_sparse_classes_36k_train_014677 | 1,892 | no_license | [
{
"docstring": "新增或更新表中的数据时调用",
"name": "save_model",
"signature": "def save_model(self, request, obj, form, change)"
},
{
"docstring": "删除表中的数据时调用",
"name": "delete_model",
"signature": "def delete_model(self, request, obj)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000702 | Implement the Python class `BaseModel` described below.
Class description:
商品种类模型管理器类
Method signatures and docstrings:
- def save_model(self, request, obj, form, change): 新增或更新表中的数据时调用
- def delete_model(self, request, obj): 删除表中的数据时调用 | Implement the Python class `BaseModel` described below.
Class description:
商品种类模型管理器类
Method signatures and docstrings:
- def save_model(self, request, obj, form, change): 新增或更新表中的数据时调用
- def delete_model(self, request, obj): 删除表中的数据时调用
<|skeleton|>
class BaseModel:
"""商品种类模型管理器类"""
def save_model(self, req... | 0267ef3cbc8c0e66f42f0b718769cce2cd94c576 | <|skeleton|>
class BaseModel:
"""商品种类模型管理器类"""
def save_model(self, request, obj, form, change):
"""新增或更新表中的数据时调用"""
<|body_0|>
def delete_model(self, request, obj):
"""删除表中的数据时调用"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseModel:
"""商品种类模型管理器类"""
def save_model(self, request, obj, form, change):
"""新增或更新表中的数据时调用"""
super().save_model(request, obj, form, change)
from celery_tasks.tasks import generate_static_index_html
generate_static_index_html.delay()
cache.delete('index_page_da... | the_stack_v2_python_sparse | Python_Workspace/DjangoDemo/dailyFresh/apps/goods/admin.py | lxconfig/BlockChainDemo | train | 14 |
1e043dc1fa809dd0ef4aee6c669772edbc87af08 | [
"task_manager.Builder.__init__(self, output_directory, output_subdirectory)\nself._android_device = android_device\nself._url = url\nself.default_final_tasks = []\nself.original_wpr_task = None",
"runner = sandwich_runner.SandwichRunner()\nrunner.url = self._url\nrunner.android_device = self._android_device\nretu... | <|body_start_0|>
task_manager.Builder.__init__(self, output_directory, output_subdirectory)
self._android_device = android_device
self._url = url
self.default_final_tasks = []
self.original_wpr_task = None
<|end_body_0|>
<|body_start_1|>
runner = sandwich_runner.Sandwich... | A builder for a graph of tasks, each prepares or invokes a SandwichRunner. | SandwichCommonBuilder | [
"LGPL-2.0-or-later",
"MIT",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-unknown",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SandwichCommonBuilder:
"""A builder for a graph of tasks, each prepares or invokes a SandwichRunner."""
def __init__(self, android_device, url, output_directory, output_subdirectory):
"""Constructor. Args: android_device: The android DeviceUtils to run sandwich on or None to run it l... | stack_v2_sparse_classes_36k_train_014678 | 2,259 | permissive | [
{
"docstring": "Constructor. Args: android_device: The android DeviceUtils to run sandwich on or None to run it locally. url: URL to benchmark. output_directory: As in task_manager.Builder.__init__ output_subdirectory: As in task_manager.Builder.__init__",
"name": "__init__",
"signature": "def __init__(... | 3 | stack_v2_sparse_classes_30k_train_017749 | Implement the Python class `SandwichCommonBuilder` described below.
Class description:
A builder for a graph of tasks, each prepares or invokes a SandwichRunner.
Method signatures and docstrings:
- def __init__(self, android_device, url, output_directory, output_subdirectory): Constructor. Args: android_device: The a... | Implement the Python class `SandwichCommonBuilder` described below.
Class description:
A builder for a graph of tasks, each prepares or invokes a SandwichRunner.
Method signatures and docstrings:
- def __init__(self, android_device, url, output_directory, output_subdirectory): Constructor. Args: android_device: The a... | 9171447efcf0bb393d41d1dc877c7c13c46d8e38 | <|skeleton|>
class SandwichCommonBuilder:
"""A builder for a graph of tasks, each prepares or invokes a SandwichRunner."""
def __init__(self, android_device, url, output_directory, output_subdirectory):
"""Constructor. Args: android_device: The android DeviceUtils to run sandwich on or None to run it l... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SandwichCommonBuilder:
"""A builder for a graph of tasks, each prepares or invokes a SandwichRunner."""
def __init__(self, android_device, url, output_directory, output_subdirectory):
"""Constructor. Args: android_device: The android DeviceUtils to run sandwich on or None to run it locally. url: ... | the_stack_v2_python_sparse | src/tools/android/loading/sandwich_utils.py | webosce/chromium53 | train | 0 |
1e0596a42bfe2a453fb9506fe5800856531a1b96 | [
"if hasattr(self, 'policy_id'):\n return self.policy_id\nreturn self.name",
"token, from_session = self.__get_oauth2_token_for_request(request)\nif token is not None:\n if token.is_expired():\n if from_session:\n return NOT_LOGGED_IN\n else:\n return LOGIN_FAILED\n eli... | <|body_start_0|>
if hasattr(self, 'policy_id'):
return self.policy_id
return self.name
<|end_body_0|>
<|body_start_1|>
token, from_session = self.__get_oauth2_token_for_request(request)
if token is not None:
if token.is_expired():
if from_session:... | Augments a WebAPIResource to support OAuth2 tokens. Any WebAPIResource subclass making use of this mixin can accept requests backed by an OAuth2 token and will restrict the request to that token's allowed scopes. It is recommended that all resources in a project inherit from a base resource that inherits both from this... | ResourceOAuth2TokenMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResourceOAuth2TokenMixin:
"""Augments a WebAPIResource to support OAuth2 tokens. Any WebAPIResource subclass making use of this mixin can accept requests backed by an OAuth2 token and will restrict the request to that token's allowed scopes. It is recommended that all resources in a project inher... | stack_v2_sparse_classes_36k_train_014679 | 5,498 | no_license | [
{
"docstring": "The ID used for required scopes. This defaults to the name of the resource, but can be overridden in case the name is not specific enough or there's a conflict. If the resource allows WebAPI tokens in addition to OAuth2 tokens, this will default to the resource's policy ID (which defaults to its... | 4 | null | Implement the Python class `ResourceOAuth2TokenMixin` described below.
Class description:
Augments a WebAPIResource to support OAuth2 tokens. Any WebAPIResource subclass making use of this mixin can accept requests backed by an OAuth2 token and will restrict the request to that token's allowed scopes. It is recommende... | Implement the Python class `ResourceOAuth2TokenMixin` described below.
Class description:
Augments a WebAPIResource to support OAuth2 tokens. Any WebAPIResource subclass making use of this mixin can accept requests backed by an OAuth2 token and will restrict the request to that token's allowed scopes. It is recommende... | 99ea69d80a3a393b0da4da3152ef26e808dd8487 | <|skeleton|>
class ResourceOAuth2TokenMixin:
"""Augments a WebAPIResource to support OAuth2 tokens. Any WebAPIResource subclass making use of this mixin can accept requests backed by an OAuth2 token and will restrict the request to that token's allowed scopes. It is recommended that all resources in a project inher... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResourceOAuth2TokenMixin:
"""Augments a WebAPIResource to support OAuth2 tokens. Any WebAPIResource subclass making use of this mixin can accept requests backed by an OAuth2 token and will restrict the request to that token's allowed scopes. It is recommended that all resources in a project inherit from a bas... | the_stack_v2_python_sparse | djblets/webapi/resources/mixins/oauth2_tokens.py | chipx86/djblets | train | 2 |
7f4e9d6d7676d5ac16ee78d28b2d0c058a817e8c | [
"self.request = request\nself.datadir = datadir\nself.original_datadir = original_datadir",
"__tracebackhide__ = True\n\ndef dump(filename):\n \"\"\"Dump dict contents to the given filename\"\"\"\n import json\n s = json.dumps(data_dict, sort_keys=True, indent=4)\n if isinstance(s, bytes):\n s ... | <|body_start_0|>
self.request = request
self.datadir = datadir
self.original_datadir = original_datadir
<|end_body_0|>
<|body_start_1|>
__tracebackhide__ = True
def dump(filename):
"""Dump dict contents to the given filename"""
import json
s ... | Implementation of `data_regression` fixture. | DataRegressionFixture | [
"Apache-2.0",
"EPL-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataRegressionFixture:
"""Implementation of `data_regression` fixture."""
def __init__(self, datadir, original_datadir, request):
""":type datadir: Path :type original_datadir: Path :type request: FixtureRequest"""
<|body_0|>
def check(self, data_dict, basename=None, ful... | stack_v2_sparse_classes_36k_train_014680 | 8,973 | permissive | [
{
"docstring": ":type datadir: Path :type original_datadir: Path :type request: FixtureRequest",
"name": "__init__",
"signature": "def __init__(self, datadir, original_datadir, request)"
},
{
"docstring": "Checks the given dict against a previously recorded version, or generate a new file. :para... | 2 | null | Implement the Python class `DataRegressionFixture` described below.
Class description:
Implementation of `data_regression` fixture.
Method signatures and docstrings:
- def __init__(self, datadir, original_datadir, request): :type datadir: Path :type original_datadir: Path :type request: FixtureRequest
- def check(sel... | Implement the Python class `DataRegressionFixture` described below.
Class description:
Implementation of `data_regression` fixture.
Method signatures and docstrings:
- def __init__(self, datadir, original_datadir, request): :type datadir: Path :type original_datadir: Path :type request: FixtureRequest
- def check(sel... | 05dbd4575d01a213f3f4d69aa4968473f2536142 | <|skeleton|>
class DataRegressionFixture:
"""Implementation of `data_regression` fixture."""
def __init__(self, datadir, original_datadir, request):
""":type datadir: Path :type original_datadir: Path :type request: FixtureRequest"""
<|body_0|>
def check(self, data_dict, basename=None, ful... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataRegressionFixture:
"""Implementation of `data_regression` fixture."""
def __init__(self, datadir, original_datadir, request):
""":type datadir: Path :type original_datadir: Path :type request: FixtureRequest"""
self.request = request
self.datadir = datadir
self.origina... | the_stack_v2_python_sparse | python/helpers/pydev/pydev_tests_python/regression_check.py | JetBrains/intellij-community | train | 16,288 |
86affc0fe827747d92941c9b2b0184ca9547afe1 | [
"self.lr = lr\nself.w = w.T\nself.b = b.T\nself.in_d = w.shape[0]\nself.out_d = w.shape[1]",
"assert input.shape[1] == self.in_d\nself.n = input.shape[0]\nself.a = input.T\nself.z = np.dot(self.w, self.a) + self.b\nreturn self.z.T",
"delta_in = gradients.T\nassert delta_in.shape[0] == self.out_d\ndelta_out = se... | <|body_start_0|>
self.lr = lr
self.w = w.T
self.b = b.T
self.in_d = w.shape[0]
self.out_d = w.shape[1]
<|end_body_0|>
<|body_start_1|>
assert input.shape[1] == self.in_d
self.n = input.shape[0]
self.a = input.T
self.z = np.dot(self.w, self.a) + se... | Class for fully connected NN layer | FCLayer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FCLayer:
"""Class for fully connected NN layer"""
def __init__(self, w, b, lr=0.001):
"""Save tunable parameters n.b.: I am transposing w and b because it makes more sense to me mathematically to treat the layers as applying the weight matrix transform to column vectors, which then a... | stack_v2_sparse_classes_36k_train_014681 | 5,097 | no_license | [
{
"docstring": "Save tunable parameters n.b.: I am transposing w and b because it makes more sense to me mathematically to treat the layers as applying the weight matrix transform to column vectors, which then also makes the partial derivatives more intuitive. However it is at the expense of having to transpose... | 3 | stack_v2_sparse_classes_30k_test_000659 | Implement the Python class `FCLayer` described below.
Class description:
Class for fully connected NN layer
Method signatures and docstrings:
- def __init__(self, w, b, lr=0.001): Save tunable parameters n.b.: I am transposing w and b because it makes more sense to me mathematically to treat the layers as applying th... | Implement the Python class `FCLayer` described below.
Class description:
Class for fully connected NN layer
Method signatures and docstrings:
- def __init__(self, w, b, lr=0.001): Save tunable parameters n.b.: I am transposing w and b because it makes more sense to me mathematically to treat the layers as applying th... | 61439222dd6df007bb9b5f631ca74eb332380249 | <|skeleton|>
class FCLayer:
"""Class for fully connected NN layer"""
def __init__(self, w, b, lr=0.001):
"""Save tunable parameters n.b.: I am transposing w and b because it makes more sense to me mathematically to treat the layers as applying the weight matrix transform to column vectors, which then a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FCLayer:
"""Class for fully connected NN layer"""
def __init__(self, w, b, lr=0.001):
"""Save tunable parameters n.b.: I am transposing w and b because it makes more sense to me mathematically to treat the layers as applying the weight matrix transform to column vectors, which then also makes the... | the_stack_v2_python_sparse | supervised/MLP.py | sarahkpardo/ml-demos | train | 0 |
782ffaf89dd84f73cde443f8423eb85b5898a55c | [
"n = len(s)\nif n == 0:\n return 0\ncount = 0\nfor i in range(n - 1, -1, -1):\n if s[i] != ' ':\n count += 1\n elif count != 0:\n return count\n else:\n continue\nreturn count",
"splt = s.split()\nif splt:\n return len(splt[-1])\nreturn 0"
] | <|body_start_0|>
n = len(s)
if n == 0:
return 0
count = 0
for i in range(n - 1, -1, -1):
if s[i] != ' ':
count += 1
elif count != 0:
return count
else:
continue
return count
<|end_body... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLastWord(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLastWord0(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n = len(s)
if n == 0:
return 0
... | stack_v2_sparse_classes_36k_train_014682 | 664 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLastWord",
"signature": "def lengthOfLastWord(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLastWord0",
"signature": "def lengthOfLastWord0(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014443 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLastWord(self, s): :type s: str :rtype: int
- def lengthOfLastWord0(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLastWord(self, s): :type s: str :rtype: int
- def lengthOfLastWord0(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def lengthOfLastWord(self, s... | 9e49b2c6003b957276737005d4aaac276b44d251 | <|skeleton|>
class Solution:
def lengthOfLastWord(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLastWord0(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLastWord(self, s):
""":type s: str :rtype: int"""
n = len(s)
if n == 0:
return 0
count = 0
for i in range(n - 1, -1, -1):
if s[i] != ' ':
count += 1
elif count != 0:
return count
... | the_stack_v2_python_sparse | PythonCode/src/0058_Length_of_Last_Word.py | oneyuan/CodeforFun | train | 0 | |
5bd22ca1acb9052f0fc3b87d60c3f6f301085a9f | [
"super(Encoder, self).__init__()\nself.idim = idim\nself.use_residual = use_residual\nif input_layer == 'linear':\n self.embed = nn.Linear(idim, econv_chans)\nelif input_layer == 'embed':\n self.embed = nn.Embedding(idim, embed_dim, padding_idx=padding_idx)\nelse:\n raise ValueError('unknown input_layer: '... | <|body_start_0|>
super(Encoder, self).__init__()
self.idim = idim
self.use_residual = use_residual
if input_layer == 'linear':
self.embed = nn.Linear(idim, econv_chans)
elif input_layer == 'embed':
self.embed = nn.Embedding(idim, embed_dim, padding_idx=pad... | Encoder module of Spectrogram prediction network. This is a module of encoder of Spectrogram prediction network in Tacotron2, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. This is the encoder which converts either a sequence of characters or acoustic features into t... | Encoder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
"""Encoder module of Spectrogram prediction network. This is a module of encoder of Spectrogram prediction network in Tacotron2, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. This is the encoder which converts either a sequence of cha... | stack_v2_sparse_classes_36k_train_014683 | 6,708 | permissive | [
{
"docstring": "Initialize Tacotron2 encoder module. Parameters ---------- idim : int Dimension of the inputs. input_layer : str Input layer type. embed_dim : int, optional Dimension of character embedding. elayers : int, optional The number of encoder blstm layers. eunits : int, optional The number of encoder ... | 3 | stack_v2_sparse_classes_30k_train_002574 | Implement the Python class `Encoder` described below.
Class description:
Encoder module of Spectrogram prediction network. This is a module of encoder of Spectrogram prediction network in Tacotron2, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. This is the encoder ... | Implement the Python class `Encoder` described below.
Class description:
Encoder module of Spectrogram prediction network. This is a module of encoder of Spectrogram prediction network in Tacotron2, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. This is the encoder ... | 8705a2a8405e3c63f2174d69880d2b5525a6c9fd | <|skeleton|>
class Encoder:
"""Encoder module of Spectrogram prediction network. This is a module of encoder of Spectrogram prediction network in Tacotron2, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. This is the encoder which converts either a sequence of cha... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Encoder:
"""Encoder module of Spectrogram prediction network. This is a module of encoder of Spectrogram prediction network in Tacotron2, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. This is the encoder which converts either a sequence of characters or ac... | the_stack_v2_python_sparse | parakeet/modules/tacotron2/encoder.py | PaddlePaddle/Parakeet | train | 609 |
6f5dd294ad55df4bafaf58136d7f79820b3dca5a | [
"self.graph = graph\nself.mst = None\nself.distance = dict(((node, float('inf')) for node in self.graph.iternodes()))\nself.parent = dict(((node, None) for node in self.graph.iternodes()))\nself._in_queue = dict(((node, True) for node in self.graph.iternodes()))",
"if source is None:\n source = next(self.graph... | <|body_start_0|>
self.graph = graph
self.mst = None
self.distance = dict(((node, float('inf')) for node in self.graph.iternodes()))
self.parent = dict(((node, None) for node in self.graph.iternodes()))
self._in_queue = dict(((node, True) for node in self.graph.iternodes()))
<|end... | Prim's algorithm for finding MST in O(V**2) time. Attributes ---------- graph : input undirected weighted graph or multigraph mst : graph (MST) distance : dict with nodes parent : dict with edges (MST) _in_queue : dict, private | PrimMatrixMSTWithEdges | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrimMatrixMSTWithEdges:
"""Prim's algorithm for finding MST in O(V**2) time. Attributes ---------- graph : input undirected weighted graph or multigraph mst : graph (MST) distance : dict with nodes parent : dict with edges (MST) _in_queue : dict, private"""
def __init__(self, graph):
... | stack_v2_sparse_classes_36k_train_014684 | 14,685 | permissive | [
{
"docstring": "The algorithm initialization.",
"name": "__init__",
"signature": "def __init__(self, graph)"
},
{
"docstring": "Executable pseudocode.",
"name": "run",
"signature": "def run(self, source=None)"
},
{
"docstring": "The minimum spanning tree is built.",
"name": "... | 3 | stack_v2_sparse_classes_30k_train_013384 | Implement the Python class `PrimMatrixMSTWithEdges` described below.
Class description:
Prim's algorithm for finding MST in O(V**2) time. Attributes ---------- graph : input undirected weighted graph or multigraph mst : graph (MST) distance : dict with nodes parent : dict with edges (MST) _in_queue : dict, private
Me... | Implement the Python class `PrimMatrixMSTWithEdges` described below.
Class description:
Prim's algorithm for finding MST in O(V**2) time. Attributes ---------- graph : input undirected weighted graph or multigraph mst : graph (MST) distance : dict with nodes parent : dict with edges (MST) _in_queue : dict, private
Me... | 0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60 | <|skeleton|>
class PrimMatrixMSTWithEdges:
"""Prim's algorithm for finding MST in O(V**2) time. Attributes ---------- graph : input undirected weighted graph or multigraph mst : graph (MST) distance : dict with nodes parent : dict with edges (MST) _in_queue : dict, private"""
def __init__(self, graph):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PrimMatrixMSTWithEdges:
"""Prim's algorithm for finding MST in O(V**2) time. Attributes ---------- graph : input undirected weighted graph or multigraph mst : graph (MST) distance : dict with nodes parent : dict with edges (MST) _in_queue : dict, private"""
def __init__(self, graph):
"""The algor... | the_stack_v2_python_sparse | graphtheory/spanningtrees/prim.py | kgashok/graphs-dict | train | 0 |
83b285e27b4558b316452685fa65c84aaacba283 | [
"super().__init__()\nself.spawnTime = 0\nself.player = player\nwhichPice = randint(1, 3)\npieceOne = [154, 251, 34, 34]\npieceTwo = [199, 254, 39, 33]\npieceThree = [259, 254, 39, 34]\nif whichPice == 1:\n usePice = pieceOne\nelif whichPice == 2:\n usePice = pieceTwo\nelse:\n usePice = pieceThree\npygame.s... | <|body_start_0|>
super().__init__()
self.spawnTime = 0
self.player = player
whichPice = randint(1, 3)
pieceOne = [154, 251, 34, 34]
pieceTwo = [199, 254, 39, 33]
pieceThree = [259, 254, 39, 34]
if whichPice == 1:
usePice = pieceOne
elif... | Rocket | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rocket:
def __init__(self, position, player):
""":param player: The player object :param position: The x-position of the player This initializes the rocket Variables: self.player: The player object self.spawnTime: The amout of time the punch will stay on screen whichPice: Randomly choose... | stack_v2_sparse_classes_36k_train_014685 | 3,629 | no_license | [
{
"docstring": ":param player: The player object :param position: The x-position of the player This initializes the rocket Variables: self.player: The player object self.spawnTime: The amout of time the punch will stay on screen whichPice: Randomly chooses a number to choose which sprite to use pieceOne: The fi... | 2 | stack_v2_sparse_classes_30k_train_006420 | Implement the Python class `Rocket` described below.
Class description:
Implement the Rocket class.
Method signatures and docstrings:
- def __init__(self, position, player): :param player: The player object :param position: The x-position of the player This initializes the rocket Variables: self.player: The player ob... | Implement the Python class `Rocket` described below.
Class description:
Implement the Rocket class.
Method signatures and docstrings:
- def __init__(self, position, player): :param player: The player object :param position: The x-position of the player This initializes the rocket Variables: self.player: The player ob... | 56fbcfc786dfc373f477270468f06e31b6271749 | <|skeleton|>
class Rocket:
def __init__(self, position, player):
""":param player: The player object :param position: The x-position of the player This initializes the rocket Variables: self.player: The player object self.spawnTime: The amout of time the punch will stay on screen whichPice: Randomly choose... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Rocket:
def __init__(self, position, player):
""":param player: The player object :param position: The x-position of the player This initializes the rocket Variables: self.player: The player object self.spawnTime: The amout of time the punch will stay on screen whichPice: Randomly chooses a number to ... | the_stack_v2_python_sparse | Doki Doki Island/bossAttacks/golem/golAttack2.py | cashpop5000/DokiProject | train | 0 | |
e8cfc0db049a5f73b931b31c11a6b443569a5a38 | [
"self.resolver = resolver\nself.options = options\nself.copyfiles = tuple()",
"self.copyfiles = self.resolver.get_copyfiles(device_start_index)\ncapacity_bytes = filesystem.volume_capacity(self.options.output)\nbackup_bytes = filesystem.directory_size(self.options.output)\ndifferent_indexes = self._find_files_dif... | <|body_start_0|>
self.resolver = resolver
self.options = options
self.copyfiles = tuple()
<|end_body_0|>
<|body_start_1|>
self.copyfiles = self.resolver.get_copyfiles(device_start_index)
capacity_bytes = filesystem.volume_capacity(self.options.output)
backup_bytes = file... | Verifies a portion of a backup written to a single volume. Ex volume 3 of 5 involved in a backup. | Verifier | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Verifier:
"""Verifies a portion of a backup written to a single volume. Ex volume 3 of 5 involved in a backup."""
def __init__(self, resolver, options):
"""Constructor. Args: resolver (multivolumecopy.resolvers.resolver.Resolver): produces list of copyfiles. options (multivolumecopy.... | stack_v2_sparse_classes_36k_train_014686 | 8,019 | permissive | [
{
"docstring": "Constructor. Args: resolver (multivolumecopy.resolvers.resolver.Resolver): produces list of copyfiles. options (multivolumecopy.copyoptions.CopyOptions): options used for copyjob.",
"name": "__init__",
"signature": "def __init__(self, resolver, options)"
},
{
"docstring": "Args: ... | 5 | stack_v2_sparse_classes_30k_train_000492 | Implement the Python class `Verifier` described below.
Class description:
Verifies a portion of a backup written to a single volume. Ex volume 3 of 5 involved in a backup.
Method signatures and docstrings:
- def __init__(self, resolver, options): Constructor. Args: resolver (multivolumecopy.resolvers.resolver.Resolve... | Implement the Python class `Verifier` described below.
Class description:
Verifies a portion of a backup written to a single volume. Ex volume 3 of 5 involved in a backup.
Method signatures and docstrings:
- def __init__(self, resolver, options): Constructor. Args: resolver (multivolumecopy.resolvers.resolver.Resolve... | 9169b97d2f005d56d4ce128069b7de23e677117c | <|skeleton|>
class Verifier:
"""Verifies a portion of a backup written to a single volume. Ex volume 3 of 5 involved in a backup."""
def __init__(self, resolver, options):
"""Constructor. Args: resolver (multivolumecopy.resolvers.resolver.Resolver): produces list of copyfiles. options (multivolumecopy.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Verifier:
"""Verifies a portion of a backup written to a single volume. Ex volume 3 of 5 involved in a backup."""
def __init__(self, resolver, options):
"""Constructor. Args: resolver (multivolumecopy.resolvers.resolver.Resolver): produces list of copyfiles. options (multivolumecopy.copyoptions.C... | the_stack_v2_python_sparse | multivolumecopy/verifier.py | willjp/multivolumecopy | train | 0 |
30f24c40e4429291c0d9e381ce82308c89c7e9ec | [
"obj = None\nif self.is_view:\n try:\n obj = self.workflow.views.get(pk=self.kwargs.get('pk'))\n except ObjectDoesNotExist:\n raise http.Http404(_('No view found matching the query.'))\nreturn obj",
"obj = self.get_object()\nformula = None\nif obj:\n formula = obj.formula\n col_names = [... | <|body_start_0|>
obj = None
if self.is_view:
try:
obj = self.workflow.views.get(pk=self.kwargs.get('pk'))
except ObjectDoesNotExist:
raise http.Http404(_('No view found matching the query.'))
return obj
<|end_body_0|>
<|body_start_1|>
... | TableCSVDownloadView | [
"LGPL-2.0-or-later",
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LGPL-2.1-only",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TableCSVDownloadView:
def get_object(self, queryset=None):
"""Get view from the workflow (if stats for view) or nothing."""
<|body_0|>
def get(self, request, *args, **kwargs):
"""Return the download response for the table/view"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_014687 | 1,461 | permissive | [
{
"docstring": "Get view from the workflow (if stats for view) or nothing.",
"name": "get_object",
"signature": "def get_object(self, queryset=None)"
},
{
"docstring": "Return the download response for the table/view",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"... | 2 | stack_v2_sparse_classes_30k_train_017795 | Implement the Python class `TableCSVDownloadView` described below.
Class description:
Implement the TableCSVDownloadView class.
Method signatures and docstrings:
- def get_object(self, queryset=None): Get view from the workflow (if stats for view) or nothing.
- def get(self, request, *args, **kwargs): Return the down... | Implement the Python class `TableCSVDownloadView` described below.
Class description:
Implement the TableCSVDownloadView class.
Method signatures and docstrings:
- def get_object(self, queryset=None): Get view from the workflow (if stats for view) or nothing.
- def get(self, request, *args, **kwargs): Return the down... | c432745dfff932cbe7397100422d49df78f0a882 | <|skeleton|>
class TableCSVDownloadView:
def get_object(self, queryset=None):
"""Get view from the workflow (if stats for view) or nothing."""
<|body_0|>
def get(self, request, *args, **kwargs):
"""Return the download response for the table/view"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TableCSVDownloadView:
def get_object(self, queryset=None):
"""Get view from the workflow (if stats for view) or nothing."""
obj = None
if self.is_view:
try:
obj = self.workflow.views.get(pk=self.kwargs.get('pk'))
except ObjectDoesNotExist:
... | the_stack_v2_python_sparse | ontask/table/views/csvdownload.py | abelardopardo/ontask_b | train | 43 | |
b0f543b05d17763841566934c6e64c7b695bba4d | [
"if node:\n if L <= node.val and node.val <= R:\n ans += node.val\n if L < node.val:\n self.dfs_search_tree(node.left, L, R)\n if node.val < R:\n self.dfs_search_tree(node.right, L, R)",
"ans = 0\nself.dfs_search_tree(root, L, R, ans)\nreturn ans"
] | <|body_start_0|>
if node:
if L <= node.val and node.val <= R:
ans += node.val
if L < node.val:
self.dfs_search_tree(node.left, L, R)
if node.val < R:
self.dfs_search_tree(node.right, L, R)
<|end_body_0|>
<|body_start_1|>
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def dfs_search_tree(self, node: TreeNode, L: int, R: int, ans: int) -> None:
"""递归求值 Args: root: 根节点 L: 最小值 R: 最大值"""
<|body_0|>
def range_sum_bst(self, root: TreeNode, L: int, R: int) -> int:
"""求和取最大数 Args: root: 根节点 L: 最小值 R: 最大值 Returns: 求和"""
<... | stack_v2_sparse_classes_36k_train_014688 | 2,294 | permissive | [
{
"docstring": "递归求值 Args: root: 根节点 L: 最小值 R: 最大值",
"name": "dfs_search_tree",
"signature": "def dfs_search_tree(self, node: TreeNode, L: int, R: int, ans: int) -> None"
},
{
"docstring": "求和取最大数 Args: root: 根节点 L: 最小值 R: 最大值 Returns: 求和",
"name": "range_sum_bst",
"signature": "def rang... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def dfs_search_tree(self, node: TreeNode, L: int, R: int, ans: int) -> None: 递归求值 Args: root: 根节点 L: 最小值 R: 最大值
- def range_sum_bst(self, root: TreeNode, L: int, R: int) -> int: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def dfs_search_tree(self, node: TreeNode, L: int, R: int, ans: int) -> None: 递归求值 Args: root: 根节点 L: 最小值 R: 最大值
- def range_sum_bst(self, root: TreeNode, L: int, R: int) -> int: ... | 50f35eef6a0ad63173efed10df3c835b1dceaa3f | <|skeleton|>
class Solution:
def dfs_search_tree(self, node: TreeNode, L: int, R: int, ans: int) -> None:
"""递归求值 Args: root: 根节点 L: 最小值 R: 最大值"""
<|body_0|>
def range_sum_bst(self, root: TreeNode, L: int, R: int) -> int:
"""求和取最大数 Args: root: 根节点 L: 最小值 R: 最大值 Returns: 求和"""
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def dfs_search_tree(self, node: TreeNode, L: int, R: int, ans: int) -> None:
"""递归求值 Args: root: 根节点 L: 最小值 R: 最大值"""
if node:
if L <= node.val and node.val <= R:
ans += node.val
if L < node.val:
self.dfs_search_tree(node.left, ... | the_stack_v2_python_sparse | src/leetcodepython/tree/range_sum_bst_938.py | zhangyu345293721/leetcode | train | 101 | |
d4f29e81938a5b93ed407f15e88a5453afadfe33 | [
"self.start = start\nself.end = end\nself.numbers = numbers",
"result = [0 for _ in range(self.start, self.end + 1)]\nfor num in self.numbers:\n index = num - self.start\n result[index] += 1\nfor i in range(1, len(result)):\n result[i] = result[i - 1] + result[i]\nresult_numbers = [0 for _ in self.number... | <|body_start_0|>
self.start = start
self.end = end
self.numbers = numbers
<|end_body_0|>
<|body_start_1|>
result = [0 for _ in range(self.start, self.end + 1)]
for num in self.numbers:
index = num - self.start
result[index] += 1
for i in range(1, ... | CountingSort | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CountingSort:
def __init__(self, start, end, numbers):
"""@param start: Minimum of the numbers @param end: Maximum of the numbers @param numbers: Array of numbers"""
<|body_0|>
def do_counting_sort(self):
"""This function performs the counting sort. @return: Sorted A... | stack_v2_sparse_classes_36k_train_014689 | 1,922 | no_license | [
{
"docstring": "@param start: Minimum of the numbers @param end: Maximum of the numbers @param numbers: Array of numbers",
"name": "__init__",
"signature": "def __init__(self, start, end, numbers)"
},
{
"docstring": "This function performs the counting sort. @return: Sorted Array",
"name": "... | 2 | null | Implement the Python class `CountingSort` described below.
Class description:
Implement the CountingSort class.
Method signatures and docstrings:
- def __init__(self, start, end, numbers): @param start: Minimum of the numbers @param end: Maximum of the numbers @param numbers: Array of numbers
- def do_counting_sort(s... | Implement the Python class `CountingSort` described below.
Class description:
Implement the CountingSort class.
Method signatures and docstrings:
- def __init__(self, start, end, numbers): @param start: Minimum of the numbers @param end: Maximum of the numbers @param numbers: Array of numbers
- def do_counting_sort(s... | 1d69d8d0c6d846c75d276a2851df41774c775904 | <|skeleton|>
class CountingSort:
def __init__(self, start, end, numbers):
"""@param start: Minimum of the numbers @param end: Maximum of the numbers @param numbers: Array of numbers"""
<|body_0|>
def do_counting_sort(self):
"""This function performs the counting sort. @return: Sorted A... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CountingSort:
def __init__(self, start, end, numbers):
"""@param start: Minimum of the numbers @param end: Maximum of the numbers @param numbers: Array of numbers"""
self.start = start
self.end = end
self.numbers = numbers
def do_counting_sort(self):
"""This functi... | the_stack_v2_python_sparse | Leetcode/countingsort.py | santoshkosgi/Programming | train | 0 | |
e714c4f5ab2bf188149ac4d77a177a49814cfde8 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn OfficeGraphInsights()",
"from .entity import Entity\nfrom .shared_insight import SharedInsight\nfrom .trending import Trending\nfrom .used_insight import UsedInsight\nfrom .entity import Entity\nfrom .shared_insight import SharedInsigh... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return OfficeGraphInsights()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .shared_insight import SharedInsight
from .trending import Trending
from .used_insig... | OfficeGraphInsights | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OfficeGraphInsights:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OfficeGraphInsights:
"""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 ob... | stack_v2_sparse_classes_36k_train_014690 | 3,700 | 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: OfficeGraphInsights",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator... | 3 | null | Implement the Python class `OfficeGraphInsights` described below.
Class description:
Implement the OfficeGraphInsights class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OfficeGraphInsights: Creates a new instance of the appropriate class based on d... | Implement the Python class `OfficeGraphInsights` described below.
Class description:
Implement the OfficeGraphInsights class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OfficeGraphInsights: Creates a new instance of the appropriate class based on d... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class OfficeGraphInsights:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OfficeGraphInsights:
"""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 ob... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OfficeGraphInsights:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OfficeGraphInsights:
"""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: ... | the_stack_v2_python_sparse | msgraph/generated/models/office_graph_insights.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
601034d873d29dac934b7c63ff0f0a33d36bb082 | [
"super(SoftDotAttention, self).__init__()\nself.linear_in = nn.Linear(dim, dim, bias=False)\nself.sm = nn.Softmax(dim=1)\nself.linear_out = nn.Linear(dim * 2, dim, bias=False)\nself.tanh = nn.Tanh()",
"target = self.linear_in(h).unsqueeze(2)\nattn = torch.bmm(context, target).squeeze(2)\nif mask is not None:\n ... | <|body_start_0|>
super(SoftDotAttention, self).__init__()
self.linear_in = nn.Linear(dim, dim, bias=False)
self.sm = nn.Softmax(dim=1)
self.linear_out = nn.Linear(dim * 2, dim, bias=False)
self.tanh = nn.Tanh()
<|end_body_0|>
<|body_start_1|>
target = self.linear_in(h).u... | Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT. | SoftDotAttention | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SoftDotAttention:
"""Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT."""
def __init__(self, dim):
"""Initialize layer."""
<|body_0|>
def forward(self, h, context, mask=None):
"""Propagate h through the network. h: b... | stack_v2_sparse_classes_36k_train_014691 | 22,228 | permissive | [
{
"docstring": "Initialize layer.",
"name": "__init__",
"signature": "def __init__(self, dim)"
},
{
"docstring": "Propagate h through the network. h: batch x dim context: batch x seq_len x dim mask: batch x seq_len indices to be masked",
"name": "forward",
"signature": "def forward(self,... | 2 | stack_v2_sparse_classes_30k_train_019627 | Implement the Python class `SoftDotAttention` described below.
Class description:
Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.
Method signatures and docstrings:
- def __init__(self, dim): Initialize layer.
- def forward(self, h, context, mask=None): Propagate h thro... | Implement the Python class `SoftDotAttention` described below.
Class description:
Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.
Method signatures and docstrings:
- def __init__(self, dim): Initialize layer.
- def forward(self, h, context, mask=None): Propagate h thro... | 868fb53d6b7978bbb10439a59e65044c811ee5c2 | <|skeleton|>
class SoftDotAttention:
"""Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT."""
def __init__(self, dim):
"""Initialize layer."""
<|body_0|>
def forward(self, h, context, mask=None):
"""Propagate h through the network. h: b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SoftDotAttention:
"""Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT."""
def __init__(self, dim):
"""Initialize layer."""
super(SoftDotAttention, self).__init__()
self.linear_in = nn.Linear(dim, dim, bias=False)
self.sm = nn.... | the_stack_v2_python_sparse | tasks/R2R/speaker/model.py | weituo12321/PREVALENT_R2R | train | 8 |
1254c40e0b6cbc681cff4f11cf2c7243d23d6166 | [
"dp = self._dp\nwhile len(dp) <= n:\n dp += (min((dp[-i * i] for i in range(1, int(len(dp) ** 0.5 + 1)))) + 1,)\nreturn dp[n]",
"dp = collections.defaultdict(int)\ny = 1\nwhile y * y <= n:\n dp[y * y] = 1\n y += 1\nfor x in range(1, n + 1):\n y = 1\n while x + y * y <= n:\n if x + y * y not ... | <|body_start_0|>
dp = self._dp
while len(dp) <= n:
dp += (min((dp[-i * i] for i in range(1, int(len(dp) ** 0.5 + 1)))) + 1,)
return dp[n]
<|end_body_0|>
<|body_start_1|>
dp = collections.defaultdict(int)
y = 1
while y * y <= n:
dp[y * y] = 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSquares(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def numSquares_TLE(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dp = self._dp
while len(dp) <= n:
dp += (min((d... | stack_v2_sparse_classes_36k_train_014692 | 1,633 | no_license | [
{
"docstring": ":type n: int :rtype: int",
"name": "numSquares",
"signature": "def numSquares(self, n)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "numSquares_TLE",
"signature": "def numSquares_TLE(self, n)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares(self, n): :type n: int :rtype: int
- def numSquares_TLE(self, n): :type n: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares(self, n): :type n: int :rtype: int
- def numSquares_TLE(self, n): :type n: int :rtype: int
<|skeleton|>
class Solution:
def numSquares(self, n):
""":... | ba58ac60b32e261e43482d7e71b32587700e3719 | <|skeleton|>
class Solution:
def numSquares(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def numSquares_TLE(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numSquares(self, n):
""":type n: int :rtype: int"""
dp = self._dp
while len(dp) <= n:
dp += (min((dp[-i * i] for i in range(1, int(len(dp) ** 0.5 + 1)))) + 1,)
return dp[n]
def numSquares_TLE(self, n):
""":type n: int :rtype: int"""
... | the_stack_v2_python_sparse | python/279_perfect_squares.py | lingng/Leetcode | train | 0 | |
4527b498d228125a007743f6253ad7205a873d44 | [
"sectors: List[HueSector] = []\nfor t in cls._HUE_TEMPLATES[template_type]:\n center: float = t[0] * 360 + float(alpha)\n width: float = t[1] * 360\n sector = HueSector(center, width)\n sectors.append(sector)\nreturn sectors",
"N: int = 360\ntemplate_types: List[str] = list(cls._HUE_TEMPLATES.keys())\... | <|body_start_0|>
sectors: List[HueSector] = []
for t in cls._HUE_TEMPLATES[template_type]:
center: float = t[0] * 360 + float(alpha)
width: float = t[1] * 360
sector = HueSector(center, width)
sectors.append(sector)
return sectors
<|end_body_0|>
<... | Metric: Color harmony. | Metric | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Metric:
"""Metric: Color harmony."""
def _get_sectors(cls, template_type: str, alpha: Union[float, int]) -> List[HueSector]:
"""Compute Shannon entropies of all the subbands. Args: template_type: Template type (options: 'i', 'V', 'L', 'mirror_L', 'I', 'T', 'Y', and 'X') alpha: Angle ... | stack_v2_sparse_classes_36k_train_014693 | 9,121 | permissive | [
{
"docstring": "Compute Shannon entropies of all the subbands. Args: template_type: Template type (options: 'i', 'V', 'L', 'mirror_L', 'I', 'T', 'Y', and 'X') alpha: Angle of the template Returns: A list of HueSectors for the template",
"name": "_get_sectors",
"signature": "def _get_sectors(cls, templat... | 3 | null | Implement the Python class `Metric` described below.
Class description:
Metric: Color harmony.
Method signatures and docstrings:
- def _get_sectors(cls, template_type: str, alpha: Union[float, int]) -> List[HueSector]: Compute Shannon entropies of all the subbands. Args: template_type: Template type (options: 'i', 'V... | Implement the Python class `Metric` described below.
Class description:
Metric: Color harmony.
Method signatures and docstrings:
- def _get_sectors(cls, template_type: str, alpha: Union[float, int]) -> List[HueSector]: Compute Shannon entropies of all the subbands. Args: template_type: Template type (options: 'i', 'V... | 89cee07f5809a7fb26d11d16822ed0738318b377 | <|skeleton|>
class Metric:
"""Metric: Color harmony."""
def _get_sectors(cls, template_type: str, alpha: Union[float, int]) -> List[HueSector]:
"""Compute Shannon entropies of all the subbands. Args: template_type: Template type (options: 'i', 'V', 'L', 'mirror_L', 'I', 'T', 'Y', and 'X') alpha: Angle ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Metric:
"""Metric: Color harmony."""
def _get_sectors(cls, template_type: str, alpha: Union[float, int]) -> List[HueSector]:
"""Compute Shannon entropies of all the subbands. Args: template_type: Template type (options: 'i', 'V', 'L', 'mirror_L', 'I', 'T', 'Y', and 'X') alpha: Angle of the templa... | the_stack_v2_python_sparse | backend/aim/metrics/m20/m20_color_harmony.py | aalto-ui/aim | train | 45 |
5740fe675b1763237df55ffb8ac5d440d248d054 | [
"row, col = ([0] * n, [0] * n)\ndiag, anti_diag = ([0] * (2 * n), [0] * (2 * n))\n\ndef dfs(x, y, s, n, path, res):\n if y == n:\n x += 1\n y = 0\n if x == n:\n if s == n:\n res.append(copy.deepcopy(path))\n return\n if not row[x] and (not col[y]) and (not diag[x + y]... | <|body_start_0|>
row, col = ([0] * n, [0] * n)
diag, anti_diag = ([0] * (2 * n), [0] * (2 * n))
def dfs(x, y, s, n, path, res):
if y == n:
x += 1
y = 0
if x == n:
if s == n:
res.append(copy.deepcopy(path... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def solveNQueens(self, n):
"""回溯 :type n: int :rtype: List[List[str]]"""
<|body_0|>
def solveNQueens2(self, n):
"""https://leetcode.com/problems/n-queens/discuss/19937/AC-Python-76-ms-iterative-backtracking-solution :param n: :return:"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_014694 | 3,466 | no_license | [
{
"docstring": "回溯 :type n: int :rtype: List[List[str]]",
"name": "solveNQueens",
"signature": "def solveNQueens(self, n)"
},
{
"docstring": "https://leetcode.com/problems/n-queens/discuss/19937/AC-Python-76-ms-iterative-backtracking-solution :param n: :return:",
"name": "solveNQueens2",
... | 2 | stack_v2_sparse_classes_30k_train_012981 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solveNQueens(self, n): 回溯 :type n: int :rtype: List[List[str]]
- def solveNQueens2(self, n): https://leetcode.com/problems/n-queens/discuss/19937/AC-Python-76-ms-iterative-ba... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solveNQueens(self, n): 回溯 :type n: int :rtype: List[List[str]]
- def solveNQueens2(self, n): https://leetcode.com/problems/n-queens/discuss/19937/AC-Python-76-ms-iterative-ba... | 5d3574ccd282d0146c83c286ae28d8baaabd4910 | <|skeleton|>
class Solution:
def solveNQueens(self, n):
"""回溯 :type n: int :rtype: List[List[str]]"""
<|body_0|>
def solveNQueens2(self, n):
"""https://leetcode.com/problems/n-queens/discuss/19937/AC-Python-76-ms-iterative-backtracking-solution :param n: :return:"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def solveNQueens(self, n):
"""回溯 :type n: int :rtype: List[List[str]]"""
row, col = ([0] * n, [0] * n)
diag, anti_diag = ([0] * (2 * n), [0] * (2 * n))
def dfs(x, y, s, n, path, res):
if y == n:
x += 1
y = 0
if ... | the_stack_v2_python_sparse | 51_N皇后.py | lovehhf/LeetCode | train | 0 | |
414229323ed3366421f025c766b429ac7eab8c1d | [
"if not self.mono_field:\n raise ValueError('mono_field未初始化')\ntemp_ptr = self.temp_ptr()\nreturn call_arg(*instance.owner.mono_field_static_get_value, instance.mono_vtable, self.mono_field, temp_ptr, ret_type=temp_ptr)",
"if not self.mono_field:\n raise ValueError('mono_field未初始化')\ntemp_ptr = self.temp_pt... | <|body_start_0|>
if not self.mono_field:
raise ValueError('mono_field未初始化')
temp_ptr = self.temp_ptr()
return call_arg(*instance.owner.mono_field_static_get_value, instance.mono_vtable, self.mono_field, temp_ptr, ret_type=temp_ptr)
<|end_body_0|>
<|body_start_1|>
if not self... | 静态字段 | MonoStaticField | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MonoStaticField:
"""静态字段"""
def op_getter(self, instance):
"""用于获取值的call_arg"""
<|body_0|>
def op_setter(self, instance, value):
"""用于设置值的call_arg"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not self.mono_field:
raise ValueErr... | stack_v2_sparse_classes_36k_train_014695 | 10,783 | no_license | [
{
"docstring": "用于获取值的call_arg",
"name": "op_getter",
"signature": "def op_getter(self, instance)"
},
{
"docstring": "用于设置值的call_arg",
"name": "op_setter",
"signature": "def op_setter(self, instance, value)"
}
] | 2 | null | Implement the Python class `MonoStaticField` described below.
Class description:
静态字段
Method signatures and docstrings:
- def op_getter(self, instance): 用于获取值的call_arg
- def op_setter(self, instance, value): 用于设置值的call_arg | Implement the Python class `MonoStaticField` described below.
Class description:
静态字段
Method signatures and docstrings:
- def op_getter(self, instance): 用于获取值的call_arg
- def op_setter(self, instance, value): 用于设置值的call_arg
<|skeleton|>
class MonoStaticField:
"""静态字段"""
def op_getter(self, instance):
... | bed824746266734e40103010c0132aad069d723a | <|skeleton|>
class MonoStaticField:
"""静态字段"""
def op_getter(self, instance):
"""用于获取值的call_arg"""
<|body_0|>
def op_setter(self, instance, value):
"""用于设置值的call_arg"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MonoStaticField:
"""静态字段"""
def op_getter(self, instance):
"""用于获取值的call_arg"""
if not self.mono_field:
raise ValueError('mono_field未初始化')
temp_ptr = self.temp_ptr()
return call_arg(*instance.owner.mono_field_static_get_value, instance.mono_vtable, self.mono_fi... | the_stack_v2_python_sparse | wxFEFactory/python/tools/base/mono_models.py | czastack/wxFEFactory | train | 0 |
5ad0aa8dc31a7f6952b6aa58ce02ec9545dc0441 | [
"params = super().request_params(stream_state=stream_state, **kwargs)\ncursor_value = stream_state.get(self.cursor_field) or self._start_date\nparams['sort'] = self.cursor_field\nstart_date = max(cursor_value, self._start_date)\nquery = f'gt:{start_date}'\nif self._end_date and self._end_date > start_date:\n que... | <|body_start_0|>
params = super().request_params(stream_state=stream_state, **kwargs)
cursor_value = stream_state.get(self.cursor_field) or self._start_date
params['sort'] = self.cursor_field
start_date = max(cursor_value, self._start_date)
query = f'gt:{start_date}'
if s... | IncrementalCartStream | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"Elastic-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IncrementalCartStream:
def request_params(self, stream_state: Mapping[str, Any], **kwargs) -> MutableMapping[str, Any]:
"""Generates a query for incremental logic Docs: https://developers.cart.com/docs/rest-api/docs/query_syntax.md"""
<|body_0|>
def get_updated_state(self, c... | stack_v2_sparse_classes_36k_train_014696 | 6,210 | permissive | [
{
"docstring": "Generates a query for incremental logic Docs: https://developers.cart.com/docs/rest-api/docs/query_syntax.md",
"name": "request_params",
"signature": "def request_params(self, stream_state: Mapping[str, Any], **kwargs) -> MutableMapping[str, Any]"
},
{
"docstring": "Return the la... | 2 | null | Implement the Python class `IncrementalCartStream` described below.
Class description:
Implement the IncrementalCartStream class.
Method signatures and docstrings:
- def request_params(self, stream_state: Mapping[str, Any], **kwargs) -> MutableMapping[str, Any]: Generates a query for incremental logic Docs: https://d... | Implement the Python class `IncrementalCartStream` described below.
Class description:
Implement the IncrementalCartStream class.
Method signatures and docstrings:
- def request_params(self, stream_state: Mapping[str, Any], **kwargs) -> MutableMapping[str, Any]: Generates a query for incremental logic Docs: https://d... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class IncrementalCartStream:
def request_params(self, stream_state: Mapping[str, Any], **kwargs) -> MutableMapping[str, Any]:
"""Generates a query for incremental logic Docs: https://developers.cart.com/docs/rest-api/docs/query_syntax.md"""
<|body_0|>
def get_updated_state(self, c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IncrementalCartStream:
def request_params(self, stream_state: Mapping[str, Any], **kwargs) -> MutableMapping[str, Any]:
"""Generates a query for incremental logic Docs: https://developers.cart.com/docs/rest-api/docs/query_syntax.md"""
params = super().request_params(stream_state=stream_state, ... | the_stack_v2_python_sparse | dts/airbyte/airbyte-integrations/connectors/source-cart/source_cart/streams.py | alldatacenter/alldata | train | 774 | |
f6ae82440e44f59504edf5f3797ea1269b00cd32 | [
"super().__init__(ui_obj=ui_obj, vertex=vertex, scale_factor=scale_factor, movable=True, selectable=True, r=r)\nself.selected_pen = GUI_settings.pen_selected_1\nself.unselected_pen = GUI_settings.pen_graph\nself.level_0_brush = GUI_settings.brush_graph_0\nself.level_1_brush = GUI_settings.brush_graph_1\nself.set_st... | <|body_start_0|>
super().__init__(ui_obj=ui_obj, vertex=vertex, scale_factor=scale_factor, movable=True, selectable=True, r=r)
self.selected_pen = GUI_settings.pen_selected_1
self.unselected_pen = GUI_settings.pen_graph
self.level_0_brush = GUI_settings.brush_graph_0
self.level_1... | InteractiveGraphColumn | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InteractiveGraphColumn:
def __init__(self, ui_obj=None, vertex=None, scale_factor=1, r=16):
"""Initialize a positional interactive column. Inherits GUI_custom_components.InteractiveColumn. Is used to highlight atomic positions."""
<|body_0|>
def set_style(self):
"""S... | stack_v2_sparse_classes_36k_train_014697 | 26,668 | no_license | [
{
"docstring": "Initialize a positional interactive column. Inherits GUI_custom_components.InteractiveColumn. Is used to highlight atomic positions.",
"name": "__init__",
"signature": "def __init__(self, ui_obj=None, vertex=None, scale_factor=1, r=16)"
},
{
"docstring": "Set the appearance of th... | 2 | stack_v2_sparse_classes_30k_train_017066 | Implement the Python class `InteractiveGraphColumn` described below.
Class description:
Implement the InteractiveGraphColumn class.
Method signatures and docstrings:
- def __init__(self, ui_obj=None, vertex=None, scale_factor=1, r=16): Initialize a positional interactive column. Inherits GUI_custom_components.Interac... | Implement the Python class `InteractiveGraphColumn` described below.
Class description:
Implement the InteractiveGraphColumn class.
Method signatures and docstrings:
- def __init__(self, ui_obj=None, vertex=None, scale_factor=1, r=16): Initialize a positional interactive column. Inherits GUI_custom_components.Interac... | 7fed6e5121180981ce67b1397ddd5ef54246e5eb | <|skeleton|>
class InteractiveGraphColumn:
def __init__(self, ui_obj=None, vertex=None, scale_factor=1, r=16):
"""Initialize a positional interactive column. Inherits GUI_custom_components.InteractiveColumn. Is used to highlight atomic positions."""
<|body_0|>
def set_style(self):
"""S... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InteractiveGraphColumn:
def __init__(self, ui_obj=None, vertex=None, scale_factor=1, r=16):
"""Initialize a positional interactive column. Inherits GUI_custom_components.InteractiveColumn. Is used to highlight atomic positions."""
super().__init__(ui_obj=ui_obj, vertex=vertex, scale_factor=sca... | the_stack_v2_python_sparse | GUI_custom_components.py | Haawk666/AutomAl_6000_thesis_version | train | 0 | |
471d2f791f86f996fa061967d95ecb388b1d6f8f | [
"self.algorithm = algorithm\nself.mode = mode\nself.data_key_length = data_key_length\nself.iv_length = iv_length\nself.auth_length = self.tag_len = auth_length\nself.auth_key_length = auth_key_length",
"if kdf.input_length is None:\n return True\nif self.data_key_length > kdf.input_length(self):\n raise In... | <|body_start_0|>
self.algorithm = algorithm
self.mode = mode
self.data_key_length = data_key_length
self.iv_length = iv_length
self.auth_length = self.tag_len = auth_length
self.auth_key_length = auth_key_length
<|end_body_0|>
<|body_start_1|>
if kdf.input_length... | Static definition of encryption algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: Encryption algorithm to use :type algorithm: cryptography.io ciphers algorithm object :param mode: Encryption mode in which to operate :type mode: cryptography.io ciphers modes... | EncryptionSuite | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EncryptionSuite:
"""Static definition of encryption algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: Encryption algorithm to use :type algorithm: cryptography.io ciphers algorithm object :param mode: Encryption mode in which to operat... | stack_v2_sparse_classes_36k_train_014698 | 14,661 | permissive | [
{
"docstring": "Prepare a new EncryptionSuite.",
"name": "__init__",
"signature": "def __init__(self, algorithm, mode, data_key_length, iv_length, auth_length, auth_key_length=0)"
},
{
"docstring": "Determine whether a KDFSuite can be used with this EncryptionSuite. :param kdf: KDFSuite to evalu... | 2 | stack_v2_sparse_classes_30k_test_001094 | Implement the Python class `EncryptionSuite` described below.
Class description:
Static definition of encryption algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: Encryption algorithm to use :type algorithm: cryptography.io ciphers algorithm object :param m... | Implement the Python class `EncryptionSuite` described below.
Class description:
Static definition of encryption algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: Encryption algorithm to use :type algorithm: cryptography.io ciphers algorithm object :param m... | 3ba8019681ed95c41bb9448f0c3897d1aecc7559 | <|skeleton|>
class EncryptionSuite:
"""Static definition of encryption algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: Encryption algorithm to use :type algorithm: cryptography.io ciphers algorithm object :param mode: Encryption mode in which to operat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EncryptionSuite:
"""Static definition of encryption algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: Encryption algorithm to use :type algorithm: cryptography.io ciphers algorithm object :param mode: Encryption mode in which to operate :type mode:... | the_stack_v2_python_sparse | src/aws_encryption_sdk/identifiers.py | aws/aws-encryption-sdk-python | train | 137 |
3f84159dfdeb5f3793d758bdde0939d5d63e294c | [
"super(FunctionComponent, self).__init__(opts)\noptions = opts.get(SECTION_SCHEDULER, {})\nvalidate_app_config(options)\nself.timezone = options.get('timezone')\nself.scheduler = ResilientScheduler(options.get('db_url'), options.get('datastore_dir'), options.get('thread_max'), options.get('timezone'))\nlog.info('Sc... | <|body_start_0|>
super(FunctionComponent, self).__init__(opts)
options = opts.get(SECTION_SCHEDULER, {})
validate_app_config(options)
self.timezone = options.get('timezone')
self.scheduler = ResilientScheduler(options.get('db_url'), options.get('datastore_dir'), options.get('thre... | Component that polls for new data arriving from Proofpoint TRAP | FunctionComponent | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FunctionComponent:
"""Component that polls for new data arriving from Proofpoint TRAP"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
<|body_0|>
def _reload(self, event, opts):
"""Configuration options have changed, sav... | stack_v2_sparse_classes_36k_train_014699 | 1,538 | permissive | [
{
"docstring": "constructor provides access to the configuration options",
"name": "__init__",
"signature": "def __init__(self, opts)"
},
{
"docstring": "Configuration options have changed, save new values",
"name": "_reload",
"signature": "def _reload(self, event, opts)"
}
] | 2 | null | Implement the Python class `FunctionComponent` described below.
Class description:
Component that polls for new data arriving from Proofpoint TRAP
Method signatures and docstrings:
- def __init__(self, opts): constructor provides access to the configuration options
- def _reload(self, event, opts): Configuration opti... | Implement the Python class `FunctionComponent` described below.
Class description:
Component that polls for new data arriving from Proofpoint TRAP
Method signatures and docstrings:
- def __init__(self, opts): constructor provides access to the configuration options
- def _reload(self, event, opts): Configuration opti... | 3ecdabe6bf2fc08f0f8e58cbe92553270d8da42f | <|skeleton|>
class FunctionComponent:
"""Component that polls for new data arriving from Proofpoint TRAP"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
<|body_0|>
def _reload(self, event, opts):
"""Configuration options have changed, sav... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FunctionComponent:
"""Component that polls for new data arriving from Proofpoint TRAP"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
super(FunctionComponent, self).__init__(opts)
options = opts.get(SECTION_SCHEDULER, {})
validat... | the_stack_v2_python_sparse | fn_scheduler/fn_scheduler/components/scheduler_poller.py | neetinkandhare/resilient-community-apps | train | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.