blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a1f9861f07898a2e43f88545f4c03fc6e94df90d | [
"Parametre.__init__(self, 'voir', 'view')\nself.schema = '<nombre>'\nself.aide_courte = 'affiche la route'\nself.aide_longue = \"Cette commande permet d'obtenir plus d'informations sur une route. Vous devez préciser en paramètre le numéro de la route, tel que spécifié dans %route% %route:liste%.\"",
"nombre = dic... | <|body_start_0|>
Parametre.__init__(self, 'voir', 'view')
self.schema = '<nombre>'
self.aide_courte = 'affiche la route'
self.aide_longue = "Cette commande permet d'obtenir plus d'informations sur une route. Vous devez préciser en paramètre le numéro de la route, tel que spécifié dans %r... | Commande 'route voir'. | PrmVoir | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmVoir:
"""Commande 'route voir'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Parametre.__init_... | stack_v2_sparse_classes_75kplus_train_003100 | 3,110 | permissive | [
{
"docstring": "Constructeur du paramètre",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Interprétation du paramètre",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | null | Implement the Python class `PrmVoir` described below.
Class description:
Commande 'route voir'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre | Implement the Python class `PrmVoir` described below.
Class description:
Commande 'route voir'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre
<|skeleton|>
class PrmVoir:
"""Commande 'route voir'."""
... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmVoir:
"""Commande 'route voir'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PrmVoir:
"""Commande 'route voir'."""
def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, 'voir', 'view')
self.schema = '<nombre>'
self.aide_courte = 'affiche la route'
self.aide_longue = "Cette commande permet d'obtenir plus d'informations... | the_stack_v2_python_sparse | src/secondaires/route/commandes/route/voir.py | vincent-lg/tsunami | train | 5 |
c9baccb09e5ac57daef9000707807c94034c59e4 | [
"self.screen_width = 1200\nself.screen_height = 680\nself.bg_color = (0, 20, 50)\nself.hero_limit = 3\nself.bullets_allowed = 5\nself.covid_vertical_speed_factor = 1\nself.speedup_scale = 1.1\nself.initialize_dynamic_settings()",
"self.hero_speed_factor = 1.5\nself.bullet_speed_factor = 1\nself.covid_horizontal_s... | <|body_start_0|>
self.screen_width = 1200
self.screen_height = 680
self.bg_color = (0, 20, 50)
self.hero_limit = 3
self.bullets_allowed = 5
self.covid_vertical_speed_factor = 1
self.speedup_scale = 1.1
self.initialize_dynamic_settings()
<|end_body_0|>
<|b... | A class that have all configurations of the game | Settings | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Settings:
"""A class that have all configurations of the game"""
def __init__(self):
"""Initialize the game configs"""
<|body_0|>
def initialize_dynamic_settings(self):
"""Initializes the configurations that increase during the game"""
<|body_1|>
def... | stack_v2_sparse_classes_75kplus_train_003101 | 2,241 | permissive | [
{
"docstring": "Initialize the game configs",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Initializes the configurations that increase during the game",
"name": "initialize_dynamic_settings",
"signature": "def initialize_dynamic_settings(self)"
},
{
"... | 3 | stack_v2_sparse_classes_30k_train_047292 | Implement the Python class `Settings` described below.
Class description:
A class that have all configurations of the game
Method signatures and docstrings:
- def __init__(self): Initialize the game configs
- def initialize_dynamic_settings(self): Initializes the configurations that increase during the game
- def inc... | Implement the Python class `Settings` described below.
Class description:
A class that have all configurations of the game
Method signatures and docstrings:
- def __init__(self): Initialize the game configs
- def initialize_dynamic_settings(self): Initializes the configurations that increase during the game
- def inc... | 4b336ebf0bc29aa4c644f0996431d13f853ac6e7 | <|skeleton|>
class Settings:
"""A class that have all configurations of the game"""
def __init__(self):
"""Initialize the game configs"""
<|body_0|>
def initialize_dynamic_settings(self):
"""Initializes the configurations that increase during the game"""
<|body_1|>
def... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Settings:
"""A class that have all configurations of the game"""
def __init__(self):
"""Initialize the game configs"""
self.screen_width = 1200
self.screen_height = 680
self.bg_color = (0, 20, 50)
self.hero_limit = 3
self.bullets_allowed = 5
self.co... | the_stack_v2_python_sparse | pygame/hero_combat/hero_settings.py | carlinhoshk/python | train | 0 |
41d49ef1c221b8cfd28d863649c36f78469e1393 | [
"super(ValueModel, self).__init__()\nself.l1 = nn.Linear(state_dim, self.hidden_1)\nself.l2 = nn.Linear(self.hidden_1, self.hidden_2)\nself.l3 = nn.Linear(self.hidden_2, 1)",
"x = F.relu(self.l1(state))\nx = F.relu(self.l2(x))\nV = self.l3(x)\nreturn V"
] | <|body_start_0|>
super(ValueModel, self).__init__()
self.l1 = nn.Linear(state_dim, self.hidden_1)
self.l2 = nn.Linear(self.hidden_1, self.hidden_2)
self.l3 = nn.Linear(self.hidden_2, 1)
<|end_body_0|>
<|body_start_1|>
x = F.relu(self.l1(state))
x = F.relu(self.l2(x))
... | ValueModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValueModel:
def __init__(self, state_dim):
""":param state_dim: dimension of the observation input"""
<|body_0|>
def forward(self, state):
"""Compute the value a the state :param state: the agent state :return: The value of the state S"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_75kplus_train_003102 | 740 | no_license | [
{
"docstring": ":param state_dim: dimension of the observation input",
"name": "__init__",
"signature": "def __init__(self, state_dim)"
},
{
"docstring": "Compute the value a the state :param state: the agent state :return: The value of the state S",
"name": "forward",
"signature": "def ... | 2 | null | Implement the Python class `ValueModel` described below.
Class description:
Implement the ValueModel class.
Method signatures and docstrings:
- def __init__(self, state_dim): :param state_dim: dimension of the observation input
- def forward(self, state): Compute the value a the state :param state: the agent state :r... | Implement the Python class `ValueModel` described below.
Class description:
Implement the ValueModel class.
Method signatures and docstrings:
- def __init__(self, state_dim): :param state_dim: dimension of the observation input
- def forward(self, state): Compute the value a the state :param state: the agent state :r... | fb1ee3d0109ec82f40e54a36a096bd4089b92d82 | <|skeleton|>
class ValueModel:
def __init__(self, state_dim):
""":param state_dim: dimension of the observation input"""
<|body_0|>
def forward(self, state):
"""Compute the value a the state :param state: the agent state :return: The value of the state S"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ValueModel:
def __init__(self, state_dim):
""":param state_dim: dimension of the observation input"""
super(ValueModel, self).__init__()
self.l1 = nn.Linear(state_dim, self.hidden_1)
self.l2 = nn.Linear(self.hidden_1, self.hidden_2)
self.l3 = nn.Linear(self.hidden_2, 1)... | the_stack_v2_python_sparse | SAC/ValueModel.py | Remydeme/SAOP | train | 2 | |
9be9a2d891cade021b1146480be15d03e1f685a9 | [
"self.__check_config(config)\nself.__collection = config[KEY_COLLECTION]\nself.__lowercase = config[KEY_LOWERCASE]\nself.__mongo_dbpedia = Mongo(MONGO_HOST, MONGO_DB, MONGO_COLLECTION_DBPEDIA)\nself.__mongo = None",
"try:\n if KEY_COLLECTION not in config:\n raise Exception(KEY_COLLECTION + ' is missing... | <|body_start_0|>
self.__check_config(config)
self.__collection = config[KEY_COLLECTION]
self.__lowercase = config[KEY_LOWERCASE]
self.__mongo_dbpedia = Mongo(MONGO_HOST, MONGO_DB, MONGO_COLLECTION_DBPEDIA)
self.__mongo = None
<|end_body_0|>
<|body_start_1|>
try:
... | DBpediaSurfaceforms2Mongo | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DBpediaSurfaceforms2Mongo:
def __init__(self, config):
"""Inserts DBpedia surface forms to Mongo."""
<|body_0|>
def __check_config(config):
"""Checks config parameters and sets default values."""
<|body_1|>
def __add_surface_form(self, surface_form, pred... | stack_v2_sparse_classes_75kplus_train_003103 | 4,510 | permissive | [
{
"docstring": "Inserts DBpedia surface forms to Mongo.",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Checks config parameters and sets default values.",
"name": "__check_config",
"signature": "def __check_config(config)"
},
{
"docstring": "Ad... | 4 | null | Implement the Python class `DBpediaSurfaceforms2Mongo` described below.
Class description:
Implement the DBpediaSurfaceforms2Mongo class.
Method signatures and docstrings:
- def __init__(self, config): Inserts DBpedia surface forms to Mongo.
- def __check_config(config): Checks config parameters and sets default valu... | Implement the Python class `DBpediaSurfaceforms2Mongo` described below.
Class description:
Implement the DBpediaSurfaceforms2Mongo class.
Method signatures and docstrings:
- def __init__(self, config): Inserts DBpedia surface forms to Mongo.
- def __check_config(config): Checks config parameters and sets default valu... | 7027699009504c72be4a087cf9730cad3051979b | <|skeleton|>
class DBpediaSurfaceforms2Mongo:
def __init__(self, config):
"""Inserts DBpedia surface forms to Mongo."""
<|body_0|>
def __check_config(config):
"""Checks config parameters and sets default values."""
<|body_1|>
def __add_surface_form(self, surface_form, pred... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DBpediaSurfaceforms2Mongo:
def __init__(self, config):
"""Inserts DBpedia surface forms to Mongo."""
self.__check_config(config)
self.__collection = config[KEY_COLLECTION]
self.__lowercase = config[KEY_LOWERCASE]
self.__mongo_dbpedia = Mongo(MONGO_HOST, MONGO_DB, MONGO_... | the_stack_v2_python_sparse | nordlys/core/data/dbpedia/dbpedia_surfaceforms2mongo.py | iai-group/nordlys | train | 35 | |
74da5a7732f8becb20d14baec21479561b0d627d | [
"parsed = urlparse(self.url)\nfor name in Statused.SERVICE_TYPE:\n if name[1] in parsed.netloc.split('.'):\n if name in ('lastfm', 'last'):\n return {'service': name[0], 'username': parsed.path.split('/')[2]}\n else:\n return {'service': name[0], 'username': parsed.path.split(... | <|body_start_0|>
parsed = urlparse(self.url)
for name in Statused.SERVICE_TYPE:
if name[1] in parsed.netloc.split('.'):
if name in ('lastfm', 'last'):
return {'service': name[0], 'username': parsed.path.split('/')[2]}
else:
... | User on other site record | MeOn | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MeOn:
"""User on other site record"""
def is_statused(self):
"""Match url for statused service"""
<|body_0|>
def parse(self, show):
"""Check type and save Keyword arguments: show -- Boolean Returns: Boolean"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_75kplus_train_003104 | 41,368 | no_license | [
{
"docstring": "Match url for statused service",
"name": "is_statused",
"signature": "def is_statused(self)"
},
{
"docstring": "Check type and save Keyword arguments: show -- Boolean Returns: Boolean",
"name": "parse",
"signature": "def parse(self, show)"
}
] | 2 | null | Implement the Python class `MeOn` described below.
Class description:
User on other site record
Method signatures and docstrings:
- def is_statused(self): Match url for statused service
- def parse(self, show): Check type and save Keyword arguments: show -- Boolean Returns: Boolean | Implement the Python class `MeOn` described below.
Class description:
User on other site record
Method signatures and docstrings:
- def is_statused(self): Match url for statused service
- def parse(self, show): Check type and save Keyword arguments: show -- Boolean Returns: Boolean
<|skeleton|>
class MeOn:
"""Us... | 39deb1dc046c80edd6bfdfbef8391842eda35dd2 | <|skeleton|>
class MeOn:
"""User on other site record"""
def is_statused(self):
"""Match url for statused service"""
<|body_0|>
def parse(self, show):
"""Check type and save Keyword arguments: show -- Boolean Returns: Boolean"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MeOn:
"""User on other site record"""
def is_statused(self):
"""Match url for statused service"""
parsed = urlparse(self.url)
for name in Statused.SERVICE_TYPE:
if name[1] in parsed.netloc.split('.'):
if name in ('lastfm', 'last'):
r... | the_stack_v2_python_sparse | src/main/models.py | nvbn/djang0byte | train | 26 |
124cca8e0e5db9002ca80b27e2ddec2c372dade5 | [
"request = pecan.request\ncontext = request.environ['context']\ntsigkey = self.central_api.get_tsigkey(context, tsigkey_id)\nLOG.info('Retrieved %(tsigkey)s', {'tsigkey': tsigkey})\nreturn DesignateAdapter.render('API_v2', tsigkey, request=request)",
"request = pecan.request\ncontext = request.environ['context']\... | <|body_start_0|>
request = pecan.request
context = request.environ['context']
tsigkey = self.central_api.get_tsigkey(context, tsigkey_id)
LOG.info('Retrieved %(tsigkey)s', {'tsigkey': tsigkey})
return DesignateAdapter.render('API_v2', tsigkey, request=request)
<|end_body_0|>
<|b... | TsigKeysController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TsigKeysController:
def get_one(self, tsigkey_id):
"""Get TsigKey"""
<|body_0|>
def get_all(self, **params):
"""List all TsigKeys"""
<|body_1|>
def post_all(self):
"""Create TsigKey"""
<|body_2|>
def patch_one(self, tsigkey_id):
... | stack_v2_sparse_classes_75kplus_train_003105 | 4,676 | permissive | [
{
"docstring": "Get TsigKey",
"name": "get_one",
"signature": "def get_one(self, tsigkey_id)"
},
{
"docstring": "List all TsigKeys",
"name": "get_all",
"signature": "def get_all(self, **params)"
},
{
"docstring": "Create TsigKey",
"name": "post_all",
"signature": "def pos... | 5 | stack_v2_sparse_classes_30k_train_007683 | Implement the Python class `TsigKeysController` described below.
Class description:
Implement the TsigKeysController class.
Method signatures and docstrings:
- def get_one(self, tsigkey_id): Get TsigKey
- def get_all(self, **params): List all TsigKeys
- def post_all(self): Create TsigKey
- def patch_one(self, tsigkey... | Implement the Python class `TsigKeysController` described below.
Class description:
Implement the TsigKeysController class.
Method signatures and docstrings:
- def get_one(self, tsigkey_id): Get TsigKey
- def get_all(self, **params): List all TsigKeys
- def post_all(self): Create TsigKey
- def patch_one(self, tsigkey... | 360433b38b449d1c53ab1357fdb0c4608c09efa5 | <|skeleton|>
class TsigKeysController:
def get_one(self, tsigkey_id):
"""Get TsigKey"""
<|body_0|>
def get_all(self, **params):
"""List all TsigKeys"""
<|body_1|>
def post_all(self):
"""Create TsigKey"""
<|body_2|>
def patch_one(self, tsigkey_id):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TsigKeysController:
def get_one(self, tsigkey_id):
"""Get TsigKey"""
request = pecan.request
context = request.environ['context']
tsigkey = self.central_api.get_tsigkey(context, tsigkey_id)
LOG.info('Retrieved %(tsigkey)s', {'tsigkey': tsigkey})
return Designate... | the_stack_v2_python_sparse | designate/api/v2/controllers/tsigkeys.py | openstack/designate | train | 156 | |
081dc29a1fc95b725e09bf79c65e6400305fbc09 | [
"heapq.heapify(nums)\nself.nums = nums\nself.k = k",
"heapq.heappush(self.nums, val)\ntry:\n return heapq.nlargest(self.k, self.nums)[self.k - 1]\nexcept:\n print('No such Kth element in the queue')"
] | <|body_start_0|>
heapq.heapify(nums)
self.nums = nums
self.k = k
<|end_body_0|>
<|body_start_1|>
heapq.heappush(self.nums, val)
try:
return heapq.nlargest(self.k, self.nums)[self.k - 1]
except:
print('No such Kth element in the queue')
<|end_body_... | 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|>
heapq.heapify(nums)
self.nums = nums
self.... | stack_v2_sparse_classes_75kplus_train_003106 | 3,962 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_040937 | 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... | b925bb22d1daa4a56c5a238a5758a926905559b4 | <|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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
heapq.heapify(nums)
self.nums = nums
self.k = k
def add(self, val):
""":type val: int :rtype: int"""
heapq.heappush(self.nums, val)
try:
return heapq.nlarg... | the_stack_v2_python_sparse | Heap/703. Kth Largest Element in a Stream.py | beninghton/notGivenUpToG | train | 0 | |
15ebccfe29448089c739f47abf90924b8c330aa9 | [
"self.size = size\nself.medX = math.ceil(size / 2)\nself.store = []\nself.medArray = []\nfor i in range(size - 1):\n self.store.append(0)\n self.medArray.append(0)\nself.medArray.append(0)\nself.loop = size + 1",
"self.store.append(value)\ni = self.loop - 2\nself.medArray[self.loop - i] = self.store[self.lo... | <|body_start_0|>
self.size = size
self.medX = math.ceil(size / 2)
self.store = []
self.medArray = []
for i in range(size - 1):
self.store.append(0)
self.medArray.append(0)
self.medArray.append(0)
self.loop = size + 1
<|end_body_0|>
<|body_... | computes median filter over range of size | median | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class median:
"""computes median filter over range of size"""
def __init__(self, size=3):
"""Inputs: size : [3,inf), size of filter"""
<|body_0|>
def run(self, value):
"""Inputs: input : value to be filtered Function: computes median filter Outputs: medVal : median val... | stack_v2_sparse_classes_75kplus_train_003107 | 3,462 | no_license | [
{
"docstring": "Inputs: size : [3,inf), size of filter",
"name": "__init__",
"signature": "def __init__(self, size=3)"
},
{
"docstring": "Inputs: input : value to be filtered Function: computes median filter Outputs: medVal : median value",
"name": "run",
"signature": "def run(self, valu... | 2 | stack_v2_sparse_classes_30k_train_030110 | Implement the Python class `median` described below.
Class description:
computes median filter over range of size
Method signatures and docstrings:
- def __init__(self, size=3): Inputs: size : [3,inf), size of filter
- def run(self, value): Inputs: input : value to be filtered Function: computes median filter Outputs... | Implement the Python class `median` described below.
Class description:
computes median filter over range of size
Method signatures and docstrings:
- def __init__(self, size=3): Inputs: size : [3,inf), size of filter
- def run(self, value): Inputs: input : value to be filtered Function: computes median filter Outputs... | 721ebaed694bb224befe90b68f4005ebc8c2de91 | <|skeleton|>
class median:
"""computes median filter over range of size"""
def __init__(self, size=3):
"""Inputs: size : [3,inf), size of filter"""
<|body_0|>
def run(self, value):
"""Inputs: input : value to be filtered Function: computes median filter Outputs: medVal : median val... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class median:
"""computes median filter over range of size"""
def __init__(self, size=3):
"""Inputs: size : [3,inf), size of filter"""
self.size = size
self.medX = math.ceil(size / 2)
self.store = []
self.medArray = []
for i in range(size - 1):
self.s... | the_stack_v2_python_sparse | ARClib/tools.py | Twoodruff/KU_ARC | train | 0 |
bb42c359e732f40fd24c107c3da27f0de4e798d2 | [
"if is_horizontal:\n super(Composition2x1, self).__init__(2 * width, height)\nelse:\n super(Composition2x1, self).__init__(width, 2 * height)\nself.single_w = width\nself.single_h = height\nself.is_horizontal = is_horizontal\nself.empty = np.zeros((height, width, 3), dtype=np.uint8)\nself.left = left\nself.ri... | <|body_start_0|>
if is_horizontal:
super(Composition2x1, self).__init__(2 * width, height)
else:
super(Composition2x1, self).__init__(width, 2 * height)
self.single_w = width
self.single_h = height
self.is_horizontal = is_horizontal
self.empty = np... | Display two keras_tf next to each other. | Composition2x1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Composition2x1:
"""Display two keras_tf next to each other."""
def __init__(self, width, height, left, right, is_horizontal: bool=True):
"""Initialize the step with all relevant attributes. :param width: Width of the final composition. :param height: Height of the final composition. ... | stack_v2_sparse_classes_75kplus_train_003108 | 1,653 | no_license | [
{
"docstring": "Initialize the step with all relevant attributes. :param width: Width of the final composition. :param height: Height of the final composition. :param left: Reference to the function which gets the frame to be displayed on left. :param right: Reference to the function which gets the frame to be ... | 2 | stack_v2_sparse_classes_30k_train_016993 | Implement the Python class `Composition2x1` described below.
Class description:
Display two keras_tf next to each other.
Method signatures and docstrings:
- def __init__(self, width, height, left, right, is_horizontal: bool=True): Initialize the step with all relevant attributes. :param width: Width of the final comp... | Implement the Python class `Composition2x1` described below.
Class description:
Display two keras_tf next to each other.
Method signatures and docstrings:
- def __init__(self, width, height, left, right, is_horizontal: bool=True): Initialize the step with all relevant attributes. :param width: Width of the final comp... | 8316bcc43805ba3cdc196b68b14f921f81610337 | <|skeleton|>
class Composition2x1:
"""Display two keras_tf next to each other."""
def __init__(self, width, height, left, right, is_horizontal: bool=True):
"""Initialize the step with all relevant attributes. :param width: Width of the final composition. :param height: Height of the final composition. ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Composition2x1:
"""Display two keras_tf next to each other."""
def __init__(self, width, height, left, right, is_horizontal: bool=True):
"""Initialize the step with all relevant attributes. :param width: Width of the final composition. :param height: Height of the final composition. :param left: ... | the_stack_v2_python_sparse | video/pipeline/compositions/composition_2x1.py | breitmuuufrosch/OpenCvPipeline | train | 0 |
e8b1569be7138c0e5764d5e9a3a217a535663c5c | [
"def count(inv_idx, m, left, right):\n return bisect.bisect_right(inv_idx[m], right) - bisect.bisect_left(inv_idx[m], left)\nself.__arr = arr\nself.__inv_idx = collections.defaultdict(list)\nfor i, x in enumerate(self.__arr):\n self.__inv_idx[x].append(i)\nself.__segment_tree = SegmentTreeRecu(arr, functools.... | <|body_start_0|>
def count(inv_idx, m, left, right):
return bisect.bisect_right(inv_idx[m], right) - bisect.bisect_left(inv_idx[m], left)
self.__arr = arr
self.__inv_idx = collections.defaultdict(list)
for i, x in enumerate(self.__arr):
self.__inv_idx[x].append(i)... | MajorityChecker3 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MajorityChecker3:
def __init__(self, arr):
""":type arr: List[int]"""
<|body_0|>
def query(self, left, right, threshold):
""":type left: int :type right: int :type threshold: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def count(... | stack_v2_sparse_classes_75kplus_train_003109 | 8,043 | permissive | [
{
"docstring": ":type arr: List[int]",
"name": "__init__",
"signature": "def __init__(self, arr)"
},
{
"docstring": ":type left: int :type right: int :type threshold: int :rtype: int",
"name": "query",
"signature": "def query(self, left, right, threshold)"
}
] | 2 | stack_v2_sparse_classes_30k_val_002160 | Implement the Python class `MajorityChecker3` described below.
Class description:
Implement the MajorityChecker3 class.
Method signatures and docstrings:
- def __init__(self, arr): :type arr: List[int]
- def query(self, left, right, threshold): :type left: int :type right: int :type threshold: int :rtype: int | Implement the Python class `MajorityChecker3` described below.
Class description:
Implement the MajorityChecker3 class.
Method signatures and docstrings:
- def __init__(self, arr): :type arr: List[int]
- def query(self, left, right, threshold): :type left: int :type right: int :type threshold: int :rtype: int
<|skel... | 4dc4e6642dc92f1983c13564cc0fd99917cab358 | <|skeleton|>
class MajorityChecker3:
def __init__(self, arr):
""":type arr: List[int]"""
<|body_0|>
def query(self, left, right, threshold):
""":type left: int :type right: int :type threshold: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MajorityChecker3:
def __init__(self, arr):
""":type arr: List[int]"""
def count(inv_idx, m, left, right):
return bisect.bisect_right(inv_idx[m], right) - bisect.bisect_left(inv_idx[m], left)
self.__arr = arr
self.__inv_idx = collections.defaultdict(list)
for... | the_stack_v2_python_sparse | Python/online-majority-element-in-subarray.py | kamyu104/LeetCode-Solutions | train | 4,549 | |
e32b65a449b305bb4633837953c0d5dbfe49bc81 | [
"self.width = width\nself.height = height\nself.w = gl.GLViewWidget()\nself.w.show()\nself.w.setWindowTitle('GLSurfacePlot')\nself.w.setCameraPosition(distance=50)\nself.g = gl.GLGridItem()\nself.g.scale(1, 1, 1)\nself.g.setDepthValue(10)\nself.w.addItem(self.g)\nself.x = np.linspace(-8, 8, self.width + 1).reshape(... | <|body_start_0|>
self.width = width
self.height = height
self.w = gl.GLViewWidget()
self.w.show()
self.w.setWindowTitle('GLSurfacePlot')
self.w.setCameraPosition(distance=50)
self.g = gl.GLGridItem()
self.g.scale(1, 1, 1)
self.g.setDepthValue(10)
... | ThreeDVisualizer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThreeDVisualizer:
def __init__(self, width, height):
"""3D visualization which renders a 2D image with color and height. :param width: Width of the 2D image being rendered. :param height: Height of the 2D image being rendered."""
<|body_0|>
def update(self, _i, _r, _index):
... | stack_v2_sparse_classes_75kplus_train_003110 | 2,323 | no_license | [
{
"docstring": "3D visualization which renders a 2D image with color and height. :param width: Width of the 2D image being rendered. :param height: Height of the 2D image being rendered.",
"name": "__init__",
"signature": "def __init__(self, width, height)"
},
{
"docstring": "Update the 3D visua... | 2 | stack_v2_sparse_classes_30k_train_025642 | Implement the Python class `ThreeDVisualizer` described below.
Class description:
Implement the ThreeDVisualizer class.
Method signatures and docstrings:
- def __init__(self, width, height): 3D visualization which renders a 2D image with color and height. :param width: Width of the 2D image being rendered. :param hei... | Implement the Python class `ThreeDVisualizer` described below.
Class description:
Implement the ThreeDVisualizer class.
Method signatures and docstrings:
- def __init__(self, width, height): 3D visualization which renders a 2D image with color and height. :param width: Width of the 2D image being rendered. :param hei... | b8061fe79f88c0892b55c2f4488355a8f68cc957 | <|skeleton|>
class ThreeDVisualizer:
def __init__(self, width, height):
"""3D visualization which renders a 2D image with color and height. :param width: Width of the 2D image being rendered. :param height: Height of the 2D image being rendered."""
<|body_0|>
def update(self, _i, _r, _index):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ThreeDVisualizer:
def __init__(self, width, height):
"""3D visualization which renders a 2D image with color and height. :param width: Width of the 2D image being rendered. :param height: Height of the 2D image being rendered."""
self.width = width
self.height = height
self.w =... | the_stack_v2_python_sparse | misc/ThreeDVisualizer.py | kevroy314/PLL-Neural-Network | train | 3 | |
0f3d08467825f116f5779a07a44b54bca4f40a9f | [
"self.marker = marker\nself.left = left\nself.right = right\nself.fill = fill\nself.fill_left = fill_left",
"left, marked, right = (format_updatable(i, pbar) for i in (self.left, self.marker, self.right))\nwidth -= len(left) + len(right)\nif pbar.maxval:\n marked *= int(pbar.currval / pbar.maxval * width)\nels... | <|body_start_0|>
self.marker = marker
self.left = left
self.right = right
self.fill = fill
self.fill_left = fill_left
<|end_body_0|>
<|body_start_1|>
left, marked, right = (format_updatable(i, pbar) for i in (self.left, self.marker, self.right))
width -= len(left... | A progress bar which stretches to fill the line. | Bar | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bar:
"""A progress bar which stretches to fill the line."""
def __init__(self, marker='#', left='|', right='|', fill=' ', fill_left=True):
"""Creates a customizable progress bar. marker - string or updatable object to use as a marker left - string or updatable object to use as a left... | stack_v2_sparse_classes_75kplus_train_003111 | 13,065 | permissive | [
{
"docstring": "Creates a customizable progress bar. marker - string or updatable object to use as a marker left - string or updatable object to use as a left border right - string or updatable object to use as a right border fill - character to use for the empty part of the progress bar fill_left - whether to ... | 2 | null | Implement the Python class `Bar` described below.
Class description:
A progress bar which stretches to fill the line.
Method signatures and docstrings:
- def __init__(self, marker='#', left='|', right='|', fill=' ', fill_left=True): Creates a customizable progress bar. marker - string or updatable object to use as a ... | Implement the Python class `Bar` described below.
Class description:
A progress bar which stretches to fill the line.
Method signatures and docstrings:
- def __init__(self, marker='#', left='|', right='|', fill=' ', fill_left=True): Creates a customizable progress bar. marker - string or updatable object to use as a ... | 19c178740257eb48367778593da55dcad08b7a4f | <|skeleton|>
class Bar:
"""A progress bar which stretches to fill the line."""
def __init__(self, marker='#', left='|', right='|', fill=' ', fill_left=True):
"""Creates a customizable progress bar. marker - string or updatable object to use as a marker left - string or updatable object to use as a left... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Bar:
"""A progress bar which stretches to fill the line."""
def __init__(self, marker='#', left='|', right='|', fill=' ', fill_left=True):
"""Creates a customizable progress bar. marker - string or updatable object to use as a marker left - string or updatable object to use as a left border right... | the_stack_v2_python_sparse | Utilities/RelMon/python/progressbar.py | cms-sw/cmssw | train | 1,006 |
a86b02581f06d22d5907fefdb2ff7bb64f911b59 | [
"self.x = np.array(x)\nself.xmin = self.x.min()\nself.xmax = self.x.max()\nself.y = np.array(y)\nself.ymin = self.y.min()\nself.ymax = self.y.max()\npol, cov = np.polyfit(self.x, self.y, deg, cov=True)\nPolynomial.__init__(self, pol, cov)",
"if restrict:\n x = np.array(x)\n for i in range(len(x)):\n ... | <|body_start_0|>
self.x = np.array(x)
self.xmin = self.x.min()
self.xmax = self.x.max()
self.y = np.array(y)
self.ymin = self.y.min()
self.ymax = self.y.max()
pol, cov = np.polyfit(self.x, self.y, deg, cov=True)
Polynomial.__init__(self, pol, cov)
<|end_bo... | Perform least squares polynomial fit and evaluate fit. (see numpy.polyfit) | PolyFit | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PolyFit:
"""Perform least squares polynomial fit and evaluate fit. (see numpy.polyfit)"""
def __init__(self, x, y, deg=1):
"""Perform fit. Parameters ---------- x : (*,) float array-like x-coordinates of sample points. y : (*,) float array-like y-coordinates of sample points. deg : i... | stack_v2_sparse_classes_75kplus_train_003112 | 35,535 | permissive | [
{
"docstring": "Perform fit. Parameters ---------- x : (*,) float array-like x-coordinates of sample points. y : (*,) float array-like y-coordinates of sample points. deg : int Degree of the fitting polynomial. (default: 1)",
"name": "__init__",
"signature": "def __init__(self, x, y, deg=1)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_029635 | Implement the Python class `PolyFit` described below.
Class description:
Perform least squares polynomial fit and evaluate fit. (see numpy.polyfit)
Method signatures and docstrings:
- def __init__(self, x, y, deg=1): Perform fit. Parameters ---------- x : (*,) float array-like x-coordinates of sample points. y : (*,)... | Implement the Python class `PolyFit` described below.
Class description:
Perform least squares polynomial fit and evaluate fit. (see numpy.polyfit)
Method signatures and docstrings:
- def __init__(self, x, y, deg=1): Perform fit. Parameters ---------- x : (*,) float array-like x-coordinates of sample points. y : (*,)... | 99107a0d4935296b673f67469c1e2bd258954b9b | <|skeleton|>
class PolyFit:
"""Perform least squares polynomial fit and evaluate fit. (see numpy.polyfit)"""
def __init__(self, x, y, deg=1):
"""Perform fit. Parameters ---------- x : (*,) float array-like x-coordinates of sample points. y : (*,) float array-like y-coordinates of sample points. deg : i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PolyFit:
"""Perform least squares polynomial fit and evaluate fit. (see numpy.polyfit)"""
def __init__(self, x, y, deg=1):
"""Perform fit. Parameters ---------- x : (*,) float array-like x-coordinates of sample points. y : (*,) float array-like y-coordinates of sample points. deg : int Degree of ... | the_stack_v2_python_sparse | maths.py | yketa/active_work | train | 1 |
a63fcd94ca0865893d29f0e633366c85e521b29c | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ScheduleInformation()",
"from .free_busy_error import FreeBusyError\nfrom .schedule_item import ScheduleItem\nfrom .working_hours import WorkingHours\nfrom .free_busy_error import FreeBusyError\nfrom .schedule_item import ScheduleItem\... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return ScheduleInformation()
<|end_body_0|>
<|body_start_1|>
from .free_busy_error import FreeBusyError
from .schedule_item import ScheduleItem
from .working_hours import WorkingHours
... | ScheduleInformation | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScheduleInformation:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ScheduleInformation:
"""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_75kplus_train_003113 | 4,465 | 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: ScheduleInformation",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator... | 3 | stack_v2_sparse_classes_30k_train_029496 | Implement the Python class `ScheduleInformation` described below.
Class description:
Implement the ScheduleInformation class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ScheduleInformation: Creates a new instance of the appropriate class based on d... | Implement the Python class `ScheduleInformation` described below.
Class description:
Implement the ScheduleInformation class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ScheduleInformation: Creates a new instance of the appropriate class based on d... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ScheduleInformation:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ScheduleInformation:
"""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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ScheduleInformation:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ScheduleInformation:
"""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/schedule_information.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
5c6d7f7c7e57052b691e8802dc6d166583c75f53 | [
"super().__init__(env, name, seed)\nself.buffer_processing_matrix = self.env.job_generator.buffer_processing_matrix\nnum_resources, _ = self.env.constituency_matrix.shape\nself.priorities = {}\nfor resource in np.arange(num_resources):\n priority_activity = priorities.get(resource, None)\n if priority_activit... | <|body_start_0|>
super().__init__(env, name, seed)
self.buffer_processing_matrix = self.env.job_generator.buffer_processing_matrix
num_resources, _ = self.env.constituency_matrix.shape
self.priorities = {}
for resource in np.arange(num_resources):
priority_activity = ... | CustomActivityPriorityAgent | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomActivityPriorityAgent:
def __init__(self, env: crw.ControlledRandomWalk, priorities: Dict, name: str='CustomActivityPriorityAgent', seed: Optional[int]=None) -> None:
"""Priority policy such that some activities have priority over others. For resources where no priorities are given... | stack_v2_sparse_classes_75kplus_train_003114 | 4,341 | permissive | [
{
"docstring": "Priority policy such that some activities have priority over others. For resources where no priorities are given, activities are chosen randomly. :param env: the environment to stepped through. :param priorities: a dictionary where the keys are the resources and the values are the activity with ... | 3 | stack_v2_sparse_classes_30k_train_032628 | Implement the Python class `CustomActivityPriorityAgent` described below.
Class description:
Implement the CustomActivityPriorityAgent class.
Method signatures and docstrings:
- def __init__(self, env: crw.ControlledRandomWalk, priorities: Dict, name: str='CustomActivityPriorityAgent', seed: Optional[int]=None) -> No... | Implement the Python class `CustomActivityPriorityAgent` described below.
Class description:
Implement the CustomActivityPriorityAgent class.
Method signatures and docstrings:
- def __init__(self, env: crw.ControlledRandomWalk, priorities: Dict, name: str='CustomActivityPriorityAgent', seed: Optional[int]=None) -> No... | b067eebaa5b57a96efdaed5796aca9f157d32214 | <|skeleton|>
class CustomActivityPriorityAgent:
def __init__(self, env: crw.ControlledRandomWalk, priorities: Dict, name: str='CustomActivityPriorityAgent', seed: Optional[int]=None) -> None:
"""Priority policy such that some activities have priority over others. For resources where no priorities are given... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CustomActivityPriorityAgent:
def __init__(self, env: crw.ControlledRandomWalk, priorities: Dict, name: str='CustomActivityPriorityAgent', seed: Optional[int]=None) -> None:
"""Priority policy such that some activities have priority over others. For resources where no priorities are given, activities a... | the_stack_v2_python_sparse | src/snc/agents/general_heuristics/custom_activity_priority_agent.py | stochasticnetworkcontrol/snc | train | 9 | |
7b2939b8f9f110f8b0456d73c8a6a377f9900c90 | [
"self._GC_TAG = 'GC'\nself._WORKFLOW_TAG = 'WORKFLOW'\nif not ctx or not hasattr(ctx, self._GC_TAG):\n self.ctx = DataContext(None, self._GC_TAG)\n self.ctx.update_context(None, self._WORKFLOW_TAG)\nself.wf_context = getattr(self.ctx, self._WORKFLOW_TAG)\nself.gc_context = getattr(self.ctx, self._GC_TAG)\nsel... | <|body_start_0|>
self._GC_TAG = 'GC'
self._WORKFLOW_TAG = 'WORKFLOW'
if not ctx or not hasattr(ctx, self._GC_TAG):
self.ctx = DataContext(None, self._GC_TAG)
self.ctx.update_context(None, self._WORKFLOW_TAG)
self.wf_context = getattr(self.ctx, self._WORKFLOW_TAG)
... | In this class we need to define all procedures which will be used in robot file security_automation.robot | BaseWorkflowDecommissionSecurityService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseWorkflowDecommissionSecurityService:
"""In this class we need to define all procedures which will be used in robot file security_automation.robot"""
def __init__(self, ctx=None):
"""Step 1: Create variables for both global and local yaml files to store data Step 2: Passes the var... | stack_v2_sparse_classes_75kplus_train_003115 | 5,362 | no_license | [
{
"docstring": "Step 1: Create variables for both global and local yaml files to store data Step 2: Passes the variables names to DataContext proc to assign values Args: :param ctx:",
"name": "__init__",
"signature": "def __init__(self, ctx=None)"
},
{
"docstring": "Description: At the end of th... | 4 | stack_v2_sparse_classes_30k_train_002991 | Implement the Python class `BaseWorkflowDecommissionSecurityService` described below.
Class description:
In this class we need to define all procedures which will be used in robot file security_automation.robot
Method signatures and docstrings:
- def __init__(self, ctx=None): Step 1: Create variables for both global ... | Implement the Python class `BaseWorkflowDecommissionSecurityService` described below.
Class description:
In this class we need to define all procedures which will be used in robot file security_automation.robot
Method signatures and docstrings:
- def __init__(self, ctx=None): Step 1: Create variables for both global ... | 93dd6d14ae4b0856aa7c6f059904cc1f13800e5f | <|skeleton|>
class BaseWorkflowDecommissionSecurityService:
"""In this class we need to define all procedures which will be used in robot file security_automation.robot"""
def __init__(self, ctx=None):
"""Step 1: Create variables for both global and local yaml files to store data Step 2: Passes the var... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BaseWorkflowDecommissionSecurityService:
"""In this class we need to define all procedures which will be used in robot file security_automation.robot"""
def __init__(self, ctx=None):
"""Step 1: Create variables for both global and local yaml files to store data Step 2: Passes the variables names ... | the_stack_v2_python_sparse | automation_framework/workflow/baseworkflow_decommission_security_service.py | vijaymaddukuri/python_repo | train | 0 |
d65f620585baa92cc6a9c2e793dc3d657444e32b | [
"funct = {'enabled': 'e => !e.disabled', 'disabled': 'e => e.disabled', 'editable': 'e => !e.readOnly', 'readonly': 'e => e.readOnly', 'selected': 'e => e.selected', 'deselected': 'e => !e.selected', 'focused': 'e => document.activeElement === e', 'defocused': 'e => document.activeElement !== e', 'checked': 'e => e... | <|body_start_0|>
funct = {'enabled': 'e => !e.disabled', 'disabled': 'e => e.disabled', 'editable': 'e => !e.readOnly', 'readonly': 'e => e.readOnly', 'selected': 'e => e.selected', 'deselected': 'e => !e.selected', 'focused': 'e => document.activeElement === e', 'defocused': 'e => document.activeElement !== e'... | Waiter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Waiter:
def wait_for_elements_state(self, selector: str, state: ElementState=ElementState.visible, timeout: str=''):
"""Waits for the element found by ``selector`` to satisfy state option. State options could be either appear/disappear from dom, or become visible/hidden. If at the moment... | stack_v2_sparse_classes_75kplus_train_003116 | 6,755 | permissive | [
{
"docstring": "Waits for the element found by ``selector`` to satisfy state option. State options could be either appear/disappear from dom, or become visible/hidden. If at the moment of calling the keyword, the selector already satisfies the condition, the keyword will return immediately. If the selector does... | 3 | stack_v2_sparse_classes_30k_val_002996 | Implement the Python class `Waiter` described below.
Class description:
Implement the Waiter class.
Method signatures and docstrings:
- def wait_for_elements_state(self, selector: str, state: ElementState=ElementState.visible, timeout: str=''): Waits for the element found by ``selector`` to satisfy state option. Stat... | Implement the Python class `Waiter` described below.
Class description:
Implement the Waiter class.
Method signatures and docstrings:
- def wait_for_elements_state(self, selector: str, state: ElementState=ElementState.visible, timeout: str=''): Waits for the element found by ``selector`` to satisfy state option. Stat... | bf663b79566c0abb9c34ed8d29abc77132a56330 | <|skeleton|>
class Waiter:
def wait_for_elements_state(self, selector: str, state: ElementState=ElementState.visible, timeout: str=''):
"""Waits for the element found by ``selector`` to satisfy state option. State options could be either appear/disappear from dom, or become visible/hidden. If at the moment... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Waiter:
def wait_for_elements_state(self, selector: str, state: ElementState=ElementState.visible, timeout: str=''):
"""Waits for the element found by ``selector`` to satisfy state option. State options could be either appear/disappear from dom, or become visible/hidden. If at the moment of calling th... | the_stack_v2_python_sparse | Browser/keywords/waiter.py | piyapsri/robotframework-browser | train | 0 | |
935962b641c19bab6b9e451960b9e92a1540669a | [
"self.timers = {}\nif items is not None:\n self.add(items)",
"if isinstance(item, list):\n for i in item:\n self.timers[i] = {'name': i, 'time': 0, 'is_counting': False, 'duration': [], 'group': group}\nelif isinstance(item, str):\n self.timers[item] = {'name': item, 'time': 0, 'is_counting': Fals... | <|body_start_0|>
self.timers = {}
if items is not None:
self.add(items)
<|end_body_0|>
<|body_start_1|>
if isinstance(item, list):
for i in item:
self.timers[i] = {'name': i, 'time': 0, 'is_counting': False, 'duration': [], 'group': group}
elif is... | Timer class to count time and do time analysis | Timer | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Timer:
"""Timer class to count time and do time analysis"""
def __init__(self, items=None):
"""Args: items (list/str): list of items to be counted, each item is a str"""
<|body_0|>
def add(self, item, group=None):
"""add item to the timer Args: item (str/list): i... | stack_v2_sparse_classes_75kplus_train_003117 | 3,333 | permissive | [
{
"docstring": "Args: items (list/str): list of items to be counted, each item is a str",
"name": "__init__",
"signature": "def __init__(self, items=None)"
},
{
"docstring": "add item to the timer Args: item (str/list): item name group (str): group name of the item",
"name": "add",
"sign... | 5 | stack_v2_sparse_classes_30k_val_000936 | Implement the Python class `Timer` described below.
Class description:
Timer class to count time and do time analysis
Method signatures and docstrings:
- def __init__(self, items=None): Args: items (list/str): list of items to be counted, each item is a str
- def add(self, item, group=None): add item to the timer Arg... | Implement the Python class `Timer` described below.
Class description:
Timer class to count time and do time analysis
Method signatures and docstrings:
- def __init__(self, items=None): Args: items (list/str): list of items to be counted, each item is a str
- def add(self, item, group=None): add item to the timer Arg... | 50e6ffa9b5164a0dfb34d3215e86cc2288df256d | <|skeleton|>
class Timer:
"""Timer class to count time and do time analysis"""
def __init__(self, items=None):
"""Args: items (list/str): list of items to be counted, each item is a str"""
<|body_0|>
def add(self, item, group=None):
"""add item to the timer Args: item (str/list): i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Timer:
"""Timer class to count time and do time analysis"""
def __init__(self, items=None):
"""Args: items (list/str): list of items to be counted, each item is a str"""
self.timers = {}
if items is not None:
self.add(items)
def add(self, item, group=None):
... | the_stack_v2_python_sparse | libs/general/timer.py | Huangying-Zhan/DF-VO | train | 494 |
0e7ca036991a46aefa803fc5b3dec8eb95707fd0 | [
"user_id = get_jwt_identity()[1]\nresponse = orchestrator.get_available_campaigns(user_id)\nAvailableCampaignsSchema(strict=True).validate(response)\nreturn (to_json(response), 200)",
"try:\n campaign_json = request.get_json()\nexcept RuntimeError:\n return ({MESSAGE: 'Error in reading campaign POST request... | <|body_start_0|>
user_id = get_jwt_identity()[1]
response = orchestrator.get_available_campaigns(user_id)
AvailableCampaignsSchema(strict=True).validate(response)
return (to_json(response), 200)
<|end_body_0|>
<|body_start_1|>
try:
campaign_json = request.get_json()
... | Manage querying, creation and deletion of campaigns To query campaign visible to a user curl "http://127.0.0.1:5000/campaigns" -H "Authorization: $(cat token.txt)" To add a new campaign curl -H "Content-Type: application/json" -d '{"name":"New campaign","description":"Something descriptive","access":{"accessType":"priv... | CampaignManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CampaignManager:
"""Manage querying, creation and deletion of campaigns To query campaign visible to a user curl "http://127.0.0.1:5000/campaigns" -H "Authorization: $(cat token.txt)" To add a new campaign curl -H "Content-Type: application/json" -d '{"name":"New campaign","description":"Somethin... | stack_v2_sparse_classes_75kplus_train_003118 | 12,385 | permissive | [
{
"docstring": "Provide a list of campaigns which user can access",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Add a new campaign",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008771 | Implement the Python class `CampaignManager` described below.
Class description:
Manage querying, creation and deletion of campaigns To query campaign visible to a user curl "http://127.0.0.1:5000/campaigns" -H "Authorization: $(cat token.txt)" To add a new campaign curl -H "Content-Type: application/json" -d '{"name"... | Implement the Python class `CampaignManager` described below.
Class description:
Manage querying, creation and deletion of campaigns To query campaign visible to a user curl "http://127.0.0.1:5000/campaigns" -H "Authorization: $(cat token.txt)" To add a new campaign curl -H "Content-Type: application/json" -d '{"name"... | 3f99e658b457ab3b86d9f7dc5ec71423d823642d | <|skeleton|>
class CampaignManager:
"""Manage querying, creation and deletion of campaigns To query campaign visible to a user curl "http://127.0.0.1:5000/campaigns" -H "Authorization: $(cat token.txt)" To add a new campaign curl -H "Content-Type: application/json" -d '{"name":"New campaign","description":"Somethin... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CampaignManager:
"""Manage querying, creation and deletion of campaigns To query campaign visible to a user curl "http://127.0.0.1:5000/campaigns" -H "Authorization: $(cat token.txt)" To add a new campaign curl -H "Content-Type: application/json" -d '{"name":"New campaign","description":"Something descriptive... | the_stack_v2_python_sparse | classification_service/service.py | GRSEB9S/classification-app-backend | train | 0 |
2f6e10f1e327d51621a4631a1ae466288ec53e78 | [
"reversion.register(Site)\nwith reversion.revision:\n site = Site.objects.create(name='site', domain='www.site-rev-1.com')\nwith reversion.revision:\n site.domain = 'www.site-rev-2.com'\n site.save()\nself.site = site",
"version_0 = Version.objects.get_for_object(self.site)[0]\nversion_1 = Version.object... | <|body_start_0|>
reversion.register(Site)
with reversion.revision:
site = Site.objects.create(name='site', domain='www.site-rev-1.com')
with reversion.revision:
site.domain = 'www.site-rev-2.com'
site.save()
self.site = site
<|end_body_0|>
<|body_star... | Tests the patch generation functionality. | PatchTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PatchTest:
"""Tests the patch generation functionality."""
def setUp(self):
"""Sets up a versioned site model to test."""
<|body_0|>
def testCanGeneratePatch(self):
"""Tests that text and HTML patches can be generated."""
<|body_1|>
def tearDown(self... | stack_v2_sparse_classes_75kplus_train_003119 | 11,235 | no_license | [
{
"docstring": "Sets up a versioned site model to test.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Tests that text and HTML patches can be generated.",
"name": "testCanGeneratePatch",
"signature": "def testCanGeneratePatch(self)"
},
{
"docstring": "Delet... | 3 | stack_v2_sparse_classes_30k_train_019816 | Implement the Python class `PatchTest` described below.
Class description:
Tests the patch generation functionality.
Method signatures and docstrings:
- def setUp(self): Sets up a versioned site model to test.
- def testCanGeneratePatch(self): Tests that text and HTML patches can be generated.
- def tearDown(self): D... | Implement the Python class `PatchTest` described below.
Class description:
Tests the patch generation functionality.
Method signatures and docstrings:
- def setUp(self): Sets up a versioned site model to test.
- def testCanGeneratePatch(self): Tests that text and HTML patches can be generated.
- def tearDown(self): D... | 07d5717a9c6040b41cd4c18aaef918294f00579c | <|skeleton|>
class PatchTest:
"""Tests the patch generation functionality."""
def setUp(self):
"""Sets up a versioned site model to test."""
<|body_0|>
def testCanGeneratePatch(self):
"""Tests that text and HTML patches can be generated."""
<|body_1|>
def tearDown(self... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PatchTest:
"""Tests the patch generation functionality."""
def setUp(self):
"""Sets up a versioned site model to test."""
reversion.register(Site)
with reversion.revision:
site = Site.objects.create(name='site', domain='www.site-rev-1.com')
with reversion.revis... | the_stack_v2_python_sparse | reversion/tests.py | tfgg/constituencyvolunteernetwork | train | 0 |
90be95b804837a7ff163445428319653307f20f5 | [
"super().__init__()\nself.k_as_x = k_as_x\nif k_as_x:\n self.qv_linear = nn.Linear(in_features, in_features * 2, bias=False)\nelse:\n self.qkv_linear = nn.Linear(in_features, in_features * 3, bias=False)\nself.n_head = num_heads\nself.head_dim = in_features // num_heads\nself.dropout_layer = nn.Dropout(dropou... | <|body_start_0|>
super().__init__()
self.k_as_x = k_as_x
if k_as_x:
self.qv_linear = nn.Linear(in_features, in_features * 2, bias=False)
else:
self.qkv_linear = nn.Linear(in_features, in_features * 3, bias=False)
self.n_head = num_heads
self.head_d... | RelativeMultiHeadAttn | [
"Apache-2.0",
"CC-BY-NC-SA-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RelativeMultiHeadAttn:
def __init__(self, in_features, num_heads, dropout, r_w_bias=None, r_r_bias=None, init_seq_length=1024, k_as_x=True):
"""Args: in_features: num_heads: dropout: r_w_bias: n_head x head_dim or None r_r_bias: n_head x head_dim or None init_seq_length: k_as_x:"""
... | stack_v2_sparse_classes_75kplus_train_003120 | 11,346 | permissive | [
{
"docstring": "Args: in_features: num_heads: dropout: r_w_bias: n_head x head_dim or None r_r_bias: n_head x head_dim or None init_seq_length: k_as_x:",
"name": "__init__",
"signature": "def __init__(self, in_features, num_heads, dropout, r_w_bias=None, r_r_bias=None, init_seq_length=1024, k_as_x=True)... | 4 | null | Implement the Python class `RelativeMultiHeadAttn` described below.
Class description:
Implement the RelativeMultiHeadAttn class.
Method signatures and docstrings:
- def __init__(self, in_features, num_heads, dropout, r_w_bias=None, r_r_bias=None, init_seq_length=1024, k_as_x=True): Args: in_features: num_heads: drop... | Implement the Python class `RelativeMultiHeadAttn` described below.
Class description:
Implement the RelativeMultiHeadAttn class.
Method signatures and docstrings:
- def __init__(self, in_features, num_heads, dropout, r_w_bias=None, r_r_bias=None, init_seq_length=1024, k_as_x=True): Args: in_features: num_heads: drop... | be2f04905a12990a527417bd47b79b851874a201 | <|skeleton|>
class RelativeMultiHeadAttn:
def __init__(self, in_features, num_heads, dropout, r_w_bias=None, r_r_bias=None, init_seq_length=1024, k_as_x=True):
"""Args: in_features: num_heads: dropout: r_w_bias: n_head x head_dim or None r_r_bias: n_head x head_dim or None init_seq_length: k_as_x:"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RelativeMultiHeadAttn:
def __init__(self, in_features, num_heads, dropout, r_w_bias=None, r_r_bias=None, init_seq_length=1024, k_as_x=True):
"""Args: in_features: num_heads: dropout: r_w_bias: n_head x head_dim or None r_r_bias: n_head x head_dim or None init_seq_length: k_as_x:"""
super().__i... | the_stack_v2_python_sparse | hanlp/layers/transformers/relative_transformer.py | hankcs/HanLP | train | 32,454 | |
57d04469bb5b989a70300000b24146c68d984e57 | [
"assert_mysql_uri(server_url)\npayload = {'server_url': server_url, 'dbname': dbname, 'species': species, 'division': division, 'db_type': db_type, 'datacheck_names': [], 'datacheck_groups': [], 'datacheck_types': [], 'email': email, 'tag': tag}\nif datacheck_names is not None:\n payload['datacheck_names'] = dat... | <|body_start_0|>
assert_mysql_uri(server_url)
payload = {'server_url': server_url, 'dbname': dbname, 'species': species, 'division': division, 'db_type': db_type, 'datacheck_names': [], 'datacheck_groups': [], 'datacheck_types': [], 'email': email, 'tag': tag}
if datacheck_names is not None:
... | Client for checking databases using the datacheck service | DatacheckClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatacheckClient:
"""Client for checking databases using the datacheck service"""
def submit_job(self, server_url, dbname, species, division, db_type, datacheck_names, datacheck_groups, datacheck_types, email, tag):
"""Run datachecks on a given server, for one or more species. Paramet... | stack_v2_sparse_classes_75kplus_train_003121 | 8,388 | permissive | [
{
"docstring": "Run datachecks on a given server, for one or more species. Parameter requirements are complicated, because only the server_url is absolutely required, for lots of other parameters you need one from a set, but it doesn't matter which one... Arguments: server_url - location of server, in URI forma... | 4 | stack_v2_sparse_classes_30k_train_042884 | Implement the Python class `DatacheckClient` described below.
Class description:
Client for checking databases using the datacheck service
Method signatures and docstrings:
- def submit_job(self, server_url, dbname, species, division, db_type, datacheck_names, datacheck_groups, datacheck_types, email, tag): Run datac... | Implement the Python class `DatacheckClient` described below.
Class description:
Client for checking databases using the datacheck service
Method signatures and docstrings:
- def submit_job(self, server_url, dbname, species, division, db_type, datacheck_names, datacheck_groups, datacheck_types, email, tag): Run datac... | d9cb8f01f3dd72463469796da656d594bcddbec6 | <|skeleton|>
class DatacheckClient:
"""Client for checking databases using the datacheck service"""
def submit_job(self, server_url, dbname, species, division, db_type, datacheck_names, datacheck_groups, datacheck_types, email, tag):
"""Run datachecks on a given server, for one or more species. Paramet... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DatacheckClient:
"""Client for checking databases using the datacheck service"""
def submit_job(self, server_url, dbname, species, division, db_type, datacheck_names, datacheck_groups, datacheck_types, email, tag):
"""Run datachecks on a given server, for one or more species. Parameter requiremen... | the_stack_v2_python_sparse | ensembl/datacheck/client.py | Ensembl/ensembl-prodinf-legacy-core | train | 0 |
c38de030227ed3a8ae84dc8cbcd4646a80832775 | [
"self._local_broker = local_broker\nself._address = address\nself._port = port",
"handler_type = type('BoundBrokerRequestHandler', (BrokerRequestHandler,), {'broker_server': self})\nwith TCPServer((self._address, self._port), handler_type) as server:\n logger.info(f'Starting server at {self._address}:{self._po... | <|body_start_0|>
self._local_broker = local_broker
self._address = address
self._port = port
<|end_body_0|>
<|body_start_1|>
handler_type = type('BoundBrokerRequestHandler', (BrokerRequestHandler,), {'broker_server': self})
with TCPServer((self._address, self._port), handler_typ... | A broker server based on a local broker over TCP. This works together with `RemoteBroker` to allow running code on a different machine than the client itself. | RemoteBrokerServer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RemoteBrokerServer:
"""A broker server based on a local broker over TCP. This works together with `RemoteBroker` to allow running code on a different machine than the client itself."""
def __init__(self, local_broker: LocalBroker, address: str, port: int):
""":param local_broker: The... | stack_v2_sparse_classes_75kplus_train_003122 | 3,188 | permissive | [
{
"docstring": ":param local_broker: The actual local broker that will handle requests :param address: The address of the server :param port: The port of the server",
"name": "__init__",
"signature": "def __init__(self, local_broker: LocalBroker, address: str, port: int)"
},
{
"docstring": "Star... | 3 | stack_v2_sparse_classes_30k_train_034591 | Implement the Python class `RemoteBrokerServer` described below.
Class description:
A broker server based on a local broker over TCP. This works together with `RemoteBroker` to allow running code on a different machine than the client itself.
Method signatures and docstrings:
- def __init__(self, local_broker: LocalB... | Implement the Python class `RemoteBrokerServer` described below.
Class description:
A broker server based on a local broker over TCP. This works together with `RemoteBroker` to allow running code on a different machine than the client itself.
Method signatures and docstrings:
- def __init__(self, local_broker: LocalB... | 73e2ccd5cbdf0cc7fc167711cde60be783e8dfe7 | <|skeleton|>
class RemoteBrokerServer:
"""A broker server based on a local broker over TCP. This works together with `RemoteBroker` to allow running code on a different machine than the client itself."""
def __init__(self, local_broker: LocalBroker, address: str, port: int):
""":param local_broker: The... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RemoteBrokerServer:
"""A broker server based on a local broker over TCP. This works together with `RemoteBroker` to allow running code on a different machine than the client itself."""
def __init__(self, local_broker: LocalBroker, address: str, port: int):
""":param local_broker: The actual local... | the_stack_v2_python_sparse | pykeval/pykeval/broker/remote_server.py | wuyadie/keval | train | 0 |
d336959fdd9497f2acabeef683885824f8ce7414 | [
"if x < 0:\n return False\nreturn self.reverse(x) == x",
"if x == 0:\n return 0\nsign = 1 if x > 0 else -1\nx = x * sign\nrev = 0\nwhile x != 0:\n x, rev = (x // 10, rev * 10 + x % 10)\nrev = rev * sign\nreturn rev"
] | <|body_start_0|>
if x < 0:
return False
return self.reverse(x) == x
<|end_body_0|>
<|body_start_1|>
if x == 0:
return 0
sign = 1 if x > 0 else -1
x = x * sign
rev = 0
while x != 0:
x, rev = (x // 10, rev * 10 + x % 10)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPalindrome(self, x):
""":type x: int :rtype: bool"""
<|body_0|>
def reverse(self, x):
""":type x: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if x < 0:
return False
return self.reverse(x) == x
... | stack_v2_sparse_classes_75kplus_train_003123 | 1,138 | no_license | [
{
"docstring": ":type x: int :rtype: bool",
"name": "isPalindrome",
"signature": "def isPalindrome(self, x)"
},
{
"docstring": ":type x: int :rtype: int",
"name": "reverse",
"signature": "def reverse(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005159 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, x): :type x: int :rtype: bool
- def reverse(self, x): :type x: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, x): :type x: int :rtype: bool
- def reverse(self, x): :type x: int :rtype: int
<|skeleton|>
class Solution:
def isPalindrome(self, x):
""":ty... | 4af44f7364c6fb4d95309056f7a7853de779b3bb | <|skeleton|>
class Solution:
def isPalindrome(self, x):
""":type x: int :rtype: bool"""
<|body_0|>
def reverse(self, x):
""":type x: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isPalindrome(self, x):
""":type x: int :rtype: bool"""
if x < 0:
return False
return self.reverse(x) == x
def reverse(self, x):
""":type x: int :rtype: int"""
if x == 0:
return 0
sign = 1 if x > 0 else -1
x = x ... | the_stack_v2_python_sparse | codes_python/0009_Palindrome_Number.py | mondler/leetcode | train | 0 | |
0df2be4934fc5d98a217e75de07db7f763f17f13 | [
"rl = self.findall(**kwargs)\nnum = len(rl)\nif num == 0:\n raise gc_exceptions.NotFound\nelif num > 1:\n raise gc_exceptions.NoUniqueMatch\nelse:\n return rl[0]",
"found = []\nsearches = kwargs.items()\nfor obj in self.list():\n try:\n if all((getattr(obj, attr) == value for attr, value in sea... | <|body_start_0|>
rl = self.findall(**kwargs)
num = len(rl)
if num == 0:
raise gc_exceptions.NotFound
elif num > 1:
raise gc_exceptions.NoUniqueMatch
else:
return rl[0]
<|end_body_0|>
<|body_start_1|>
found = []
searches = kwarg... | Add find() and findall() to the ImageManager class | ImageManager_v1 | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageManager_v1:
"""Add find() and findall() to the ImageManager class"""
def find(self, **kwargs):
"""Find a single item with attributes matching ``**kwargs``. This isn't very efficient: it loads the entire list then filters on the Python side."""
<|body_0|>
def findall... | stack_v2_sparse_classes_75kplus_train_003124 | 3,628 | permissive | [
{
"docstring": "Find a single item with attributes matching ``**kwargs``. This isn't very efficient: it loads the entire list then filters on the Python side.",
"name": "find",
"signature": "def find(self, **kwargs)"
},
{
"docstring": "Find all items with attributes matching ``**kwargs``. This i... | 2 | stack_v2_sparse_classes_30k_train_051098 | Implement the Python class `ImageManager_v1` described below.
Class description:
Add find() and findall() to the ImageManager class
Method signatures and docstrings:
- def find(self, **kwargs): Find a single item with attributes matching ``**kwargs``. This isn't very efficient: it loads the entire list then filters o... | Implement the Python class `ImageManager_v1` described below.
Class description:
Add find() and findall() to the ImageManager class
Method signatures and docstrings:
- def find(self, **kwargs): Find a single item with attributes matching ``**kwargs``. This isn't very efficient: it loads the entire list then filters o... | 80cca0badc61b4754ef2c10f23a0ee48cd227445 | <|skeleton|>
class ImageManager_v1:
"""Add find() and findall() to the ImageManager class"""
def find(self, **kwargs):
"""Find a single item with attributes matching ``**kwargs``. This isn't very efficient: it loads the entire list then filters on the Python side."""
<|body_0|>
def findall... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImageManager_v1:
"""Add find() and findall() to the ImageManager class"""
def find(self, **kwargs):
"""Find a single item with attributes matching ``**kwargs``. This isn't very efficient: it loads the entire list then filters on the Python side."""
rl = self.findall(**kwargs)
num ... | the_stack_v2_python_sparse | devstack/python-openstackclient/openstackclient/image/client.py | onsoku/horizon_review | train | 1 |
d3b383a3a01900279a3bc5ed36e89ad9d6e036f8 | [
"logging.info('%s', request)\nbot = get_or_raise(bot_management.get_info_key(request.bot_id))\nreturn message_conversion.bot_info_to_rpc(bot, utils.utcnow())",
"logging.info('%s', request)\nbot_key = bot_management.get_info_key(request.bot_id)\nget_or_raise(bot_key)\nbot_key.delete()\nreturn swarming_rpcs.Deleted... | <|body_start_0|>
logging.info('%s', request)
bot = get_or_raise(bot_management.get_info_key(request.bot_id))
return message_conversion.bot_info_to_rpc(bot, utils.utcnow())
<|end_body_0|>
<|body_start_1|>
logging.info('%s', request)
bot_key = bot_management.get_info_key(request.b... | Bot-related API. Permits querying information about the bot's properties | SwarmingBotService | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SwarmingBotService:
"""Bot-related API. Permits querying information about the bot's properties"""
def get(self, request):
"""Returns information about a known bot. This includes its state and dimensions, and if it is currently running a task."""
<|body_0|>
def delete(se... | stack_v2_sparse_classes_75kplus_train_003125 | 21,776 | permissive | [
{
"docstring": "Returns information about a known bot. This includes its state and dimensions, and if it is currently running a task.",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Deletes the bot corresponding to a provided bot_id. At that point, the bot will not appe... | 5 | stack_v2_sparse_classes_30k_train_022169 | Implement the Python class `SwarmingBotService` described below.
Class description:
Bot-related API. Permits querying information about the bot's properties
Method signatures and docstrings:
- def get(self, request): Returns information about a known bot. This includes its state and dimensions, and if it is currently... | Implement the Python class `SwarmingBotService` described below.
Class description:
Bot-related API. Permits querying information about the bot's properties
Method signatures and docstrings:
- def get(self, request): Returns information about a known bot. This includes its state and dimensions, and if it is currently... | a2349b78d2dce6aa4e131e6f7afaa202ccd72ea8 | <|skeleton|>
class SwarmingBotService:
"""Bot-related API. Permits querying information about the bot's properties"""
def get(self, request):
"""Returns information about a known bot. This includes its state and dimensions, and if it is currently running a task."""
<|body_0|>
def delete(se... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SwarmingBotService:
"""Bot-related API. Permits querying information about the bot's properties"""
def get(self, request):
"""Returns information about a known bot. This includes its state and dimensions, and if it is currently running a task."""
logging.info('%s', request)
bot = ... | the_stack_v2_python_sparse | appengine/swarming/handlers_endpoints.py | mellowdistrict/luci-py | train | 1 |
5281f3cf435d9b7f4242ca803ef43d6855051831 | [
"seq_list = list(seq)\nif len(set(seq_list)) <= 2:\n print('The input string should have more than 2 different characters.')\n raise Exception(ValueError)\nchar_count = {}\nfor key in seq_list:\n char_count[key] = char_count.get(key, 0) + 1\nself.sorted_list = sorted(char_count.items(), key=lambda item: it... | <|body_start_0|>
seq_list = list(seq)
if len(set(seq_list)) <= 2:
print('The input string should have more than 2 different characters.')
raise Exception(ValueError)
char_count = {}
for key in seq_list:
char_count[key] = char_count.get(key, 0) + 1
... | Huffman tree object. Attributes: sorted_list: character and its frenquency in ascending order. root_node: Root node of the Huffman tree. | HuffmanTree | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HuffmanTree:
"""Huffman tree object. Attributes: sorted_list: character and its frenquency in ascending order. root_node: Root node of the Huffman tree."""
def __init__(self, seq: str):
"""Huffman tree encoding for a string sequence. Args: Input string with more than 2 different char... | stack_v2_sparse_classes_75kplus_train_003126 | 3,224 | permissive | [
{
"docstring": "Huffman tree encoding for a string sequence. Args: Input string with more than 2 different characters. Returns: Root node of the Huffman tree.",
"name": "__init__",
"signature": "def __init__(self, seq: str)"
},
{
"docstring": "Print out the Huffman encoding",
"name": "get_en... | 2 | stack_v2_sparse_classes_30k_train_008435 | Implement the Python class `HuffmanTree` described below.
Class description:
Huffman tree object. Attributes: sorted_list: character and its frenquency in ascending order. root_node: Root node of the Huffman tree.
Method signatures and docstrings:
- def __init__(self, seq: str): Huffman tree encoding for a string seq... | Implement the Python class `HuffmanTree` described below.
Class description:
Huffman tree object. Attributes: sorted_list: character and its frenquency in ascending order. root_node: Root node of the Huffman tree.
Method signatures and docstrings:
- def __init__(self, seq: str): Huffman tree encoding for a string seq... | 9adbe5fc2bce71f4c09ccf83079c44699c27fce4 | <|skeleton|>
class HuffmanTree:
"""Huffman tree object. Attributes: sorted_list: character and its frenquency in ascending order. root_node: Root node of the Huffman tree."""
def __init__(self, seq: str):
"""Huffman tree encoding for a string sequence. Args: Input string with more than 2 different char... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HuffmanTree:
"""Huffman tree object. Attributes: sorted_list: character and its frenquency in ascending order. root_node: Root node of the Huffman tree."""
def __init__(self, seq: str):
"""Huffman tree encoding for a string sequence. Args: Input string with more than 2 different characters. Retur... | the_stack_v2_python_sparse | data_structures/huffman_tree.py | 1lch2/PythonExercise | train | 1 |
e1fc5358df3f6a18ed9073a3bcb01627dab4d04d | [
"group = Group.objects.get(pk=primary_key)\nif not group:\n raise Http404('Group does not exist')\ntask_queryset = GroupTask.objects.filter(group_id=group.id)\nresponse_data = []\nif len(task_queryset) <= 0:\n return Response({'EmptyTaskList': 'No task in group yet'}, status=status.HTTP_200_OK)\nelse:\n fo... | <|body_start_0|>
group = Group.objects.get(pk=primary_key)
if not group:
raise Http404('Group does not exist')
task_queryset = GroupTask.objects.filter(group_id=group.id)
response_data = []
if len(task_queryset) <= 0:
return Response({'EmptyTaskList': 'No ... | GroupTaskView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupTaskView:
def get(self, request, primary_key, format=None):
"""show all tasks in group"""
<|body_0|>
def post(self, request, primary_key, format=None):
"""add task to group"""
<|body_1|>
def put(self, request, primary_key, format=None):
"""m... | stack_v2_sparse_classes_75kplus_train_003127 | 8,683 | no_license | [
{
"docstring": "show all tasks in group",
"name": "get",
"signature": "def get(self, request, primary_key, format=None)"
},
{
"docstring": "add task to group",
"name": "post",
"signature": "def post(self, request, primary_key, format=None)"
},
{
"docstring": "modify task's detail... | 4 | stack_v2_sparse_classes_30k_train_015066 | Implement the Python class `GroupTaskView` described below.
Class description:
Implement the GroupTaskView class.
Method signatures and docstrings:
- def get(self, request, primary_key, format=None): show all tasks in group
- def post(self, request, primary_key, format=None): add task to group
- def put(self, request... | Implement the Python class `GroupTaskView` described below.
Class description:
Implement the GroupTaskView class.
Method signatures and docstrings:
- def get(self, request, primary_key, format=None): show all tasks in group
- def post(self, request, primary_key, format=None): add task to group
- def put(self, request... | a112a110bf9d932ecb300dd2354914d8297350c4 | <|skeleton|>
class GroupTaskView:
def get(self, request, primary_key, format=None):
"""show all tasks in group"""
<|body_0|>
def post(self, request, primary_key, format=None):
"""add task to group"""
<|body_1|>
def put(self, request, primary_key, format=None):
"""m... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GroupTaskView:
def get(self, request, primary_key, format=None):
"""show all tasks in group"""
group = Group.objects.get(pk=primary_key)
if not group:
raise Http404('Group does not exist')
task_queryset = GroupTask.objects.filter(group_id=group.id)
response_... | the_stack_v2_python_sparse | backend/groups/views.py | s3855825/BISbackend | train | 0 | |
6143fb01cb94616a5b28e7118338eabe2751f66e | [
"self._warmup_steps = warmup_steps\nself._global_batch_size = global_batch_size\nself._step = 0\nself._timestamps = []\nself._logger = logger\nself._mode = mode",
"self._step += 1\nif self._step >= self._warmup_steps:\n self._timestamps.append(time.time())",
"deltas = np.array([self._timestamps[i + 1] - self... | <|body_start_0|>
self._warmup_steps = warmup_steps
self._global_batch_size = global_batch_size
self._step = 0
self._timestamps = []
self._logger = logger
self._mode = mode
<|end_body_0|>
<|body_start_1|>
self._step += 1
if self._step >= self._warmup_steps... | Hook for profiling metrics | ProfilingHook | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfilingHook:
"""Hook for profiling metrics"""
def __init__(self, warmup_steps, global_batch_size, logger, mode):
"""Build hook :param warmup_steps: Number of steps to skip initially :param global_batch_size: Number of samples per bach in all gpus :param logger: Logger object :param... | stack_v2_sparse_classes_75kplus_train_003128 | 7,371 | permissive | [
{
"docstring": "Build hook :param warmup_steps: Number of steps to skip initially :param global_batch_size: Number of samples per bach in all gpus :param logger: Logger object :param mode: Estimator's execution mode",
"name": "__init__",
"signature": "def __init__(self, warmup_steps, global_batch_size, ... | 3 | stack_v2_sparse_classes_30k_train_019892 | Implement the Python class `ProfilingHook` described below.
Class description:
Hook for profiling metrics
Method signatures and docstrings:
- def __init__(self, warmup_steps, global_batch_size, logger, mode): Build hook :param warmup_steps: Number of steps to skip initially :param global_batch_size: Number of samples... | Implement the Python class `ProfilingHook` described below.
Class description:
Hook for profiling metrics
Method signatures and docstrings:
- def __init__(self, warmup_steps, global_batch_size, logger, mode): Build hook :param warmup_steps: Number of steps to skip initially :param global_batch_size: Number of samples... | a5388a45f71a949639b35cc5b990bd130d2d8164 | <|skeleton|>
class ProfilingHook:
"""Hook for profiling metrics"""
def __init__(self, warmup_steps, global_batch_size, logger, mode):
"""Build hook :param warmup_steps: Number of steps to skip initially :param global_batch_size: Number of samples per bach in all gpus :param logger: Logger object :param... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProfilingHook:
"""Hook for profiling metrics"""
def __init__(self, warmup_steps, global_batch_size, logger, mode):
"""Build hook :param warmup_steps: Number of steps to skip initially :param global_batch_size: Number of samples per bach in all gpus :param logger: Logger object :param mode: Estima... | the_stack_v2_python_sparse | TensorFlow/Segmentation/UNet_3D_Medical/runtime/hooks.py | NVIDIA/DeepLearningExamples | train | 11,838 |
4d010b9b5734b2a40abdad981d55ff40dfda7b3f | [
"if not params:\n return\nsocial_meta = SocialMetaModel.query.filter_by(user_id=user_id).first()\nif not social_meta:\n social_meta = SocialMetaModel()\n social_meta.user_id = user_id\n db.session.add(social_meta)\n db.session.commit()\nfor attr in params:\n if not attr:\n continue\n val... | <|body_start_0|>
if not params:
return
social_meta = SocialMetaModel.query.filter_by(user_id=user_id).first()
if not social_meta:
social_meta = SocialMetaModel()
social_meta.user_id = user_id
db.session.add(social_meta)
db.session.commi... | SocialMetaModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SocialMetaModel:
def update_social_meta_model(user_id=0, params=list(), meta_add=True):
"""更新SocialMetaModel的参数 :param user_id: 用户id :param params: 需要修改的参数列表 :param meta_add: 增加参数还是减少参数"""
<|body_0|>
def query_social_meta_info(user_id):
"""查询用户社交信息,可以批量查询"""
... | stack_v2_sparse_classes_75kplus_train_003129 | 2,119 | permissive | [
{
"docstring": "更新SocialMetaModel的参数 :param user_id: 用户id :param params: 需要修改的参数列表 :param meta_add: 增加参数还是减少参数",
"name": "update_social_meta_model",
"signature": "def update_social_meta_model(user_id=0, params=list(), meta_add=True)"
},
{
"docstring": "查询用户社交信息,可以批量查询",
"name": "query_social... | 2 | stack_v2_sparse_classes_30k_val_002395 | Implement the Python class `SocialMetaModel` described below.
Class description:
Implement the SocialMetaModel class.
Method signatures and docstrings:
- def update_social_meta_model(user_id=0, params=list(), meta_add=True): 更新SocialMetaModel的参数 :param user_id: 用户id :param params: 需要修改的参数列表 :param meta_add: 增加参数还是减少参... | Implement the Python class `SocialMetaModel` described below.
Class description:
Implement the SocialMetaModel class.
Method signatures and docstrings:
- def update_social_meta_model(user_id=0, params=list(), meta_add=True): 更新SocialMetaModel的参数 :param user_id: 用户id :param params: 需要修改的参数列表 :param meta_add: 增加参数还是减少参... | 646eeaacea77e293c6eccc6dad82a04ece9294a3 | <|skeleton|>
class SocialMetaModel:
def update_social_meta_model(user_id=0, params=list(), meta_add=True):
"""更新SocialMetaModel的参数 :param user_id: 用户id :param params: 需要修改的参数列表 :param meta_add: 增加参数还是减少参数"""
<|body_0|>
def query_social_meta_info(user_id):
"""查询用户社交信息,可以批量查询"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SocialMetaModel:
def update_social_meta_model(user_id=0, params=list(), meta_add=True):
"""更新SocialMetaModel的参数 :param user_id: 用户id :param params: 需要修改的参数列表 :param meta_add: 增加参数还是减少参数"""
if not params:
return
social_meta = SocialMetaModel.query.filter_by(user_id=user_id).... | the_stack_v2_python_sparse | app/models/social/social_meta.py | Eastwu5788/heron | train | 7 | |
3ed95f3b2508664178d65f048d4e7951ea15ff08 | [
"search_term = request.args.get('q') or None\nlimit = request.args.get('limit') or Config.MAX_PAGE_SIZE\npage_limit = 100 if int(limit) > 100 else int(limit)\npage = request.args.get('page') or 1\nif page_limit < 1 or page < 1:\n return abort(400, 'Page or Limit cannot be negative values')\ncontact_data = Contac... | <|body_start_0|>
search_term = request.args.get('q') or None
limit = request.args.get('limit') or Config.MAX_PAGE_SIZE
page_limit = 100 if int(limit) > 100 else int(limit)
page = request.args.get('page') or 1
if page_limit < 1 or page < 1:
return abort(400, 'Page or L... | ContactsEndPoint | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContactsEndPoint:
def get(self):
"""Retrieve contacts"""
<|body_0|>
def post(self):
"""Create an contact"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
search_term = request.args.get('q') or None
limit = request.args.get('limit') or Config.... | stack_v2_sparse_classes_75kplus_train_003130 | 6,659 | permissive | [
{
"docstring": "Retrieve contacts",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Create an contact",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013853 | Implement the Python class `ContactsEndPoint` described below.
Class description:
Implement the ContactsEndPoint class.
Method signatures and docstrings:
- def get(self): Retrieve contacts
- def post(self): Create an contact | Implement the Python class `ContactsEndPoint` described below.
Class description:
Implement the ContactsEndPoint class.
Method signatures and docstrings:
- def get(self): Retrieve contacts
- def post(self): Create an contact
<|skeleton|>
class ContactsEndPoint:
def get(self):
"""Retrieve contacts"""
... | 652c156b622e679fa2e68d2fb4b0f87180b3ca11 | <|skeleton|>
class ContactsEndPoint:
def get(self):
"""Retrieve contacts"""
<|body_0|>
def post(self):
"""Create an contact"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ContactsEndPoint:
def get(self):
"""Retrieve contacts"""
search_term = request.args.get('q') or None
limit = request.args.get('limit') or Config.MAX_PAGE_SIZE
page_limit = 100 if int(limit) > 100 else int(limit)
page = request.args.get('page') or 1
if page_limit... | the_stack_v2_python_sparse | app/api/v1/contact.py | Enkya/ims_beta | train | 0 | |
46d9cd1116ca97db3d0f77aa2ce2118033d4e9e1 | [
"for event in events:\n dumped_data, _ = self.validator.dump(event)\n event_data, errors = self.validator.load(dumped_data)\n if not errors:\n yield event_data",
"organised_events = defaultdict(dict)\nfor event in event_data:\n uri_id = event['uri_id']\n origin = event['origin']\n organis... | <|body_start_0|>
for event in events:
dumped_data, _ = self.validator.dump(event)
event_data, errors = self.validator.load(dumped_data)
if not errors:
yield event_data
<|end_body_0|>
<|body_start_1|>
organised_events = defaultdict(dict)
for ev... | Implements Crossref Event Data API integration. | CrossrefEventDataProvider | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CrossrefEventDataProvider:
"""Implements Crossref Event Data API integration."""
def _validate(self, events):
"""Make sure event passes validation. Args: events (list): Event objects coming from the client. Returns: generator: Yields valid deserialized event objects."""
<|bod... | stack_v2_sparse_classes_75kplus_train_003131 | 6,567 | permissive | [
{
"docstring": "Make sure event passes validation. Args: events (list): Event objects coming from the client. Returns: generator: Yields valid deserialized event objects.",
"name": "_validate",
"signature": "def _validate(self, events)"
},
{
"docstring": "Divide events by URI_id and Origin. Args... | 4 | stack_v2_sparse_classes_30k_train_003288 | Implement the Python class `CrossrefEventDataProvider` described below.
Class description:
Implements Crossref Event Data API integration.
Method signatures and docstrings:
- def _validate(self, events): Make sure event passes validation. Args: events (list): Event objects coming from the client. Returns: generator: ... | Implement the Python class `CrossrefEventDataProvider` described below.
Class description:
Implements Crossref Event Data API integration.
Method signatures and docstrings:
- def _validate(self, events): Make sure event passes validation. Args: events (list): Event objects coming from the client. Returns: generator: ... | 546726f01e81e3ca2f37d448d01a55625e9be1ea | <|skeleton|>
class CrossrefEventDataProvider:
"""Implements Crossref Event Data API integration."""
def _validate(self, events):
"""Make sure event passes validation. Args: events (list): Event objects coming from the client. Returns: generator: Yields valid deserialized event objects."""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CrossrefEventDataProvider:
"""Implements Crossref Event Data API integration."""
def _validate(self, events):
"""Make sure event passes validation. Args: events (list): Event objects coming from the client. Returns: generator: Yields valid deserialized event objects."""
for event in event... | the_stack_v2_python_sparse | src/plugins/crossref_event_data/crossref_event_data.py | hirmeos/altmetrics | train | 2 |
552d62249bfdc33b1da830be2c44bf1ba586a4e1 | [
"parser_context = parser_context or {}\nencoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)\nparser = etree.DefusedXMLParser(encoding=encoding)\ntry:\n tree = etree.parse(stream, parser=parser, forbid_dtd=True)\nexcept (etree.ParseError, ValueError) as exc:\n raise ParseError(detail=str(exc))\... | <|body_start_0|>
parser_context = parser_context or {}
encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)
parser = etree.DefusedXMLParser(encoding=encoding)
try:
tree = etree.parse(stream, parser=parser, forbid_dtd=True)
except (etree.ParseError, Valu... | XML company parser. | XMLCompanyParser | [
"LicenseRef-scancode-other-permissive",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XMLCompanyParser:
"""XML company parser."""
def parse(self, stream, media_type=None, parser_context=None):
"""Parses the incoming bytestream as XML and returns the resulting data."""
<|body_0|>
def _xml_convert(self, element):
"""convert the xml `element` into th... | stack_v2_sparse_classes_75kplus_train_003132 | 2,236 | permissive | [
{
"docstring": "Parses the incoming bytestream as XML and returns the resulting data.",
"name": "parse",
"signature": "def parse(self, stream, media_type=None, parser_context=None)"
},
{
"docstring": "convert the xml `element` into the corresponding python object",
"name": "_xml_convert",
... | 2 | stack_v2_sparse_classes_30k_train_040370 | Implement the Python class `XMLCompanyParser` described below.
Class description:
XML company parser.
Method signatures and docstrings:
- def parse(self, stream, media_type=None, parser_context=None): Parses the incoming bytestream as XML and returns the resulting data.
- def _xml_convert(self, element): convert the ... | Implement the Python class `XMLCompanyParser` described below.
Class description:
XML company parser.
Method signatures and docstrings:
- def parse(self, stream, media_type=None, parser_context=None): Parses the incoming bytestream as XML and returns the resulting data.
- def _xml_convert(self, element): convert the ... | 6ac816e7c2711568cd7bcb1d996ba74c09513b3f | <|skeleton|>
class XMLCompanyParser:
"""XML company parser."""
def parse(self, stream, media_type=None, parser_context=None):
"""Parses the incoming bytestream as XML and returns the resulting data."""
<|body_0|>
def _xml_convert(self, element):
"""convert the xml `element` into th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class XMLCompanyParser:
"""XML company parser."""
def parse(self, stream, media_type=None, parser_context=None):
"""Parses the incoming bytestream as XML and returns the resulting data."""
parser_context = parser_context or {}
encoding = parser_context.get('encoding', settings.DEFAULT_C... | the_stack_v2_python_sparse | django_kala/api/basecamp_classic/companies/parsers.py | brahimmade/kala-app | train | 0 |
c208fda97c34ffc0d2891352f7aa33e8e79d69ad | [
"super(PosePrior, self).__init__()\nself.num_joints = num_joints\nself.conv_pose_0_1 = nn.Conv2d(num_joints, 32, 3, padding=1)\nself.conv_pose_0_2 = TFConv2D(32, 32, 3, stride=2)\nself.conv_pose_1_1 = nn.Conv2d(32, 64, 3, padding=1)\nself.conv_pose_1_2 = TFConv2D(64, 64, 3, stride=2)\nself.conv_pose_2_1 = nn.Conv2d... | <|body_start_0|>
super(PosePrior, self).__init__()
self.num_joints = num_joints
self.conv_pose_0_1 = nn.Conv2d(num_joints, 32, 3, padding=1)
self.conv_pose_0_2 = TFConv2D(32, 32, 3, stride=2)
self.conv_pose_1_1 = nn.Conv2d(32, 64, 3, padding=1)
self.conv_pose_1_2 = TFConv... | Implements the PosePrior architecture. The purpose of this network is to estimate the 3D coordinates of the hand using 2D heatmaps. This architecture is defined in: Zimmermann, C., & Brox, T. (2017). Learning to Estimate 3D Hand Pose from Single RGB Images. Retrieved from http://arxiv.org/abs/1705.01389 | PosePrior | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PosePrior:
"""Implements the PosePrior architecture. The purpose of this network is to estimate the 3D coordinates of the hand using 2D heatmaps. This architecture is defined in: Zimmermann, C., & Brox, T. (2017). Learning to Estimate 3D Hand Pose from Single RGB Images. Retrieved from http://arx... | stack_v2_sparse_classes_75kplus_train_003133 | 6,461 | permissive | [
{
"docstring": "Defines and initializes the network.",
"name": "__init__",
"signature": "def __init__(self, num_joints=9)"
},
{
"docstring": "Forward pass through PosePrior. Args: x - (batch x num_joints x 256 x 256): 2D keypoint heatmaps. Returns: (batch x num_joints x 3): xyz coordinates of th... | 2 | null | Implement the Python class `PosePrior` described below.
Class description:
Implements the PosePrior architecture. The purpose of this network is to estimate the 3D coordinates of the hand using 2D heatmaps. This architecture is defined in: Zimmermann, C., & Brox, T. (2017). Learning to Estimate 3D Hand Pose from Singl... | Implement the Python class `PosePrior` described below.
Class description:
Implements the PosePrior architecture. The purpose of this network is to estimate the 3D coordinates of the hand using 2D heatmaps. This architecture is defined in: Zimmermann, C., & Brox, T. (2017). Learning to Estimate 3D Hand Pose from Singl... | 5a77818670060710dff2b1b617a96481e5dc20a0 | <|skeleton|>
class PosePrior:
"""Implements the PosePrior architecture. The purpose of this network is to estimate the 3D coordinates of the hand using 2D heatmaps. This architecture is defined in: Zimmermann, C., & Brox, T. (2017). Learning to Estimate 3D Hand Pose from Single RGB Images. Retrieved from http://arx... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PosePrior:
"""Implements the PosePrior architecture. The purpose of this network is to estimate the 3D coordinates of the hand using 2D heatmaps. This architecture is defined in: Zimmermann, C., & Brox, T. (2017). Learning to Estimate 3D Hand Pose from Single RGB Images. Retrieved from http://arxiv.org/abs/17... | the_stack_v2_python_sparse | model/PoseNet.py | ajdillhoff/3dhpe-udd | train | 1 |
5ab29d17aea4b30ae1bbbb68e0cf723a555c5e36 | [
"super(CheckMainPage, cls).setUpClass()\ncls.pagelogin = CBSLogin(cls.browserclass.get_driver())\ncls.pageindex = PageIndex(cls.browserclass.get_driver())",
"self.log.info('--------- Start Login ---------')\nself.browserclass.get_driver().get(self.loginurl)\nself.pagelogin.userlogin('admin', '!000000als')\ncheck ... | <|body_start_0|>
super(CheckMainPage, cls).setUpClass()
cls.pagelogin = CBSLogin(cls.browserclass.get_driver())
cls.pageindex = PageIndex(cls.browserclass.get_driver())
<|end_body_0|>
<|body_start_1|>
self.log.info('--------- Start Login ---------')
self.browserclass.get_driver(... | CheckMainPage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckMainPage:
def setUpClass(cls):
"""测试类中所有测试方法执行前执行的方法"""
<|body_0|>
def test_a_weblogin(self):
"""登录测试,并为后面的菜单页面check测试,提供登录后的系统操作 :return:"""
<|body_1|>
def test_b_pagecheck(self, menu1, menu2, menu3, check_a):
"""数据驱动,左侧菜单点击及页面显示check 三个参数依... | stack_v2_sparse_classes_75kplus_train_003134 | 10,766 | no_license | [
{
"docstring": "测试类中所有测试方法执行前执行的方法",
"name": "setUpClass",
"signature": "def setUpClass(cls)"
},
{
"docstring": "登录测试,并为后面的菜单页面check测试,提供登录后的系统操作 :return:",
"name": "test_a_weblogin",
"signature": "def test_a_weblogin(self)"
},
{
"docstring": "数据驱动,左侧菜单点击及页面显示check 三个参数依次是 一级菜单 二... | 3 | stack_v2_sparse_classes_30k_train_004819 | Implement the Python class `CheckMainPage` described below.
Class description:
Implement the CheckMainPage class.
Method signatures and docstrings:
- def setUpClass(cls): 测试类中所有测试方法执行前执行的方法
- def test_a_weblogin(self): 登录测试,并为后面的菜单页面check测试,提供登录后的系统操作 :return:
- def test_b_pagecheck(self, menu1, menu2, menu3, check_a... | Implement the Python class `CheckMainPage` described below.
Class description:
Implement the CheckMainPage class.
Method signatures and docstrings:
- def setUpClass(cls): 测试类中所有测试方法执行前执行的方法
- def test_a_weblogin(self): 登录测试,并为后面的菜单页面check测试,提供登录后的系统操作 :return:
- def test_b_pagecheck(self, menu1, menu2, menu3, check_a... | 08b98e08b76ed2a4984efb7f543ed63eabe30757 | <|skeleton|>
class CheckMainPage:
def setUpClass(cls):
"""测试类中所有测试方法执行前执行的方法"""
<|body_0|>
def test_a_weblogin(self):
"""登录测试,并为后面的菜单页面check测试,提供登录后的系统操作 :return:"""
<|body_1|>
def test_b_pagecheck(self, menu1, menu2, menu3, check_a):
"""数据驱动,左侧菜单点击及页面显示check 三个参数依... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CheckMainPage:
def setUpClass(cls):
"""测试类中所有测试方法执行前执行的方法"""
super(CheckMainPage, cls).setUpClass()
cls.pagelogin = CBSLogin(cls.browserclass.get_driver())
cls.pageindex = PageIndex(cls.browserclass.get_driver())
def test_a_weblogin(self):
"""登录测试,并为后面的菜单页面check测试,... | the_stack_v2_python_sparse | Sys_CBS/TestClass/CBScheckMainPage.py | duozi/webUITestLight | train | 0 | |
ad348972f1000131c537436478b1d79b9c00950b | [
"self.num_filters = num_filters\nself._build_layer_components()\nsuper(ReductionB, self).__init__(**kwargs)",
"self.max_pool1 = MaxPool2D(pool_size=(3, 3), strides=2, padding='valid')\nself.conv_block1 = [Conv2D(self.num_filters, kernel_size=1, strides=1, padding='same', activation=tf.nn.relu)]\nself.conv_block1.... | <|body_start_0|>
self.num_filters = num_filters
self._build_layer_components()
super(ReductionB, self).__init__(**kwargs)
<|end_body_0|>
<|body_start_1|>
self.max_pool1 = MaxPool2D(pool_size=(3, 3), strides=2, padding='valid')
self.conv_block1 = [Conv2D(self.num_filters, kernel_... | Variant B of the two Reduction layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters, to reduce the spatial extent of the image and reduce computational complexity for downstream layers. | ReductionB | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReductionB:
"""Variant B of the two Reduction layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters, to reduce the spatial extent of the image and reduce computational complexity for downstream layers."... | stack_v2_sparse_classes_75kplus_train_003135 | 17,354 | permissive | [
{
"docstring": "Parameters ---------- num_filters: int, Number of convolutional filters",
"name": "__init__",
"signature": "def __init__(self, num_filters, **kwargs)"
},
{
"docstring": "Builds the layers components and set _layers attribute.",
"name": "_build_layer_components",
"signatur... | 3 | stack_v2_sparse_classes_30k_train_002871 | Implement the Python class `ReductionB` described below.
Class description:
Variant B of the two Reduction layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters, to reduce the spatial extent of the image and reduce computati... | Implement the Python class `ReductionB` described below.
Class description:
Variant B of the two Reduction layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters, to reduce the spatial extent of the image and reduce computati... | ee6e67ebcf7bf04259cf13aff6388e2b791fea3d | <|skeleton|>
class ReductionB:
"""Variant B of the two Reduction layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters, to reduce the spatial extent of the image and reduce computational complexity for downstream layers."... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReductionB:
"""Variant B of the two Reduction layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters, to reduce the spatial extent of the image and reduce computational complexity for downstream layers."""
def _... | the_stack_v2_python_sparse | deepchem/models/chemnet_layers.py | deepchem/deepchem | train | 4,876 |
7517a3815c19aec69e44c85c554b61f4c07b5197 | [
"name = name.lower()\nproperties = filter(lambda property_: property_.name.lower() == name, self.property)\nif properties:\n return properties[0].value",
"name = name.lower()\nproperties = filter(lambda property_: property_.name.lower() == name, self.property)\nreturn properties and properties[0] or self._Empt... | <|body_start_0|>
name = name.lower()
properties = filter(lambda property_: property_.name.lower() == name, self.property)
if properties:
return properties[0].value
<|end_body_0|>
<|body_start_1|>
name = name.lower()
properties = filter(lambda property_: property_.nam... | Pattern class to be used as a base for xml node to py object translation | _ObjectifiedXmlNode_ | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _ObjectifiedXmlNode_:
"""Pattern class to be used as a base for xml node to py object translation"""
def getPropertyValueByName(self, name):
"""@types: str -> _ObjectifiedXmlNode_ or _EmptyCollection"""
<|body_0|>
def getPropertyByName(self, name):
"""Utility met... | stack_v2_sparse_classes_75kplus_train_003136 | 39,195 | no_license | [
{
"docstring": "@types: str -> _ObjectifiedXmlNode_ or _EmptyCollection",
"name": "getPropertyValueByName",
"signature": "def getPropertyValueByName(self, name)"
},
{
"docstring": "Utility method making it easy to grab properties defined in such manner <properties> <property name=\"n1\" value=\"... | 2 | stack_v2_sparse_classes_30k_train_034679 | Implement the Python class `_ObjectifiedXmlNode_` described below.
Class description:
Pattern class to be used as a base for xml node to py object translation
Method signatures and docstrings:
- def getPropertyValueByName(self, name): @types: str -> _ObjectifiedXmlNode_ or _EmptyCollection
- def getPropertyByName(sel... | Implement the Python class `_ObjectifiedXmlNode_` described below.
Class description:
Pattern class to be used as a base for xml node to py object translation
Method signatures and docstrings:
- def getPropertyValueByName(self, name): @types: str -> _ObjectifiedXmlNode_ or _EmptyCollection
- def getPropertyByName(sel... | c431e809e8d0f82e1bca7e3429dd0245560b5680 | <|skeleton|>
class _ObjectifiedXmlNode_:
"""Pattern class to be used as a base for xml node to py object translation"""
def getPropertyValueByName(self, name):
"""@types: str -> _ObjectifiedXmlNode_ or _EmptyCollection"""
<|body_0|>
def getPropertyByName(self, name):
"""Utility met... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _ObjectifiedXmlNode_:
"""Pattern class to be used as a base for xml node to py object translation"""
def getPropertyValueByName(self, name):
"""@types: str -> _ObjectifiedXmlNode_ or _EmptyCollection"""
name = name.lower()
properties = filter(lambda property_: property_.name.lower... | the_stack_v2_python_sparse | reference/ucmdb/discovery/glassfish_discoverer.py | madmonkyang/cda-record | train | 0 |
d9146f3221e1e9e82a0b97ba27ca5b304002102b | [
"body = {'reviewer_id': user_id, 'stars': stars}\nif text:\n body['text_review'] = text\nreq = safe_post(f'{Restaurant.BASE_URL}/reviews/{restaurant_id}', json=body)\nif req.status_code != 201:\n raise GoOutSafeError('DB error')",
"if user_id:\n req = safe_get(f'{Restaurant.BASE_URL}/reviews/{restaurant_... | <|body_start_0|>
body = {'reviewer_id': user_id, 'stars': stars}
if text:
body['text_review'] = text
req = safe_post(f'{Restaurant.BASE_URL}/reviews/{restaurant_id}', json=body)
if req.status_code != 201:
raise GoOutSafeError('DB error')
<|end_body_0|>
<|body_sta... | Review abstraction over REST endpoints. Do not return such instances and do not pass them around as function arguments. | Review | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Review:
"""Review abstraction over REST endpoints. Do not return such instances and do not pass them around as function arguments."""
def add(restaurant_id, user_id, stars, text=None):
"""Adds a new Review for the restaurant restaurant_id by the User user_id Args: restaurant_id (int)... | stack_v2_sparse_classes_75kplus_train_003137 | 8,164 | no_license | [
{
"docstring": "Adds a new Review for the restaurant restaurant_id by the User user_id Args: restaurant_id (int): the restaurant_id user_id (int): the user_id stars (int): the number of stars text (str, optional): the review text if any. Defaults to None. Raises: GoOutSafeError: if a db error happens",
"nam... | 2 | stack_v2_sparse_classes_30k_train_002010 | Implement the Python class `Review` described below.
Class description:
Review abstraction over REST endpoints. Do not return such instances and do not pass them around as function arguments.
Method signatures and docstrings:
- def add(restaurant_id, user_id, stars, text=None): Adds a new Review for the restaurant re... | Implement the Python class `Review` described below.
Class description:
Review abstraction over REST endpoints. Do not return such instances and do not pass them around as function arguments.
Method signatures and docstrings:
- def add(restaurant_id, user_id, stars, text=None): Adds a new Review for the restaurant re... | a357482dc746e9c622fde1fc574fb9a823017d11 | <|skeleton|>
class Review:
"""Review abstraction over REST endpoints. Do not return such instances and do not pass them around as function arguments."""
def add(restaurant_id, user_id, stars, text=None):
"""Adds a new Review for the restaurant restaurant_id by the User user_id Args: restaurant_id (int)... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Review:
"""Review abstraction over REST endpoints. Do not return such instances and do not pass them around as function arguments."""
def add(restaurant_id, user_id, stars, text=None):
"""Adds a new Review for the restaurant restaurant_id by the User user_id Args: restaurant_id (int): the restaur... | the_stack_v2_python_sparse | api_gateway/classes/restaurant.py | Advanced-Software-Engineering-S5/api-gateway-microservice | train | 0 |
8330a4bfea177d657c992e789822f66b79aef722 | [
"if not self.user:\n raise Exception('self.user is required')\nif not self.facebook_id:\n raise Exception('self.facebook_id is required')\nif not self.name:\n raise Exception('self.name is required')",
"self._validate_attrs()\ntry:\n self.save()\n return self\nexcept Exception:\n return None"
] | <|body_start_0|>
if not self.user:
raise Exception('self.user is required')
if not self.facebook_id:
raise Exception('self.facebook_id is required')
if not self.name:
raise Exception('self.name is required')
<|end_body_0|>
<|body_start_1|>
self._valid... | FacebookModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FacebookModel:
def _validate_attrs(self):
"""Validates required attributes"""
<|body_0|>
def parse_and_save(self):
"""save if it doesnt exist"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not self.user:
raise Exception('self.user is... | stack_v2_sparse_classes_75kplus_train_003138 | 1,931 | no_license | [
{
"docstring": "Validates required attributes",
"name": "_validate_attrs",
"signature": "def _validate_attrs(self)"
},
{
"docstring": "save if it doesnt exist",
"name": "parse_and_save",
"signature": "def parse_and_save(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_035120 | Implement the Python class `FacebookModel` described below.
Class description:
Implement the FacebookModel class.
Method signatures and docstrings:
- def _validate_attrs(self): Validates required attributes
- def parse_and_save(self): save if it doesnt exist | Implement the Python class `FacebookModel` described below.
Class description:
Implement the FacebookModel class.
Method signatures and docstrings:
- def _validate_attrs(self): Validates required attributes
- def parse_and_save(self): save if it doesnt exist
<|skeleton|>
class FacebookModel:
def _validate_attrs... | 3c6f741e0d74f51bc85f7b73c8b188f2a726a7e6 | <|skeleton|>
class FacebookModel:
def _validate_attrs(self):
"""Validates required attributes"""
<|body_0|>
def parse_and_save(self):
"""save if it doesnt exist"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FacebookModel:
def _validate_attrs(self):
"""Validates required attributes"""
if not self.user:
raise Exception('self.user is required')
if not self.facebook_id:
raise Exception('self.facebook_id is required')
if not self.name:
raise Exceptio... | the_stack_v2_python_sparse | estagiario/apps/social_user/models/fb_model.py | pedromarins/estagiario | train | 0 | |
d39e17a393aa6fdc344046ef8159f4dd631d9f2d | [
"if status == 'CANCELLED' and (not cancel_reason):\n raise ILLError('You have to provide a cancel reason when cancelling a request')\nif cancel_reason and (not status == 'CANCELLED'):\n raise ILLError('If you select a cancel reason you need to select \"Cancelled\" in the state')",
"Document = current_app_il... | <|body_start_0|>
if status == 'CANCELLED' and (not cancel_reason):
raise ILLError('You have to provide a cancel reason when cancelling a request')
if cancel_reason and (not status == 'CANCELLED'):
raise ILLError('If you select a cancel reason you need to select "Cancelled" in the... | Ill record validator. | IllValidator | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IllValidator:
"""Ill record validator."""
def validate_cancel(self, status, cancel_reason):
"""Validate decline is correct."""
<|body_0|>
def ensure_document_exists(self, document_pid):
"""Ensure document exists or raise."""
<|body_1|>
def ensure_pat... | stack_v2_sparse_classes_75kplus_train_003139 | 13,301 | permissive | [
{
"docstring": "Validate decline is correct.",
"name": "validate_cancel",
"signature": "def validate_cancel(self, status, cancel_reason)"
},
{
"docstring": "Ensure document exists or raise.",
"name": "ensure_document_exists",
"signature": "def ensure_document_exists(self, document_pid)"
... | 5 | stack_v2_sparse_classes_30k_train_030766 | Implement the Python class `IllValidator` described below.
Class description:
Ill record validator.
Method signatures and docstrings:
- def validate_cancel(self, status, cancel_reason): Validate decline is correct.
- def ensure_document_exists(self, document_pid): Ensure document exists or raise.
- def ensure_patron_... | Implement the Python class `IllValidator` described below.
Class description:
Ill record validator.
Method signatures and docstrings:
- def validate_cancel(self, status, cancel_reason): Validate decline is correct.
- def ensure_document_exists(self, document_pid): Ensure document exists or raise.
- def ensure_patron_... | 1c36526e85510100c5f64059518d1b716d87ac10 | <|skeleton|>
class IllValidator:
"""Ill record validator."""
def validate_cancel(self, status, cancel_reason):
"""Validate decline is correct."""
<|body_0|>
def ensure_document_exists(self, document_pid):
"""Ensure document exists or raise."""
<|body_1|>
def ensure_pat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IllValidator:
"""Ill record validator."""
def validate_cancel(self, status, cancel_reason):
"""Validate decline is correct."""
if status == 'CANCELLED' and (not cancel_reason):
raise ILLError('You have to provide a cancel reason when cancelling a request')
if cancel_re... | the_stack_v2_python_sparse | invenio_app_ils/ill/api.py | inveniosoftware/invenio-app-ils | train | 64 |
d65d5cae739b3fe175dfb0ef3fa7d6b280384e75 | [
"super(ResNetBlock, self).__init__()\nself.inplace = False\n' (bool) Inplace. '\nself.conv1 = torch.nn.Conv2d(inplanes, planes, kernel_size=3, stride=stride, padding=1, bias=False)\ntorch.nn.init.kaiming_normal_(self.conv1.weight, mode='fan_out', nonlinearity='relu')\nself.normalization = normalization\nif self.nor... | <|body_start_0|>
super(ResNetBlock, self).__init__()
self.inplace = False
' (bool) Inplace. '
self.conv1 = torch.nn.Conv2d(inplanes, planes, kernel_size=3, stride=stride, padding=1, bias=False)
torch.nn.init.kaiming_normal_(self.conv1.weight, mode='fan_out', nonlinearity='relu')
... | ResNet block. | ResNetBlock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResNetBlock:
"""ResNet block."""
def __init__(self, inplanes, planes, stride=1, downsample=None, normalization=True):
"""Constructor. :param inplanes: input channels :type inplanes: int :param planes: output channels :type planes: int :param stride: stride :type stride: int :param do... | stack_v2_sparse_classes_75kplus_train_003140 | 2,400 | no_license | [
{
"docstring": "Constructor. :param inplanes: input channels :type inplanes: int :param planes: output channels :type planes: int :param stride: stride :type stride: int :param downsample: whether to downsample :type downsample: bool :param normalization: whether to use normalization :type normalization: bool",... | 2 | null | Implement the Python class `ResNetBlock` described below.
Class description:
ResNet block.
Method signatures and docstrings:
- def __init__(self, inplanes, planes, stride=1, downsample=None, normalization=True): Constructor. :param inplanes: input channels :type inplanes: int :param planes: output channels :type plan... | Implement the Python class `ResNetBlock` described below.
Class description:
ResNet block.
Method signatures and docstrings:
- def __init__(self, inplanes, planes, stride=1, downsample=None, normalization=True): Constructor. :param inplanes: input channels :type inplanes: int :param planes: output channels :type plan... | 8ed8b33afc6757a334c4d3f046fcb7793dd2c873 | <|skeleton|>
class ResNetBlock:
"""ResNet block."""
def __init__(self, inplanes, planes, stride=1, downsample=None, normalization=True):
"""Constructor. :param inplanes: input channels :type inplanes: int :param planes: output channels :type planes: int :param stride: stride :type stride: int :param do... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ResNetBlock:
"""ResNet block."""
def __init__(self, inplanes, planes, stride=1, downsample=None, normalization=True):
"""Constructor. :param inplanes: input channels :type inplanes: int :param planes: output channels :type planes: int :param stride: stride :type stride: int :param downsample: whe... | the_stack_v2_python_sparse | zoo/saved_instances/CCAT/models/resnet_block.py | lavanova/adaptive-auto-attack | train | 0 |
6fadbdb7d59da050da98b6ebfaa1449f04b33e5f | [
"result = {'result': 'NG', 'error': ''}\ndata_json = request.get_json(force=True)\nflag, error = CtrlUserGroup().update_manager_member(data_json)\nif flag:\n result['result'] = 'OK'\nelse:\n result['error'] = error\nreturn result",
"result = {'result': 'NG', 'error': ''}\nflag, error = CtrlUserGroup().delet... | <|body_start_0|>
result = {'result': 'NG', 'error': ''}
data_json = request.get_json(force=True)
flag, error = CtrlUserGroup().update_manager_member(data_json)
if flag:
result['result'] = 'OK'
else:
result['error'] = error
return result
<|end_body_... | 项目体制增加组员 | ApiManagerMemeber | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiManagerMemeber:
"""项目体制增加组员"""
def post(self):
"""更新"""
<|body_0|>
def delete(self, proj_id, group_id, user_id, commit_user):
"""删除"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = {'result': 'NG', 'error': ''}
data_json = req... | stack_v2_sparse_classes_75kplus_train_003141 | 3,031 | no_license | [
{
"docstring": "更新",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "删除",
"name": "delete",
"signature": "def delete(self, proj_id, group_id, user_id, commit_user)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013165 | Implement the Python class `ApiManagerMemeber` described below.
Class description:
项目体制增加组员
Method signatures and docstrings:
- def post(self): 更新
- def delete(self, proj_id, group_id, user_id, commit_user): 删除 | Implement the Python class `ApiManagerMemeber` described below.
Class description:
项目体制增加组员
Method signatures and docstrings:
- def post(self): 更新
- def delete(self, proj_id, group_id, user_id, commit_user): 删除
<|skeleton|>
class ApiManagerMemeber:
"""项目体制增加组员"""
def post(self):
"""更新"""
<|b... | 64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11 | <|skeleton|>
class ApiManagerMemeber:
"""项目体制增加组员"""
def post(self):
"""更新"""
<|body_0|>
def delete(self, proj_id, group_id, user_id, commit_user):
"""删除"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ApiManagerMemeber:
"""项目体制增加组员"""
def post(self):
"""更新"""
result = {'result': 'NG', 'error': ''}
data_json = request.get_json(force=True)
flag, error = CtrlUserGroup().update_manager_member(data_json)
if flag:
result['result'] = 'OK'
else:
... | the_stack_v2_python_sparse | koala/koala_server/app/api_1_0/api_user_group.py | lsn1183/web_project | train | 0 |
bd91eb8e431a535a5f8e6187fa689bafbde5917d | [
"trie = Trie()\ntrie.insert('Trieee')\nself.assertEqual(trie.search('Triee'), False)",
"trie = Trie()\ntrie.insert('Trieee')\nself.assertEqual(trie.startWith('Tri'), True)"
] | <|body_start_0|>
trie = Trie()
trie.insert('Trieee')
self.assertEqual(trie.search('Triee'), False)
<|end_body_0|>
<|body_start_1|>
trie = Trie()
trie.insert('Trieee')
self.assertEqual(trie.startWith('Tri'), True)
<|end_body_1|>
| TestTrie | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestTrie:
def testTrieSearch(self):
"""docstring"""
<|body_0|>
def testTrieStartWith(self):
"""docstring"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
trie = Trie()
trie.insert('Trieee')
self.assertEqual(trie.search('Triee'), False... | stack_v2_sparse_classes_75kplus_train_003142 | 7,022 | no_license | [
{
"docstring": "docstring",
"name": "testTrieSearch",
"signature": "def testTrieSearch(self)"
},
{
"docstring": "docstring",
"name": "testTrieStartWith",
"signature": "def testTrieStartWith(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_033168 | Implement the Python class `TestTrie` described below.
Class description:
Implement the TestTrie class.
Method signatures and docstrings:
- def testTrieSearch(self): docstring
- def testTrieStartWith(self): docstring | Implement the Python class `TestTrie` described below.
Class description:
Implement the TestTrie class.
Method signatures and docstrings:
- def testTrieSearch(self): docstring
- def testTrieStartWith(self): docstring
<|skeleton|>
class TestTrie:
def testTrieSearch(self):
"""docstring"""
<|body_0... | a15b3171365d26e859a08c891bd14ebc80ff5ae0 | <|skeleton|>
class TestTrie:
def testTrieSearch(self):
"""docstring"""
<|body_0|>
def testTrieStartWith(self):
"""docstring"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestTrie:
def testTrieSearch(self):
"""docstring"""
trie = Trie()
trie.insert('Trieee')
self.assertEqual(trie.search('Triee'), False)
def testTrieStartWith(self):
"""docstring"""
trie = Trie()
trie.insert('Trieee')
self.assertEqual(trie.star... | the_stack_v2_python_sparse | Week_07/Homework.py | sdaheng/algorithm019 | train | 0 | |
ccd15b87c7e9db0063b7d0d1289749829a417895 | [
"if graph.is_directed():\n raise ValueError('the graph is directed')\nself.graph = graph\nself.color = dict(((node, None) for node in self.graph.iternodes()))\nfor edge in self.graph.iteredges():\n if edge.source == edge.target:\n raise ValueError('a loop detected')",
"uncolored_graph = self.graph.co... | <|body_start_0|>
if graph.is_directed():
raise ValueError('the graph is directed')
self.graph = graph
self.color = dict(((node, None) for node in self.graph.iternodes()))
for edge in self.graph.iteredges():
if edge.source == edge.target:
raise Valu... | Recursive Largest First (RLF) algorithm for node coloring. | RLFNodeColoring1 | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RLFNodeColoring1:
"""Recursive Largest First (RLF) algorithm for node coloring."""
def __init__(self, graph):
"""The algorithm initialization."""
<|body_0|>
def run(self):
"""Executable pseudocode."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_003143 | 5,309 | permissive | [
{
"docstring": "The algorithm initialization.",
"name": "__init__",
"signature": "def __init__(self, graph)"
},
{
"docstring": "Executable pseudocode.",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002477 | Implement the Python class `RLFNodeColoring1` described below.
Class description:
Recursive Largest First (RLF) algorithm for node coloring.
Method signatures and docstrings:
- def __init__(self, graph): The algorithm initialization.
- def run(self): Executable pseudocode. | Implement the Python class `RLFNodeColoring1` described below.
Class description:
Recursive Largest First (RLF) algorithm for node coloring.
Method signatures and docstrings:
- def __init__(self, graph): The algorithm initialization.
- def run(self): Executable pseudocode.
<|skeleton|>
class RLFNodeColoring1:
""... | 0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60 | <|skeleton|>
class RLFNodeColoring1:
"""Recursive Largest First (RLF) algorithm for node coloring."""
def __init__(self, graph):
"""The algorithm initialization."""
<|body_0|>
def run(self):
"""Executable pseudocode."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RLFNodeColoring1:
"""Recursive Largest First (RLF) algorithm for node coloring."""
def __init__(self, graph):
"""The algorithm initialization."""
if graph.is_directed():
raise ValueError('the graph is directed')
self.graph = graph
self.color = dict(((node, None... | the_stack_v2_python_sparse | graphtheory/coloring/nodecolorrlf.py | kgashok/graphs-dict | train | 0 |
07c372fb5d11e70a822c1a8af603fe36562d9e52 | [
"super().__init__(reporters, max_iterations, evaluator, individual_generator, target_fitness)\nself.selector = selector\nself.crossover = crossover\nself.mutation = mutation\nself.population_size = population_size\nself.population = individual_generator.batch_generate(population_size)",
"self.evaluator.batch_eval... | <|body_start_0|>
super().__init__(reporters, max_iterations, evaluator, individual_generator, target_fitness)
self.selector = selector
self.crossover = crossover
self.mutation = mutation
self.population_size = population_size
self.population = individual_generator.batch_g... | Genetic algorithm class | GeneticAlgorithm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeneticAlgorithm:
"""Genetic algorithm class"""
def __init__(self, reporters, evaluator, selector, crossover, mutation, population_size, individual_generator, max_iterations, target_fitness=None):
"""Initialize genetic algorithm hyperparameters. :param evaluator: Evaluator instance :... | stack_v2_sparse_classes_75kplus_train_003144 | 2,221 | no_license | [
{
"docstring": "Initialize genetic algorithm hyperparameters. :param evaluator: Evaluator instance :param reporters: List of Reporter instances :param selector: Selector to be used :param crossover: Crossover to be used :param mutation: Mutation to be used :param population_size: population size :param individu... | 2 | stack_v2_sparse_classes_30k_train_007426 | Implement the Python class `GeneticAlgorithm` described below.
Class description:
Genetic algorithm class
Method signatures and docstrings:
- def __init__(self, reporters, evaluator, selector, crossover, mutation, population_size, individual_generator, max_iterations, target_fitness=None): Initialize genetic algorith... | Implement the Python class `GeneticAlgorithm` described below.
Class description:
Genetic algorithm class
Method signatures and docstrings:
- def __init__(self, reporters, evaluator, selector, crossover, mutation, population_size, individual_generator, max_iterations, target_fitness=None): Initialize genetic algorith... | 30d87754ed22aa5aab7103d912c414f5a6150a34 | <|skeleton|>
class GeneticAlgorithm:
"""Genetic algorithm class"""
def __init__(self, reporters, evaluator, selector, crossover, mutation, population_size, individual_generator, max_iterations, target_fitness=None):
"""Initialize genetic algorithm hyperparameters. :param evaluator: Evaluator instance :... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GeneticAlgorithm:
"""Genetic algorithm class"""
def __init__(self, reporters, evaluator, selector, crossover, mutation, population_size, individual_generator, max_iterations, target_fitness=None):
"""Initialize genetic algorithm hyperparameters. :param evaluator: Evaluator instance :param reporte... | the_stack_v2_python_sparse | algorithms/genetic_algorithm.py | Yabk/SF-Evolution | train | 0 |
bae3ebeb2007b1032f63180a2691e26875352db5 | [
"DataFrame.__init__(self, rows=rows, list_x_min=list_x_min, list_x_max=list_x_max, list_x_delta=list_x_delta)\nself.listXDelta = list_x_delta\nsum_probs = 0\nfor row in rows:\n sum_probs += row[-1]\nif sum_probs < 0.99999 or sum_probs > 1.000001:\n raise ValueError('Sum of probabilities should add to 1.')",
... | <|body_start_0|>
DataFrame.__init__(self, rows=rows, list_x_min=list_x_min, list_x_max=list_x_max, list_x_delta=list_x_delta)
self.listXDelta = list_x_delta
sum_probs = 0
for row in rows:
sum_probs += row[-1]
if sum_probs < 0.99999 or sum_probs > 1.000001:
... | example: age, sex, probability 0, 0, 0.1, 0, 1, 0.2, 5, 0, 0.3, 5, 1, 0.4, | DataFrameWithEmpiricalDist | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataFrameWithEmpiricalDist:
"""example: age, sex, probability 0, 0, 0.1, 0, 1, 0.2, 5, 0, 0.3, 5, 1, 0.4,"""
def __init__(self, rows, list_x_min, list_x_max, list_x_delta):
""":param rows: (list of list) the table above :param list_x_min: list of minimum value of x (in example above:... | stack_v2_sparse_classes_75kplus_train_003145 | 22,072 | no_license | [
{
"docstring": ":param rows: (list of list) the table above :param list_x_min: list of minimum value of x (in example above: [0, 0]) :param list_x_max: list of maximum value of x (in example above: [10, 1]) :param list_x_delta: list of interval between break points of x if set to 'int', x is treated as categori... | 2 | stack_v2_sparse_classes_30k_train_015085 | Implement the Python class `DataFrameWithEmpiricalDist` described below.
Class description:
example: age, sex, probability 0, 0, 0.1, 0, 1, 0.2, 5, 0, 0.3, 5, 1, 0.4,
Method signatures and docstrings:
- def __init__(self, rows, list_x_min, list_x_max, list_x_delta): :param rows: (list of list) the table above :param ... | Implement the Python class `DataFrameWithEmpiricalDist` described below.
Class description:
example: age, sex, probability 0, 0, 0.1, 0, 1, 0.2, 5, 0, 0.3, 5, 1, 0.4,
Method signatures and docstrings:
- def __init__(self, rows, list_x_min, list_x_max, list_x_delta): :param rows: (list of list) the table above :param ... | 2c456d92741ba751af6bc90c49608b49f524182d | <|skeleton|>
class DataFrameWithEmpiricalDist:
"""example: age, sex, probability 0, 0, 0.1, 0, 1, 0.2, 5, 0, 0.3, 5, 1, 0.4,"""
def __init__(self, rows, list_x_min, list_x_max, list_x_delta):
""":param rows: (list of list) the table above :param list_x_min: list of minimum value of x (in example above:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DataFrameWithEmpiricalDist:
"""example: age, sex, probability 0, 0, 0.1, 0, 1, 0.2, 5, 0, 0.3, 5, 1, 0.4,"""
def __init__(self, rows, list_x_min, list_x_max, list_x_delta):
""":param rows: (list of list) the table above :param list_x_min: list of minimum value of x (in example above: [0, 0]) :par... | the_stack_v2_python_sparse | SimPy/DataFrames.py | yaesoubilab/SimPy | train | 6 |
1be18f30372b9169ef9deb2d4ce604483a97b78f | [
"if nums == []:\n return None\nfirst = 0\nlast = len(nums) - 1\nwhile last - first > 1:\n mid = (first + last) // 2\n if nums[mid] > target:\n last = mid\n else:\n first = mid\nif nums[first] == target:\n return first\nelif nums[last] == target:\n return last\nelse:\n return None"... | <|body_start_0|>
if nums == []:
return None
first = 0
last = len(nums) - 1
while last - first > 1:
mid = (first + last) // 2
if nums[mid] > target:
last = mid
else:
first = mid
if nums[first] == targe... | Solution1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution1:
def binarysearch(self, nums, target):
""":type nums: list :type target int"""
<|body_0|>
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if... | stack_v2_sparse_classes_75kplus_train_003146 | 1,527 | no_license | [
{
"docstring": ":type nums: list :type target int",
"name": "binarysearch",
"signature": "def binarysearch(self, nums, target)"
},
{
"docstring": ":type numbers: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, numbers, target)"
}
] | 2 | stack_v2_sparse_classes_30k_train_045651 | Implement the Python class `Solution1` described below.
Class description:
Implement the Solution1 class.
Method signatures and docstrings:
- def binarysearch(self, nums, target): :type nums: list :type target int
- def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int] | Implement the Python class `Solution1` described below.
Class description:
Implement the Solution1 class.
Method signatures and docstrings:
- def binarysearch(self, nums, target): :type nums: list :type target int
- def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int]
<|ske... | 9bd2d706f014ce84356ba38fc7801da0285a91d3 | <|skeleton|>
class Solution1:
def binarysearch(self, nums, target):
""":type nums: list :type target int"""
<|body_0|>
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution1:
def binarysearch(self, nums, target):
""":type nums: list :type target int"""
if nums == []:
return None
first = 0
last = len(nums) - 1
while last - first > 1:
mid = (first + last) // 2
if nums[mid] > target:
... | the_stack_v2_python_sparse | leetcode/twoSum-167.py | pittcat/Algorithm_Practice | train | 0 | |
410c3e5bbb8252eee783021c754ad1383cc0864a | [
"self.product_code = product_code\nself.description = description\nself.market_price = market_price\nself.rental_price = rental_price",
"output_dict = {}\noutput_dict['product_code'] = self.product_code\noutput_dict['description'] = self.description\noutput_dict['market_price'] = self.market_price\noutput_dict['r... | <|body_start_0|>
self.product_code = product_code
self.description = description
self.market_price = market_price
self.rental_price = rental_price
<|end_body_0|>
<|body_start_1|>
output_dict = {}
output_dict['product_code'] = self.product_code
output_dict['descri... | Class for creating inventory object Methods: return_as_dictionary: Convert inventory object to a dictionary with keys for each attribute name and values for attribute value | Inventory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Inventory:
"""Class for creating inventory object Methods: return_as_dictionary: Convert inventory object to a dictionary with keys for each attribute name and values for attribute value"""
def __init__(self, product_code, description, market_price, rental_price):
"""Create instance ... | stack_v2_sparse_classes_75kplus_train_003147 | 1,525 | no_license | [
{
"docstring": "Create instance of inventory object Args: product_code (alphanumeric): Unique product code description (string): Description of product market_price (numeric): Product price rental_price (numeric): Product rental price",
"name": "__init__",
"signature": "def __init__(self, product_code, ... | 2 | stack_v2_sparse_classes_30k_val_002398 | Implement the Python class `Inventory` described below.
Class description:
Class for creating inventory object Methods: return_as_dictionary: Convert inventory object to a dictionary with keys for each attribute name and values for attribute value
Method signatures and docstrings:
- def __init__(self, product_code, d... | Implement the Python class `Inventory` described below.
Class description:
Class for creating inventory object Methods: return_as_dictionary: Convert inventory object to a dictionary with keys for each attribute name and values for attribute value
Method signatures and docstrings:
- def __init__(self, product_code, d... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class Inventory:
"""Class for creating inventory object Methods: return_as_dictionary: Convert inventory object to a dictionary with keys for each attribute name and values for attribute value"""
def __init__(self, product_code, description, market_price, rental_price):
"""Create instance ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Inventory:
"""Class for creating inventory object Methods: return_as_dictionary: Convert inventory object to a dictionary with keys for each attribute name and values for attribute value"""
def __init__(self, product_code, description, market_price, rental_price):
"""Create instance of inventory ... | the_stack_v2_python_sparse | students/gregdevore/lesson01/assignment/inventory_management/inventory_class.py | JavaRod/SP_Python220B_2019 | train | 1 |
806a72898252ae695e7d055da974c9ec92a2d473 | [
"if 'angle' in kwargs and isinstance(kwargs['angle'], (int, float)):\n self.angle = kwargs.get('angle', 0)\nelse:\n raise ValueError(\"Unsupported angle format or angle doesn't set\")",
"if not isinstance(resource, Image.Image):\n raise ValueError('Unknown resource format')\nresource_format = resource.fo... | <|body_start_0|>
if 'angle' in kwargs and isinstance(kwargs['angle'], (int, float)):
self.angle = kwargs.get('angle', 0)
else:
raise ValueError("Unsupported angle format or angle doesn't set")
<|end_body_0|>
<|body_start_1|>
if not isinstance(resource, Image.Image):
... | Rotate filter | RotateFilter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RotateFilter:
"""Rotate filter"""
def __init__(self, **kwargs):
""":param kwargs: dict"""
<|body_0|>
def apply(self, resource):
"""Apply filter to resource :param resource: Image :return: Image"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if ... | stack_v2_sparse_classes_75kplus_train_003148 | 935 | permissive | [
{
"docstring": ":param kwargs: dict",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Apply filter to resource :param resource: Image :return: Image",
"name": "apply",
"signature": "def apply(self, resource)"
}
] | 2 | stack_v2_sparse_classes_30k_test_003029 | Implement the Python class `RotateFilter` described below.
Class description:
Rotate filter
Method signatures and docstrings:
- def __init__(self, **kwargs): :param kwargs: dict
- def apply(self, resource): Apply filter to resource :param resource: Image :return: Image | Implement the Python class `RotateFilter` described below.
Class description:
Rotate filter
Method signatures and docstrings:
- def __init__(self, **kwargs): :param kwargs: dict
- def apply(self, resource): Apply filter to resource :param resource: Image :return: Image
<|skeleton|>
class RotateFilter:
"""Rotate ... | c42b2f068f449891a72ff48fc3526e8472fe9edb | <|skeleton|>
class RotateFilter:
"""Rotate filter"""
def __init__(self, **kwargs):
""":param kwargs: dict"""
<|body_0|>
def apply(self, resource):
"""Apply filter to resource :param resource: Image :return: Image"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RotateFilter:
"""Rotate filter"""
def __init__(self, **kwargs):
""":param kwargs: dict"""
if 'angle' in kwargs and isinstance(kwargs['angle'], (int, float)):
self.angle = kwargs.get('angle', 0)
else:
raise ValueError("Unsupported angle format or angle doesn... | the_stack_v2_python_sparse | flask_imagine/filters/rotate.py | FlaskGuys/Flask-Imagine | train | 1 |
6ac5c476eaa579b7296775513e26587a3aa7c648 | [
"length = len(prices)\nif length == 0:\n return 0\nresult = 0\nbuy = prices[0]\nsell = 0\nfor i in range(1, length):\n if sell == 0:\n diff = prices[i] - buy\n if diff <= 0:\n buy = prices[i]\n else:\n sell = prices[i]\n else:\n diff = prices[i] - sell\n ... | <|body_start_0|>
length = len(prices)
if length == 0:
return 0
result = 0
buy = prices[0]
sell = 0
for i in range(1, length):
if sell == 0:
diff = prices[i] - buy
if diff <= 0:
buy = prices[i]
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit2(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
length = len(prices)
if length =... | stack_v2_sparse_classes_75kplus_train_003149 | 1,400 | permissive | [
{
"docstring": ":type prices: List[int] :rtype: int",
"name": "maxProfit",
"signature": "def maxProfit(self, prices)"
},
{
"docstring": ":type prices: List[int] :rtype: int",
"name": "maxProfit2",
"signature": "def maxProfit2(self, prices)"
}
] | 2 | stack_v2_sparse_classes_30k_train_022652 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices): :type prices: List[int] :rtype: int
- def maxProfit2(self, prices): :type prices: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices): :type prices: List[int] :rtype: int
- def maxProfit2(self, prices): :type prices: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxPro... | c8bf33af30569177c5276ffcd72a8d93ba4c402a | <|skeleton|>
class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit2(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
length = len(prices)
if length == 0:
return 0
result = 0
buy = prices[0]
sell = 0
for i in range(1, length):
if sell == 0:
diff = pri... | the_stack_v2_python_sparse | 101-200/121-130/122-buyAndSell2/buyAndSell2.py | xuychen/Leetcode | train | 0 | |
e5135289c0ffe09523d2221a36797d71b06460cf | [
"if self.__class__ == other.__class__:\n return self.value == other.value\nelse:\n return self.value == other",
"if self.__class__ == other.__class__:\n return self.value >= other.value\nelse:\n return self.value >= other",
"if self.__class__ == other.__class__:\n return self.value <= other.value... | <|body_start_0|>
if self.__class__ == other.__class__:
return self.value == other.value
else:
return self.value == other
<|end_body_0|>
<|body_start_1|>
if self.__class__ == other.__class__:
return self.value >= other.value
else:
return se... | An enum that supports order comparisons. Outlined in https://docs.python.org/3/library/enum.html#orderedenum | OrderedEnum | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrderedEnum:
"""An enum that supports order comparisons. Outlined in https://docs.python.org/3/library/enum.html#orderedenum"""
def __eq__(self, other):
"""Equality comparison. :param other: The other value to compare with. :type other: :class:`~objects.ordered_enum.OrderedEnum`"""
... | stack_v2_sparse_classes_75kplus_train_003150 | 2,039 | no_license | [
{
"docstring": "Equality comparison. :param other: The other value to compare with. :type other: :class:`~objects.ordered_enum.OrderedEnum`",
"name": "__eq__",
"signature": "def __eq__(self, other)"
},
{
"docstring": "Greater than or equal to comparison. :param other: The other value to compare ... | 5 | null | Implement the Python class `OrderedEnum` described below.
Class description:
An enum that supports order comparisons. Outlined in https://docs.python.org/3/library/enum.html#orderedenum
Method signatures and docstrings:
- def __eq__(self, other): Equality comparison. :param other: The other value to compare with. :ty... | Implement the Python class `OrderedEnum` described below.
Class description:
An enum that supports order comparisons. Outlined in https://docs.python.org/3/library/enum.html#orderedenum
Method signatures and docstrings:
- def __eq__(self, other): Equality comparison. :param other: The other value to compare with. :ty... | 6320913c6adf31347d4b1f8d398bd65b61428cfb | <|skeleton|>
class OrderedEnum:
"""An enum that supports order comparisons. Outlined in https://docs.python.org/3/library/enum.html#orderedenum"""
def __eq__(self, other):
"""Equality comparison. :param other: The other value to compare with. :type other: :class:`~objects.ordered_enum.OrderedEnum`"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OrderedEnum:
"""An enum that supports order comparisons. Outlined in https://docs.python.org/3/library/enum.html#orderedenum"""
def __eq__(self, other):
"""Equality comparison. :param other: The other value to compare with. :type other: :class:`~objects.ordered_enum.OrderedEnum`"""
if sel... | the_stack_v2_python_sparse | lib/objects/ordered_enum.py | TianhaoFu/eld-data | train | 0 |
89a83a0e512e7a07c2abc97af9c93057ff6e2b34 | [
"self.probability = probability\nself.children = []\nself.parents = []\nself.face = face\nself.is_sink = True if not self.children else False\nself.has_parent = False\nself.num_parents = 0",
"self.is_sink = False\nself.children.append(child)\nchild.parents.append(self)\nchild.has_parent = True\nchild.num_parents ... | <|body_start_0|>
self.probability = probability
self.children = []
self.parents = []
self.face = face
self.is_sink = True if not self.children else False
self.has_parent = False
self.num_parents = 0
<|end_body_0|>
<|body_start_1|>
self.is_sink = False
... | Each face of the convex hull of a polyhedron is represented as a Vertex in a directed acyclic graph | Vertex | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vertex:
"""Each face of the convex hull of a polyhedron is represented as a Vertex in a directed acyclic graph"""
def __init__(self, probability, face, children=[]):
"""Create a Vertex with given probability and children probability -- float probability of toppling children -- array ... | stack_v2_sparse_classes_75kplus_train_003151 | 17,384 | no_license | [
{
"docstring": "Create a Vertex with given probability and children probability -- float probability of toppling children -- array of vertices pointed at by this vertex",
"name": "__init__",
"signature": "def __init__(self, probability, face, children=[])"
},
{
"docstring": "Connects this vertex... | 2 | stack_v2_sparse_classes_30k_val_000135 | Implement the Python class `Vertex` described below.
Class description:
Each face of the convex hull of a polyhedron is represented as a Vertex in a directed acyclic graph
Method signatures and docstrings:
- def __init__(self, probability, face, children=[]): Create a Vertex with given probability and children probab... | Implement the Python class `Vertex` described below.
Class description:
Each face of the convex hull of a polyhedron is represented as a Vertex in a directed acyclic graph
Method signatures and docstrings:
- def __init__(self, probability, face, children=[]): Create a Vertex with given probability and children probab... | 92f2d11d76439a86d4e795d3373cc8cd24adaa62 | <|skeleton|>
class Vertex:
"""Each face of the convex hull of a polyhedron is represented as a Vertex in a directed acyclic graph"""
def __init__(self, probability, face, children=[]):
"""Create a Vertex with given probability and children probability -- float probability of toppling children -- array ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Vertex:
"""Each face of the convex hull of a polyhedron is represented as a Vertex in a directed acyclic graph"""
def __init__(self, probability, face, children=[]):
"""Create a Vertex with given probability and children probability -- float probability of toppling children -- array of vertices p... | the_stack_v2_python_sparse | dex-net-new-api/src/dexnet/stable_poses.py | BerkeleyAutomation/optimal_manipulation_simulator | train | 6 |
86951d6db83ab5f1900c3e52c12cae259b1c6310 | [
"super(ActorSnn, self).__init__()\nself.fc1 = nn.Linear(state_dim, 400)\nself.fc2 = nn.Linear(400, 300)\nself.fc3 = nn.Linear(300, action_dim)\nselu_weights_init(self.fc1)\nselu_weights_init(self.fc2)\nselu_weights_init(self.fc3)\nnn.init.uniform_(self.fc3.weight, -0.0003, 0.0003)",
"x = self.fc1(batch)\nx = F.se... | <|body_start_0|>
super(ActorSnn, self).__init__()
self.fc1 = nn.Linear(state_dim, 400)
self.fc2 = nn.Linear(400, 300)
self.fc3 = nn.Linear(300, action_dim)
selu_weights_init(self.fc1)
selu_weights_init(self.fc2)
selu_weights_init(self.fc3)
nn.init.uniform_... | Represents an Actor in the Actor to Critic Model. | ActorSnn | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActorSnn:
"""Represents an Actor in the Actor to Critic Model."""
def __init__(self, state_dim, action_dim):
"""Initialise layers. Args: state_dim (int) : Number of state inputs action_dim (int) : Number of action ouputs"""
<|body_0|>
def forward(self, batch):
""... | stack_v2_sparse_classes_75kplus_train_003152 | 13,450 | no_license | [
{
"docstring": "Initialise layers. Args: state_dim (int) : Number of state inputs action_dim (int) : Number of action ouputs",
"name": "__init__",
"signature": "def __init__(self, state_dim, action_dim)"
},
{
"docstring": "Generate action policy for the batch of states. Args: batch (float tensor... | 2 | stack_v2_sparse_classes_30k_train_024112 | Implement the Python class `ActorSnn` described below.
Class description:
Represents an Actor in the Actor to Critic Model.
Method signatures and docstrings:
- def __init__(self, state_dim, action_dim): Initialise layers. Args: state_dim (int) : Number of state inputs action_dim (int) : Number of action ouputs
- def ... | Implement the Python class `ActorSnn` described below.
Class description:
Represents an Actor in the Actor to Critic Model.
Method signatures and docstrings:
- def __init__(self, state_dim, action_dim): Initialise layers. Args: state_dim (int) : Number of state inputs action_dim (int) : Number of action ouputs
- def ... | 6dcb04e79f776fc780b843208e2c689578c94bb3 | <|skeleton|>
class ActorSnn:
"""Represents an Actor in the Actor to Critic Model."""
def __init__(self, state_dim, action_dim):
"""Initialise layers. Args: state_dim (int) : Number of state inputs action_dim (int) : Number of action ouputs"""
<|body_0|>
def forward(self, batch):
""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ActorSnn:
"""Represents an Actor in the Actor to Critic Model."""
def __init__(self, state_dim, action_dim):
"""Initialise layers. Args: state_dim (int) : Number of state inputs action_dim (int) : Number of action ouputs"""
super(ActorSnn, self).__init__()
self.fc1 = nn.Linear(sta... | the_stack_v2_python_sparse | retina_reinforcement_sim/src/model/models.py | lewisboyd/MsciProject | train | 0 |
8fd1cdd2f48b7836cfb82f52cd1960c39fce9dc2 | [
"settings = self.settings\ncmd = [config['exe_paths']['jshint'], '--extract=%s' % settings['extract_js_from_html'], '--reporter=%s' % self.REPORTER_PATH]\nconfig_content = self.settings['config']\nif config_content:\n cmd.append('--config=%s' % make_tempfile(content=config_content.encode('utf-8')))\nreturn cmd",... | <|body_start_0|>
settings = self.settings
cmd = [config['exe_paths']['jshint'], '--extract=%s' % settings['extract_js_from_html'], '--reporter=%s' % self.REPORTER_PATH]
config_content = self.settings['config']
if config_content:
cmd.append('--config=%s' % make_tempfile(conten... | Review Bot tool to run jshint. | JSHintTool | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JSHintTool:
"""Review Bot tool to run jshint."""
def build_base_command(self, **kwargs):
"""Build the base command line used to review files. If a custom JSHint configuration is set, this will save it to a temporary file and pass it along for all JSHint runs. Args: **kwargs (dict, un... | stack_v2_sparse_classes_75kplus_train_003153 | 4,667 | permissive | [
{
"docstring": "Build the base command line used to review files. If a custom JSHint configuration is set, this will save it to a temporary file and pass it along for all JSHint runs. Args: **kwargs (dict, unused): Additional keyword arguments. Returns: list of unicode: The base command line.",
"name": "bui... | 2 | stack_v2_sparse_classes_30k_train_008291 | Implement the Python class `JSHintTool` described below.
Class description:
Review Bot tool to run jshint.
Method signatures and docstrings:
- def build_base_command(self, **kwargs): Build the base command line used to review files. If a custom JSHint configuration is set, this will save it to a temporary file and pa... | Implement the Python class `JSHintTool` described below.
Class description:
Review Bot tool to run jshint.
Method signatures and docstrings:
- def build_base_command(self, **kwargs): Build the base command line used to review files. If a custom JSHint configuration is set, this will save it to a temporary file and pa... | b59b566e127b5ef1b08f3189f1aa0194b7437d94 | <|skeleton|>
class JSHintTool:
"""Review Bot tool to run jshint."""
def build_base_command(self, **kwargs):
"""Build the base command line used to review files. If a custom JSHint configuration is set, this will save it to a temporary file and pass it along for all JSHint runs. Args: **kwargs (dict, un... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class JSHintTool:
"""Review Bot tool to run jshint."""
def build_base_command(self, **kwargs):
"""Build the base command line used to review files. If a custom JSHint configuration is set, this will save it to a temporary file and pass it along for all JSHint runs. Args: **kwargs (dict, unused): Additi... | the_stack_v2_python_sparse | bot/reviewbot/tools/jshint.py | reviewboard/ReviewBot | train | 110 |
2963d978adc7c224d24aa605754d7cdd4b95f3af | [
"self.__property1: str = property1\nself.__operation: str = operation\nself.__property2: str = property2",
"name = path or 'args'\nvalue1 = ObjectReader.get_property(value, self.__property1)\nvalue2 = ObjectReader.get_property(value, self.__property2)\nif not ObjectComparator.compare(value1, self.__operation, val... | <|body_start_0|>
self.__property1: str = property1
self.__operation: str = operation
self.__property2: str = property2
<|end_body_0|>
<|body_start_1|>
name = path or 'args'
value1 = ObjectReader.get_property(value, self.__property1)
value2 = ObjectReader.get_property(val... | Validation rule that compares two object properties. Example: .. code-block:: python schema = ObjectSchema().with_rule(PropertyComparisonRule("field1", "NE", "field2")) schema.validate({ field1: 1, field2: 2 }) # Result: no errors schema.validate({ field1: 1, field2: 1 }) # Result: field1 shall not be equal to field2 s... | PropertiesComparisonRule | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PropertiesComparisonRule:
"""Validation rule that compares two object properties. Example: .. code-block:: python schema = ObjectSchema().with_rule(PropertyComparisonRule("field1", "NE", "field2")) schema.validate({ field1: 1, field2: 2 }) # Result: no errors schema.validate({ field1: 1, field2: ... | stack_v2_sparse_classes_75kplus_train_003154 | 2,842 | permissive | [
{
"docstring": "Creates a new validation rule and sets its arguments. :param property1: a name of the first property to compare. :param operation: a comparison operation: \"==\" (\"=\", \"EQ\"), \"!= \" (\"<>\", \"NE\"); \"<\"/\">\" (\"LT\"/\"GT\"), \"<=\"/\">=\" (\"LE\"/\"GE\"); \"LIKE\". :param property2: a n... | 2 | stack_v2_sparse_classes_30k_train_014516 | Implement the Python class `PropertiesComparisonRule` described below.
Class description:
Validation rule that compares two object properties. Example: .. code-block:: python schema = ObjectSchema().with_rule(PropertyComparisonRule("field1", "NE", "field2")) schema.validate({ field1: 1, field2: 2 }) # Result: no error... | Implement the Python class `PropertiesComparisonRule` described below.
Class description:
Validation rule that compares two object properties. Example: .. code-block:: python schema = ObjectSchema().with_rule(PropertyComparisonRule("field1", "NE", "field2")) schema.validate({ field1: 1, field2: 2 }) # Result: no error... | 17f8a231fb75684032ec57b24025c9a3ca3dcdd6 | <|skeleton|>
class PropertiesComparisonRule:
"""Validation rule that compares two object properties. Example: .. code-block:: python schema = ObjectSchema().with_rule(PropertyComparisonRule("field1", "NE", "field2")) schema.validate({ field1: 1, field2: 2 }) # Result: no errors schema.validate({ field1: 1, field2: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PropertiesComparisonRule:
"""Validation rule that compares two object properties. Example: .. code-block:: python schema = ObjectSchema().with_rule(PropertyComparisonRule("field1", "NE", "field2")) schema.validate({ field1: 1, field2: 2 }) # Result: no errors schema.validate({ field1: 1, field2: 1 }) # Result... | the_stack_v2_python_sparse | pip_services3_commons/validate/PropertiesComparisonRule.py | pip-services3-python/pip-services3-commons-python | train | 0 |
35aab647286e2fe337274fd92a4fbd27d61f91ed | [
"self.telephone = [(), ('*',), ('a', 'b', 'c'), ('d', 'e', 'f'), ('g', 'h', 'i'), ('j', 'k', 'l'), ('m', 'n', 'o'), ('p', 'q', 'r', 's'), ('t', 'u', 'v'), ('w', 'x', 'y', 'z')]\nif len(digits) == 0:\n return []\nelif len(digits) == 1:\n return list(self.telephone[int(digits[0])])\nelse:\n return self.dfs(0... | <|body_start_0|>
self.telephone = [(), ('*',), ('a', 'b', 'c'), ('d', 'e', 'f'), ('g', 'h', 'i'), ('j', 'k', 'l'), ('m', 'n', 'o'), ('p', 'q', 'r', 's'), ('t', 'u', 'v'), ('w', 'x', 'y', 'z')]
if len(digits) == 0:
return []
elif len(digits) == 1:
return list(self.telephon... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def letterCombinations(self, digits):
""":type digits: str :rtype: List[str]"""
<|body_0|>
def dfs(self, i, digits):
""":type i: int :type digits: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.telephone = [(), ('*',), ('a', 'b',... | stack_v2_sparse_classes_75kplus_train_003155 | 1,585 | no_license | [
{
"docstring": ":type digits: str :rtype: List[str]",
"name": "letterCombinations",
"signature": "def letterCombinations(self, digits)"
},
{
"docstring": ":type i: int :type digits: str",
"name": "dfs",
"signature": "def dfs(self, i, digits)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012013 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def letterCombinations(self, digits): :type digits: str :rtype: List[str]
- def dfs(self, i, digits): :type i: int :type digits: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def letterCombinations(self, digits): :type digits: str :rtype: List[str]
- def dfs(self, i, digits): :type i: int :type digits: str
<|skeleton|>
class Solution:
def letter... | f832227c4d0e0b1c0cc326561187004ef24e2a68 | <|skeleton|>
class Solution:
def letterCombinations(self, digits):
""":type digits: str :rtype: List[str]"""
<|body_0|>
def dfs(self, i, digits):
""":type i: int :type digits: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def letterCombinations(self, digits):
""":type digits: str :rtype: List[str]"""
self.telephone = [(), ('*',), ('a', 'b', 'c'), ('d', 'e', 'f'), ('g', 'h', 'i'), ('j', 'k', 'l'), ('m', 'n', 'o'), ('p', 'q', 'r', 's'), ('t', 'u', 'v'), ('w', 'x', 'y', 'z')]
if len(digits) == 0:... | the_stack_v2_python_sparse | 17.py | Gackle/leetcode_practice | train | 0 | |
7827ddd9f4cfc18c123f16a5583632fe720d95b8 | [
"self.nums = nums\nself.lens = len(nums)\nself.BIT = [0] * (self.lens + 1)\nfor i in range(self.lens):\n k = i + 1\n while k <= self.lens:\n self.BIT[k] += nums[i]\n k += k & -k",
"diff = val - self.nums[i]\nself.nums[i] = val\ni += 1\nwhile i <= self.lens:\n self.BIT[i] += diff\n i += i... | <|body_start_0|>
self.nums = nums
self.lens = len(nums)
self.BIT = [0] * (self.lens + 1)
for i in range(self.lens):
k = i + 1
while k <= self.lens:
self.BIT[k] += nums[i]
k += k & -k
<|end_body_0|>
<|body_start_1|>
diff = v... | NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def update(self, i, val):
"""update 操作一直都是遍历左侧 :type i: int :type val: int :rtype: void"""
<|body_1|>
def sumRange(self, i, j):
"""sum: 遍历右侧 上一层已经把左侧的值加上去了,而左侧的索引又是小于右侧,所以... | stack_v2_sparse_classes_75kplus_train_003156 | 1,921 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": "update 操作一直都是遍历左侧 :type i: int :type val: int :rtype: void",
"name": "update",
"signature": "def update(self, i, val)"
},
{
"docstring": "sum: 遍历右侧 上一层已经把左侧的值加上去... | 3 | stack_v2_sparse_classes_30k_train_044662 | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def update(self, i, val): update 操作一直都是遍历左侧 :type i: int :type val: int :rtype: void
- def sumRange(self, i, j): sum: 遍历右侧 上一层已经... | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def update(self, i, val): update 操作一直都是遍历左侧 :type i: int :type val: int :rtype: void
- def sumRange(self, i, j): sum: 遍历右侧 上一层已经... | 212f8b83d6ac22db1a777f980075d9e12ce521d2 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def update(self, i, val):
"""update 操作一直都是遍历左侧 :type i: int :type val: int :rtype: void"""
<|body_1|>
def sumRange(self, i, j):
"""sum: 遍历右侧 上一层已经把左侧的值加上去了,而左侧的索引又是小于右侧,所以... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
self.nums = nums
self.lens = len(nums)
self.BIT = [0] * (self.lens + 1)
for i in range(self.lens):
k = i + 1
while k <= self.lens:
self.BIT[k] += nums[i]
... | the_stack_v2_python_sparse | Data Structures and Algorithm Analysis/tree/Binary Indexed Tree.py | FrankieZhen/Lookoop | train | 1 | |
a6fe174c99fcd417755167f97fcddc8b3f87413e | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DirectoryRole()",
"from .directory_object import DirectoryObject\nfrom .scoped_role_membership import ScopedRoleMembership\nfrom .directory_object import DirectoryObject\nfrom .scoped_role_membership import ScopedRoleMembership\nfields... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return DirectoryRole()
<|end_body_0|>
<|body_start_1|>
from .directory_object import DirectoryObject
from .scoped_role_membership import ScopedRoleMembership
from .directory_object impo... | DirectoryRole | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DirectoryRole:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DirectoryRole:
"""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... | stack_v2_sparse_classes_75kplus_train_003157 | 3,845 | 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: DirectoryRole",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value... | 3 | stack_v2_sparse_classes_30k_train_052168 | Implement the Python class `DirectoryRole` described below.
Class description:
Implement the DirectoryRole class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DirectoryRole: Creates a new instance of the appropriate class based on discriminator value... | Implement the Python class `DirectoryRole` described below.
Class description:
Implement the DirectoryRole class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DirectoryRole: Creates a new instance of the appropriate class based on discriminator value... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class DirectoryRole:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DirectoryRole:
"""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... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DirectoryRole:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DirectoryRole:
"""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: DirectoryRol... | the_stack_v2_python_sparse | msgraph/generated/models/directory_role.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
5848f2e3da17bf3940a0b8b27d18d06b6af2bb1f | [
"paragraph = re.sub('[^\\\\w]', ' ', paragraph).lower().split()\nwords = [word for word in paragraph if word not in banned]\ncount = {}\nfor word in words:\n if word in count.keys():\n count[word] += 1\n else:\n count[word] = 1\ncount = sorted(count.items(), key=lambda x: x[1])\nreturn count[-1]... | <|body_start_0|>
paragraph = re.sub('[^\\w]', ' ', paragraph).lower().split()
words = [word for word in paragraph if word not in banned]
count = {}
for word in words:
if word in count.keys():
count[word] += 1
else:
count[word] = 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mostCommonWord(self, paragraph: str, banned: List[str]) -> str:
"""Runtime: 28 ms Memory Usage: 14.3 MB"""
<|body_0|>
def mostCommonWordCounter(self, paragraph: str, banned: List[str]) -> str:
"""Runtime: 36 ms Memory Usage: 14.2 MB"""
<|body_1|... | stack_v2_sparse_classes_75kplus_train_003158 | 986 | no_license | [
{
"docstring": "Runtime: 28 ms Memory Usage: 14.3 MB",
"name": "mostCommonWord",
"signature": "def mostCommonWord(self, paragraph: str, banned: List[str]) -> str"
},
{
"docstring": "Runtime: 36 ms Memory Usage: 14.2 MB",
"name": "mostCommonWordCounter",
"signature": "def mostCommonWordCo... | 2 | stack_v2_sparse_classes_30k_train_023968 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: Runtime: 28 ms Memory Usage: 14.3 MB
- def mostCommonWordCounter(self, paragraph: str, banned: List[str]) -> s... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: Runtime: 28 ms Memory Usage: 14.3 MB
- def mostCommonWordCounter(self, paragraph: str, banned: List[str]) -> s... | 01fdc354aedd240936d35c2b0e2dff8a57e35eec | <|skeleton|>
class Solution:
def mostCommonWord(self, paragraph: str, banned: List[str]) -> str:
"""Runtime: 28 ms Memory Usage: 14.3 MB"""
<|body_0|>
def mostCommonWordCounter(self, paragraph: str, banned: List[str]) -> str:
"""Runtime: 36 ms Memory Usage: 14.2 MB"""
<|body_1|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def mostCommonWord(self, paragraph: str, banned: List[str]) -> str:
"""Runtime: 28 ms Memory Usage: 14.3 MB"""
paragraph = re.sub('[^\\w]', ' ', paragraph).lower().split()
words = [word for word in paragraph if word not in banned]
count = {}
for word in words:... | the_stack_v2_python_sparse | algorithm-interview/ch6/04/Junetrbl_most_common_words.py | wafflestudio/waffle-algorithm | train | 8 | |
2dfab900e499be7cdca312690e8e338fc11f5091 | [
"for item in os.listdir(source):\n if os.path.isfile(os.path.join(source, item)):\n self.put(os.path.join(source, item), '%s/%s' % (target, item))\n else:\n self.mkdir('%s/%s' % (target, item), ignore_existing=True)\n self.put_dir(os.path.join(source, item), '%s/%s' % (target, item))",
... | <|body_start_0|>
for item in os.listdir(source):
if os.path.isfile(os.path.join(source, item)):
self.put(os.path.join(source, item), '%s/%s' % (target, item))
else:
self.mkdir('%s/%s' % (target, item), ignore_existing=True)
self.put_dir(os.... | RSFTPClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RSFTPClient:
def put_dir(self, source, target):
"""Uploads the contents of the source directory to the target path. The target directory needs to exists. All subdirectories in source are created under target."""
<|body_0|>
def mkdir(self, path, mode=511, ignore_existing=Fals... | stack_v2_sparse_classes_75kplus_train_003159 | 43,347 | permissive | [
{
"docstring": "Uploads the contents of the source directory to the target path. The target directory needs to exists. All subdirectories in source are created under target.",
"name": "put_dir",
"signature": "def put_dir(self, source, target)"
},
{
"docstring": "Augments mkdir by adding an optio... | 2 | stack_v2_sparse_classes_30k_train_004665 | Implement the Python class `RSFTPClient` described below.
Class description:
Implement the RSFTPClient class.
Method signatures and docstrings:
- def put_dir(self, source, target): Uploads the contents of the source directory to the target path. The target directory needs to exists. All subdirectories in source are c... | Implement the Python class `RSFTPClient` described below.
Class description:
Implement the RSFTPClient class.
Method signatures and docstrings:
- def put_dir(self, source, target): Uploads the contents of the source directory to the target path. The target directory needs to exists. All subdirectories in source are c... | 981afa736547ad08e48a11137788fba5b8980cd9 | <|skeleton|>
class RSFTPClient:
def put_dir(self, source, target):
"""Uploads the contents of the source directory to the target path. The target directory needs to exists. All subdirectories in source are created under target."""
<|body_0|>
def mkdir(self, path, mode=511, ignore_existing=Fals... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RSFTPClient:
def put_dir(self, source, target):
"""Uploads the contents of the source directory to the target path. The target directory needs to exists. All subdirectories in source are created under target."""
for item in os.listdir(source):
if os.path.isfile(os.path.join(source,... | the_stack_v2_python_sparse | src/riaps/ctrl/ctrl.py | RIAPS/riaps-pycom | train | 7 | |
c9778e07547d82d828b5c75c445959126de040c2 | [
"resource_args.AddRestoreResourceArgs(parser)\nbase.ASYNC_FLAG.AddToParser(parser)\nencryption_group_parser = parser.add_argument_group()\nresource_args.AddRestoreDbEncryptionTypeArg(encryption_group_parser)\nresource_args.AddKmsKeyResourceArg(encryption_group_parser, 'to restore the Cloud Spanner database')",
"b... | <|body_start_0|>
resource_args.AddRestoreResourceArgs(parser)
base.ASYNC_FLAG.AddToParser(parser)
encryption_group_parser = parser.add_argument_group()
resource_args.AddRestoreDbEncryptionTypeArg(encryption_group_parser)
resource_args.AddKmsKeyResourceArg(encryption_group_parser,... | Restore a Cloud Spanner database. | Restore | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Restore:
"""Restore a Cloud Spanner database."""
def Args(parser):
"""Register flags for this command."""
<|body_0|>
def Run(self, args):
"""This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were p... | stack_v2_sparse_classes_75kplus_train_003160 | 3,172 | permissive | [
{
"docstring": "Register flags for this command.",
"name": "Args",
"signature": "def Args(parser)"
},
{
"docstring": "This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this command invocation. Returns: A message i... | 2 | null | Implement the Python class `Restore` described below.
Class description:
Restore a Cloud Spanner database.
Method signatures and docstrings:
- def Args(parser): Register flags for this command.
- def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse namespace. All the ... | Implement the Python class `Restore` described below.
Class description:
Restore a Cloud Spanner database.
Method signatures and docstrings:
- def Args(parser): Register flags for this command.
- def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse namespace. All the ... | 392abf004b16203030e6efd2f0af24db7c8d669e | <|skeleton|>
class Restore:
"""Restore a Cloud Spanner database."""
def Args(parser):
"""Register flags for this command."""
<|body_0|>
def Run(self, args):
"""This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Restore:
"""Restore a Cloud Spanner database."""
def Args(parser):
"""Register flags for this command."""
resource_args.AddRestoreResourceArgs(parser)
base.ASYNC_FLAG.AddToParser(parser)
encryption_group_parser = parser.add_argument_group()
resource_args.AddRestore... | the_stack_v2_python_sparse | lib/surface/spanner/databases/restore.py | google-cloud-sdk-unofficial/google-cloud-sdk | train | 9 |
bf33eb786db7a9018921a03bfb7bcc00c8368fbb | [
"link = Link.query.filter_by(id=link_id).first()\nlink_data, errors = self.schema.dump(link)\nif errors:\n current_app.logger.warning(errors)\nresponse_out = {'id': link.id, 'data': link_data, 'url': '/links', 'type': 'link'}\nreturn (response_out, 200)",
"args = convert_args(args)\nlink = Link(url=args.url, d... | <|body_start_0|>
link = Link.query.filter_by(id=link_id).first()
link_data, errors = self.schema.dump(link)
if errors:
current_app.logger.warning(errors)
response_out = {'id': link.id, 'data': link_data, 'url': '/links', 'type': 'link'}
return (response_out, 200)
<|en... | Link resource. | LinkResource | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinkResource:
"""Link resource."""
def get(self, link_id):
"""Get link resource. .. :quickref: Link collection. **Example request**: .. sourcecode:: http GET /links/1 HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example response**: .. sourcecode:: http HTTP/... | stack_v2_sparse_classes_75kplus_train_003161 | 3,983 | permissive | [
{
"docstring": "Get link resource. .. :quickref: Link collection. **Example request**: .. sourcecode:: http GET /links/1 HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript { \"data\": { \"clic... | 2 | stack_v2_sparse_classes_30k_train_048513 | Implement the Python class `LinkResource` described below.
Class description:
Link resource.
Method signatures and docstrings:
- def get(self, link_id): Get link resource. .. :quickref: Link collection. **Example request**: .. sourcecode:: http GET /links/1 HTTP/1.1 Host: example.com Accept: application/json, text/ja... | Implement the Python class `LinkResource` described below.
Class description:
Link resource.
Method signatures and docstrings:
- def get(self, link_id): Get link resource. .. :quickref: Link collection. **Example request**: .. sourcecode:: http GET /links/1 HTTP/1.1 Host: example.com Accept: application/json, text/ja... | d4d64c102478623022f68632adff070398a8771f | <|skeleton|>
class LinkResource:
"""Link resource."""
def get(self, link_id):
"""Get link resource. .. :quickref: Link collection. **Example request**: .. sourcecode:: http GET /links/1 HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example response**: .. sourcecode:: http HTTP/... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LinkResource:
"""Link resource."""
def get(self, link_id):
"""Get link resource. .. :quickref: Link collection. **Example request**: .. sourcecode:: http GET /links/1 HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Va... | the_stack_v2_python_sparse | slicr/resources/links.py | travisbyrum/slicr | train | 0 |
c9376bc6ee95cb1e5db25a7976d85ce20a69fdf0 | [
"super().__init__(client, target_type, session_id, flat_session)\nself._proto_def: Dict = proto_def\nfor domain, clazz in proto_def.items():\n setattr(self, domain, clazz(self))",
"connection = self._connection if self._flat_session else self\nsession = TargetSessionDynamic(connection, target_type, session_id,... | <|body_start_0|>
super().__init__(client, target_type, session_id, flat_session)
self._proto_def: Dict = proto_def
for domain, clazz in proto_def.items():
setattr(self, domain, clazz(self))
<|end_body_0|>
<|body_start_1|>
connection = self._connection if self._flat_session e... | TargetSessionDynamic | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TargetSessionDynamic:
def __init__(self, client: Union['ClientDynamic', 'TargetSessionDynamic'], target_type: str, session_id: str, flat_session: bool=False, proto_def: Dict=None) -> None:
"""Creat a new TargetSession :param client: The client or connection to be used :param target_type:... | stack_v2_sparse_classes_75kplus_train_003162 | 6,989 | permissive | [
{
"docstring": "Creat a new TargetSession :param client: The client or connection to be used :param target_type: The type of the target :param session_id: The session id for communication with the target :param flat_session: Is flat session mode enabled :param proto_def: The CDP protocol definition",
"name"... | 2 | stack_v2_sparse_classes_30k_train_013811 | Implement the Python class `TargetSessionDynamic` described below.
Class description:
Implement the TargetSessionDynamic class.
Method signatures and docstrings:
- def __init__(self, client: Union['ClientDynamic', 'TargetSessionDynamic'], target_type: str, session_id: str, flat_session: bool=False, proto_def: Dict=No... | Implement the Python class `TargetSessionDynamic` described below.
Class description:
Implement the TargetSessionDynamic class.
Method signatures and docstrings:
- def __init__(self, client: Union['ClientDynamic', 'TargetSessionDynamic'], target_type: str, session_id: str, flat_session: bool=False, proto_def: Dict=No... | 49a77349fc5712508e5071d69dfcc9e94f36bfe8 | <|skeleton|>
class TargetSessionDynamic:
def __init__(self, client: Union['ClientDynamic', 'TargetSessionDynamic'], target_type: str, session_id: str, flat_session: bool=False, proto_def: Dict=None) -> None:
"""Creat a new TargetSession :param client: The client or connection to be used :param target_type:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TargetSessionDynamic:
def __init__(self, client: Union['ClientDynamic', 'TargetSessionDynamic'], target_type: str, session_id: str, flat_session: bool=False, proto_def: Dict=None) -> None:
"""Creat a new TargetSession :param client: The client or connection to be used :param target_type: The type of t... | the_stack_v2_python_sparse | cripy/target_session.py | N0taN3rd/chrome-remote-interface-py | train | 5 | |
c10c9455869b9c9309b8c950208599ef5232c7b2 | [
"left, right = newInterval\nans = []\nfor interval in intervals:\n li, ri = interval\n if ri < left or li > right:\n ans.append(interval)\n else:\n left = min(li, left)\n right = max(ri, right)\nans.append([left, right])\nans.sort(key=lambda x: x[0])\nreturn ans",
"left, right = newI... | <|body_start_0|>
left, right = newInterval
ans = []
for interval in intervals:
li, ri = interval
if ri < left or li > right:
ans.append(interval)
else:
left = min(li, left)
right = max(ri, right)
ans.appe... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def insert(self, intervals, newInterval):
""":type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]"""
<|body_0|>
def insert(self, intervals, newInterval):
""":type intervals: List[List[int]] :type newInterval: List[int] :rtyp... | stack_v2_sparse_classes_75kplus_train_003163 | 2,481 | no_license | [
{
"docstring": ":type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]",
"name": "insert",
"signature": "def insert(self, intervals, newInterval)"
},
{
"docstring": ":type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]",
"name":... | 3 | stack_v2_sparse_classes_30k_train_043727 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insert(self, intervals, newInterval): :type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]
- def insert(self, intervals, newInterval): :type ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insert(self, intervals, newInterval): :type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]
- def insert(self, intervals, newInterval): :type ... | c162817f717b78997197649c084c27af48c3fd6f | <|skeleton|>
class Solution:
def insert(self, intervals, newInterval):
""":type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]"""
<|body_0|>
def insert(self, intervals, newInterval):
""":type intervals: List[List[int]] :type newInterval: List[int] :rtyp... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def insert(self, intervals, newInterval):
""":type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]"""
left, right = newInterval
ans = []
for interval in intervals:
li, ri = interval
if ri < left or li > right:
... | the_stack_v2_python_sparse | Week_09/57.插入区间.py | dream201188/algorithm017 | train | 1 | |
1dd9d9c04b4bbc092f4f1788ea36892d812ece54 | [
"permission_classes = [IsAuthenticated]\nif self.action != 'create':\n permission_classes.append(IsOwner)\nreturn [permission() for permission in permission_classes]",
"if self.action in ['create', 'retrieve']:\n return CreateGymModelSerializer\nreturn GymModelSerializer",
"instance = self.get_object()\ns... | <|body_start_0|>
permission_classes = [IsAuthenticated]
if self.action != 'create':
permission_classes.append(IsOwner)
return [permission() for permission in permission_classes]
<|end_body_0|>
<|body_start_1|>
if self.action in ['create', 'retrieve']:
return Crea... | Gym view set. | GymViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GymViewSet:
"""Gym view set."""
def get_permissions(self):
"""Assing permission base on action."""
<|body_0|>
def get_serializer_class(self):
"""Use serializer depending on the action."""
<|body_1|>
def destroy(self, request, *args, **kwargs):
... | stack_v2_sparse_classes_75kplus_train_003164 | 1,856 | permissive | [
{
"docstring": "Assing permission base on action.",
"name": "get_permissions",
"signature": "def get_permissions(self)"
},
{
"docstring": "Use serializer depending on the action.",
"name": "get_serializer_class",
"signature": "def get_serializer_class(self)"
},
{
"docstring": "Se... | 4 | stack_v2_sparse_classes_30k_train_053831 | Implement the Python class `GymViewSet` described below.
Class description:
Gym view set.
Method signatures and docstrings:
- def get_permissions(self): Assing permission base on action.
- def get_serializer_class(self): Use serializer depending on the action.
- def destroy(self, request, *args, **kwargs): Send data ... | Implement the Python class `GymViewSet` described below.
Class description:
Gym view set.
Method signatures and docstrings:
- def get_permissions(self): Assing permission base on action.
- def get_serializer_class(self): Use serializer depending on the action.
- def destroy(self, request, *args, **kwargs): Send data ... | caf2b6f5e9a0ed9e98567a036bec9a34b44ecf13 | <|skeleton|>
class GymViewSet:
"""Gym view set."""
def get_permissions(self):
"""Assing permission base on action."""
<|body_0|>
def get_serializer_class(self):
"""Use serializer depending on the action."""
<|body_1|>
def destroy(self, request, *args, **kwargs):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GymViewSet:
"""Gym view set."""
def get_permissions(self):
"""Assing permission base on action."""
permission_classes = [IsAuthenticated]
if self.action != 'create':
permission_classes.append(IsOwner)
return [permission() for permission in permission_classes]
... | the_stack_v2_python_sparse | backend/admingym/gyms/views/gyms.py | Manuelhra/AdminGym | train | 0 |
d8867a2bdc58722c5ce95cf4555e9c4c6b326771 | [
"length = len(nums)\nfor i in range(0, length):\n for j in range(i + 1, length):\n sum = nums[i] + nums[j]\n if sum == target:\n return (i, j)",
"dic = {}\nfor i, num in enumerate(nums):\n dic[num] = i\nfor i, num in enumerate(nums):\n j = target - num\n if j in dic and dic[j]... | <|body_start_0|>
length = len(nums)
for i in range(0, length):
for j in range(i + 1, length):
sum = nums[i] + nums[j]
if sum == target:
return (i, j)
<|end_body_0|>
<|body_start_1|>
dic = {}
for i, num in enumerate(nums):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def two_sum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def two_pass_dict(self, nums, target):
""":param nums: List[int] :param target: int :return: List[int]"""
<|body_1|>
def one_pass_dict(s... | stack_v2_sparse_classes_75kplus_train_003165 | 1,077 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "two_sum",
"signature": "def two_sum(self, nums, target)"
},
{
"docstring": ":param nums: List[int] :param target: int :return: List[int]",
"name": "two_pass_dict",
"signature": "def two_pass_dict(self, n... | 3 | stack_v2_sparse_classes_30k_train_043344 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def two_sum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def two_pass_dict(self, nums, target): :param nums: List[int] :param target: int :ret... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def two_sum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def two_pass_dict(self, nums, target): :param nums: List[int] :param target: int :ret... | f234bd7b62cb7bc2150faa764bf05a9095e19192 | <|skeleton|>
class Solution:
def two_sum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def two_pass_dict(self, nums, target):
""":param nums: List[int] :param target: int :return: List[int]"""
<|body_1|>
def one_pass_dict(s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def two_sum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
length = len(nums)
for i in range(0, length):
for j in range(i + 1, length):
sum = nums[i] + nums[j]
if sum == target:
... | the_stack_v2_python_sparse | alg/two_sum.py | nyannko/leetcode-python | train | 0 | |
8dd15129881c0591c67934a65df86ca9fdadec26 | [
"limit = int(self.request.get('limit', 100))\ncommits = Commit.all().order('-position_num').order('position_ref').fetch(limit)\nif self.request.get('format') == 'json':\n self.response.headers['Content-Type'] = 'application/json'\n self.response.headers['Access-Control-Allow-Origin'] = '*'\n data = json.du... | <|body_start_0|>
limit = int(self.request.get('limit', 100))
commits = Commit.all().order('-position_num').order('position_ref').fetch(limit)
if self.request.get('format') == 'json':
self.response.headers['Content-Type'] = 'application/json'
self.response.headers['Access-... | Displays the Git LKGR history page containing the last 100 LKGRs. | Commits | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Commits:
"""Displays the Git LKGR history page containing the last 100 LKGRs."""
def get(self):
"""Returns information about the history of LKGR."""
<|body_0|>
def post(self):
"""Adds a new revision status."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_75kplus_train_003166 | 2,851 | permissive | [
{
"docstring": "Returns information about the history of LKGR.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Adds a new revision status.",
"name": "post",
"signature": "def post(self)"
}
] | 2 | null | Implement the Python class `Commits` described below.
Class description:
Displays the Git LKGR history page containing the last 100 LKGRs.
Method signatures and docstrings:
- def get(self): Returns information about the history of LKGR.
- def post(self): Adds a new revision status. | Implement the Python class `Commits` described below.
Class description:
Displays the Git LKGR history page containing the last 100 LKGRs.
Method signatures and docstrings:
- def get(self): Returns information about the history of LKGR.
- def post(self): Adds a new revision status.
<|skeleton|>
class Commits:
""... | b5d4783f99461438ca9e6a477535617fadab6ba3 | <|skeleton|>
class Commits:
"""Displays the Git LKGR history page containing the last 100 LKGRs."""
def get(self):
"""Returns information about the history of LKGR."""
<|body_0|>
def post(self):
"""Adds a new revision status."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Commits:
"""Displays the Git LKGR history page containing the last 100 LKGRs."""
def get(self):
"""Returns information about the history of LKGR."""
limit = int(self.request.get('limit', 100))
commits = Commit.all().order('-position_num').order('position_ref').fetch(limit)
... | the_stack_v2_python_sparse | appengine/chromium_status/appengine_module/chromium_status/git_lkgr.py | xinghun61/infra | train | 2 |
5aad2914dc66ed5c00654fdf0a85f17cacbe7898 | [
"self.validate_parameters(value=value)\n_query_builder = Configuration.get_base_uri()\n_query_builder += '/identification/session/invalidate'\n_query_url = APIHelper.clean_url(_query_builder)\n_headers = {'accept': 'application/json', 'content-type': 'application/json; charset=utf-8'}\n_request = self.http_client.p... | <|body_start_0|>
self.validate_parameters(value=value)
_query_builder = Configuration.get_base_uri()
_query_builder += '/identification/session/invalidate'
_query_url = APIHelper.clean_url(_query_builder)
_headers = {'accept': 'application/json', 'content-type': 'application/json... | A Controller to access Endpoints in the idfy_rest_client API. | IdentificationSessionController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdentificationSessionController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def invalidate_session(self, value):
"""Does a PUT request to /identification/session/invalidate. Invalidate the identification session to avoid using the same request twice. (remark:... | stack_v2_sparse_classes_75kplus_train_003167 | 9,716 | permissive | [
{
"docstring": "Does a PUT request to /identification/session/invalidate. Invalidate the identification session to avoid using the same request twice. (remark: if the session is in error the session will not be invalidated) Args: value (InvalidateIdentificationRequest): A request object Returns: mixed: Response... | 4 | stack_v2_sparse_classes_30k_train_052392 | Implement the Python class `IdentificationSessionController` described below.
Class description:
A Controller to access Endpoints in the idfy_rest_client API.
Method signatures and docstrings:
- def invalidate_session(self, value): Does a PUT request to /identification/session/invalidate. Invalidate the identificatio... | Implement the Python class `IdentificationSessionController` described below.
Class description:
A Controller to access Endpoints in the idfy_rest_client API.
Method signatures and docstrings:
- def invalidate_session(self, value): Does a PUT request to /identification/session/invalidate. Invalidate the identificatio... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class IdentificationSessionController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def invalidate_session(self, value):
"""Does a PUT request to /identification/session/invalidate. Invalidate the identification session to avoid using the same request twice. (remark:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IdentificationSessionController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def invalidate_session(self, value):
"""Does a PUT request to /identification/session/invalidate. Invalidate the identification session to avoid using the same request twice. (remark: if the sessi... | the_stack_v2_python_sparse | idfy_rest_client/controllers/identification_session_controller.py | dealflowteam/Idfy | train | 0 |
3da6723fb2f328bd7eea061c2b5e8efa9adf23d6 | [
"self.config_map = config_map\nself.downward_api = downward_api\nself.secret = secret\nself.service_account_token = service_account_token",
"if dictionary is None:\n return None\nconfig_map = cohesity_management_sdk.models.pod_info_pod_spec_volume_info_projected_volume_projection_config_map_projection.PodInfo_... | <|body_start_0|>
self.config_map = config_map
self.downward_api = downward_api
self.secret = secret
self.service_account_token = service_account_token
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
config_map = cohesity_management_sdk.mode... | Implementation of the 'PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection' model. TODO: type description here. Attributes: config_map (PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection): TODO: Type description here. downward_api (PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_DownwardA... | PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection:
"""Implementation of the 'PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection' model. TODO: type description here. Attributes: config_map (PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection): TODO: Type description he... | stack_v2_sparse_classes_75kplus_train_003168 | 3,966 | permissive | [
{
"docstring": "Constructor for the PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection class",
"name": "__init__",
"signature": "def __init__(self, config_map=None, downward_api=None, secret=None, service_account_token=None)"
},
{
"docstring": "Creates an instance of this model from a diction... | 2 | stack_v2_sparse_classes_30k_train_042819 | Implement the Python class `PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection` described below.
Class description:
Implementation of the 'PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection' model. TODO: type description here. Attributes: config_map (PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMa... | Implement the Python class `PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection` described below.
Class description:
Implementation of the 'PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection' model. TODO: type description here. Attributes: config_map (PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMa... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection:
"""Implementation of the 'PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection' model. TODO: type description here. Attributes: config_map (PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection): TODO: Type description he... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection:
"""Implementation of the 'PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection' model. TODO: type description here. Attributes: config_map (PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection): TODO: Type description here. downward_... | the_stack_v2_python_sparse | cohesity_management_sdk/models/pod_info_pod_spec_volume_info_projected_volume_projection.py | cohesity/management-sdk-python | train | 24 |
fad50495069e05d02b3a1e55c09b7ac1e58aa232 | [
"self.frames = dict()\nself.pads = dict()\nself.cpads = dict() if cropping else None\nself.frame_time = int(Gst.SECOND / fps)\n\ndef bind(pad, prop):\n \"\"\" adds a binding to a gstreamer property\n pad's property\n \"\"\"\n cs = GstController.InterpolationControlSource()\n cs.se... | <|body_start_0|>
self.frames = dict()
self.pads = dict()
self.cpads = dict() if cropping else None
self.frame_time = int(Gst.SECOND / fps)
def bind(pad, prop):
""" adds a binding to a gstreamer property
pad's property
"""
... | Scene is the adaptor between the gstreamer compositor and voctomix frames. With commit() you add frames at a specified play time | Scene | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Scene:
"""Scene is the adaptor between the gstreamer compositor and voctomix frames. With commit() you add frames at a specified play time"""
def __init__(self, sources, pipeline, fps, start_sink, cropping=True):
"""initialize with a gstreamer pipeline and names of the sources to man... | stack_v2_sparse_classes_75kplus_train_003169 | 5,039 | permissive | [
{
"docstring": "initialize with a gstreamer pipeline and names of the sources to manage",
"name": "__init__",
"signature": "def __init__(self, sources, pipeline, fps, start_sink, cropping=True)"
},
{
"docstring": "commit multiple frames to the current gstreamer scene",
"name": "commit",
... | 4 | stack_v2_sparse_classes_30k_train_022709 | Implement the Python class `Scene` described below.
Class description:
Scene is the adaptor between the gstreamer compositor and voctomix frames. With commit() you add frames at a specified play time
Method signatures and docstrings:
- def __init__(self, sources, pipeline, fps, start_sink, cropping=True): initialize ... | Implement the Python class `Scene` described below.
Class description:
Scene is the adaptor between the gstreamer compositor and voctomix frames. With commit() you add frames at a specified play time
Method signatures and docstrings:
- def __init__(self, sources, pipeline, fps, start_sink, cropping=True): initialize ... | 27e2c58eaeda59cc021a6596d36fdb1ed28a4ace | <|skeleton|>
class Scene:
"""Scene is the adaptor between the gstreamer compositor and voctomix frames. With commit() you add frames at a specified play time"""
def __init__(self, sources, pipeline, fps, start_sink, cropping=True):
"""initialize with a gstreamer pipeline and names of the sources to man... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Scene:
"""Scene is the adaptor between the gstreamer compositor and voctomix frames. With commit() you add frames at a specified play time"""
def __init__(self, sources, pipeline, fps, start_sink, cropping=True):
"""initialize with a gstreamer pipeline and names of the sources to manage"""
... | the_stack_v2_python_sparse | voctocore/lib/scene.py | CybernetiX-S3C/voctomix | train | 0 |
c5dffb171cdba116db235caf5bac3754e0bd81bf | [
"del platform_config\nsuper().__init__(executor_spec)\npython_class_executor_spec = cast(executable_spec_pb2.PythonClassExecutableSpec, self._executor_spec)\nself._executor_cls = import_utils.import_class_by_path(python_class_executor_spec.class_path)\nself.extra_flags = []\nself.extra_flags.extend(python_class_exe... | <|body_start_0|>
del platform_config
super().__init__(executor_spec)
python_class_executor_spec = cast(executable_spec_pb2.PythonClassExecutableSpec, self._executor_spec)
self._executor_cls = import_utils.import_class_by_path(python_class_executor_spec.class_path)
self.extra_flag... | PythonExecutorOperator handles python class based executor's init and execution. Attributes: extra_flags: Extra flags that will pass to Python executors. It come from two sources in the order: 1. The `extra_flags` set in the executor spec. 2. The flags passed in when starting the program by users or by other systems. T... | PythonExecutorOperator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PythonExecutorOperator:
"""PythonExecutorOperator handles python class based executor's init and execution. Attributes: extra_flags: Extra flags that will pass to Python executors. It come from two sources in the order: 1. The `extra_flags` set in the executor spec. 2. The flags passed in when st... | stack_v2_sparse_classes_75kplus_train_003170 | 5,438 | permissive | [
{
"docstring": "Initializes a PythonExecutorOperator. Args: executor_spec: The specification of how to initialize the executor. platform_config: The specification of how to allocate resource for the executor.",
"name": "__init__",
"signature": "def __init__(self, executor_spec: message.Message, platform... | 2 | null | Implement the Python class `PythonExecutorOperator` described below.
Class description:
PythonExecutorOperator handles python class based executor's init and execution. Attributes: extra_flags: Extra flags that will pass to Python executors. It come from two sources in the order: 1. The `extra_flags` set in the execut... | Implement the Python class `PythonExecutorOperator` described below.
Class description:
PythonExecutorOperator handles python class based executor's init and execution. Attributes: extra_flags: Extra flags that will pass to Python executors. It come from two sources in the order: 1. The `extra_flags` set in the execut... | 1b328504fa08a70388691e4072df76f143631325 | <|skeleton|>
class PythonExecutorOperator:
"""PythonExecutorOperator handles python class based executor's init and execution. Attributes: extra_flags: Extra flags that will pass to Python executors. It come from two sources in the order: 1. The `extra_flags` set in the executor spec. 2. The flags passed in when st... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PythonExecutorOperator:
"""PythonExecutorOperator handles python class based executor's init and execution. Attributes: extra_flags: Extra flags that will pass to Python executors. It come from two sources in the order: 1. The `extra_flags` set in the executor spec. 2. The flags passed in when starting the pr... | the_stack_v2_python_sparse | tfx/orchestration/portable/python_executor_operator.py | tensorflow/tfx | train | 2,116 |
ad9af2e852b0fe5301887731e3a763898bf7ad89 | [
"super(FormPublishCompound, self).__init__()\nself._compound = compound\nself.ui = ui_def.Ui_MainWindow()\nself.ui.setupUi(self)\nself.load_compound(compound)\nself.ui.pushButton_submit.pressed.connect(self.on_submit)",
"metadata = CompoundDefinition(**compound.get_metadata())\nself.ui.lineEdit_name.setText(metad... | <|body_start_0|>
super(FormPublishCompound, self).__init__()
self._compound = compound
self.ui = ui_def.Ui_MainWindow()
self.ui.setupUi(self)
self.load_compound(compound)
self.ui.pushButton_submit.pressed.connect(self.on_submit)
<|end_body_0|>
<|body_start_1|>
me... | Window used to publish a new compound version. | FormPublishCompound | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FormPublishCompound:
"""Window used to publish a new compound version."""
def __init__(self, compound):
""":param omtk_compound.Compound compound: The compound to publish"""
<|body_0|>
def load_compound(self, compound):
""":param omtk_compound.Compound compound: ... | stack_v2_sparse_classes_75kplus_train_003171 | 2,323 | no_license | [
{
"docstring": ":param omtk_compound.Compound compound: The compound to publish",
"name": "__init__",
"signature": "def __init__(self, compound)"
},
{
"docstring": ":param omtk_compound.Compound compound: The compound to load",
"name": "load_compound",
"signature": "def load_compound(sel... | 4 | stack_v2_sparse_classes_30k_train_033832 | Implement the Python class `FormPublishCompound` described below.
Class description:
Window used to publish a new compound version.
Method signatures and docstrings:
- def __init__(self, compound): :param omtk_compound.Compound compound: The compound to publish
- def load_compound(self, compound): :param omtk_compoun... | Implement the Python class `FormPublishCompound` described below.
Class description:
Window used to publish a new compound version.
Method signatures and docstrings:
- def __init__(self, compound): :param omtk_compound.Compound compound: The compound to publish
- def load_compound(self, compound): :param omtk_compoun... | 8d04a581644e84d60f8fb52e1673935ad8e9664c | <|skeleton|>
class FormPublishCompound:
"""Window used to publish a new compound version."""
def __init__(self, compound):
""":param omtk_compound.Compound compound: The compound to publish"""
<|body_0|>
def load_compound(self, compound):
""":param omtk_compound.Compound compound: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FormPublishCompound:
"""Window used to publish a new compound version."""
def __init__(self, compound):
""":param omtk_compound.Compound compound: The compound to publish"""
super(FormPublishCompound, self).__init__()
self._compound = compound
self.ui = ui_def.Ui_MainWindo... | the_stack_v2_python_sparse | scripts/omtk_compound/widgets/form_compound_publish.py | renaudll/omtk-compound | train | 8 |
6802f961aa5581ca416f1440e5a73eec616dcaf4 | [
"if x < 0:\n return False\ns = str(x)\nif s == s[::-1]:\n return True\nreturn False",
"if x < 0:\n return False\nnumber = x\nreverse = 0\nwhile number > 0:\n reminder = number % 10\n reverse = reverse * 10 + reminder\n number = number // 10\nif reverse == x:\n return True\nreturn False"
] | <|body_start_0|>
if x < 0:
return False
s = str(x)
if s == s[::-1]:
return True
return False
<|end_body_0|>
<|body_start_1|>
if x < 0:
return False
number = x
reverse = 0
while number > 0:
reminder = number ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPalindrome_usingStr(self, x):
"""https://leetcode.com/problems/palindrome-number/ :type x: int :rtype: bool"""
<|body_0|>
def isPalindrome_notUsingStr(self, x):
"""https://leetcode.com/problems/palindrome-number/ :type x: int :rtype: bool"""
<... | stack_v2_sparse_classes_75kplus_train_003172 | 826 | no_license | [
{
"docstring": "https://leetcode.com/problems/palindrome-number/ :type x: int :rtype: bool",
"name": "isPalindrome_usingStr",
"signature": "def isPalindrome_usingStr(self, x)"
},
{
"docstring": "https://leetcode.com/problems/palindrome-number/ :type x: int :rtype: bool",
"name": "isPalindrom... | 2 | stack_v2_sparse_classes_30k_train_054107 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome_usingStr(self, x): https://leetcode.com/problems/palindrome-number/ :type x: int :rtype: bool
- def isPalindrome_notUsingStr(self, x): https://leetcode.com/probl... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome_usingStr(self, x): https://leetcode.com/problems/palindrome-number/ :type x: int :rtype: bool
- def isPalindrome_notUsingStr(self, x): https://leetcode.com/probl... | 1e089ee63d7faf329850ffbff39d34564bd1a956 | <|skeleton|>
class Solution:
def isPalindrome_usingStr(self, x):
"""https://leetcode.com/problems/palindrome-number/ :type x: int :rtype: bool"""
<|body_0|>
def isPalindrome_notUsingStr(self, x):
"""https://leetcode.com/problems/palindrome-number/ :type x: int :rtype: bool"""
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isPalindrome_usingStr(self, x):
"""https://leetcode.com/problems/palindrome-number/ :type x: int :rtype: bool"""
if x < 0:
return False
s = str(x)
if s == s[::-1]:
return True
return False
def isPalindrome_notUsingStr(self, x):... | the_stack_v2_python_sparse | Practise/palindromeNumber.py | sangziteng/smallPythonProj | train | 0 | |
1ede4a3e09e6d2f3daf4faa4490b7afd702c5e83 | [
"if request.method == 'POST':\n security = SecurityHandler()\n if security.is_valid_key(request):\n content = request.POST.get('request')\n else:\n return False\nelse:\n content = content = ''\ndata_decoded = self.serializer.decode(content)\nreturn data_decoded",
"if request.method == 'P... | <|body_start_0|>
if request.method == 'POST':
security = SecurityHandler()
if security.is_valid_key(request):
content = request.POST.get('request')
else:
return False
else:
content = content = ''
data_decoded = self.... | Class RequestHandler handles parsing of requests params. @author: Lionel Cuevas <lionel@hoopemedia.com> | RequestHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RequestHandler:
"""Class RequestHandler handles parsing of requests params. @author: Lionel Cuevas <lionel@hoopemedia.com>"""
def getData(self, request, **options):
"""Returns data object from request"""
<|body_0|>
def getDataSignature(self, request, **options):
... | stack_v2_sparse_classes_75kplus_train_003173 | 1,532 | no_license | [
{
"docstring": "Returns data object from request",
"name": "getData",
"signature": "def getData(self, request, **options)"
},
{
"docstring": "Returns data object from request",
"name": "getDataSignature",
"signature": "def getDataSignature(self, request, **options)"
},
{
"docstri... | 3 | stack_v2_sparse_classes_30k_train_043132 | Implement the Python class `RequestHandler` described below.
Class description:
Class RequestHandler handles parsing of requests params. @author: Lionel Cuevas <lionel@hoopemedia.com>
Method signatures and docstrings:
- def getData(self, request, **options): Returns data object from request
- def getDataSignature(sel... | Implement the Python class `RequestHandler` described below.
Class description:
Class RequestHandler handles parsing of requests params. @author: Lionel Cuevas <lionel@hoopemedia.com>
Method signatures and docstrings:
- def getData(self, request, **options): Returns data object from request
- def getDataSignature(sel... | 8b125c60648eed9b8ee51915e31ca547157b0d8a | <|skeleton|>
class RequestHandler:
"""Class RequestHandler handles parsing of requests params. @author: Lionel Cuevas <lionel@hoopemedia.com>"""
def getData(self, request, **options):
"""Returns data object from request"""
<|body_0|>
def getDataSignature(self, request, **options):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RequestHandler:
"""Class RequestHandler handles parsing of requests params. @author: Lionel Cuevas <lionel@hoopemedia.com>"""
def getData(self, request, **options):
"""Returns data object from request"""
if request.method == 'POST':
security = SecurityHandler()
if ... | the_stack_v2_python_sparse | propietapi/core/handlers/request_handler.py | propiet/api.propiet.com | train | 0 |
633d9bd1cad69407b5d640cbf36feff5203d8658 | [
"lat_0, lng_0 = origin.coordinates\nlat_1, lng_1 = destination.coordinates\nurl = cls.URL.format(lng_0=lng_0, lat_0=lat_0, lng_1=lng_1, lat_1=lat_1)\ntry:\n response = requests.get(url, timeout=5)\n if response and response.status_code in [requests.codes.ok, requests.codes.no_content]:\n response_data ... | <|body_start_0|>
lat_0, lng_0 = origin.coordinates
lat_1, lng_1 = destination.coordinates
url = cls.URL.format(lng_0=lng_0, lat_0=lat_0, lng_1=lng_1, lat_1=lat_1)
try:
response = requests.get(url, timeout=5)
if response and response.status_code in [requests.codes.... | Class that contains the Open Source Routing Machine service to obtain city routes | OSRMService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OSRMService:
"""Class that contains the Open Source Routing Machine service to obtain city routes"""
def get_route(cls, origin: Location, destination: Location) -> Route:
"""Method to obtain a movement route using docker-mounted OSRM"""
<|body_0|>
def estimate_route_prop... | stack_v2_sparse_classes_75kplus_train_003174 | 5,110 | no_license | [
{
"docstring": "Method to obtain a movement route using docker-mounted OSRM",
"name": "get_route",
"signature": "def get_route(cls, origin: Location, destination: Location) -> Route"
},
{
"docstring": "Method to estimate the distance and time it would take to fulfill a route from an origin",
... | 4 | null | Implement the Python class `OSRMService` described below.
Class description:
Class that contains the Open Source Routing Machine service to obtain city routes
Method signatures and docstrings:
- def get_route(cls, origin: Location, destination: Location) -> Route: Method to obtain a movement route using docker-mounte... | Implement the Python class `OSRMService` described below.
Class description:
Class that contains the Open Source Routing Machine service to obtain city routes
Method signatures and docstrings:
- def get_route(cls, origin: Location, destination: Location) -> Route: Method to obtain a movement route using docker-mounte... | 94656681006f7bbc32b2f1970e288944c52d308a | <|skeleton|>
class OSRMService:
"""Class that contains the Open Source Routing Machine service to obtain city routes"""
def get_route(cls, origin: Location, destination: Location) -> Route:
"""Method to obtain a movement route using docker-mounted OSRM"""
<|body_0|>
def estimate_route_prop... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OSRMService:
"""Class that contains the Open Source Routing Machine service to obtain city routes"""
def get_route(cls, origin: Location, destination: Location) -> Route:
"""Method to obtain a movement route using docker-mounted OSRM"""
lat_0, lng_0 = origin.coordinates
lat_1, lng... | the_stack_v2_python_sparse | services/osrm_service.py | DanielG1397/mdrp-sim | train | 0 |
4cf3859733ae5faeea3f055fffcc638c6e18b893 | [
"pool = multiprocessing.pool.ThreadPool()\nresults = pool.map(_test_filler, range(500))\nself.assertTrue(all((r is quantum_context.q_context() for r in results)))",
"pool = multiprocessing.Pool()\nresults = pool.map(_test_filler, range(500))\nself.assertFalse(all((r is quantum_context.q_context() for r in results... | <|body_start_0|>
pool = multiprocessing.pool.ThreadPool()
results = pool.map(_test_filler, range(500))
self.assertTrue(all((r is quantum_context.q_context() for r in results)))
<|end_body_0|>
<|body_start_1|>
pool = multiprocessing.Pool()
results = pool.map(_test_filler, range(5... | Test that quantum context objects work. | QContextTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QContextTest:
"""Test that quantum context objects work."""
def test_global_singleton(self):
"""Test that context object is a true singleton."""
<|body_0|>
def test_global_not_singleton(self):
"""In the case of Processes singleton objects will be reset."""
... | stack_v2_sparse_classes_75kplus_train_003175 | 2,579 | permissive | [
{
"docstring": "Test that context object is a true singleton.",
"name": "test_global_singleton",
"signature": "def test_global_singleton(self)"
},
{
"docstring": "In the case of Processes singleton objects will be reset.",
"name": "test_global_not_singleton",
"signature": "def test_globa... | 4 | stack_v2_sparse_classes_30k_test_002901 | Implement the Python class `QContextTest` described below.
Class description:
Test that quantum context objects work.
Method signatures and docstrings:
- def test_global_singleton(self): Test that context object is a true singleton.
- def test_global_not_singleton(self): In the case of Processes singleton objects wil... | Implement the Python class `QContextTest` described below.
Class description:
Test that quantum context objects work.
Method signatures and docstrings:
- def test_global_singleton(self): Test that context object is a true singleton.
- def test_global_not_singleton(self): In the case of Processes singleton objects wil... | f56257bceb988b743790e1e480eac76fd036d4ff | <|skeleton|>
class QContextTest:
"""Test that quantum context objects work."""
def test_global_singleton(self):
"""Test that context object is a true singleton."""
<|body_0|>
def test_global_not_singleton(self):
"""In the case of Processes singleton objects will be reset."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QContextTest:
"""Test that quantum context objects work."""
def test_global_singleton(self):
"""Test that context object is a true singleton."""
pool = multiprocessing.pool.ThreadPool()
results = pool.map(_test_filler, range(500))
self.assertTrue(all((r is quantum_context.... | the_stack_v2_python_sparse | tensorflow_quantum/python/quantum_context_test.py | tensorflow/quantum | train | 1,799 |
4cdcd2254e219ca22f778cf162069424188aa01a | [
"super().__init__()\nself.in_dim = in_dim\nself.out_dim = out_dim\nself.non_linearity = non_linearity\nself.layers = nn.ModuleList()\nfor dim in range(len(hidden_dims) + 1):\n if dim == 0:\n self.layers.append(nn.Linear(self.in_dim, hidden_dims[dim]))\n elif dim == len(hidden_dims):\n self.layer... | <|body_start_0|>
super().__init__()
self.in_dim = in_dim
self.out_dim = out_dim
self.non_linearity = non_linearity
self.layers = nn.ModuleList()
for dim in range(len(hidden_dims) + 1):
if dim == 0:
self.layers.append(nn.Linear(self.in_dim, hidd... | A `vanilla` neural network. | VanillaNN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VanillaNN:
"""A `vanilla` neural network."""
def __init__(self, in_dim, out_dim, hidden_dims, non_linearity=F.relu):
""":param in_dim: (int) Dimensionality of the input. :param out_dim: (int) Dimensionality of the output. :param hidden_dims: (list of ints) Architecture of the network... | stack_v2_sparse_classes_75kplus_train_003176 | 16,175 | no_license | [
{
"docstring": ":param in_dim: (int) Dimensionality of the input. :param out_dim: (int) Dimensionality of the output. :param hidden_dims: (list of ints) Architecture of the network. :param non_linearity: Non-linear activation function to apply after each linear transformation, e.g. relu or tanh.",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_027927 | Implement the Python class `VanillaNN` described below.
Class description:
A `vanilla` neural network.
Method signatures and docstrings:
- def __init__(self, in_dim, out_dim, hidden_dims, non_linearity=F.relu): :param in_dim: (int) Dimensionality of the input. :param out_dim: (int) Dimensionality of the output. :para... | Implement the Python class `VanillaNN` described below.
Class description:
A `vanilla` neural network.
Method signatures and docstrings:
- def __init__(self, in_dim, out_dim, hidden_dims, non_linearity=F.relu): :param in_dim: (int) Dimensionality of the input. :param out_dim: (int) Dimensionality of the output. :para... | de60f831ee082ab2ae232c498cf2755da7c14c27 | <|skeleton|>
class VanillaNN:
"""A `vanilla` neural network."""
def __init__(self, in_dim, out_dim, hidden_dims, non_linearity=F.relu):
""":param in_dim: (int) Dimensionality of the input. :param out_dim: (int) Dimensionality of the output. :param hidden_dims: (list of ints) Architecture of the network... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VanillaNN:
"""A `vanilla` neural network."""
def __init__(self, in_dim, out_dim, hidden_dims, non_linearity=F.relu):
""":param in_dim: (int) Dimensionality of the input. :param out_dim: (int) Dimensionality of the output. :param hidden_dims: (list of ints) Architecture of the network. :param non_... | the_stack_v2_python_sparse | models/networks/np_networks.py | PenelopeJones/neural_processes | train | 4 |
966a567b7a47c88751896717ae03a0836e7a0529 | [
"Frame.__init__(self, master)\nself.grid()\nself.create_widgets()",
"Label(self, text='Choose your favorite type of movie').grid(row=0, column=0, sticky=W)\nLabel(self, text='Selecting one:').grid(row=1, column=0, sticky=W)\nself.favorite = StringVar()\nRadiobutton(self, text='Comedy', variable=self.favorite, val... | <|body_start_0|>
Frame.__init__(self, master)
self.grid()
self.create_widgets()
<|end_body_0|>
<|body_start_1|>
Label(self, text='Choose your favorite type of movie').grid(row=0, column=0, sticky=W)
Label(self, text='Selecting one:').grid(row=1, column=0, sticky=W)
self.... | Application | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Application:
def __init__(self, master):
"""initialize the Frame"""
<|body_0|>
def create_widgets(self):
"""create widgets for movie type choices"""
<|body_1|>
def update_text(self):
"""update the text area"""
<|body_2|>
<|end_skeleton|>... | stack_v2_sparse_classes_75kplus_train_003177 | 1,498 | no_license | [
{
"docstring": "initialize the Frame",
"name": "__init__",
"signature": "def __init__(self, master)"
},
{
"docstring": "create widgets for movie type choices",
"name": "create_widgets",
"signature": "def create_widgets(self)"
},
{
"docstring": "update the text area",
"name": ... | 3 | stack_v2_sparse_classes_30k_train_046795 | Implement the Python class `Application` described below.
Class description:
Implement the Application class.
Method signatures and docstrings:
- def __init__(self, master): initialize the Frame
- def create_widgets(self): create widgets for movie type choices
- def update_text(self): update the text area | Implement the Python class `Application` described below.
Class description:
Implement the Application class.
Method signatures and docstrings:
- def __init__(self, master): initialize the Frame
- def create_widgets(self): create widgets for movie type choices
- def update_text(self): update the text area
<|skeleton... | 728a8614fa50e3de0541efa87f71ec047326d66a | <|skeleton|>
class Application:
def __init__(self, master):
"""initialize the Frame"""
<|body_0|>
def create_widgets(self):
"""create widgets for movie type choices"""
<|body_1|>
def update_text(self):
"""update the text area"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Application:
def __init__(self, master):
"""initialize the Frame"""
Frame.__init__(self, master)
self.grid()
self.create_widgets()
def create_widgets(self):
"""create widgets for movie type choices"""
Label(self, text='Choose your favorite type of movie').g... | the_stack_v2_python_sparse | src/Ex14/radio_buttons.py | lil-val/she-codes | train | 0 | |
c70f9487d917f6cc8ce2a386969918fab424b182 | [
"self.__summary_train_writer = tf.summary.create_file_writer(model_dir + '/logs/train/')\nself.__summary_eval_writer = tf.summary.create_file_writer(model_dir + '/logs/eval/')\nself.__summary_test_writer = tf.summary.create_file_writer(model_dir + '/logs/test/')",
"if mode == 'train':\n return self.__summary_t... | <|body_start_0|>
self.__summary_train_writer = tf.summary.create_file_writer(model_dir + '/logs/train/')
self.__summary_eval_writer = tf.summary.create_file_writer(model_dir + '/logs/eval/')
self.__summary_test_writer = tf.summary.create_file_writer(model_dir + '/logs/test/')
<|end_body_0|>
<|b... | The TensorboardSummarymanager manages the train, eval and test summaries for the Tensorboard. :Attributes: __summary_train_writer: (tf.summary.FileWriter) The summary writer for the training steps. __summary_eval_writer: (tf.summary.FileWriter) The summary writer for the eval steps. __summary_test_writer: (tf.summary.F... | TensorboardSummaryManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TensorboardSummaryManager:
"""The TensorboardSummarymanager manages the train, eval and test summaries for the Tensorboard. :Attributes: __summary_train_writer: (tf.summary.FileWriter) The summary writer for the training steps. __summary_eval_writer: (tf.summary.FileWriter) The summary writer for... | stack_v2_sparse_classes_75kplus_train_003178 | 1,381 | permissive | [
{
"docstring": "Constructor, initialize member variables. :param model_dir: (String) The path to the model directory, where the summary will be saved under /logs.",
"name": "__init__",
"signature": "def __init__(self, model_dir)"
},
{
"docstring": "Write the summary for the given mode. :param mo... | 2 | null | Implement the Python class `TensorboardSummaryManager` described below.
Class description:
The TensorboardSummarymanager manages the train, eval and test summaries for the Tensorboard. :Attributes: __summary_train_writer: (tf.summary.FileWriter) The summary writer for the training steps. __summary_eval_writer: (tf.sum... | Implement the Python class `TensorboardSummaryManager` described below.
Class description:
The TensorboardSummarymanager manages the train, eval and test summaries for the Tensorboard. :Attributes: __summary_train_writer: (tf.summary.FileWriter) The summary writer for the training steps. __summary_eval_writer: (tf.sum... | 6907ae5781765f56a8492bfba594bfb3b9987f29 | <|skeleton|>
class TensorboardSummaryManager:
"""The TensorboardSummarymanager manages the train, eval and test summaries for the Tensorboard. :Attributes: __summary_train_writer: (tf.summary.FileWriter) The summary writer for the training steps. __summary_eval_writer: (tf.summary.FileWriter) The summary writer for... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TensorboardSummaryManager:
"""The TensorboardSummarymanager manages the train, eval and test summaries for the Tensorboard. :Attributes: __summary_train_writer: (tf.summary.FileWriter) The summary writer for the training steps. __summary_eval_writer: (tf.summary.FileWriter) The summary writer for the eval ste... | the_stack_v2_python_sparse | Output_Component/Summary/TensorboardSummaryManager.py | BonifazStuhr/OFM | train | 0 |
cd0b4981c9780923d311186ca55b5189bc815b29 | [
"try:\n int(lower_bound)\n return True\nexcept ValueError:\n return False",
"lower_bound = int(lower_bound)\nupper_bound = int(upper_bound)\nsplit_value = lower_bound + (upper_bound - lower_bound) / 2\nreturn split_value",
"if not RangeShardingIntegerHandler.is_valid_lower_bound(split_value):\n retu... | <|body_start_0|>
try:
int(lower_bound)
return True
except ValueError:
return False
<|end_body_0|>
<|body_start_1|>
lower_bound = int(lower_bound)
upper_bound = int(upper_bound)
split_value = lower_bound + (upper_bound - lower_bound) / 2
... | Contains the members that are required to handle a sharding definition based on an INTEGER datatype. | RangeShardingIntegerHandler | [
"Apache-2.0",
"LicenseRef-scancode-python-cwi",
"LGPL-2.0-or-later",
"BSD-3-Clause",
"bzip2-1.0.6",
"LicenseRef-scancode-free-unknown",
"GPL-2.0-only",
"LicenseRef-scancode-other-copyleft",
"Sleepycat",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference",
... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RangeShardingIntegerHandler:
"""Contains the members that are required to handle a sharding definition based on an INTEGER datatype."""
def is_valid_lower_bound(lower_bound):
"""Verify if the given value is a valid INTEGER lower bound. :param lower_bound: The value that needs to be v... | stack_v2_sparse_classes_75kplus_train_003179 | 20,959 | permissive | [
{
"docstring": "Verify if the given value is a valid INTEGER lower bound. :param lower_bound: The value that needs to be verified.",
"name": "is_valid_lower_bound",
"signature": "def is_valid_lower_bound(lower_bound)"
},
{
"docstring": "Find the middle value of a sharding range that can be used ... | 3 | stack_v2_sparse_classes_30k_train_015000 | Implement the Python class `RangeShardingIntegerHandler` described below.
Class description:
Contains the members that are required to handle a sharding definition based on an INTEGER datatype.
Method signatures and docstrings:
- def is_valid_lower_bound(lower_bound): Verify if the given value is a valid INTEGER lowe... | Implement the Python class `RangeShardingIntegerHandler` described below.
Class description:
Contains the members that are required to handle a sharding definition based on an INTEGER datatype.
Method signatures and docstrings:
- def is_valid_lower_bound(lower_bound): Verify if the given value is a valid INTEGER lowe... | 1e912fd87282be3b3bed48487e6beb0ecb1de339 | <|skeleton|>
class RangeShardingIntegerHandler:
"""Contains the members that are required to handle a sharding definition based on an INTEGER datatype."""
def is_valid_lower_bound(lower_bound):
"""Verify if the given value is a valid INTEGER lower bound. :param lower_bound: The value that needs to be v... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RangeShardingIntegerHandler:
"""Contains the members that are required to handle a sharding definition based on an INTEGER datatype."""
def is_valid_lower_bound(lower_bound):
"""Verify if the given value is a valid INTEGER lower bound. :param lower_bound: The value that needs to be verified."""
... | the_stack_v2_python_sparse | mysql-utilities-1.6.0/mysql/fabric/sharding_datatype.py | scavarda/mysql-dbcompare | train | 2 |
a9cfa137ed17f7cce55163c648520edb27001cb1 | [
"descriptor = WeblogicJndiBindingDescriptor()\nroot = self._getRootElement(content)\nfor bean in root.getChildren('weblogic-enterprise-bean', root.getNamespace()):\n bean_name = bean.getChildText('ejb-name', root.getNamespace())\n jndi_name = bean.getChildText('jndi-name', root.getNamespace())\n if bean_na... | <|body_start_0|>
descriptor = WeblogicJndiBindingDescriptor()
root = self._getRootElement(content)
for bean in root.getChildren('weblogic-enterprise-bean', root.getNamespace()):
bean_name = bean.getChildText('ejb-name', root.getNamespace())
jndi_name = bean.getChildText('... | WeblogicApplicationDescriptorParser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeblogicApplicationDescriptorParser:
def parseWeblogicEjbModuleDescriptor(self, content):
"""Parse Bean-Jndi relation in 'weblogic-ejb-jar.xml' :type content: str :param content: content of 'weblogic-ejb-jar.xml' :rtype: WeblogicJndiBindingDescriptor :return: Bean-Jndi relation"""
... | stack_v2_sparse_classes_75kplus_train_003180 | 17,219 | no_license | [
{
"docstring": "Parse Bean-Jndi relation in 'weblogic-ejb-jar.xml' :type content: str :param content: content of 'weblogic-ejb-jar.xml' :rtype: WeblogicJndiBindingDescriptor :return: Bean-Jndi relation",
"name": "parseWeblogicEjbModuleDescriptor",
"signature": "def parseWeblogicEjbModuleDescriptor(self,... | 3 | stack_v2_sparse_classes_30k_train_026565 | Implement the Python class `WeblogicApplicationDescriptorParser` described below.
Class description:
Implement the WeblogicApplicationDescriptorParser class.
Method signatures and docstrings:
- def parseWeblogicEjbModuleDescriptor(self, content): Parse Bean-Jndi relation in 'weblogic-ejb-jar.xml' :type content: str :... | Implement the Python class `WeblogicApplicationDescriptorParser` described below.
Class description:
Implement the WeblogicApplicationDescriptorParser class.
Method signatures and docstrings:
- def parseWeblogicEjbModuleDescriptor(self, content): Parse Bean-Jndi relation in 'weblogic-ejb-jar.xml' :type content: str :... | c431e809e8d0f82e1bca7e3429dd0245560b5680 | <|skeleton|>
class WeblogicApplicationDescriptorParser:
def parseWeblogicEjbModuleDescriptor(self, content):
"""Parse Bean-Jndi relation in 'weblogic-ejb-jar.xml' :type content: str :param content: content of 'weblogic-ejb-jar.xml' :rtype: WeblogicJndiBindingDescriptor :return: Bean-Jndi relation"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WeblogicApplicationDescriptorParser:
def parseWeblogicEjbModuleDescriptor(self, content):
"""Parse Bean-Jndi relation in 'weblogic-ejb-jar.xml' :type content: str :param content: content of 'weblogic-ejb-jar.xml' :rtype: WeblogicJndiBindingDescriptor :return: Bean-Jndi relation"""
descriptor =... | the_stack_v2_python_sparse | reference/ucmdb/discovery/asm_weblogic_discoverer.py | madmonkyang/cda-record | train | 0 | |
d3fea5f2536c9f72078f73262d6c59ea76569ee3 | [
"super().__init__(master)\nself.transient()\nself.focus_set()\nself.grab_set()\nconn = sqlite3.connect('movieDB.db')\nself.cur = conn.cursor()\ntk.Label(self, text=\"IMDB's Top 250 Rated Movies\").grid()\nF = tk.Frame(self)\ntk.Button(F, text='Average Movie Runtime Per Year', command=self.yearVsAvgRuntime).grid(row... | <|body_start_0|>
super().__init__(master)
self.transient()
self.focus_set()
self.grab_set()
conn = sqlite3.connect('movieDB.db')
self.cur = conn.cursor()
tk.Label(self, text="IMDB's Top 250 Rated Movies").grid()
F = tk.Frame(self)
tk.Button(F, text... | Show options for graphs | PlotMenuWin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlotMenuWin:
"""Show options for graphs"""
def __init__(self, master):
"""show user the 3 graph options they have"""
<|body_0|>
def plotHistogram(self, key):
"""compile histogram data and prompt graph"""
<|body_1|>
def yearVsAvgRuntime(self):
... | stack_v2_sparse_classes_75kplus_train_003181 | 19,434 | permissive | [
{
"docstring": "show user the 3 graph options they have",
"name": "__init__",
"signature": "def __init__(self, master)"
},
{
"docstring": "compile histogram data and prompt graph",
"name": "plotHistogram",
"signature": "def plotHistogram(self, key)"
},
{
"docstring": "compile sca... | 3 | stack_v2_sparse_classes_30k_train_004061 | Implement the Python class `PlotMenuWin` described below.
Class description:
Show options for graphs
Method signatures and docstrings:
- def __init__(self, master): show user the 3 graph options they have
- def plotHistogram(self, key): compile histogram data and prompt graph
- def yearVsAvgRuntime(self): compile sca... | Implement the Python class `PlotMenuWin` described below.
Class description:
Show options for graphs
Method signatures and docstrings:
- def __init__(self, master): show user the 3 graph options they have
- def plotHistogram(self, key): compile histogram data and prompt graph
- def yearVsAvgRuntime(self): compile sca... | 3a99e5512aa96fd62f0246abd364acc95c10802a | <|skeleton|>
class PlotMenuWin:
"""Show options for graphs"""
def __init__(self, master):
"""show user the 3 graph options they have"""
<|body_0|>
def plotHistogram(self, key):
"""compile histogram data and prompt graph"""
<|body_1|>
def yearVsAvgRuntime(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PlotMenuWin:
"""Show options for graphs"""
def __init__(self, master):
"""show user the 3 graph options they have"""
super().__init__(master)
self.transient()
self.focus_set()
self.grab_set()
conn = sqlite3.connect('movieDB.db')
self.cur = conn.curs... | the_stack_v2_python_sparse | Program 6_Top 250 Movies/application.py | anh65498/Python-Applications | train | 1 |
52afcd37f559d9e4f41b9d062e098d72c50b5550 | [
"p = super().Params()\np.Define('sub', None, 'The param of the sub-layer.')\np.Define('x_times', 0, 'Num times to repeat sub.')\nwp = p.weight_split_dims_mapping\nwp.Define('sub', None, 'How the list of subs should be sharded.')\nreturn p",
"super().__init__(params)\np = self.params\nwp = p.weight_split_dims_mapp... | <|body_start_0|>
p = super().Params()
p.Define('sub', None, 'The param of the sub-layer.')
p.Define('x_times', 0, 'Num times to repeat sub.')
wp = p.weight_split_dims_mapping
wp.Define('sub', None, 'How the list of subs should be sharded.')
return p
<|end_body_0|>
<|body... | A generic repeat layer. | Repeat | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Repeat:
"""A generic repeat layer."""
def Params(cls) -> InstantiableParams:
"""Parameterization of this model."""
<|body_0|>
def __init__(self, params: InstantiableParams) -> None:
"""Constructor."""
<|body_1|>
def fprop(self, theta: NestedMap, inpu... | stack_v2_sparse_classes_75kplus_train_003182 | 6,968 | permissive | [
{
"docstring": "Parameterization of this model.",
"name": "Params",
"signature": "def Params(cls) -> InstantiableParams"
},
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, params: InstantiableParams) -> None"
},
{
"docstring": "FProp inputs thr... | 5 | stack_v2_sparse_classes_30k_train_022952 | Implement the Python class `Repeat` described below.
Class description:
A generic repeat layer.
Method signatures and docstrings:
- def Params(cls) -> InstantiableParams: Parameterization of this model.
- def __init__(self, params: InstantiableParams) -> None: Constructor.
- def fprop(self, theta: NestedMap, inputs: ... | Implement the Python class `Repeat` described below.
Class description:
A generic repeat layer.
Method signatures and docstrings:
- def Params(cls) -> InstantiableParams: Parameterization of this model.
- def __init__(self, params: InstantiableParams) -> None: Constructor.
- def fprop(self, theta: NestedMap, inputs: ... | 6c07258cbfaec3ebea8e1db6326743a649ee7676 | <|skeleton|>
class Repeat:
"""A generic repeat layer."""
def Params(cls) -> InstantiableParams:
"""Parameterization of this model."""
<|body_0|>
def __init__(self, params: InstantiableParams) -> None:
"""Constructor."""
<|body_1|>
def fprop(self, theta: NestedMap, inpu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Repeat:
"""A generic repeat layer."""
def Params(cls) -> InstantiableParams:
"""Parameterization of this model."""
p = super().Params()
p.Define('sub', None, 'The param of the sub-layer.')
p.Define('x_times', 0, 'Num times to repeat sub.')
wp = p.weight_split_dims_... | the_stack_v2_python_sparse | lingvo/jax/layers/repeats.py | lightslife/lingvo | train | 0 |
30dcd74a1938553d2edf2cebe5da196bcd4ff16f | [
"ObjectManager.__init__(self)\nself.setters.update({'description': 'set_general', 'external_reference': 'set_general', 'facebook_message': 'set_general', 'lag_time': 'set_general', 'lead_time': 'set_general', 'name_prefix': 'set_general', 'notify_cfgs': 'set_many', 'organization': 'set_foreign_key', 'product_line':... | <|body_start_0|>
ObjectManager.__init__(self)
self.setters.update({'description': 'set_general', 'external_reference': 'set_general', 'facebook_message': 'set_general', 'lag_time': 'set_general', 'lead_time': 'set_general', 'name_prefix': 'set_general', 'notify_cfgs': 'set_many', 'organization': 'set_fo... | Manage EventTemplates in the Power Reg system | EventTemplateManager | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventTemplateManager:
"""Manage EventTemplates in the Power Reg system"""
def __init__(self):
"""constructor"""
<|body_0|>
def create(self, auth_token, name_prefix, title, description, optional_attributes=None):
"""Create a new EventTemplate. @param name_prefix P... | stack_v2_sparse_classes_75kplus_train_003183 | 3,075 | permissive | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Create a new EventTemplate. @param name_prefix Prefix that will be used in generating a unique name @param title title of the EventTemplate @param description description of the EventTemplate @... | 2 | stack_v2_sparse_classes_30k_train_036603 | Implement the Python class `EventTemplateManager` described below.
Class description:
Manage EventTemplates in the Power Reg system
Method signatures and docstrings:
- def __init__(self): constructor
- def create(self, auth_token, name_prefix, title, description, optional_attributes=None): Create a new EventTemplate.... | Implement the Python class `EventTemplateManager` described below.
Class description:
Manage EventTemplates in the Power Reg system
Method signatures and docstrings:
- def __init__(self): constructor
- def create(self, auth_token, name_prefix, title, description, optional_attributes=None): Create a new EventTemplate.... | a59457bc37f0501aea1f54d006a6de94ff80511c | <|skeleton|>
class EventTemplateManager:
"""Manage EventTemplates in the Power Reg system"""
def __init__(self):
"""constructor"""
<|body_0|>
def create(self, auth_token, name_prefix, title, description, optional_attributes=None):
"""Create a new EventTemplate. @param name_prefix P... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EventTemplateManager:
"""Manage EventTemplates in the Power Reg system"""
def __init__(self):
"""constructor"""
ObjectManager.__init__(self)
self.setters.update({'description': 'set_general', 'external_reference': 'set_general', 'facebook_message': 'set_general', 'lag_time': 'set_... | the_stack_v2_python_sparse | pr_services/event_system/event_template_manager.py | ninemoreminutes/openassign-server | train | 0 |
dc5b4f303e2839c883f6209bc6f64f0ed8d69095 | [
"username = bleach.clean(username)\nrtn = [g.name for g in ActuatorGroup.objects.filter(users__in=[User.objects.get(username=username)])]\nreturn Response(rtn)",
"username = bleach.clean(username)\nuser = User.objects.get(username=username)\nif user is None:\n return ParseError(detail='User cannot be found', c... | <|body_start_0|>
username = bleach.clean(username)
rtn = [g.name for g in ActuatorGroup.objects.filter(users__in=[User.objects.get(username=username)])]
return Response(rtn)
<|end_body_0|>
<|body_start_1|>
username = bleach.clean(username)
user = User.objects.get(username=userna... | API endpoint that allows users actuator access to be viewed or edited. | ActuatorAccess | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActuatorAccess:
"""API endpoint that allows users actuator access to be viewed or edited."""
def get(self, request, username, *args, **kwargs):
"""API endpoint that lists the actuators a users can access"""
<|body_0|>
def put(self, request, username, *args, **kwargs):
... | stack_v2_sparse_classes_75kplus_train_003184 | 2,283 | permissive | [
{
"docstring": "API endpoint that lists the actuators a users can access",
"name": "get",
"signature": "def get(self, request, username, *args, **kwargs)"
},
{
"docstring": "API endpoint that adds actuators to a users access",
"name": "put",
"signature": "def put(self, request, username,... | 2 | stack_v2_sparse_classes_30k_train_007205 | Implement the Python class `ActuatorAccess` described below.
Class description:
API endpoint that allows users actuator access to be viewed or edited.
Method signatures and docstrings:
- def get(self, request, username, *args, **kwargs): API endpoint that lists the actuators a users can access
- def put(self, request... | Implement the Python class `ActuatorAccess` described below.
Class description:
API endpoint that allows users actuator access to be viewed or edited.
Method signatures and docstrings:
- def get(self, request, username, *args, **kwargs): API endpoint that lists the actuators a users can access
- def put(self, request... | 85102bb41aa0d558a3fa088e4fd6f51613599ad0 | <|skeleton|>
class ActuatorAccess:
"""API endpoint that allows users actuator access to be viewed or edited."""
def get(self, request, username, *args, **kwargs):
"""API endpoint that lists the actuators a users can access"""
<|body_0|>
def put(self, request, username, *args, **kwargs):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ActuatorAccess:
"""API endpoint that allows users actuator access to be viewed or edited."""
def get(self, request, username, *args, **kwargs):
"""API endpoint that lists the actuators a users can access"""
username = bleach.clean(username)
rtn = [g.name for g in ActuatorGroup.obj... | the_stack_v2_python_sparse | orchestrator/core/orc_server/account/views/apiviews.py | g2-inc/openc2-oif-orchestrator | train | 1 |
f8dec2f4fdb7a9faf91673eef84a5716bb3fcd26 | [
"self.dynamic = True\nself.type = 'DynamicMetadataTree'\nMetadataTree.__init__(self, rootName)\nself.pivotParam = pivotParam",
"pivotVal = float(pivotVal)\npNode = self._findPivot(root, pivotVal)\ntNode = MetadataTree._findTarget(self, pNode, target)\nreturn tNode",
"found = False\nfor child in root:\n if ch... | <|body_start_0|>
self.dynamic = True
self.type = 'DynamicMetadataTree'
MetadataTree.__init__(self, rootName)
self.pivotParam = pivotParam
<|end_body_0|>
<|body_start_1|>
pivotVal = float(pivotVal)
pNode = self._findPivot(root, pivotVal)
tNode = MetadataTree._find... | Class for construction of metadata xml trees used in data objects. Usually contains summary data such as that produced by postprocessor models. Two types of tree exist: dynamic and static. See RAVEN Output type of Files object. | DynamicMetadataTree | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DynamicMetadataTree:
"""Class for construction of metadata xml trees used in data objects. Usually contains summary data such as that produced by postprocessor models. Two types of tree exist: dynamic and static. See RAVEN Output type of Files object."""
def __init__(self, rootName, pivotPar... | stack_v2_sparse_classes_75kplus_train_003185 | 36,827 | permissive | [
{
"docstring": "Constructor. @ In, rootName, str, root of tree if provided @ In, pivotParam, str, pivot variable @ Out, None",
"name": "__init__",
"signature": "def __init__(self, rootName, pivotParam)"
},
{
"docstring": "Used to find target node. Extension of base class method for Dynamic mode ... | 3 | stack_v2_sparse_classes_30k_train_045304 | Implement the Python class `DynamicMetadataTree` described below.
Class description:
Class for construction of metadata xml trees used in data objects. Usually contains summary data such as that produced by postprocessor models. Two types of tree exist: dynamic and static. See RAVEN Output type of Files object.
Metho... | Implement the Python class `DynamicMetadataTree` described below.
Class description:
Class for construction of metadata xml trees used in data objects. Usually contains summary data such as that produced by postprocessor models. Two types of tree exist: dynamic and static. See RAVEN Output type of Files object.
Metho... | 2b16e7aa3325fe84cab2477947a951414c635381 | <|skeleton|>
class DynamicMetadataTree:
"""Class for construction of metadata xml trees used in data objects. Usually contains summary data such as that produced by postprocessor models. Two types of tree exist: dynamic and static. See RAVEN Output type of Files object."""
def __init__(self, rootName, pivotPar... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DynamicMetadataTree:
"""Class for construction of metadata xml trees used in data objects. Usually contains summary data such as that produced by postprocessor models. Two types of tree exist: dynamic and static. See RAVEN Output type of Files object."""
def __init__(self, rootName, pivotParam):
... | the_stack_v2_python_sparse | ravenframework/utils/TreeStructure.py | idaholab/raven | train | 201 |
66816586744f9c658805a7c15538fb57662f80a4 | [
"self._hass = hass\nself._sender = sender\nself._resource = resource\nself._password = password\nself._recipients = recipient\nself._tls = tls\nself._verify = verify\nself._room = room",
"title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)\ntext = f'{title}: {message}' if title else message\ndata = kwargs.get(ATTR... | <|body_start_0|>
self._hass = hass
self._sender = sender
self._resource = resource
self._password = password
self._recipients = recipient
self._tls = tls
self._verify = verify
self._room = room
<|end_body_0|>
<|body_start_1|>
title = kwargs.get(AT... | Implement the notification service for Jabber (XMPP). | XmppNotificationService | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XmppNotificationService:
"""Implement the notification service for Jabber (XMPP)."""
def __init__(self, sender, resource, password, recipient, tls, verify, room, hass):
"""Initialize the service."""
<|body_0|>
async def async_send_message(self, message='', **kwargs):
... | stack_v2_sparse_classes_75kplus_train_003186 | 14,046 | permissive | [
{
"docstring": "Initialize the service.",
"name": "__init__",
"signature": "def __init__(self, sender, resource, password, recipient, tls, verify, room, hass)"
},
{
"docstring": "Send a message to a user.",
"name": "async_send_message",
"signature": "async def async_send_message(self, me... | 2 | stack_v2_sparse_classes_30k_train_050557 | Implement the Python class `XmppNotificationService` described below.
Class description:
Implement the notification service for Jabber (XMPP).
Method signatures and docstrings:
- def __init__(self, sender, resource, password, recipient, tls, verify, room, hass): Initialize the service.
- async def async_send_message(... | Implement the Python class `XmppNotificationService` described below.
Class description:
Implement the notification service for Jabber (XMPP).
Method signatures and docstrings:
- def __init__(self, sender, resource, password, recipient, tls, verify, room, hass): Initialize the service.
- async def async_send_message(... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class XmppNotificationService:
"""Implement the notification service for Jabber (XMPP)."""
def __init__(self, sender, resource, password, recipient, tls, verify, room, hass):
"""Initialize the service."""
<|body_0|>
async def async_send_message(self, message='', **kwargs):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class XmppNotificationService:
"""Implement the notification service for Jabber (XMPP)."""
def __init__(self, sender, resource, password, recipient, tls, verify, room, hass):
"""Initialize the service."""
self._hass = hass
self._sender = sender
self._resource = resource
... | the_stack_v2_python_sparse | homeassistant/components/xmpp/notify.py | home-assistant/core | train | 35,501 |
497a3ae1431ebf6f62ace729253bb044690da488 | [
"out = ''\nfor i, val in enumerate(s):\n k = 0\n while i - k >= 0 and i + k < len(s) and (s[i - k] == s[i + k]):\n k += 1\n if 2 * k - 1 > len(out):\n out = s[i - k + 1:i + k]\n if i + 1 < len(s) and s[i] == s[i + 1]:\n k = 0\n while i - k >= 0 and i + 1 + k < len(s) and (s[i... | <|body_start_0|>
out = ''
for i, val in enumerate(s):
k = 0
while i - k >= 0 and i + k < len(s) and (s[i - k] == s[i + k]):
k += 1
if 2 * k - 1 > len(out):
out = s[i - k + 1:i + k]
if i + 1 < len(s) and s[i] == s[i + 1]:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestPalindrome1(self, s: str) -> str:
"""中心扩展算法,注意奇偶情况 :param s: :return:"""
<|body_0|>
def longestPalindrome2(self, s: str) -> str:
"""Manacher 算法 :param s: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
out = ''
... | stack_v2_sparse_classes_75kplus_train_003187 | 1,780 | no_license | [
{
"docstring": "中心扩展算法,注意奇偶情况 :param s: :return:",
"name": "longestPalindrome1",
"signature": "def longestPalindrome1(self, s: str) -> str"
},
{
"docstring": "Manacher 算法 :param s: :return:",
"name": "longestPalindrome2",
"signature": "def longestPalindrome2(self, s: str) -> str"
}
] | 2 | stack_v2_sparse_classes_30k_train_031478 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome1(self, s: str) -> str: 中心扩展算法,注意奇偶情况 :param s: :return:
- def longestPalindrome2(self, s: str) -> str: Manacher 算法 :param s: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome1(self, s: str) -> str: 中心扩展算法,注意奇偶情况 :param s: :return:
- def longestPalindrome2(self, s: str) -> str: Manacher 算法 :param s: :return:
<|skeleton|>
class So... | f2c162654a83c51495ebd161f42a1d0b69caf72d | <|skeleton|>
class Solution:
def longestPalindrome1(self, s: str) -> str:
"""中心扩展算法,注意奇偶情况 :param s: :return:"""
<|body_0|>
def longestPalindrome2(self, s: str) -> str:
"""Manacher 算法 :param s: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def longestPalindrome1(self, s: str) -> str:
"""中心扩展算法,注意奇偶情况 :param s: :return:"""
out = ''
for i, val in enumerate(s):
k = 0
while i - k >= 0 and i + k < len(s) and (s[i - k] == s[i + k]):
k += 1
if 2 * k - 1 > len(out):
... | the_stack_v2_python_sparse | 05 longestPalindrome.py | ABenxj/leetcode | train | 1 | |
ed2bd943e10a0f65db0af0b164989cc9456ad5ba | [
"exist_serial = PpsnackSerialNums.query.filter_by(serial_num=request.json['serial_num']).first()\nif exist_serial is None:\n return ({'msg': 'Serial number is invalid. Please check again.'}, 404)\nif exist_serial.registered == 1:\n return ({'msg': 'Serial number is already registered. please check again.'}, 4... | <|body_start_0|>
exist_serial = PpsnackSerialNums.query.filter_by(serial_num=request.json['serial_num']).first()
if exist_serial is None:
return ({'msg': 'Serial number is invalid. Please check again.'}, 404)
if exist_serial.registered == 1:
return ({'msg': 'Serial number... | PpsnackApi | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PpsnackApi:
def post(self, ppcam_id):
"""/ppcam/<int:ppcam_id>/ppsnack Register ppsnack by ppcam :path: ppcam_id: int :body: serial_num: str, feedback: float *** Persist state of ppsnack ***"""
<|body_0|>
def get(self, ppcam_id):
"""Return ppsnack data by ppcam id :p... | stack_v2_sparse_classes_75kplus_train_003188 | 5,180 | permissive | [
{
"docstring": "/ppcam/<int:ppcam_id>/ppsnack Register ppsnack by ppcam :path: ppcam_id: int :body: serial_num: str, feedback: float *** Persist state of ppsnack ***",
"name": "post",
"signature": "def post(self, ppcam_id)"
},
{
"docstring": "Return ppsnack data by ppcam id :path: ppcam_id: int ... | 3 | stack_v2_sparse_classes_30k_train_011773 | Implement the Python class `PpsnackApi` described below.
Class description:
Implement the PpsnackApi class.
Method signatures and docstrings:
- def post(self, ppcam_id): /ppcam/<int:ppcam_id>/ppsnack Register ppsnack by ppcam :path: ppcam_id: int :body: serial_num: str, feedback: float *** Persist state of ppsnack **... | Implement the Python class `PpsnackApi` described below.
Class description:
Implement the PpsnackApi class.
Method signatures and docstrings:
- def post(self, ppcam_id): /ppcam/<int:ppcam_id>/ppsnack Register ppsnack by ppcam :path: ppcam_id: int :body: serial_num: str, feedback: float *** Persist state of ppsnack **... | 02cea28c6a79f02b1aac05fe733e04a51f84e13a | <|skeleton|>
class PpsnackApi:
def post(self, ppcam_id):
"""/ppcam/<int:ppcam_id>/ppsnack Register ppsnack by ppcam :path: ppcam_id: int :body: serial_num: str, feedback: float *** Persist state of ppsnack ***"""
<|body_0|>
def get(self, ppcam_id):
"""Return ppsnack data by ppcam id :p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PpsnackApi:
def post(self, ppcam_id):
"""/ppcam/<int:ppcam_id>/ppsnack Register ppsnack by ppcam :path: ppcam_id: int :body: serial_num: str, feedback: float *** Persist state of ppsnack ***"""
exist_serial = PpsnackSerialNums.query.filter_by(serial_num=request.json['serial_num']).first()
... | the_stack_v2_python_sparse | app/resources/ppsnack.py | badger777/goodpp-ml-backend | train | 0 | |
1cc55762659acd6d08d73f179fcb41ad4ae806f4 | [
"configuration = g.user.get_api().get_configuration(configuration)\nzone_parent = configuration.get_view(view)\nleaf_zone = zone_parent\nif zone:\n zone_hierarchy = zone.split('/zones')\n zone_entity = zone_parent.get_zone(zone_hierarchy[0])\n leaf_zone = check_zone_in_path(zone_entity, zone_hierarchy[0], ... | <|body_start_0|>
configuration = g.user.get_api().get_configuration(configuration)
zone_parent = configuration.get_view(view)
leaf_zone = zone_parent
if zone:
zone_hierarchy = zone.split('/zones')
zone_entity = zone_parent.get_zone(zone_hierarchy[0])
l... | ZoneCollection | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZoneCollection:
def get(self, configuration, view, zone=None):
"""Get all direct subzones belonging to default or provided Configuration and View plus Zone hierarchy. Subzones can be recursively retrieved by specifying extra "zones" parameters. Zones should be of the format: 1. zone_name... | stack_v2_sparse_classes_75kplus_train_003189 | 33,507 | permissive | [
{
"docstring": "Get all direct subzones belonging to default or provided Configuration and View plus Zone hierarchy. Subzones can be recursively retrieved by specifying extra \"zones\" parameters. Zones should be of the format: 1. zone_name 2. zone_name1/zones/zone_name2",
"name": "get",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_009097 | Implement the Python class `ZoneCollection` described below.
Class description:
Implement the ZoneCollection class.
Method signatures and docstrings:
- def get(self, configuration, view, zone=None): Get all direct subzones belonging to default or provided Configuration and View plus Zone hierarchy. Subzones can be re... | Implement the Python class `ZoneCollection` described below.
Class description:
Implement the ZoneCollection class.
Method signatures and docstrings:
- def get(self, configuration, view, zone=None): Get all direct subzones belonging to default or provided Configuration and View plus Zone hierarchy. Subzones can be re... | 60b36434e689c3ef852ab388ca2aae370e70c62d | <|skeleton|>
class ZoneCollection:
def get(self, configuration, view, zone=None):
"""Get all direct subzones belonging to default or provided Configuration and View plus Zone hierarchy. Subzones can be recursively retrieved by specifying extra "zones" parameters. Zones should be of the format: 1. zone_name... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ZoneCollection:
def get(self, configuration, view, zone=None):
"""Get all direct subzones belonging to default or provided Configuration and View plus Zone hierarchy. Subzones can be recursively retrieved by specifying extra "zones" parameters. Zones should be of the format: 1. zone_name 2. zone_name1... | the_stack_v2_python_sparse | Community/rest_api/dns_page.py | bluecatlabs/gateway-workflows | train | 45 | |
d99ddfb523c953ca2120581deaf92b88e031d646 | [
"self.pager = pager\nself.text = text\nself.page = page\nself.state = None\nif active:\n self.state = 'active'\nif disabled:\n self.state = 'disabled'",
"if self.state is not None:\n return None\nreturn self.pager._href_pattern % self.page"
] | <|body_start_0|>
self.pager = pager
self.text = text
self.page = page
self.state = None
if active:
self.state = 'active'
if disabled:
self.state = 'disabled'
<|end_body_0|>
<|body_start_1|>
if self.state is not None:
return Non... | An object representing a single link in the pagination control. | _PageLink | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _PageLink:
"""An object representing a single link in the pagination control."""
def __init__(self, pager, text, page, active=False, disabled=False):
"""Create a new page link. Arguments: pager: The parent Pager object. text: The text of the link. page: The page number that the link ... | stack_v2_sparse_classes_75kplus_train_003190 | 5,248 | permissive | [
{
"docstring": "Create a new page link. Arguments: pager: The parent Pager object. text: The text of the link. page: The page number that the link points to. active: Whether the link represents the current page. disabled: Whether the link is invalid.",
"name": "__init__",
"signature": "def __init__(self... | 2 | stack_v2_sparse_classes_30k_train_049097 | Implement the Python class `_PageLink` described below.
Class description:
An object representing a single link in the pagination control.
Method signatures and docstrings:
- def __init__(self, pager, text, page, active=False, disabled=False): Create a new page link. Arguments: pager: The parent Pager object. text: T... | Implement the Python class `_PageLink` described below.
Class description:
An object representing a single link in the pagination control.
Method signatures and docstrings:
- def __init__(self, pager, text, page, active=False, disabled=False): Create a new page link. Arguments: pager: The parent Pager object. text: T... | 5701b2a6ef4c94a3026f03e1bbea09cd999e9d88 | <|skeleton|>
class _PageLink:
"""An object representing a single link in the pagination control."""
def __init__(self, pager, text, page, active=False, disabled=False):
"""Create a new page link. Arguments: pager: The parent Pager object. text: The text of the link. page: The page number that the link ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _PageLink:
"""An object representing a single link in the pagination control."""
def __init__(self, pager, text, page, active=False, disabled=False):
"""Create a new page link. Arguments: pager: The parent Pager object. text: The text of the link. page: The page number that the link points to. ac... | the_stack_v2_python_sparse | app/handlers/pager.py | tapted/pub-dartlang | train | 0 |
16ee59bd2aa7907a32a8c635c5f27a1f27830b51 | [
"raw_df = pd.read_csv(os.path.join(_TEST_DATA_DIR, 'test_industry_tiny_raw.csv'), index_col=0)\nclean_df = pd.read_csv(os.path.join(_TEST_DATA_DIR, 'test_industry_tiny_cleaned.csv'), index_col=0)\nloader = import_industry_data_and_gen_mcf.StateGDPIndustryDataLoader()\nloader.process_data(raw_df)\npd.testing.assert_... | <|body_start_0|>
raw_df = pd.read_csv(os.path.join(_TEST_DATA_DIR, 'test_industry_tiny_raw.csv'), index_col=0)
clean_df = pd.read_csv(os.path.join(_TEST_DATA_DIR, 'test_industry_tiny_cleaned.csv'), index_col=0)
loader = import_industry_data_and_gen_mcf.StateGDPIndustryDataLoader()
loader... | USStateQuarterlyPerIndustryImportTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class USStateQuarterlyPerIndustryImportTest:
def test_data_processing_tiny(self):
"""Tests end-to-end data cleaning on a tiny example."""
<|body_0|>
def test_value_converter(self):
"""Tests value converter function that cleans out empty datapoints."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_003191 | 5,596 | permissive | [
{
"docstring": "Tests end-to-end data cleaning on a tiny example.",
"name": "test_data_processing_tiny",
"signature": "def test_data_processing_tiny(self)"
},
{
"docstring": "Tests value converter function that cleans out empty datapoints.",
"name": "test_value_converter",
"signature": "... | 3 | stack_v2_sparse_classes_30k_train_002352 | Implement the Python class `USStateQuarterlyPerIndustryImportTest` described below.
Class description:
Implement the USStateQuarterlyPerIndustryImportTest class.
Method signatures and docstrings:
- def test_data_processing_tiny(self): Tests end-to-end data cleaning on a tiny example.
- def test_value_converter(self):... | Implement the Python class `USStateQuarterlyPerIndustryImportTest` described below.
Class description:
Implement the USStateQuarterlyPerIndustryImportTest class.
Method signatures and docstrings:
- def test_data_processing_tiny(self): Tests end-to-end data cleaning on a tiny example.
- def test_value_converter(self):... | 6b32c869f426a8a5ba1b99edd324cc0c77bbd4ad | <|skeleton|>
class USStateQuarterlyPerIndustryImportTest:
def test_data_processing_tiny(self):
"""Tests end-to-end data cleaning on a tiny example."""
<|body_0|>
def test_value_converter(self):
"""Tests value converter function that cleans out empty datapoints."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class USStateQuarterlyPerIndustryImportTest:
def test_data_processing_tiny(self):
"""Tests end-to-end data cleaning on a tiny example."""
raw_df = pd.read_csv(os.path.join(_TEST_DATA_DIR, 'test_industry_tiny_raw.csv'), index_col=0)
clean_df = pd.read_csv(os.path.join(_TEST_DATA_DIR, 'test_in... | the_stack_v2_python_sparse | scripts/us_bea/states_gdp/import_data_test.py | wh1210/data | train | 1 | |
1d9656247478eaee8967fbd286450ae2b06b66b7 | [
"self.log = logger or logging.getLogger('layout_json')\nself._vault_client = None\nself.cache = {}\nself.vault_token = os.getenv('VAULT_TOKEN')\nself.vault_addr = os.getenv('VAULT_ADDR') or os.getenv('VAULT_URL')",
"if '/' in env_variable:\n paths = env_variable.lstrip('/').split('/')\n env_variable = '/'.j... | <|body_start_0|>
self.log = logger or logging.getLogger('layout_json')
self._vault_client = None
self.cache = {}
self.vault_token = os.getenv('VAULT_TOKEN')
self.vault_addr = os.getenv('VAULT_ADDR') or os.getenv('VAULT_URL')
<|end_body_0|>
<|body_start_1|>
if '/' in env_... | TcEx Key Value API Module. Args: logger (logging.Logger, optional): A instance of Logger. Defaults to None. | EnvStore | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EnvStore:
"""TcEx Key Value API Module. Args: logger (logging.Logger, optional): A instance of Logger. Defaults to None."""
def __init__(self, logger=None):
"""Initialize the Class properties."""
<|body_0|>
def _convert_env(env_variable):
"""Convert an a vault pa... | stack_v2_sparse_classes_75kplus_train_003192 | 4,970 | permissive | [
{
"docstring": "Initialize the Class properties.",
"name": "__init__",
"signature": "def __init__(self, logger=None)"
},
{
"docstring": "Convert an a vault path to env variable, removing first 2 parts of path Vault path need to be updated to be looked up as env variables. /ninja/int/cisco/umbrel... | 5 | stack_v2_sparse_classes_30k_train_012251 | Implement the Python class `EnvStore` described below.
Class description:
TcEx Key Value API Module. Args: logger (logging.Logger, optional): A instance of Logger. Defaults to None.
Method signatures and docstrings:
- def __init__(self, logger=None): Initialize the Class properties.
- def _convert_env(env_variable): ... | Implement the Python class `EnvStore` described below.
Class description:
TcEx Key Value API Module. Args: logger (logging.Logger, optional): A instance of Logger. Defaults to None.
Method signatures and docstrings:
- def __init__(self, logger=None): Initialize the Class properties.
- def _convert_env(env_variable): ... | 7cf04fec048fadc71ff851970045b8a587269ccf | <|skeleton|>
class EnvStore:
"""TcEx Key Value API Module. Args: logger (logging.Logger, optional): A instance of Logger. Defaults to None."""
def __init__(self, logger=None):
"""Initialize the Class properties."""
<|body_0|>
def _convert_env(env_variable):
"""Convert an a vault pa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EnvStore:
"""TcEx Key Value API Module. Args: logger (logging.Logger, optional): A instance of Logger. Defaults to None."""
def __init__(self, logger=None):
"""Initialize the Class properties."""
self.log = logger or logging.getLogger('layout_json')
self._vault_client = None
... | the_stack_v2_python_sparse | tcex/env_store/env_store.py | TpyoKnig/tcex | train | 0 |
a223ccd0951b56756fbeedbe4f17d0301734e3c6 | [
"if not len(time_lat_lon_data) == 0:\n _time, lat, lon, data = time_lat_lon_data[0]\n assigns = ftsg.assign_space_grid(lat, lon, requires_mesh)\n flat_assigns = assigns.flatten().reshape(data.size, 2)\ntime_data_assigns = []\nfor _time, dump1, dump2, data in time_lat_lon_data:\n flat_data = data.flatten... | <|body_start_0|>
if not len(time_lat_lon_data) == 0:
_time, lat, lon, data = time_lat_lon_data[0]
assigns = ftsg.assign_space_grid(lat, lon, requires_mesh)
flat_assigns = assigns.flatten().reshape(data.size, 2)
time_data_assigns = []
for _time, dump1, dump2, d... | ConsistentGridConversionCleaner | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConsistentGridConversionCleaner:
def assign_space_each_time(self, time_lat_lon_data, ftsg, requires_mesh):
"""Create grid assignments for each set of space coordinates for each time. Returns arrays of data and grid assignments for that data, for each time. Note: Assumes that grid is same... | stack_v2_sparse_classes_75kplus_train_003193 | 21,556 | permissive | [
{
"docstring": "Create grid assignments for each set of space coordinates for each time. Returns arrays of data and grid assignments for that data, for each time. Note: Assumes that grid is same shape and is used for speeding up",
"name": "assign_space_each_time",
"signature": "def assign_space_each_tim... | 3 | stack_v2_sparse_classes_30k_train_011688 | Implement the Python class `ConsistentGridConversionCleaner` described below.
Class description:
Implement the ConsistentGridConversionCleaner class.
Method signatures and docstrings:
- def assign_space_each_time(self, time_lat_lon_data, ftsg, requires_mesh): Create grid assignments for each set of space coordinates ... | Implement the Python class `ConsistentGridConversionCleaner` described below.
Class description:
Implement the ConsistentGridConversionCleaner class.
Method signatures and docstrings:
- def assign_space_each_time(self, time_lat_lon_data, ftsg, requires_mesh): Create grid assignments for each set of space coordinates ... | cc3c8f16f7759fe29e46d3cec32a3ed6ca86bd5f | <|skeleton|>
class ConsistentGridConversionCleaner:
def assign_space_each_time(self, time_lat_lon_data, ftsg, requires_mesh):
"""Create grid assignments for each set of space coordinates for each time. Returns arrays of data and grid assignments for that data, for each time. Note: Assumes that grid is same... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConsistentGridConversionCleaner:
def assign_space_each_time(self, time_lat_lon_data, ftsg, requires_mesh):
"""Create grid assignments for each set of space coordinates for each time. Returns arrays of data and grid assignments for that data, for each time. Note: Assumes that grid is same shape and is ... | the_stack_v2_python_sparse | smoke/clean/cleaners.py | minnieteng/smoke_project | train | 0 | |
6ce263712cfa4ff7e8a1654cacb99a9908f1e652 | [
"if self.name:\n return self.name\nreturn ''",
"try:\n if not self.name and (not self.type) and (not self.group):\n return\n super(IllnessTranslation, self).save(*args, **kwargs)\nexcept Illness.DoesNotExist:\n super(IllnessTranslation, self).save(*args, **kwargs)"
] | <|body_start_0|>
if self.name:
return self.name
return ''
<|end_body_0|>
<|body_start_1|>
try:
if not self.name and (not self.type) and (not self.group):
return
super(IllnessTranslation, self).save(*args, **kwargs)
except Illness.DoesN... | Models a illness | IllnessTranslation | [
"Apache-2.0",
"CC-BY-4.0",
"CC-BY-3.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IllnessTranslation:
"""Models a illness"""
def __unicode__(self):
"""Show the illness name."""
<|body_0|>
def save(self, *args, **kwargs):
"""Overriding the save method, that does not support empty or repeated records."""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_75kplus_train_003194 | 9,085 | permissive | [
{
"docstring": "Show the illness name.",
"name": "__unicode__",
"signature": "def __unicode__(self)"
},
{
"docstring": "Overriding the save method, that does not support empty or repeated records.",
"name": "save",
"signature": "def save(self, *args, **kwargs)"
}
] | 2 | null | Implement the Python class `IllnessTranslation` described below.
Class description:
Models a illness
Method signatures and docstrings:
- def __unicode__(self): Show the illness name.
- def save(self, *args, **kwargs): Overriding the save method, that does not support empty or repeated records. | Implement the Python class `IllnessTranslation` described below.
Class description:
Models a illness
Method signatures and docstrings:
- def __unicode__(self): Show the illness name.
- def save(self, *args, **kwargs): Overriding the save method, that does not support empty or repeated records.
<|skeleton|>
class Ill... | 59387f04283de48106c8f80ae5ea365d3e76e350 | <|skeleton|>
class IllnessTranslation:
"""Models a illness"""
def __unicode__(self):
"""Show the illness name."""
<|body_0|>
def save(self, *args, **kwargs):
"""Overriding the save method, that does not support empty or repeated records."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IllnessTranslation:
"""Models a illness"""
def __unicode__(self):
"""Show the illness name."""
if self.name:
return self.name
return ''
def save(self, *args, **kwargs):
"""Overriding the save method, that does not support empty or repeated records."""
... | the_stack_v2_python_sparse | pythonidae/plugins/econmet/models.py | Fidesol/econmet | train | 0 |
12dcd5f7096e4684a91a188a73df5dbe52febc66 | [
"self.name = name\nself.desired_species = desired_species\nself.considered_species = considered_species",
"adopter_score = float(adoption_center.get_number_of_species(self.desired_species))\nnum_other = 0\nfor a in self.considered_species:\n num_other += float(adoption_center.get_number_of_species(a))\nreturn ... | <|body_start_0|>
self.name = name
self.desired_species = desired_species
self.considered_species = considered_species
<|end_body_0|>
<|body_start_1|>
adopter_score = float(adoption_center.get_number_of_species(self.desired_species))
num_other = 0
for a in self.considered... | A FlexibleAdopter still has one type of species that they desire, but they are also alright with considering other types of species. considered_species is a list containing the other species the adopter will consider Their score should be 1x their desired species + .3x all of their desired species | FlexibleAdopter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FlexibleAdopter:
"""A FlexibleAdopter still has one type of species that they desire, but they are also alright with considering other types of species. considered_species is a list containing the other species the adopter will consider Their score should be 1x their desired species + .3x all of ... | stack_v2_sparse_classes_75kplus_train_003195 | 4,359 | no_license | [
{
"docstring": "Initializes FlexibleAdopter, a subclass of Adopter object class considered_species - a list of strings of alternative species that the person is interested in adopting. All of the inputs are the same as the Adopter",
"name": "__init__",
"signature": "def __init__(self, name, desired_spec... | 2 | stack_v2_sparse_classes_30k_train_015451 | Implement the Python class `FlexibleAdopter` described below.
Class description:
A FlexibleAdopter still has one type of species that they desire, but they are also alright with considering other types of species. considered_species is a list containing the other species the adopter will consider Their score should be... | Implement the Python class `FlexibleAdopter` described below.
Class description:
A FlexibleAdopter still has one type of species that they desire, but they are also alright with considering other types of species. considered_species is a list containing the other species the adopter will consider Their score should be... | d8750a5d78f042477f6577af67cc46d584f4aede | <|skeleton|>
class FlexibleAdopter:
"""A FlexibleAdopter still has one type of species that they desire, but they are also alright with considering other types of species. considered_species is a list containing the other species the adopter will consider Their score should be 1x their desired species + .3x all of ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FlexibleAdopter:
"""A FlexibleAdopter still has one type of species that they desire, but they are also alright with considering other types of species. considered_species is a list containing the other species the adopter will consider Their score should be 1x their desired species + .3x all of their desired... | the_stack_v2_python_sparse | ProblemSets/ProblemSet07c.py | Greatdane/MITx-6.00.1x | train | 0 |
4e0b71dee89f77efef4af948c755663887d809f7 | [
"out, stack = ([], [])\nnode, status = (root, 0)\nwhile True:\n if not node:\n if stack:\n node, status = stack.pop()\n else:\n break\n if node and status == 0:\n while node:\n stack.append((node, 1))\n node, status = (node.left, 0)\n elif no... | <|body_start_0|>
out, stack = ([], [])
node, status = (root, 0)
while True:
if not node:
if stack:
node, status = stack.pop()
else:
break
if node and status == 0:
while node:
... | TreeTraversalPostOrder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TreeTraversalPostOrder:
def traverse_iterative(root: TreeNode) -> []:
"""Iterative tree traversal in order"""
<|body_0|>
def traverse_recursive(self, root: TreeNode) -> []:
"""Recursive tree traversal in order"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_75kplus_train_003196 | 1,443 | no_license | [
{
"docstring": "Iterative tree traversal in order",
"name": "traverse_iterative",
"signature": "def traverse_iterative(root: TreeNode) -> []"
},
{
"docstring": "Recursive tree traversal in order",
"name": "traverse_recursive",
"signature": "def traverse_recursive(self, root: TreeNode) ->... | 2 | stack_v2_sparse_classes_30k_train_044144 | Implement the Python class `TreeTraversalPostOrder` described below.
Class description:
Implement the TreeTraversalPostOrder class.
Method signatures and docstrings:
- def traverse_iterative(root: TreeNode) -> []: Iterative tree traversal in order
- def traverse_recursive(self, root: TreeNode) -> []: Recursive tree t... | Implement the Python class `TreeTraversalPostOrder` described below.
Class description:
Implement the TreeTraversalPostOrder class.
Method signatures and docstrings:
- def traverse_iterative(root: TreeNode) -> []: Iterative tree traversal in order
- def traverse_recursive(self, root: TreeNode) -> []: Recursive tree t... | 8ae84f276cd07ffdb9b742569a5e32809ecc6b29 | <|skeleton|>
class TreeTraversalPostOrder:
def traverse_iterative(root: TreeNode) -> []:
"""Iterative tree traversal in order"""
<|body_0|>
def traverse_recursive(self, root: TreeNode) -> []:
"""Recursive tree traversal in order"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TreeTraversalPostOrder:
def traverse_iterative(root: TreeNode) -> []:
"""Iterative tree traversal in order"""
out, stack = ([], [])
node, status = (root, 0)
while True:
if not node:
if stack:
node, status = stack.pop()
... | the_stack_v2_python_sparse | pyquiz/leetcode/TreeTraversalPostOrder.py | DmitryPukhov/pyquiz | train | 0 | |
2200246b2d465503ed6ec5ad2fa8b20feb4b7dbf | [
"sync_test_data()\ndb.fastqs.drop()\ndb.mappings.drop()\ndb.experiments.drop()\ndb.gtfs.drop()\nmock_insert(sample_name, genome_name)\ngtfs.get_version_before = Mock(return_value=genome_name)\nencode.get_online_list = Mock(return_value=ex_mock.get_online_list(sample_name))\nself.e_acc = sample_name\nself.gtf_ver = ... | <|body_start_0|>
sync_test_data()
db.fastqs.drop()
db.mappings.drop()
db.experiments.drop()
db.gtfs.drop()
mock_insert(sample_name, genome_name)
gtfs.get_version_before = Mock(return_value=genome_name)
encode.get_online_list = Mock(return_value=ex_mock.get... | IntExperiments | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IntExperiments:
def __init__(self, genome_name='chM', sample_name='SAMP_CHM'):
"""Empty databases prior to start :return:"""
<|body_0|>
def test_process(self):
"""Fetch list of online experiments, store into database and enqueue for download :return:"""
<|bod... | stack_v2_sparse_classes_75kplus_train_003197 | 7,057 | permissive | [
{
"docstring": "Empty databases prior to start :return:",
"name": "__init__",
"signature": "def __init__(self, genome_name='chM', sample_name='SAMP_CHM')"
},
{
"docstring": "Fetch list of online experiments, store into database and enqueue for download :return:",
"name": "test_process",
... | 2 | null | Implement the Python class `IntExperiments` described below.
Class description:
Implement the IntExperiments class.
Method signatures and docstrings:
- def __init__(self, genome_name='chM', sample_name='SAMP_CHM'): Empty databases prior to start :return:
- def test_process(self): Fetch list of online experiments, sto... | Implement the Python class `IntExperiments` described below.
Class description:
Implement the IntExperiments class.
Method signatures and docstrings:
- def __init__(self, genome_name='chM', sample_name='SAMP_CHM'): Empty databases prior to start :return:
- def test_process(self): Fetch list of online experiments, sto... | dcff565ce96afe37aa8a41995637d00cce02360d | <|skeleton|>
class IntExperiments:
def __init__(self, genome_name='chM', sample_name='SAMP_CHM'):
"""Empty databases prior to start :return:"""
<|body_0|>
def test_process(self):
"""Fetch list of online experiments, store into database and enqueue for download :return:"""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IntExperiments:
def __init__(self, genome_name='chM', sample_name='SAMP_CHM'):
"""Empty databases prior to start :return:"""
sync_test_data()
db.fastqs.drop()
db.mappings.drop()
db.experiments.drop()
db.gtfs.drop()
mock_insert(sample_name, genome_name)
... | the_stack_v2_python_sparse | enCount/integration/experiments.py | mstrazar/enCount | train | 0 | |
a50be3966194211bd56a985baecdfdcfae6e9d99 | [
"if not request.user.is_superuser:\n return Response(status=status.HTTP_403_FORBIDDEN)\ntry:\n object_list = persistent_query_example_api.get_all(request.user)\n serializer = self.serializer(object_list, many=True)\n return Response(serializer.data, status=status.HTTP_200_OK)\nexcept AccessControlError ... | <|body_start_0|>
if not request.user.is_superuser:
return Response(status=status.HTTP_403_FORBIDDEN)
try:
object_list = persistent_query_example_api.get_all(request.user)
serializer = self.serializer(object_list, many=True)
return Response(serializer.data,... | List all persistent query example, or create a new one. | AdminPersistentQueryExampleList | [
"NIST-Software",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdminPersistentQueryExampleList:
"""List all persistent query example, or create a new one."""
def get(self, request):
"""Get all user persistent query example Args: request: HTTP request Returns: - code: 200 content: List of persistent query example - code: 403 content: Forbidden - ... | stack_v2_sparse_classes_75kplus_train_003198 | 13,206 | permissive | [
{
"docstring": "Get all user persistent query example Args: request: HTTP request Returns: - code: 200 content: List of persistent query example - code: 403 content: Forbidden - code: 500 content: Internal server error",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Cre... | 2 | stack_v2_sparse_classes_30k_val_001286 | Implement the Python class `AdminPersistentQueryExampleList` described below.
Class description:
List all persistent query example, or create a new one.
Method signatures and docstrings:
- def get(self, request): Get all user persistent query example Args: request: HTTP request Returns: - code: 200 content: List of p... | Implement the Python class `AdminPersistentQueryExampleList` described below.
Class description:
List all persistent query example, or create a new one.
Method signatures and docstrings:
- def get(self, request): Get all user persistent query example Args: request: HTTP request Returns: - code: 200 content: List of p... | 2abebfd1c2319899d907ad0b650fedb955be7492 | <|skeleton|>
class AdminPersistentQueryExampleList:
"""List all persistent query example, or create a new one."""
def get(self, request):
"""Get all user persistent query example Args: request: HTTP request Returns: - code: 200 content: List of persistent query example - code: 403 content: Forbidden - ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AdminPersistentQueryExampleList:
"""List all persistent query example, or create a new one."""
def get(self, request):
"""Get all user persistent query example Args: request: HTTP request Returns: - code: 200 content: List of persistent query example - code: 403 content: Forbidden - code: 500 con... | the_stack_v2_python_sparse | core_explore_example_app/rest/persistent_query_example/views.py | usnistgov/core_explore_example_app | train | 0 |
7fd786262736908d252864d31fe99c865f46d97b | [
"try:\n t = u'本地'\n self.assertEqual(t, self.app.back_app())\n print('退出app正确')\nexcept Exception as e:\n print('退出app失败')",
"try:\n t = u'QQ音乐'\n self.assertEqual(t, self.app.OpenAPP())\n print('进入app正确')\nexcept Exception as e:\n print('进入app失败')"
] | <|body_start_0|>
try:
t = u'本地'
self.assertEqual(t, self.app.back_app())
print('退出app正确')
except Exception as e:
print('退出app失败')
<|end_body_0|>
<|body_start_1|>
try:
t = u'QQ音乐'
self.assertEqual(t, self.app.OpenAPP())
... | Test_open_close_app | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_open_close_app:
def test_close_app(self):
"""关闭app"""
<|body_0|>
def test_open_app(self):
"""打开app"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
t = u'本地'
self.assertEqual(t, self.app.back_app())
print... | stack_v2_sparse_classes_75kplus_train_003199 | 997 | no_license | [
{
"docstring": "关闭app",
"name": "test_close_app",
"signature": "def test_close_app(self)"
},
{
"docstring": "打开app",
"name": "test_open_app",
"signature": "def test_open_app(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_030118 | Implement the Python class `Test_open_close_app` described below.
Class description:
Implement the Test_open_close_app class.
Method signatures and docstrings:
- def test_close_app(self): 关闭app
- def test_open_app(self): 打开app | Implement the Python class `Test_open_close_app` described below.
Class description:
Implement the Test_open_close_app class.
Method signatures and docstrings:
- def test_close_app(self): 关闭app
- def test_open_app(self): 打开app
<|skeleton|>
class Test_open_close_app:
def test_close_app(self):
"""关闭app"""... | 2c8b1cfa3c0ead8995578ba5eee2e496bba01be1 | <|skeleton|>
class Test_open_close_app:
def test_close_app(self):
"""关闭app"""
<|body_0|>
def test_open_app(self):
"""打开app"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Test_open_close_app:
def test_close_app(self):
"""关闭app"""
try:
t = u'本地'
self.assertEqual(t, self.app.back_app())
print('退出app正确')
except Exception as e:
print('退出app失败')
def test_open_app(self):
"""打开app"""
try:
... | the_stack_v2_python_sparse | CarNavigation_Test/Project/Music_CarNavigation/Test_Case/test_RunAPP.py | zhangyuanzhou900408/Test | train | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.