blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
e69623bb5205999e45ab3c7939e17fa981345ad5
[ "Parametre.__init__(self, 'liste', 'list')\nself.aide_courte = 'liste les tags existants'\nself.aide_longue = 'Cette commande liste les tags existants, groupés par type. La première colonne est le type de tag. La seconde est sa clé. La troisième est le nombre de lignes scripting définies dans ce tag.'", "tags = t...
<|body_start_0|> Parametre.__init__(self, 'liste', 'list') self.aide_courte = 'liste les tags existants' self.aide_longue = 'Cette commande liste les tags existants, groupés par type. La première colonne est le type de tag. La seconde est sa clé. La troisième est le nombre de lignes scripting dé...
Commande 'tags liste'.
PrmListe
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmListe: """Commande 'tags liste'.""" 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_36k_train_006800
3,244
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
stack_v2_sparse_classes_30k_train_021234
Implement the Python class `PrmListe` described below. Class description: Commande 'tags liste'. 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 `PrmListe` described below. Class description: Commande 'tags liste'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmListe: """Commande 'tags liste'.""...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmListe: """Commande 'tags liste'.""" 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_36k
data/stack_v2_sparse_classes_30k
class PrmListe: """Commande 'tags liste'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'liste', 'list') self.aide_courte = 'liste les tags existants' self.aide_longue = 'Cette commande liste les tags existants, groupés par type. La première col...
the_stack_v2_python_sparse
src/secondaires/tags/commandes/tags/liste.py
vincent-lg/tsunami
train
5
0ea6018076d6fe44d6e5e0f7d2e57897153b03bc
[ "with objc.autorelease_pool():\n with pipes() as (out, err):\n if self.slow_mo and version == PHOTOS_VERSION_CURRENT:\n return [self._export_slow_mo(dest, filename=filename, version=version, overwrite=overwrite)]\n filename = pathlib.Path(filename) if filename else pathlib.Path(self.orig...
<|body_start_0|> with objc.autorelease_pool(): with pipes() as (out, err): if self.slow_mo and version == PHOTOS_VERSION_CURRENT: return [self._export_slow_mo(dest, filename=filename, version=version, overwrite=overwrite)] filename = pathlib.Path(f...
PhotoKit PHAsset representation of video asset
VideoAsset
[ "MIT", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoAsset: """PhotoKit PHAsset representation of video asset""" def export(self, dest, filename=None, version=PHOTOS_VERSION_CURRENT, overwrite=False, **kwargs): """Export video to path Args: dest: str, path to destination directory filename: str, optional name of exported file; if ...
stack_v2_sparse_classes_36k_train_006801
46,280
permissive
[ { "docstring": "Export video to path Args: dest: str, path to destination directory filename: str, optional name of exported file; if not provided, defaults to asset's original filename version: which version of image (PHOTOS_VERSION_ORIGINAL or PHOTOS_VERSION_CURRENT) overwrite: bool, if True, overwrites desti...
3
stack_v2_sparse_classes_30k_train_014849
Implement the Python class `VideoAsset` described below. Class description: PhotoKit PHAsset representation of video asset Method signatures and docstrings: - def export(self, dest, filename=None, version=PHOTOS_VERSION_CURRENT, overwrite=False, **kwargs): Export video to path Args: dest: str, path to destination dir...
Implement the Python class `VideoAsset` described below. Class description: PhotoKit PHAsset representation of video asset Method signatures and docstrings: - def export(self, dest, filename=None, version=PHOTOS_VERSION_CURRENT, overwrite=False, **kwargs): Export video to path Args: dest: str, path to destination dir...
2cb5a4d18a27be6ccf68f5f35abd39418d238016
<|skeleton|> class VideoAsset: """PhotoKit PHAsset representation of video asset""" def export(self, dest, filename=None, version=PHOTOS_VERSION_CURRENT, overwrite=False, **kwargs): """Export video to path Args: dest: str, path to destination directory filename: str, optional name of exported file; if ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VideoAsset: """PhotoKit PHAsset representation of video asset""" def export(self, dest, filename=None, version=PHOTOS_VERSION_CURRENT, overwrite=False, **kwargs): """Export video to path Args: dest: str, path to destination directory filename: str, optional name of exported file; if not provided,...
the_stack_v2_python_sparse
osxphotos/photokit.py
RhetTbull/osxphotos
train
1,287
949df21b39d7968ad76c94362ef9d1c2bff0af93
[ "args = self.arguments\nopts = self.options\nbase = self.resolve_base(opts)\ntyp = TypeHelper.to_plural(args[0])\ncollection = None\ntyps = self.get_singular_types(method='add', typ=args[0])\nif base:\n if hasattr(base, typ):\n collection = getattr(base, typ)\nelse:\n connection = self.check_connection...
<|body_start_0|> args = self.arguments opts = self.options base = self.resolve_base(opts) typ = TypeHelper.to_plural(args[0]) collection = None typs = self.get_singular_types(method='add', typ=args[0]) if base: if hasattr(base, typ): co...
AddCommand
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddCommand: def execute(self): """Execute the "add" command.""" <|body_0|> def show_help(self): """Show help for "add".""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = self.arguments opts = self.options base = self.resolve_bas...
stack_v2_sparse_classes_36k_train_006802
6,182
permissive
[ { "docstring": "Execute the \"add\" command.", "name": "execute", "signature": "def execute(self)" }, { "docstring": "Show help for \"add\".", "name": "show_help", "signature": "def show_help(self)" } ]
2
stack_v2_sparse_classes_30k_train_019958
Implement the Python class `AddCommand` described below. Class description: Implement the AddCommand class. Method signatures and docstrings: - def execute(self): Execute the "add" command. - def show_help(self): Show help for "add".
Implement the Python class `AddCommand` described below. Class description: Implement the AddCommand class. Method signatures and docstrings: - def execute(self): Execute the "add" command. - def show_help(self): Show help for "add". <|skeleton|> class AddCommand: def execute(self): """Execute the "add"...
422d70e1dc422f0ca248abea47a472e3605caa4b
<|skeleton|> class AddCommand: def execute(self): """Execute the "add" command.""" <|body_0|> def show_help(self): """Show help for "add".""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddCommand: def execute(self): """Execute the "add" command.""" args = self.arguments opts = self.options base = self.resolve_base(opts) typ = TypeHelper.to_plural(args[0]) collection = None typs = self.get_singular_types(method='add', typ=args[0]) ...
the_stack_v2_python_sparse
src/ovirtcli/command/add.py
minqf/ovirt-engine-cli
train
0
4ee0d8cb1de38d7b40796148dd3ce34f10a3a890
[ "self.data = dat\nself.cov = cov\nself.z = z\nself.prior = prior", "mod = modelo(theta, self.z)\nself.u = -likelihood(mod, self.data, self.cov) - self.prior.get_log_pdf(theta)\nreturn self.u", "self.value(theta)\nself.gradient = tf.gradients(self.u, theta)\nreturn self.gradient[0]" ]
<|body_start_0|> self.data = dat self.cov = cov self.z = z self.prior = prior <|end_body_0|> <|body_start_1|> mod = modelo(theta, self.z) self.u = -likelihood(mod, self.data, self.cov) - self.prior.get_log_pdf(theta) return self.u <|end_body_1|> <|body_start_2|>...
Potential
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Potential: def __init__(self, dat, cov, z, prior): """Computes potential energy and its gradient. dat: array (ndata), data. sigma: array (ndata, ndata), data error z: array (ndata), redshift. prior: object, prior.""" <|body_0|> def value(self, theta): """Returns pote...
stack_v2_sparse_classes_36k_train_006803
11,880
no_license
[ { "docstring": "Computes potential energy and its gradient. dat: array (ndata), data. sigma: array (ndata, ndata), data error z: array (ndata), redshift. prior: object, prior.", "name": "__init__", "signature": "def __init__(self, dat, cov, z, prior)" }, { "docstring": "Returns potential value i...
3
stack_v2_sparse_classes_30k_train_005808
Implement the Python class `Potential` described below. Class description: Implement the Potential class. Method signatures and docstrings: - def __init__(self, dat, cov, z, prior): Computes potential energy and its gradient. dat: array (ndata), data. sigma: array (ndata, ndata), data error z: array (ndata), redshift...
Implement the Python class `Potential` described below. Class description: Implement the Potential class. Method signatures and docstrings: - def __init__(self, dat, cov, z, prior): Computes potential energy and its gradient. dat: array (ndata), data. sigma: array (ndata, ndata), data error z: array (ndata), redshift...
8789f692d81c5435a5888b6b151ccf6187d5a064
<|skeleton|> class Potential: def __init__(self, dat, cov, z, prior): """Computes potential energy and its gradient. dat: array (ndata), data. sigma: array (ndata, ndata), data error z: array (ndata), redshift. prior: object, prior.""" <|body_0|> def value(self, theta): """Returns pote...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Potential: def __init__(self, dat, cov, z, prior): """Computes potential energy and its gradient. dat: array (ndata), data. sigma: array (ndata, ndata), data error z: array (ndata), redshift. prior: object, prior.""" self.data = dat self.cov = cov self.z = z self.prior ...
the_stack_v2_python_sparse
p18/hmc.py
fluowhy/MCMC-methods
train
1
b32b07dda977953b65e520bf6f405eed052478ac
[ "dims = [n_inputs] + n_hidden + [n_classes]\nself.modules = []\nfor l, neurons in enumerate(dims):\n if l == 0:\n continue\n self.modules.append(LinearModule(dims[l - 1], neurons))\n if l < len(dims) - 1:\n self.modules.append(ELUModule())\n else:\n self.modules.append(SoftMaxModule...
<|body_start_0|> dims = [n_inputs] + n_hidden + [n_classes] self.modules = [] for l, neurons in enumerate(dims): if l == 0: continue self.modules.append(LinearModule(dims[l - 1], neurons)) if l < len(dims) - 1: self.modules.appe...
This class implements a Multi-layer Perceptron in NumPy. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward and backward.
MLP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLP: """This class implements a Multi-layer Perceptron in NumPy. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward and backward.""" def __init__(self, n_inputs, n_hidden, n_classes): """Initializes MLP object. Args: n_inpu...
stack_v2_sparse_classes_36k_train_006804
2,247
no_license
[ { "docstring": "Initializes MLP object. Args: n_inputs: number of inputs. n_hidden: list of ints, specifies the number of units in each linear layer. If the list is empty, the MLP will not have any linear layers, and the model will simply perform a multinomial logistic regression. n_classes: number of classes o...
3
stack_v2_sparse_classes_30k_train_014697
Implement the Python class `MLP` described below. Class description: This class implements a Multi-layer Perceptron in NumPy. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward and backward. Method signatures and docstrings: - def __init__(self, n_inputs, n...
Implement the Python class `MLP` described below. Class description: This class implements a Multi-layer Perceptron in NumPy. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward and backward. Method signatures and docstrings: - def __init__(self, n_inputs, n...
f854e5af04145546f1dcded7a044faafe850506d
<|skeleton|> class MLP: """This class implements a Multi-layer Perceptron in NumPy. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward and backward.""" def __init__(self, n_inputs, n_hidden, n_classes): """Initializes MLP object. Args: n_inpu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MLP: """This class implements a Multi-layer Perceptron in NumPy. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward and backward.""" def __init__(self, n_inputs, n_hidden, n_classes): """Initializes MLP object. Args: n_inputs: number of...
the_stack_v2_python_sparse
assignment_1/1_mlp_cnn/code/mlp_numpy.py
ioverho/uvadlc_practicals_2020
train
0
711d1aca9514e7b02356404de3b4d59429d525c8
[ "measurements.sort(key=lambda measurement: str(measurement['end']))\nnotifications = []\nfor report in reports:\n notable_metrics = []\n for subject in report['subjects'].values():\n for metric_uuid, metric in subject['metrics'].items():\n metric_measurements = [m for m in measurements if m[...
<|body_start_0|> measurements.sort(key=lambda measurement: str(measurement['end'])) notifications = [] for report in reports: notable_metrics = [] for subject in report['subjects'].values(): for metric_uuid, metric in subject['metrics'].items(): ...
Handle notification contents and status.
NotificationFinder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationFinder: """Handle notification contents and status.""" def get_notifications(self, reports: list[Report], measurements: list[Measurement], most_recent_measurement_seen: datetime) -> list[Notification]: """Return the reports that have a webhook and metrics that require not...
stack_v2_sparse_classes_36k_train_006805
2,330
permissive
[ { "docstring": "Return the reports that have a webhook and metrics that require notifying.", "name": "get_notifications", "signature": "def get_notifications(self, reports: list[Report], measurements: list[Measurement], most_recent_measurement_seen: datetime) -> list[Notification]" }, { "docstri...
2
null
Implement the Python class `NotificationFinder` described below. Class description: Handle notification contents and status. Method signatures and docstrings: - def get_notifications(self, reports: list[Report], measurements: list[Measurement], most_recent_measurement_seen: datetime) -> list[Notification]: Return the...
Implement the Python class `NotificationFinder` described below. Class description: Handle notification contents and status. Method signatures and docstrings: - def get_notifications(self, reports: list[Report], measurements: list[Measurement], most_recent_measurement_seen: datetime) -> list[Notification]: Return the...
5d9952bf0bd47895824fa78428d3e4f4d6b5d9b3
<|skeleton|> class NotificationFinder: """Handle notification contents and status.""" def get_notifications(self, reports: list[Report], measurements: list[Measurement], most_recent_measurement_seen: datetime) -> list[Notification]: """Return the reports that have a webhook and metrics that require not...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotificationFinder: """Handle notification contents and status.""" def get_notifications(self, reports: list[Report], measurements: list[Measurement], most_recent_measurement_seen: datetime) -> list[Notification]: """Return the reports that have a webhook and metrics that require notifying.""" ...
the_stack_v2_python_sparse
components/notifier/src/strategies/notification_strategy.py
ICTU/quality-time
train
43
50614e956a5aa2be071e8dcbca9b731b7f0aa3ce
[ "visited = dict()\n\ndef dfs(i, sum_result, visited):\n if i < len(nums) and (i, sum_result) not in visited:\n visited[i, sum_result] = dfs(i + 1, sum_result - nums[i], visited) + dfs(i + 1, sum_result + nums[i], visited)\n return visited.get((i, sum_result), sum_result == S)\nreturn dfs(0, 0, visited)...
<|body_start_0|> visited = dict() def dfs(i, sum_result, visited): if i < len(nums) and (i, sum_result) not in visited: visited[i, sum_result] = dfs(i + 1, sum_result - nums[i], visited) + dfs(i + 1, sum_result + nums[i], visited) return visited.get((i, sum_resul...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findTargetSumWays(self, nums: List[int], S: int) -> int: """记忆化回溯 :param nums: :param S: :return:""" <|body_0|> def findTargetSumWays1(self, nums: List[int], S: int) -> int: """动态规划 dp[i][j] :param nums: :param S: :return:""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k_train_006806
2,297
no_license
[ { "docstring": "记忆化回溯 :param nums: :param S: :return:", "name": "findTargetSumWays", "signature": "def findTargetSumWays(self, nums: List[int], S: int) -> int" }, { "docstring": "动态规划 dp[i][j] :param nums: :param S: :return:", "name": "findTargetSumWays1", "signature": "def findTargetSum...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays(self, nums: List[int], S: int) -> int: 记忆化回溯 :param nums: :param S: :return: - def findTargetSumWays1(self, nums: List[int], S: int) -> int: 动态规划 dp[i][j] :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays(self, nums: List[int], S: int) -> int: 记忆化回溯 :param nums: :param S: :return: - def findTargetSumWays1(self, nums: List[int], S: int) -> int: 动态规划 dp[i][j] :...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def findTargetSumWays(self, nums: List[int], S: int) -> int: """记忆化回溯 :param nums: :param S: :return:""" <|body_0|> def findTargetSumWays1(self, nums: List[int], S: int) -> int: """动态规划 dp[i][j] :param nums: :param S: :return:""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findTargetSumWays(self, nums: List[int], S: int) -> int: """记忆化回溯 :param nums: :param S: :return:""" visited = dict() def dfs(i, sum_result, visited): if i < len(nums) and (i, sum_result) not in visited: visited[i, sum_result] = dfs(i + 1, sum...
the_stack_v2_python_sparse
Interview_preparation/tencent/FindTargetSumWays.py
yinhuax/leet_code
train
0
83ea54472f8aad1a0f8659501c0bfbf34b18ea6f
[ "reply = await message.get_reply_message()\nmtext = utils.get_args_raw(message)\nif message.media:\n await message.edit('<b>Загрузка файла...</b>')\n data = await message.client.download_file(m, bytes)\nelif mtext:\n data = bytes(mtext, 'utf-8')\nelif reply:\n if reply.media:\n await message.edit...
<|body_start_0|> reply = await message.get_reply_message() mtext = utils.get_args_raw(message) if message.media: await message.edit('<b>Загрузка файла...</b>') data = await message.client.download_file(m, bytes) elif mtext: data = bytes(mtext, 'utf-8')...
Кодирование и декодирование base64
base64Mod
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class base64Mod: """Кодирование и декодирование base64""" async def b64encodecmd(self, message): """.b64encode <(text or media) or (reply to text or media)>""" <|body_0|> async def b64decodecmd(self, message): """.b64decode <text or reply to text>""" <|body_1|>...
stack_v2_sparse_classes_36k_train_006807
2,055
no_license
[ { "docstring": ".b64encode <(text or media) or (reply to text or media)>", "name": "b64encodecmd", "signature": "async def b64encodecmd(self, message)" }, { "docstring": ".b64decode <text or reply to text>", "name": "b64decodecmd", "signature": "async def b64decodecmd(self, message)" }...
2
stack_v2_sparse_classes_30k_test_000244
Implement the Python class `base64Mod` described below. Class description: Кодирование и декодирование base64 Method signatures and docstrings: - async def b64encodecmd(self, message): .b64encode <(text or media) or (reply to text or media)> - async def b64decodecmd(self, message): .b64decode <text or reply to text>
Implement the Python class `base64Mod` described below. Class description: Кодирование и декодирование base64 Method signatures and docstrings: - async def b64encodecmd(self, message): .b64encode <(text or media) or (reply to text or media)> - async def b64decodecmd(self, message): .b64decode <text or reply to text> ...
d9d859ea0ed7f66bb23a6a06d1efa4c8bce9b846
<|skeleton|> class base64Mod: """Кодирование и декодирование base64""" async def b64encodecmd(self, message): """.b64encode <(text or media) or (reply to text or media)>""" <|body_0|> async def b64decodecmd(self, message): """.b64decode <text or reply to text>""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class base64Mod: """Кодирование и декодирование base64""" async def b64encodecmd(self, message): """.b64encode <(text or media) or (reply to text or media)>""" reply = await message.get_reply_message() mtext = utils.get_args_raw(message) if message.media: await messa...
the_stack_v2_python_sparse
_base64.py
abdula2003/modules
train
0
ed40160de2d4691aa03da5fb8555fa307cb94c40
[ "menu_item.MenuItem.__init__(self, main_menu, frame)\nself.create_menu_item_button('Classroom Management')\nself.menu_item_button['command'] = self.get_classroom_challenge_window", "self.gui.active_window.hide()\nself.associated_window = classroom_management_window.ClassroomManagementWindow(self.gui)\nself.gui.ac...
<|body_start_0|> menu_item.MenuItem.__init__(self, main_menu, frame) self.create_menu_item_button('Classroom Management') self.menu_item_button['command'] = self.get_classroom_challenge_window <|end_body_0|> <|body_start_1|> self.gui.active_window.hide() self.associated_window =...
This class is used to create a button that will bring the user to the classroom management menu.
ClassroomManagementMenuItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassroomManagementMenuItem: """This class is used to create a button that will bring the user to the classroom management menu.""" def __init__(self, main_menu, frame): """Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to a...
stack_v2_sparse_classes_36k_train_006808
1,134
no_license
[ { "docstring": "Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's active window", "name": "__init__", "signature": "def __init__(self, main_menu, frame)" }, { "docstring": "This function will hide everything on the activ...
2
stack_v2_sparse_classes_30k_train_002456
Implement the Python class `ClassroomManagementMenuItem` described below. Class description: This class is used to create a button that will bring the user to the classroom management menu. Method signatures and docstrings: - def __init__(self, main_menu, frame): Args: main_menu ([]): this class must know about the m...
Implement the Python class `ClassroomManagementMenuItem` described below. Class description: This class is used to create a button that will bring the user to the classroom management menu. Method signatures and docstrings: - def __init__(self, main_menu, frame): Args: main_menu ([]): this class must know about the m...
e26d9450b98fa0f372bcdf6eaf251a2c9dcba44e
<|skeleton|> class ClassroomManagementMenuItem: """This class is used to create a button that will bring the user to the classroom management menu.""" def __init__(self, main_menu, frame): """Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassroomManagementMenuItem: """This class is used to create a button that will bring the user to the classroom management menu.""" def __init__(self, main_menu, frame): """Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI'...
the_stack_v2_python_sparse
user_interface/menu_items/classroom_management_menu_item.py
pucheng-tan/WordFlow
train
0
d14182bd98980cea1160d087347ce243390bc388
[ "response = self.client.get(reverse('cocktail_list'))\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, 'There are no cocktails in the database.')\nself.assertQuerysetEqual(response.context['cocktail_list'], [])", "add_cocktail('test', 1)\nadd_cocktail('temp', 1)\nadd_cocktail('tmp', 1)\...
<|body_start_0|> response = self.client.get(reverse('cocktail_list')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'There are no cocktails in the database.') self.assertQuerysetEqual(response.context['cocktail_list'], []) <|end_body_0|> <|body_start_1|> ...
ListViewTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListViewTests: def test_list_view_with_no_cocktails(self): """If no cocktails exist, an appropriate message should be displayed.""" <|body_0|> def test_index_view_with_categories(self): """If some cocktails are created, they should be displayed""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_006809
1,595
no_license
[ { "docstring": "If no cocktails exist, an appropriate message should be displayed.", "name": "test_list_view_with_no_cocktails", "signature": "def test_list_view_with_no_cocktails(self)" }, { "docstring": "If some cocktails are created, they should be displayed", "name": "test_index_view_wit...
2
stack_v2_sparse_classes_30k_train_007874
Implement the Python class `ListViewTests` described below. Class description: Implement the ListViewTests class. Method signatures and docstrings: - def test_list_view_with_no_cocktails(self): If no cocktails exist, an appropriate message should be displayed. - def test_index_view_with_categories(self): If some cock...
Implement the Python class `ListViewTests` described below. Class description: Implement the ListViewTests class. Method signatures and docstrings: - def test_list_view_with_no_cocktails(self): If no cocktails exist, an appropriate message should be displayed. - def test_index_view_with_categories(self): If some cock...
18abb27ffd9824b9673be6aef0fa4d0a20c78fb4
<|skeleton|> class ListViewTests: def test_list_view_with_no_cocktails(self): """If no cocktails exist, an appropriate message should be displayed.""" <|body_0|> def test_index_view_with_categories(self): """If some cocktails are created, they should be displayed""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListViewTests: def test_list_view_with_no_cocktails(self): """If no cocktails exist, an appropriate message should be displayed.""" response = self.client.get(reverse('cocktail_list')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'There are no cockt...
the_stack_v2_python_sparse
apps/cocktails/tests.py
Carlosedo/mixees
train
1
0c19ef85cb0a8ccc41a7fd30ae131ef7fcc9327f
[ "print(f'{self.kwargs}')\ncontext = super().get_context_data(**kwargs)\ncontext.update(self.kwargs)\nreturn context", "user = self.request.user\ncategory = kwargs.get('category')\nresult = Post.objects.filter(categories__name__contains=category)\nresult = result.order_by('-created_on')\nprint(f'{result}')\nself.q...
<|body_start_0|> print(f'{self.kwargs}') context = super().get_context_data(**kwargs) context.update(self.kwargs) return context <|end_body_0|> <|body_start_1|> user = self.request.user category = kwargs.get('category') result = Post.objects.filter(categories__na...
BlogCategoryView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlogCategoryView: def get_context_data(self, **kwargs): """pass the category slug to the template""" <|body_0|> def get(self, request, *args, **kwargs): """Return all Posts filtered by category""" <|body_1|> <|end_skeleton|> <|body_start_0|> print(f...
stack_v2_sparse_classes_36k_train_006810
3,746
no_license
[ { "docstring": "pass the category slug to the template", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Return all Posts filtered by category", "name": "get", "signature": "def get(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_015720
Implement the Python class `BlogCategoryView` described below. Class description: Implement the BlogCategoryView class. Method signatures and docstrings: - def get_context_data(self, **kwargs): pass the category slug to the template - def get(self, request, *args, **kwargs): Return all Posts filtered by category
Implement the Python class `BlogCategoryView` described below. Class description: Implement the BlogCategoryView class. Method signatures and docstrings: - def get_context_data(self, **kwargs): pass the category slug to the template - def get(self, request, *args, **kwargs): Return all Posts filtered by category <|s...
1704f1796cb3f25cac260c6120becd70e9f1c33f
<|skeleton|> class BlogCategoryView: def get_context_data(self, **kwargs): """pass the category slug to the template""" <|body_0|> def get(self, request, *args, **kwargs): """Return all Posts filtered by category""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlogCategoryView: def get_context_data(self, **kwargs): """pass the category slug to the template""" print(f'{self.kwargs}') context = super().get_context_data(**kwargs) context.update(self.kwargs) return context def get(self, request, *args, **kwargs): """...
the_stack_v2_python_sparse
django-djongo/venv-djongo/SRC/django-blog/blog/views.py
sdugaro/django
train
0
ff9bb67685cdcbc507f54655b035fbf5e76aacdd
[ "if len(nums) == 1:\n return nums[0]\nelse:\n return max(self.rob1(nums[1:]), self.rob1(nums[:-1]))", "n = len(nums)\nif n == 0:\n return 0\nif n == 1:\n return nums[0]\nsum = [0] * n\nsum[0] = nums[0]\nsum[1] = max(nums[0], nums[1])\nfor i in range(2, n):\n sum[i] = max(sum[i - 2] + nums[i], sum[i...
<|body_start_0|> if len(nums) == 1: return nums[0] else: return max(self.rob1(nums[1:]), self.rob1(nums[:-1])) <|end_body_0|> <|body_start_1|> n = len(nums) if n == 0: return 0 if n == 1: return nums[0] sum = [0] * n ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums) == 1: return nums[0] else: ...
stack_v2_sparse_classes_36k_train_006811
1,314
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "rob", "signature": "def rob(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "rob1", "signature": "def rob1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_016637
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def rob1(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def rob1(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def rob(self, nums): "...
ba58ac60b32e261e43482d7e71b32587700e3719
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" if len(nums) == 1: return nums[0] else: return max(self.rob1(nums[1:]), self.rob1(nums[:-1])) def rob1(self, nums): """:type nums: List[int] :rtype: int""" n = len(nums) ...
the_stack_v2_python_sparse
python/213_house_robber_II.py
lingng/Leetcode
train
0
971b033fc41126b850d323387751a1624d6e78e1
[ "if value is not None:\n obj: Optional[str] = serializer.dumps(value)\nelse:\n obj = value\nreturn obj", "if value is not None:\n value = serializer.loads(value)\nreturn value" ]
<|body_start_0|> if value is not None: obj: Optional[str] = serializer.dumps(value) else: obj = value return obj <|end_body_0|> <|body_start_1|> if value is not None: value = serializer.loads(value) return value <|end_body_1|>
A SQLite-friendly JSON data type.
SQLiteJSON
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SQLiteJSON: """A SQLite-friendly JSON data type.""" def process_bind_param(self, value: Optional[dict], dialect: str) -> Optional[str]: """Serialize a dict to JSON.""" <|body_0|> def process_result_value(self, value: str, dialect: str) -> Optional[Union[str, dict]]: ...
stack_v2_sparse_classes_36k_train_006812
3,561
permissive
[ { "docstring": "Serialize a dict to JSON.", "name": "process_bind_param", "signature": "def process_bind_param(self, value: Optional[dict], dialect: str) -> Optional[str]" }, { "docstring": "Deserialize JSON content to a dict.", "name": "process_result_value", "signature": "def process_r...
2
stack_v2_sparse_classes_30k_train_016812
Implement the Python class `SQLiteJSON` described below. Class description: A SQLite-friendly JSON data type. Method signatures and docstrings: - def process_bind_param(self, value: Optional[dict], dialect: str) -> Optional[str]: Serialize a dict to JSON. - def process_result_value(self, value: str, dialect: str) -> ...
Implement the Python class `SQLiteJSON` described below. Class description: A SQLite-friendly JSON data type. Method signatures and docstrings: - def process_bind_param(self, value: Optional[dict], dialect: str) -> Optional[str]: Serialize a dict to JSON. - def process_result_value(self, value: str, dialect: str) -> ...
6077ce4e0685d67ce7010800083a898857158112
<|skeleton|> class SQLiteJSON: """A SQLite-friendly JSON data type.""" def process_bind_param(self, value: Optional[dict], dialect: str) -> Optional[str]: """Serialize a dict to JSON.""" <|body_0|> def process_result_value(self, value: str, dialect: str) -> Optional[Union[str, dict]]: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SQLiteJSON: """A SQLite-friendly JSON data type.""" def process_bind_param(self, value: Optional[dict], dialect: str) -> Optional[str]: """Serialize a dict to JSON.""" if value is not None: obj: Optional[str] = serializer.dumps(value) else: obj = value ...
the_stack_v2_python_sparse
core/arxiv/submission/services/classic/util.py
arXiv/arxiv-submission-core
train
14
dbd32240acbc03e36033ba5844c68fc020fd0314
[ "deps = [('szip', '--with-szlib')]\nfor dep, opt in deps:\n root = get_software_root(dep)\n if root:\n self.cfg.update('configopts', '%s=%s' % (opt, root))\n else:\n self.log.error('Dependency module %s not loaded.' % dep)\nfcomp = 'FC=\"%s\"' % os.getenv('F90')\nself.cfg.update('configopts',...
<|body_start_0|> deps = [('szip', '--with-szlib')] for dep, opt in deps: root = get_software_root(dep) if root: self.cfg.update('configopts', '%s=%s' % (opt, root)) else: self.log.error('Dependency module %s not loaded.' % dep) ...
Support for building/installing HDF5
EB_hdf5
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EB_hdf5: """Support for building/installing HDF5""" def configure_step(self): """Configure build: set require config and make options, and run configure script.""" <|body_0|> def sanity_check_step(self): """Custom sanity check for HDF5""" <|body_1|> <|en...
stack_v2_sparse_classes_36k_train_006813
4,328
no_license
[ { "docstring": "Configure build: set require config and make options, and run configure script.", "name": "configure_step", "signature": "def configure_step(self)" }, { "docstring": "Custom sanity check for HDF5", "name": "sanity_check_step", "signature": "def sanity_check_step(self)" ...
2
stack_v2_sparse_classes_30k_train_019677
Implement the Python class `EB_hdf5` described below. Class description: Support for building/installing HDF5 Method signatures and docstrings: - def configure_step(self): Configure build: set require config and make options, and run configure script. - def sanity_check_step(self): Custom sanity check for HDF5
Implement the Python class `EB_hdf5` described below. Class description: Support for building/installing HDF5 Method signatures and docstrings: - def configure_step(self): Configure build: set require config and make options, and run configure script. - def sanity_check_step(self): Custom sanity check for HDF5 <|ske...
3c5434f9a4193fbe4cf8107327faadda83d798ae
<|skeleton|> class EB_hdf5: """Support for building/installing HDF5""" def configure_step(self): """Configure build: set require config and make options, and run configure script.""" <|body_0|> def sanity_check_step(self): """Custom sanity check for HDF5""" <|body_1|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EB_hdf5: """Support for building/installing HDF5""" def configure_step(self): """Configure build: set require config and make options, and run configure script.""" deps = [('szip', '--with-szlib')] for dep, opt in deps: root = get_software_root(dep) if root...
the_stack_v2_python_sparse
1.13.0/easyblock/easyblocks/h/hdf5.py
lsuhpchelp/easybuild_smic
train
0
63b4b0650ed9e8f85598331db7cee4cac60aae0e
[ "super(LambdaMemorySize, self).__init__()\nresource_type_specs = ['AWS::Lambda::Function']\nfor resource_type_spec in resource_type_specs:\n self.resource_property_types.append(resource_type_spec)", "matches = []\nif value in parameters:\n parameter = parameters.get(value)\n min_value = parameter.get('Mi...
<|body_start_0|> super(LambdaMemorySize, self).__init__() resource_type_specs = ['AWS::Lambda::Function'] for resource_type_spec in resource_type_specs: self.resource_property_types.append(resource_type_spec) <|end_body_0|> <|body_start_1|> matches = [] if value in p...
Check Lambda Memory Size
LambdaMemorySize
[ "MIT-0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LambdaMemorySize: """Check Lambda Memory Size""" def __init__(self): """Init""" <|body_0|> def check_lambda_memory_size_ref(self, value, path, parameters, resources): """Check ref for VPC""" <|body_1|> def check(self, properties, resource_type, path,...
stack_v2_sparse_classes_36k_train_006814
2,504
permissive
[ { "docstring": "Init", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Check ref for VPC", "name": "check_lambda_memory_size_ref", "signature": "def check_lambda_memory_size_ref(self, value, path, parameters, resources)" }, { "docstring": "Check itself", ...
4
stack_v2_sparse_classes_30k_train_003545
Implement the Python class `LambdaMemorySize` described below. Class description: Check Lambda Memory Size Method signatures and docstrings: - def __init__(self): Init - def check_lambda_memory_size_ref(self, value, path, parameters, resources): Check ref for VPC - def check(self, properties, resource_type, path, cfn...
Implement the Python class `LambdaMemorySize` described below. Class description: Check Lambda Memory Size Method signatures and docstrings: - def __init__(self): Init - def check_lambda_memory_size_ref(self, value, path, parameters, resources): Check ref for VPC - def check(self, properties, resource_type, path, cfn...
5176573c2f4cb7313998b4bc0bcb0716b58ea380
<|skeleton|> class LambdaMemorySize: """Check Lambda Memory Size""" def __init__(self): """Init""" <|body_0|> def check_lambda_memory_size_ref(self, value, path, parameters, resources): """Check ref for VPC""" <|body_1|> def check(self, properties, resource_type, path,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LambdaMemorySize: """Check Lambda Memory Size""" def __init__(self): """Init""" super(LambdaMemorySize, self).__init__() resource_type_specs = ['AWS::Lambda::Function'] for resource_type_spec in resource_type_specs: self.resource_property_types.append(resource_...
the_stack_v2_python_sparse
src/cfnlint/rules/parameters/LambdaMemorySize.py
rene84/cfn-python-lint
train
1
443acf7c3281d2b228395310e0dbdaf46af80118
[ "result = {'result': 'OK', 'content': []}\nres = CtrlChapter().get_chapter(screen_gid, _type)\nif res:\n result['result'] = 'OK'\n result['content'] = res\nreturn result", "result = {'result': 'NG'}\ndata = request.get_json(force=True)\nif data:\n res, message = CtrlChapter().update_chapter(_type, data)\...
<|body_start_0|> result = {'result': 'OK', 'content': []} res = CtrlChapter().get_chapter(screen_gid, _type) if res: result['result'] = 'OK' result['content'] = res return result <|end_body_0|> <|body_start_1|> result = {'result': 'NG'} data = req...
ApiChapter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiChapter: def get(self, screen_gid, _type): """获取chapter表格信息""" <|body_0|> def post(self, _type): """更新表格""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {'result': 'OK', 'content': []} res = CtrlChapter().get_chapter(screen_gid, ...
stack_v2_sparse_classes_36k_train_006815
1,096
no_license
[ { "docstring": "获取chapter表格信息", "name": "get", "signature": "def get(self, screen_gid, _type)" }, { "docstring": "更新表格", "name": "post", "signature": "def post(self, _type)" } ]
2
null
Implement the Python class `ApiChapter` described below. Class description: Implement the ApiChapter class. Method signatures and docstrings: - def get(self, screen_gid, _type): 获取chapter表格信息 - def post(self, _type): 更新表格
Implement the Python class `ApiChapter` described below. Class description: Implement the ApiChapter class. Method signatures and docstrings: - def get(self, screen_gid, _type): 获取chapter表格信息 - def post(self, _type): 更新表格 <|skeleton|> class ApiChapter: def get(self, screen_gid, _type): """获取chapter表格信息"...
64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11
<|skeleton|> class ApiChapter: def get(self, screen_gid, _type): """获取chapter表格信息""" <|body_0|> def post(self, _type): """更新表格""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiChapter: def get(self, screen_gid, _type): """获取chapter表格信息""" result = {'result': 'OK', 'content': []} res = CtrlChapter().get_chapter(screen_gid, _type) if res: result['result'] = 'OK' result['content'] = res return result def post(self...
the_stack_v2_python_sparse
op/ope_server/app/api_1_0/api_chapter.py
lsn1183/web_project
train
0
a86e6bcd38eb23e8273abcc54dcee7dbc9b3e32a
[ "super().__init__(env)\nself.width = width\nself.height = height\nself.observation_space = gym.spaces.Box(low=0, high=255, shape=(self.height, self.width, 1), dtype=env.observation_space.dtype)", "frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)\nframe = cv2.resize(frame, (self.width, self.height), interpolation=c...
<|body_start_0|> super().__init__(env) self.width = width self.height = height self.observation_space = gym.spaces.Box(low=0, high=255, shape=(self.height, self.width, 1), dtype=env.observation_space.dtype) <|end_body_0|> <|body_start_1|> frame = cv2.cvtColor(frame, cv2.COLOR_RG...
WarpFrame
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WarpFrame: def __init__(self, env, width=84, height=84): """Warp frames to 84x84 as done in the Nature paper and later work. :param env: (Gym Environment) the environment""" <|body_0|> def observation(self, frame): """returns the current observation from a frame :par...
stack_v2_sparse_classes_36k_train_006816
8,786
permissive
[ { "docstring": "Warp frames to 84x84 as done in the Nature paper and later work. :param env: (Gym Environment) the environment", "name": "__init__", "signature": "def __init__(self, env, width=84, height=84)" }, { "docstring": "returns the current observation from a frame :param frame: ([int] or...
2
stack_v2_sparse_classes_30k_train_010133
Implement the Python class `WarpFrame` described below. Class description: Implement the WarpFrame class. Method signatures and docstrings: - def __init__(self, env, width=84, height=84): Warp frames to 84x84 as done in the Nature paper and later work. :param env: (Gym Environment) the environment - def observation(s...
Implement the Python class `WarpFrame` described below. Class description: Implement the WarpFrame class. Method signatures and docstrings: - def __init__(self, env, width=84, height=84): Warp frames to 84x84 as done in the Nature paper and later work. :param env: (Gym Environment) the environment - def observation(s...
1d304115406f6e29186cedb0160811d4139e2733
<|skeleton|> class WarpFrame: def __init__(self, env, width=84, height=84): """Warp frames to 84x84 as done in the Nature paper and later work. :param env: (Gym Environment) the environment""" <|body_0|> def observation(self, frame): """returns the current observation from a frame :par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WarpFrame: def __init__(self, env, width=84, height=84): """Warp frames to 84x84 as done in the Nature paper and later work. :param env: (Gym Environment) the environment""" super().__init__(env) self.width = width self.height = height self.observation_space = gym.space...
the_stack_v2_python_sparse
unstable_baselines/lib/envs/wrap/atari.py
Ending2015a/unstable_baselines
train
10
ba3e7708765ad557a2cb01cac370a5c2da1fa74b
[ "network = self.create_network(dns_domain='starwars.')\nself.setup_network_and_server(network=network, server_name='luke')\nself.create_pingable_secgroup_rule(secgroup_id=self.security_groups[-1]['id'])\nself.check_connectivity(self.fip['floating_ip_address'], CONF.validation.image_ssh_user, self.keypair['private_k...
<|body_start_0|> network = self.create_network(dns_domain='starwars.') self.setup_network_and_server(network=network, server_name='luke') self.create_pingable_secgroup_rule(secgroup_id=self.security_groups[-1]['id']) self.check_connectivity(self.fip['floating_ip_address'], CONF.validatio...
Tests internal DNS capabilities.
InternalDNSTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InternalDNSTest: """Tests internal DNS capabilities.""" def test_dns_domain_and_name(self): """Test the ability to ping a VM's hostname from another VM. 1) Create two VMs on the same network, giving each a name 2) SSH in to the first VM: 2.1) ping the other VM's internal IP 2.2) ping...
stack_v2_sparse_classes_36k_train_006817
8,441
permissive
[ { "docstring": "Test the ability to ping a VM's hostname from another VM. 1) Create two VMs on the same network, giving each a name 2) SSH in to the first VM: 2.1) ping the other VM's internal IP 2.2) ping the other VM's hostname", "name": "test_dns_domain_and_name", "signature": "def test_dns_domain_an...
2
stack_v2_sparse_classes_30k_train_004403
Implement the Python class `InternalDNSTest` described below. Class description: Tests internal DNS capabilities. Method signatures and docstrings: - def test_dns_domain_and_name(self): Test the ability to ping a VM's hostname from another VM. 1) Create two VMs on the same network, giving each a name 2) SSH in to the...
Implement the Python class `InternalDNSTest` described below. Class description: Tests internal DNS capabilities. Method signatures and docstrings: - def test_dns_domain_and_name(self): Test the ability to ping a VM's hostname from another VM. 1) Create two VMs on the same network, giving each a name 2) SSH in to the...
8f63937f01e6e662ced78a758991a0035df468b9
<|skeleton|> class InternalDNSTest: """Tests internal DNS capabilities.""" def test_dns_domain_and_name(self): """Test the ability to ping a VM's hostname from another VM. 1) Create two VMs on the same network, giving each a name 2) SSH in to the first VM: 2.1) ping the other VM's internal IP 2.2) ping...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InternalDNSTest: """Tests internal DNS capabilities.""" def test_dns_domain_and_name(self): """Test the ability to ping a VM's hostname from another VM. 1) Create two VMs on the same network, giving each a name 2) SSH in to the first VM: 2.1) ping the other VM's internal IP 2.2) ping the other VM...
the_stack_v2_python_sparse
neutron_tempest_plugin/scenario/test_internal_dns.py
openstack/neutron-tempest-plugin
train
14
400594ef30b70c494f8249cae5ab982b4e25936c
[ "self.length = length\nself.mass = mass\nself.deck_space = deck_space", "key = 'tower_section_fasten_time'\ntime = kwargs.get(key, pt[key])\nreturn ('Fasten Tower Section', time)", "key = 'tower_section_release_time'\ntime = kwargs.get(key, pt[key])\nreturn ('Release Tower Section', time)" ]
<|body_start_0|> self.length = length self.mass = mass self.deck_space = deck_space <|end_body_0|> <|body_start_1|> key = 'tower_section_fasten_time' time = kwargs.get(key, pt[key]) return ('Fasten Tower Section', time) <|end_body_1|> <|body_start_2|> key = 'tow...
Tower Section Cargo
TowerSection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TowerSection: """Tower Section Cargo""" def __init__(self, length=None, mass=None, deck_space=None, **kwargs): """Creates an instance of `TowerSection`.""" <|body_0|> def fasten(**kwargs): """Returns time required to fasten a tower section at port.""" <|b...
stack_v2_sparse_classes_36k_train_006818
7,645
permissive
[ { "docstring": "Creates an instance of `TowerSection`.", "name": "__init__", "signature": "def __init__(self, length=None, mass=None, deck_space=None, **kwargs)" }, { "docstring": "Returns time required to fasten a tower section at port.", "name": "fasten", "signature": "def fasten(**kwa...
3
stack_v2_sparse_classes_30k_train_008687
Implement the Python class `TowerSection` described below. Class description: Tower Section Cargo Method signatures and docstrings: - def __init__(self, length=None, mass=None, deck_space=None, **kwargs): Creates an instance of `TowerSection`. - def fasten(**kwargs): Returns time required to fasten a tower section at...
Implement the Python class `TowerSection` described below. Class description: Tower Section Cargo Method signatures and docstrings: - def __init__(self, length=None, mass=None, deck_space=None, **kwargs): Creates an instance of `TowerSection`. - def fasten(**kwargs): Returns time required to fasten a tower section at...
d7270ebe1c554293a9d36730d67ab555c071cb17
<|skeleton|> class TowerSection: """Tower Section Cargo""" def __init__(self, length=None, mass=None, deck_space=None, **kwargs): """Creates an instance of `TowerSection`.""" <|body_0|> def fasten(**kwargs): """Returns time required to fasten a tower section at port.""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TowerSection: """Tower Section Cargo""" def __init__(self, length=None, mass=None, deck_space=None, **kwargs): """Creates an instance of `TowerSection`.""" self.length = length self.mass = mass self.deck_space = deck_space def fasten(**kwargs): """Returns time...
the_stack_v2_python_sparse
wisdem/orbit/phases/install/turbine_install/common.py
WISDEM/WISDEM
train
120
4d79a4a3eb616b699a3b06cb9907c78f8b121e75
[ "self.vlan = vlan\nself.protocol = protocol\nself.src_port = src_port\nself.src_port_range = src_port_range\nself.dst_port = dst_port\nself.dst_port_range = dst_port_range\nself.dscp = dscp", "if dictionary is None:\n return None\nvlan = dictionary.get('vlan')\nprotocol = dictionary.get('protocol')\nsrc_port =...
<|body_start_0|> self.vlan = vlan self.protocol = protocol self.src_port = src_port self.src_port_range = src_port_range self.dst_port = dst_port self.dst_port_range = dst_port_range self.dscp = dscp <|end_body_0|> <|body_start_1|> if dictionary is None: ...
Implementation of the 'updateNetworkSwitchSettingsQosRule' model. TODO: type model description here. Attributes: vlan (int): The VLAN of the incoming packet. A null value will match any VLAN. protocol (Protocol7Enum): The protocol of the incoming packet. Can be one of "ANY", "TCP" or "UDP". Default value is "ANY". src_...
UpdateNetworkSwitchSettingsQosRuleModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkSwitchSettingsQosRuleModel: """Implementation of the 'updateNetworkSwitchSettingsQosRule' model. TODO: type model description here. Attributes: vlan (int): The VLAN of the incoming packet. A null value will match any VLAN. protocol (Protocol7Enum): The protocol of the incoming packet...
stack_v2_sparse_classes_36k_train_006819
3,482
permissive
[ { "docstring": "Constructor for the UpdateNetworkSwitchSettingsQosRuleModel class", "name": "__init__", "signature": "def __init__(self, vlan=None, protocol=None, src_port=None, src_port_range=None, dst_port=None, dst_port_range=None, dscp=None)" }, { "docstring": "Creates an instance of this mo...
2
null
Implement the Python class `UpdateNetworkSwitchSettingsQosRuleModel` described below. Class description: Implementation of the 'updateNetworkSwitchSettingsQosRule' model. TODO: type model description here. Attributes: vlan (int): The VLAN of the incoming packet. A null value will match any VLAN. protocol (Protocol7Enu...
Implement the Python class `UpdateNetworkSwitchSettingsQosRuleModel` described below. Class description: Implementation of the 'updateNetworkSwitchSettingsQosRule' model. TODO: type model description here. Attributes: vlan (int): The VLAN of the incoming packet. A null value will match any VLAN. protocol (Protocol7Enu...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkSwitchSettingsQosRuleModel: """Implementation of the 'updateNetworkSwitchSettingsQosRule' model. TODO: type model description here. Attributes: vlan (int): The VLAN of the incoming packet. A null value will match any VLAN. protocol (Protocol7Enum): The protocol of the incoming packet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateNetworkSwitchSettingsQosRuleModel: """Implementation of the 'updateNetworkSwitchSettingsQosRule' model. TODO: type model description here. Attributes: vlan (int): The VLAN of the incoming packet. A null value will match any VLAN. protocol (Protocol7Enum): The protocol of the incoming packet. Can be one ...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_switch_settings_qos_rule_model.py
RaulCatalano/meraki-python-sdk
train
1
11fd49109bd25604428577bf10e63f1b1f67715c
[ "self.poly_degree = params.poly_degree\nself.crt_context = params.crt_context\nself.secret_key = secret_key", "c0, c1 = (ciphertext.c0, ciphertext.c1)\nmessage = c1.multiply(self.secret_key.s, ciphertext.modulus, crt=self.crt_context)\nmessage = c0.add(message, ciphertext.modulus)\nif c2:\n secret_key_squared ...
<|body_start_0|> self.poly_degree = params.poly_degree self.crt_context = params.crt_context self.secret_key = secret_key <|end_body_0|> <|body_start_1|> c0, c1 = (ciphertext.c0, ciphertext.c1) message = c1.multiply(self.secret_key.s, ciphertext.modulus, crt=self.crt_context) ...
An object that can decrypt data using CKKS given a secret key. Attributes: poly_degree: Degree of polynomial in quotient ring. crt_context: CRT context for multiplication. secret_key (SecretKey): Secret key used for encryption.
CKKSDecryptor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CKKSDecryptor: """An object that can decrypt data using CKKS given a secret key. Attributes: poly_degree: Degree of polynomial in quotient ring. crt_context: CRT context for multiplication. secret_key (SecretKey): Secret key used for encryption.""" def __init__(self, params, secret_key): ...
stack_v2_sparse_classes_36k_train_006820
1,888
permissive
[ { "docstring": "Initializes decryptor for CKKS scheme. Args: params (Parameters): Parameters including polynomial degree, plaintext modulus, and ciphertext modulus. secret_key (SecretKey): Secret key used for decryption.", "name": "__init__", "signature": "def __init__(self, params, secret_key)" }, ...
2
stack_v2_sparse_classes_30k_train_005134
Implement the Python class `CKKSDecryptor` described below. Class description: An object that can decrypt data using CKKS given a secret key. Attributes: poly_degree: Degree of polynomial in quotient ring. crt_context: CRT context for multiplication. secret_key (SecretKey): Secret key used for encryption. Method sign...
Implement the Python class `CKKSDecryptor` described below. Class description: An object that can decrypt data using CKKS given a secret key. Attributes: poly_degree: Degree of polynomial in quotient ring. crt_context: CRT context for multiplication. secret_key (SecretKey): Secret key used for encryption. Method sign...
be700505547b81671c37026e55c4eefbd44dcaae
<|skeleton|> class CKKSDecryptor: """An object that can decrypt data using CKKS given a secret key. Attributes: poly_degree: Degree of polynomial in quotient ring. crt_context: CRT context for multiplication. secret_key (SecretKey): Secret key used for encryption.""" def __init__(self, params, secret_key): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CKKSDecryptor: """An object that can decrypt data using CKKS given a secret key. Attributes: poly_degree: Degree of polynomial in quotient ring. crt_context: CRT context for multiplication. secret_key (SecretKey): Secret key used for encryption.""" def __init__(self, params, secret_key): """Initi...
the_stack_v2_python_sparse
ckks/ckks_decryptor.py
seounghwan-oh/py_FHE_for_homomorphic_encryption
train
3
089aa9b40b8ef0543a3477f66eb4b56a2a8cc4ac
[ "max_num = 0\nfor i in range(len(prices)):\n for j in range(i + 1, len(prices)):\n if prices[j] - prices[i] > 0:\n max_num = max(max_num, prices[j] - prices[i])\nreturn max_num", "if prices == []:\n return 0\nmin_num = prices[0]\nret = 0\nfor i in range(1, len(prices)):\n ret = max(ret,...
<|body_start_0|> max_num = 0 for i in range(len(prices)): for j in range(i + 1, len(prices)): if prices[j] - prices[i] > 0: max_num = max(max_num, prices[j] - prices[i]) return max_num <|end_body_0|> <|body_start_1|> if prices == []: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit1(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|> max_num = 0 for i in ...
stack_v2_sparse_classes_36k_train_006821
1,071
no_license
[ { "docstring": "暴力求解 :type prices: List[int] :rtype: int", "name": "maxProfit1", "signature": "def maxProfit1(self, prices)" }, { "docstring": "动态规划 :type prices: List[int] :rtype: int", "name": "maxProfit2", "signature": "def maxProfit2(self, prices)" } ]
2
stack_v2_sparse_classes_30k_test_000125
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit1(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 maxProfit1(self, prices): 暴力求解 :type prices: List[int] :rtype: int - def maxProfit2(self, prices): 动态规划 :type prices: List[int] :rtype: int <|skeleton|> class Solution: ...
4c395a31e627b6096a601b9e30f82073ddc9b02b
<|skeleton|> class Solution: def maxProfit1(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_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit1(self, prices): """暴力求解 :type prices: List[int] :rtype: int""" max_num = 0 for i in range(len(prices)): for j in range(i + 1, len(prices)): if prices[j] - prices[i] > 0: max_num = max(max_num, prices[j] - prices[i]...
the_stack_v2_python_sparse
leetcode/easy/Best_Time_to_Buy_and_Sell_Stock.py
xiangzz159/Python-Study
train
0
abab9dc1fbd4d6967adbd5057f8d9c346e1a729a
[ "res = nums\nlist = [[]]\nwhile res:\n temp = []\n tmp = res.pop()\n for i in range(len(list)):\n temp.append(list[i] + [tmp])\n list += temp\nreturn list", "list = [[]]\nwhile nums:\n tmp = nums.pop()\n list += [x + [tmp] for x in list]\nreturn list" ]
<|body_start_0|> res = nums list = [[]] while res: temp = [] tmp = res.pop() for i in range(len(list)): temp.append(list[i] + [tmp]) list += temp return list <|end_body_0|> <|body_start_1|> list = [[]] while...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = nums list = [[]...
stack_v2_sparse_classes_36k_train_006822
630
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsets", "signature": "def subsets(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsets", "signature": "def subsets(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Solution: ...
d253f2bdc90348ad6ff0ea8f391fe3839f279879
<|skeleton|> class Solution: def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" res = nums list = [[]] while res: temp = [] tmp = res.pop() for i in range(len(list)): temp.append(list[i] + [tmp]) list += tem...
the_stack_v2_python_sparse
中等难度算法/10子集.py
eumeniders/LeetCode
train
1
ed1689733a913a5ef1e3715fc9e5f7f6f1848381
[ "if 'ProcessorDate' in metadata_dict:\n replace_dic = {'$': '', '#': '', 'Date::': ''}\n processor_date_value = metadata_dict['ProcessorDate']\n for i, j in replace_dic.iteritems():\n processor_date_value = processor_date_value.replace(i, j)\n metadata_dict['ProcessorDate'] = processor_date_value...
<|body_start_0|> if 'ProcessorDate' in metadata_dict: replace_dic = {'$': '', '#': '', 'Date::': ''} processor_date_value = metadata_dict['ProcessorDate'] for i, j in replace_dic.iteritems(): processor_date_value = processor_date_value.replace(i, j) ...
This class is designed to provide storage and handling capabilities for EGADS algorithm metadata. Stores instances of VariableMetadata objects to use to populate algorithm variable outputs.
AlgorithmMetadata
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlgorithmMetadata: """This class is designed to provide storage and handling capabilities for EGADS algorithm metadata. Stores instances of VariableMetadata objects to use to populate algorithm variable outputs.""" def __init__(self, metadata_dict, child_variable_metadata=None): """I...
stack_v2_sparse_classes_36k_train_006823
17,164
permissive
[ { "docstring": "Initialize AlgorithmMetadata instance with given metadata in dict form and any child variable metadata. :param dict metadata_dict: Dictionary object containing variable metadata names and values :param list child_varable_metadata: Optional - List containing VariableMetadata", "name": "__init...
2
stack_v2_sparse_classes_30k_test_000015
Implement the Python class `AlgorithmMetadata` described below. Class description: This class is designed to provide storage and handling capabilities for EGADS algorithm metadata. Stores instances of VariableMetadata objects to use to populate algorithm variable outputs. Method signatures and docstrings: - def __ini...
Implement the Python class `AlgorithmMetadata` described below. Class description: This class is designed to provide storage and handling capabilities for EGADS algorithm metadata. Stores instances of VariableMetadata objects to use to populate algorithm variable outputs. Method signatures and docstrings: - def __ini...
05fce4d36f070587171506caa8b136508fa9405c
<|skeleton|> class AlgorithmMetadata: """This class is designed to provide storage and handling capabilities for EGADS algorithm metadata. Stores instances of VariableMetadata objects to use to populate algorithm variable outputs.""" def __init__(self, metadata_dict, child_variable_metadata=None): """I...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlgorithmMetadata: """This class is designed to provide storage and handling capabilities for EGADS algorithm metadata. Stores instances of VariableMetadata objects to use to populate algorithm variable outputs.""" def __init__(self, metadata_dict, child_variable_metadata=None): """Initialize Alg...
the_stack_v2_python_sparse
egads/egads/core/metadata.py
mfreer/eufar-egads
train
0
2582f9e0f800154e65dfda749e65478bc32d7128
[ "self.students = []\nself.grades = {}\nself.isSorted = True", "if student in self.students:\n raise ValueError('Duplicate Student')\nself.students.append(student)\nself.grades[student.getIdNum()] = []\nself.isSorted = False", "try:\n self.grades[student.getIdNum()].append(grade)\nexcept:\n raise ValueE...
<|body_start_0|> self.students = [] self.grades = {} self.isSorted = True <|end_body_0|> <|body_start_1|> if student in self.students: raise ValueError('Duplicate Student') self.students.append(student) self.grades[student.getIdNum()] = [] self.isSort...
Grades
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Grades: def __init__(self): """Create empty grade book""" <|body_0|> def addStudent(self, student): """Assumes: student is of type Student Add student to the gradebook""" <|body_1|> def addGrade(self, student, grade): """Assumes: grade is a float...
stack_v2_sparse_classes_36k_train_006824
1,705
no_license
[ { "docstring": "Create empty grade book", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Assumes: student is of type Student Add student to the gradebook", "name": "addStudent", "signature": "def addStudent(self, student)" }, { "docstring": "Assumes: gra...
5
stack_v2_sparse_classes_30k_val_000716
Implement the Python class `Grades` described below. Class description: Implement the Grades class. Method signatures and docstrings: - def __init__(self): Create empty grade book - def addStudent(self, student): Assumes: student is of type Student Add student to the gradebook - def addGrade(self, student, grade): As...
Implement the Python class `Grades` described below. Class description: Implement the Grades class. Method signatures and docstrings: - def __init__(self): Create empty grade book - def addStudent(self, student): Assumes: student is of type Student Add student to the gradebook - def addGrade(self, student, grade): As...
cd85abea9d91ed8b17334f744ab150e790044da6
<|skeleton|> class Grades: def __init__(self): """Create empty grade book""" <|body_0|> def addStudent(self, student): """Assumes: student is of type Student Add student to the gradebook""" <|body_1|> def addGrade(self, student, grade): """Assumes: grade is a float...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Grades: def __init__(self): """Create empty grade book""" self.students = [] self.grades = {} self.isSorted = True def addStudent(self, student): """Assumes: student is of type Student Add student to the gradebook""" if student in self.students: ...
the_stack_v2_python_sparse
Chapters/Chapter8/Grades.py
ppysjp93/Introduction-to-Computation-and-Programming-Using-Python-
train
0
eb9f25df8bfc44d468540843729836725a4309b1
[ "user = request.user\nuser_obj = UserModelQueries.get_user_profile_by_user_id(user.id)\nserializer = GetUserProfileSerializer(instance=user_obj)\nreturn StandardHttpResponse.rsp_200(serializer.data, 'Profile fetched Successfully.')", "request_data = request.data.copy()\nif not type(request_data) == dict:\n ret...
<|body_start_0|> user = request.user user_obj = UserModelQueries.get_user_profile_by_user_id(user.id) serializer = GetUserProfileSerializer(instance=user_obj) return StandardHttpResponse.rsp_200(serializer.data, 'Profile fetched Successfully.') <|end_body_0|> <|body_start_1|> re...
UserProfileDetails
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProfileDetails: def get(self, request): """To get the profile details :param request: :return:""" <|body_0|> def post(self, request): """To edit the user profile :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = req...
stack_v2_sparse_classes_36k_train_006825
6,810
no_license
[ { "docstring": "To get the profile details :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "To edit the user profile :param request: :return:", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_006032
Implement the Python class `UserProfileDetails` described below. Class description: Implement the UserProfileDetails class. Method signatures and docstrings: - def get(self, request): To get the profile details :param request: :return: - def post(self, request): To edit the user profile :param request: :return:
Implement the Python class `UserProfileDetails` described below. Class description: Implement the UserProfileDetails class. Method signatures and docstrings: - def get(self, request): To get the profile details :param request: :return: - def post(self, request): To edit the user profile :param request: :return: <|sk...
7e8ce5ee35c56d725d0c1ccb9047f65a90ec5eac
<|skeleton|> class UserProfileDetails: def get(self, request): """To get the profile details :param request: :return:""" <|body_0|> def post(self, request): """To edit the user profile :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserProfileDetails: def get(self, request): """To get the profile details :param request: :return:""" user = request.user user_obj = UserModelQueries.get_user_profile_by_user_id(user.id) serializer = GetUserProfileSerializer(instance=user_obj) return StandardHttpRespons...
the_stack_v2_python_sparse
idfi_ibms/accounts/v1/user_profile.py
ayushman-vvdn/AuthenticationPython3.5
train
0
2968db61b8fc3770939093a7c18a4e2a1e312257
[ "from collections import deque\ntree_list = deque()\ntree_list.append(root)\ns = []\nwhile tree_list:\n if tree_list[0]:\n s.append(str(tree_list[0].val))\n tree_list.append(tree_list[0].left)\n tree_list.append(tree_list[0].right)\n else:\n s.append('null')\n tree_list.popleft(...
<|body_start_0|> from collections import deque tree_list = deque() tree_list.append(root) s = [] while tree_list: if tree_list[0]: s.append(str(tree_list[0].val)) tree_list.append(tree_list[0].left) tree_list.append(tree...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_006826
2,902
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_003079
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
2d7cb909535c6ea88c3b1c5e3123f75debaae188
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" from collections import deque tree_list = deque() tree_list.append(root) s = [] while tree_list: if tree_list[0]: s.append(str...
the_stack_v2_python_sparse
LeetCode297.py
wangyu33/LeetCode
train
0
d77ad6bf461c93196744e599479e1c95c6e2d95d
[ "json_data = await self.request.json()\nid_num = json_data.get('id')\ndb_num = json_data.get('db')\ntype_str = json_data.get('type')\nkey_str = json_data.get('key')\ngrpc_obj = GrpcService(self.request, id_num, db_num)\nvalue = None\nif type_str == 'string':\n value = grpc_obj.get(name=key_str)\nelif type_str ==...
<|body_start_0|> json_data = await self.request.json() id_num = json_data.get('id') db_num = json_data.get('db') type_str = json_data.get('type') key_str = json_data.get('key') grpc_obj = GrpcService(self.request, id_num, db_num) value = None if type_str =...
single key value option
RedisDetailController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RedisDetailController: """single key value option""" async def get(self): """获取 单个 key 的值 @id-> int which machine redis which can be found from mysql @db-> int redis's db num @type-> string list or string or hash or set @key-> string :return: @value-> any json data # todo @ttl->int t...
stack_v2_sparse_classes_36k_train_006827
5,386
no_license
[ { "docstring": "获取 单个 key 的值 @id-> int which machine redis which can be found from mysql @db-> int redis's db num @type-> string list or string or hash or set @key-> string :return: @value-> any json data # todo @ttl->int ttl time", "name": "get", "signature": "async def get(self)" }, { "docstri...
4
stack_v2_sparse_classes_30k_train_000741
Implement the Python class `RedisDetailController` described below. Class description: single key value option Method signatures and docstrings: - async def get(self): 获取 单个 key 的值 @id-> int which machine redis which can be found from mysql @db-> int redis's db num @type-> string list or string or hash or set @key-> ...
Implement the Python class `RedisDetailController` described below. Class description: single key value option Method signatures and docstrings: - async def get(self): 获取 单个 key 的值 @id-> int which machine redis which can be found from mysql @db-> int redis's db num @type-> string list or string or hash or set @key-> ...
c6fdd48dae3bc98f9c41c603bef20d10c15476d7
<|skeleton|> class RedisDetailController: """single key value option""" async def get(self): """获取 单个 key 的值 @id-> int which machine redis which can be found from mysql @db-> int redis's db num @type-> string list or string or hash or set @key-> string :return: @value-> any json data # todo @ttl->int t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RedisDetailController: """single key value option""" async def get(self): """获取 单个 key 的值 @id-> int which machine redis which can be found from mysql @db-> int redis's db num @type-> string list or string or hash or set @key-> string :return: @value-> any json data # todo @ttl->int ttl time""" ...
the_stack_v2_python_sparse
api/redis_controller.py
Fosity/rpc_web
train
0
0baad08f60b306f88dc0370f00b308263969daf1
[ "user_api_key = api_key\nif region in REGION_URL.keys():\n self.region = region\n self.region_url = REGION_URL[region]\nelse:\n raise Exception('\\n The region {} is not available.\\n The currently available regions are: {}'.format(region, ', '.join(list(REGION_URL.keys()))))\...
<|body_start_0|> user_api_key = api_key if region in REGION_URL.keys(): self.region = region self.region_url = REGION_URL[region] else: raise Exception('\n The region {} is not available.\n The currently available regions are: {}'...
ValWrapper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValWrapper: def __init__(self, api_key, region): """Valorant API Wrapper :param api_key: Riot Developer API Key. :param region: The region to execute the requests.""" <|body_0|> def platform_data(self): """Get VALORANT status for the given platform.""" <|body...
stack_v2_sparse_classes_36k_train_006828
1,493
permissive
[ { "docstring": "Valorant API Wrapper :param api_key: Riot Developer API Key. :param region: The region to execute the requests.", "name": "__init__", "signature": "def __init__(self, api_key, region)" }, { "docstring": "Get VALORANT status for the given platform.", "name": "platform_data", ...
3
stack_v2_sparse_classes_30k_train_018654
Implement the Python class `ValWrapper` described below. Class description: Implement the ValWrapper class. Method signatures and docstrings: - def __init__(self, api_key, region): Valorant API Wrapper :param api_key: Riot Developer API Key. :param region: The region to execute the requests. - def platform_data(self)...
Implement the Python class `ValWrapper` described below. Class description: Implement the ValWrapper class. Method signatures and docstrings: - def __init__(self, api_key, region): Valorant API Wrapper :param api_key: Riot Developer API Key. :param region: The region to execute the requests. - def platform_data(self)...
7c5367314e60fbea333933bf0d6660f003dd2efc
<|skeleton|> class ValWrapper: def __init__(self, api_key, region): """Valorant API Wrapper :param api_key: Riot Developer API Key. :param region: The region to execute the requests.""" <|body_0|> def platform_data(self): """Get VALORANT status for the given platform.""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValWrapper: def __init__(self, api_key, region): """Valorant API Wrapper :param api_key: Riot Developer API Key. :param region: The region to execute the requests.""" user_api_key = api_key if region in REGION_URL.keys(): self.region = region self.region_url = R...
the_stack_v2_python_sparse
riotwrapper/val.py
Victoraq/Riot-API-Wrapper
train
0
b93686147560119d5e93fdb7ba4df882c6f09317
[ "if not root:\n return ''\nres = []\nqueue = collections.deque()\nqueue.append(root)\nwhile queue:\n node = queue.popleft()\n if node:\n queue.append(node.left)\n queue.append(node.right)\n res.append(str(node.val) if node else '*')\nreturn ','.join(res)", "if not data:\n return None\...
<|body_start_0|> if not root: return '' res = [] queue = collections.deque() queue.append(root) while queue: node = queue.popleft() if node: queue.append(node.left) queue.append(node.right) res.append...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_006829
1,712
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
1cfcf8da6983fffebe6d037ee134aeff3ca96320
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' res = [] queue = collections.deque() queue.append(root) while queue: node = queue.popleft() if ...
the_stack_v2_python_sparse
Trees/S_d.py
parambole/LeetCode
train
1
f76a2d9f4eef079f06f5a0b15a3abe7d826fc596
[ "self.device = device_claim(device)\nself.generated_length = generated_length\nself.batch_size = batch_size\nself.resources_path = resources_path\nself.load_pretrained_paccmann(os.path.join(self.resources_path, 'params.json'), os.path.join(self.resources_path, 'smiles_language.pkl'), os.path.join(self.resources_pat...
<|body_start_0|> self.device = device_claim(device) self.generated_length = generated_length self.batch_size = batch_size self.resources_path = resources_path self.load_pretrained_paccmann(os.path.join(self.resources_path, 'params.json'), os.path.join(self.resources_path, 'smiles...
Generator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: def __init__(self, resources_path: str, generated_length: int=100, batch_size: int=32, device: Optional[Union[torch.device, str]]=None): """Initialize the encoder/decoder generative model. Args: resources_path: directory where to find models and parameters. generated_length: l...
stack_v2_sparse_classes_36k_train_006830
5,775
permissive
[ { "docstring": "Initialize the encoder/decoder generative model. Args: resources_path: directory where to find models and parameters. generated_length: length of the generated molecule in tokens. Defaults to 100. batch_size: size of the batch. Defaults to 1. device: device where the inference is running either ...
4
stack_v2_sparse_classes_30k_train_020521
Implement the Python class `Generator` described below. Class description: Implement the Generator class. Method signatures and docstrings: - def __init__(self, resources_path: str, generated_length: int=100, batch_size: int=32, device: Optional[Union[torch.device, str]]=None): Initialize the encoder/decoder generati...
Implement the Python class `Generator` described below. Class description: Implement the Generator class. Method signatures and docstrings: - def __init__(self, resources_path: str, generated_length: int=100, batch_size: int=32, device: Optional[Union[torch.device, str]]=None): Initialize the encoder/decoder generati...
0b69b7d5b261f2f9af3984793c1295b9b80cd01a
<|skeleton|> class Generator: def __init__(self, resources_path: str, generated_length: int=100, batch_size: int=32, device: Optional[Union[torch.device, str]]=None): """Initialize the encoder/decoder generative model. Args: resources_path: directory where to find models and parameters. generated_length: l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Generator: def __init__(self, resources_path: str, generated_length: int=100, batch_size: int=32, device: Optional[Union[torch.device, str]]=None): """Initialize the encoder/decoder generative model. Args: resources_path: directory where to find models and parameters. generated_length: length of the g...
the_stack_v2_python_sparse
src/gt4sd/algorithms/generation/polymer_blocks/implementation.py
GT4SD/gt4sd-core
train
239
64c2322890e53b8ab0505f70b417e0c434deda05
[ "size = 0\nfor root, dirs, files in os.walk(dir):\n size += sum([getsize(join(root, name)) for name in files])\nreturn size", "if not os.path.exists(input_path) or not os.path.isdir(input_path):\n print('Input_path Error!')\n return None\ndirector_queue = queue.Queue()\ndirector_queue.put(input_path)\ntr...
<|body_start_0|> size = 0 for root, dirs, files in os.walk(dir): size += sum([getsize(join(root, name)) for name in files]) return size <|end_body_0|> <|body_start_1|> if not os.path.exists(input_path) or not os.path.isdir(input_path): print('Input_path Error!') ...
绘制目录结构图,用树的形式
DrawDirectorTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DrawDirectorTree: """绘制目录结构图,用树的形式""" def getdirsize(cls, dir): """获取文件夹大小 :param dir: :return: 返回尺寸""" <|body_0|> def draw_director_tree(cls, input_path): """深度遍历一个目录,绘制目录树形图 :param input_path: 目标目录 :return:""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_006831
5,184
no_license
[ { "docstring": "获取文件夹大小 :param dir: :return: 返回尺寸", "name": "getdirsize", "signature": "def getdirsize(cls, dir)" }, { "docstring": "深度遍历一个目录,绘制目录树形图 :param input_path: 目标目录 :return:", "name": "draw_director_tree", "signature": "def draw_director_tree(cls, input_path)" } ]
2
stack_v2_sparse_classes_30k_train_015210
Implement the Python class `DrawDirectorTree` described below. Class description: 绘制目录结构图,用树的形式 Method signatures and docstrings: - def getdirsize(cls, dir): 获取文件夹大小 :param dir: :return: 返回尺寸 - def draw_director_tree(cls, input_path): 深度遍历一个目录,绘制目录树形图 :param input_path: 目标目录 :return:
Implement the Python class `DrawDirectorTree` described below. Class description: 绘制目录结构图,用树的形式 Method signatures and docstrings: - def getdirsize(cls, dir): 获取文件夹大小 :param dir: :return: 返回尺寸 - def draw_director_tree(cls, input_path): 深度遍历一个目录,绘制目录树形图 :param input_path: 目标目录 :return: <|skeleton|> class DrawDirectorT...
32900324b7bc5d7c0b473aa68393bb84c9cd4790
<|skeleton|> class DrawDirectorTree: """绘制目录结构图,用树的形式""" def getdirsize(cls, dir): """获取文件夹大小 :param dir: :return: 返回尺寸""" <|body_0|> def draw_director_tree(cls, input_path): """深度遍历一个目录,绘制目录树形图 :param input_path: 目标目录 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DrawDirectorTree: """绘制目录结构图,用树的形式""" def getdirsize(cls, dir): """获取文件夹大小 :param dir: :return: 返回尺寸""" size = 0 for root, dirs, files in os.walk(dir): size += sum([getsize(join(root, name)) for name in files]) return size def draw_director_tree(cls, input...
the_stack_v2_python_sparse
etlpy/DAG.py
xisafe/mypython
train
0
766430e6d7e04403ec26164a43921eafdef2428f
[ "st = Study.query.get(kf_id)\nif st is None:\n abort(404, 'could not find {} `{}`'.format('study', kf_id))\nreturn StudySchema().jsonify(st)", "body = request.get_json(force=True)\nst = Study.query.get(kf_id)\nif st is None:\n abort(404, 'could not find {} `{}`'.format('study', kf_id))\ntry:\n st = Study...
<|body_start_0|> st = Study.query.get(kf_id) if st is None: abort(404, 'could not find {} `{}`'.format('study', kf_id)) return StudySchema().jsonify(st) <|end_body_0|> <|body_start_1|> body = request.get_json(force=True) st = Study.query.get(kf_id) if st is N...
Study API
StudyAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StudyAPI: """Study API""" def get(self, kf_id): """Get a study by id --- template: path: get_by_id.yml properties: resource: Study""" <|body_0|> def patch(self, kf_id): """Update an existing study. Allows partial update of resource --- template: path: update_by_i...
stack_v2_sparse_classes_36k_train_006832
3,738
permissive
[ { "docstring": "Get a study by id --- template: path: get_by_id.yml properties: resource: Study", "name": "get", "signature": "def get(self, kf_id)" }, { "docstring": "Update an existing study. Allows partial update of resource --- template: path: update_by_id.yml properties: resource: Study", ...
3
stack_v2_sparse_classes_30k_train_015595
Implement the Python class `StudyAPI` described below. Class description: Study API Method signatures and docstrings: - def get(self, kf_id): Get a study by id --- template: path: get_by_id.yml properties: resource: Study - def patch(self, kf_id): Update an existing study. Allows partial update of resource --- templa...
Implement the Python class `StudyAPI` described below. Class description: Study API Method signatures and docstrings: - def get(self, kf_id): Get a study by id --- template: path: get_by_id.yml properties: resource: Study - def patch(self, kf_id): Update an existing study. Allows partial update of resource --- templa...
36ee3fc3d1ba9d1a177274d051fb175c56dd898e
<|skeleton|> class StudyAPI: """Study API""" def get(self, kf_id): """Get a study by id --- template: path: get_by_id.yml properties: resource: Study""" <|body_0|> def patch(self, kf_id): """Update an existing study. Allows partial update of resource --- template: path: update_by_i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StudyAPI: """Study API""" def get(self, kf_id): """Get a study by id --- template: path: get_by_id.yml properties: resource: Study""" st = Study.query.get(kf_id) if st is None: abort(404, 'could not find {} `{}`'.format('study', kf_id)) return StudySchema().jso...
the_stack_v2_python_sparse
dataservice/api/study/resources.py
kids-first/kf-api-dataservice
train
9
13b415dc74c0558e659d576898ed8b3206940733
[ "super().__init__()\nassert isinstance(torch_feature, torch.Tensor), f'torch_feature in TorchBasedFeature must be torch.Tensor, but got {type(torch_feature)}.'\nself._tensor = torch_feature", "if ids is None:\n return self._tensor\nreturn self._tensor[ids]", "if ids is None:\n assert self._tensor.shape ==...
<|body_start_0|> super().__init__() assert isinstance(torch_feature, torch.Tensor), f'torch_feature in TorchBasedFeature must be torch.Tensor, but got {type(torch_feature)}.' self._tensor = torch_feature <|end_body_0|> <|body_start_1|> if ids is None: return self._tensor ...
Torch based feature.
TorchBasedFeature
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TorchBasedFeature: """Torch based feature.""" def __init__(self, torch_feature: torch.Tensor): """Initialize a torch based feature store by a torch feature. Note that the feature can be either in memory or on disk. Parameters ---------- torch_feature : torch.Tensor The torch feature....
stack_v2_sparse_classes_36k_train_006833
6,169
permissive
[ { "docstring": "Initialize a torch based feature store by a torch feature. Note that the feature can be either in memory or on disk. Parameters ---------- torch_feature : torch.Tensor The torch feature. Examples -------- >>> import torch >>> torch_feat = torch.arange(0, 5) >>> feature_store = TorchBasedFeature(...
3
stack_v2_sparse_classes_30k_train_011407
Implement the Python class `TorchBasedFeature` described below. Class description: Torch based feature. Method signatures and docstrings: - def __init__(self, torch_feature: torch.Tensor): Initialize a torch based feature store by a torch feature. Note that the feature can be either in memory or on disk. Parameters -...
Implement the Python class `TorchBasedFeature` described below. Class description: Torch based feature. Method signatures and docstrings: - def __init__(self, torch_feature: torch.Tensor): Initialize a torch based feature store by a torch feature. Note that the feature can be either in memory or on disk. Parameters -...
bbc8ff6261f2e0d2b5982e992b6fbe545e2a4aa1
<|skeleton|> class TorchBasedFeature: """Torch based feature.""" def __init__(self, torch_feature: torch.Tensor): """Initialize a torch based feature store by a torch feature. Note that the feature can be either in memory or on disk. Parameters ---------- torch_feature : torch.Tensor The torch feature....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TorchBasedFeature: """Torch based feature.""" def __init__(self, torch_feature: torch.Tensor): """Initialize a torch based feature store by a torch feature. Note that the feature can be either in memory or on disk. Parameters ---------- torch_feature : torch.Tensor The torch feature. Examples ---...
the_stack_v2_python_sparse
python/dgl/graphbolt/impl/torch_based_feature_store.py
dmlc/dgl
train
12,631
a087f718d7c3264dc2186f6a72ef2b3e33aef5cc
[ "if not self.is_empty():\n for p in self._subtree_inorder(self.root()):\n yield p", "if self.left(p) is not None:\n for other in self._subtree_inorder(self.left(p)):\n yield other\nyield p\nif self.right(p) is not None:\n for other in self._subtree_inorder(self.right(p)):\n yield oth...
<|body_start_0|> if not self.is_empty(): for p in self._subtree_inorder(self.root()): yield p <|end_body_0|> <|body_start_1|> if self.left(p) is not None: for other in self._subtree_inorder(self.left(p)): yield other yield p if sel...
TreeTraversals
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreeTraversals: def inorder(self): """Generate a inorder iteration of positions in the tree.""" <|body_0|> def _subtree_inorder(self, p): """Generate an inorder iteration of positions in subtree rooted at p.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_006834
880
permissive
[ { "docstring": "Generate a inorder iteration of positions in the tree.", "name": "inorder", "signature": "def inorder(self)" }, { "docstring": "Generate an inorder iteration of positions in subtree rooted at p.", "name": "_subtree_inorder", "signature": "def _subtree_inorder(self, p)" ...
2
stack_v2_sparse_classes_30k_train_009251
Implement the Python class `TreeTraversals` described below. Class description: Implement the TreeTraversals class. Method signatures and docstrings: - def inorder(self): Generate a inorder iteration of positions in the tree. - def _subtree_inorder(self, p): Generate an inorder iteration of positions in subtree roote...
Implement the Python class `TreeTraversals` described below. Class description: Implement the TreeTraversals class. Method signatures and docstrings: - def inorder(self): Generate a inorder iteration of positions in the tree. - def _subtree_inorder(self, p): Generate an inorder iteration of positions in subtree roote...
fc18b54128cd5bc7639a14999d8f990190b524eb
<|skeleton|> class TreeTraversals: def inorder(self): """Generate a inorder iteration of positions in the tree.""" <|body_0|> def _subtree_inorder(self, p): """Generate an inorder iteration of positions in subtree rooted at p.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TreeTraversals: def inorder(self): """Generate a inorder iteration of positions in the tree.""" if not self.is_empty(): for p in self._subtree_inorder(self.root()): yield p def _subtree_inorder(self, p): """Generate an inorder iteration of positions in ...
the_stack_v2_python_sparse
CHAPTER 08 (trees)/inorder_traversals.py
ahammadshawki8/DSA-Implementations-in-Python
train
2
c7343e36430c63026d8a3c6cd5fe11726cb84ca3
[ "logging.debug('Enabling user to execute test as root...')\ncommand = \"sed -i -e '$a{mark}\\\\n{user} ALL=NOPASSWD: /usr/bin/python' {filename}\".format(mark=self.MARK, user=os.getenv('SUDO_USER'), script=os.path.realpath(__file__), filename=self.SUDOERS)\nCommand(command, verbose=False).run()", "logging.debug('...
<|body_start_0|> logging.debug('Enabling user to execute test as root...') command = "sed -i -e '$a{mark}\\n{user} ALL=NOPASSWD: /usr/bin/python' {filename}".format(mark=self.MARK, user=os.getenv('SUDO_USER'), script=os.path.realpath(__file__), filename=self.SUDOERS) Command(command, verbose=Fal...
Enable/disable reboot test to be executed as root to make sure that reboot test works properly
SudoersConfigurator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SudoersConfigurator: """Enable/disable reboot test to be executed as root to make sure that reboot test works properly""" def enable(self): """Make sure that user will be allowed to execute reboot test as root""" <|body_0|> def disable(self): """Revert sudoers co...
stack_v2_sparse_classes_36k_train_006835
33,067
permissive
[ { "docstring": "Make sure that user will be allowed to execute reboot test as root", "name": "enable", "signature": "def enable(self)" }, { "docstring": "Revert sudoers configuration changes", "name": "disable", "signature": "def disable(self)" } ]
2
stack_v2_sparse_classes_30k_train_007925
Implement the Python class `SudoersConfigurator` described below. Class description: Enable/disable reboot test to be executed as root to make sure that reboot test works properly Method signatures and docstrings: - def enable(self): Make sure that user will be allowed to execute reboot test as root - def disable(sel...
Implement the Python class `SudoersConfigurator` described below. Class description: Enable/disable reboot test to be executed as root to make sure that reboot test works properly Method signatures and docstrings: - def enable(self): Make sure that user will be allowed to execute reboot test as root - def disable(sel...
40ceac081f5181d01e188a5a1c40463d891203e6
<|skeleton|> class SudoersConfigurator: """Enable/disable reboot test to be executed as root to make sure that reboot test works properly""" def enable(self): """Make sure that user will be allowed to execute reboot test as root""" <|body_0|> def disable(self): """Revert sudoers co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SudoersConfigurator: """Enable/disable reboot test to be executed as root to make sure that reboot test works properly""" def enable(self): """Make sure that user will be allowed to execute reboot test as root""" logging.debug('Enabling user to execute test as root...') command = ...
the_stack_v2_python_sparse
work/pm.py
sebastian-code/ideas_sueltas
train
0
0b21b40489803f9ac18e1605778de8cf82e520d3
[ "couples = [(0.0, 0.0)]\nfor i, row in enumerate(self.values):\n v = self._interpret_row(row)\n x = functionX(v) if functionX is not None else float(i + 1)\n y = functionY(v)\n couples.append((x, y))\n if y < 0:\n raise ValueError('a value should not be negative for y: ' + str(y))\n if x < ...
<|body_start_0|> couples = [(0.0, 0.0)] for i, row in enumerate(self.values): v = self._interpret_row(row) x = functionX(v) if functionX is not None else float(i + 1) y = functionY(v) couples.append((x, y)) if y < 0: raise Value...
Contains various statistical functions. :: table = TableFormula ("sum_y#1#1#1#1#1#1#1#1#1#1#1".replace(" ", "\\t").replace("#","\\n")) gini = table.Gini (lambda v : v["sum_y"]) print (gini) # expects 1 table = TableFormula ("sum_y#1#1#1#1#1#1#1#1#1#1#1#5#10".replace(" ", "\\t").replace("#","\\n")) gini = table.Gini (la...
_TableFormulaStat
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _TableFormulaStat: """Contains various statistical functions. :: table = TableFormula ("sum_y#1#1#1#1#1#1#1#1#1#1#1".replace(" ", "\\t").replace("#","\\n")) gini = table.Gini (lambda v : v["sum_y"]) print (gini) # expects 1 table = TableFormula ("sum_y#1#1#1#1#1#1#1#1#1#1#1#5#10".replace(" ", "\\...
stack_v2_sparse_classes_36k_train_006836
5,013
permissive
[ { "docstring": "Computes the Gini curve, takes the following parameters. @param functionY revenues @param functionX sum of persons having an income below Y (or having Y is isXdx is True) @param isXdx number of persons equal to Y (True) or inferior (False), if True, X,Y couples are sorted @return a curve (x, Gin...
4
null
Implement the Python class `_TableFormulaStat` described below. Class description: Contains various statistical functions. :: table = TableFormula ("sum_y#1#1#1#1#1#1#1#1#1#1#1".replace(" ", "\\t").replace("#","\\n")) gini = table.Gini (lambda v : v["sum_y"]) print (gini) # expects 1 table = TableFormula ("sum_y#1#1#1...
Implement the Python class `_TableFormulaStat` described below. Class description: Contains various statistical functions. :: table = TableFormula ("sum_y#1#1#1#1#1#1#1#1#1#1#1".replace(" ", "\\t").replace("#","\\n")) gini = table.Gini (lambda v : v["sum_y"]) print (gini) # expects 1 table = TableFormula ("sum_y#1#1#1...
2abbc7a20c7437f9ab91d1ec83a6aecdefceb028
<|skeleton|> class _TableFormulaStat: """Contains various statistical functions. :: table = TableFormula ("sum_y#1#1#1#1#1#1#1#1#1#1#1".replace(" ", "\\t").replace("#","\\n")) gini = table.Gini (lambda v : v["sum_y"]) print (gini) # expects 1 table = TableFormula ("sum_y#1#1#1#1#1#1#1#1#1#1#1#5#10".replace(" ", "\\...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _TableFormulaStat: """Contains various statistical functions. :: table = TableFormula ("sum_y#1#1#1#1#1#1#1#1#1#1#1".replace(" ", "\\t").replace("#","\\n")) gini = table.Gini (lambda v : v["sum_y"]) print (gini) # expects 1 table = TableFormula ("sum_y#1#1#1#1#1#1#1#1#1#1#1#5#10".replace(" ", "\\t").replace("...
the_stack_v2_python_sparse
src/ensae_teaching_cs/homeblog/table_formula_stat.py
Pandinosaurus/ensae_teaching_cs
train
1
b7c53adda3f133930ececd5bbe6f13c4098d02d4
[ "self.__dungeon_map = DungeonMap()\nself.__character = None\nself.__enemy = None\nself.__game_start_mode = None\nself.__current_game_state = GAME_MENU\nself.__text_to_menu = {'new game': NEW_GAME, 'load': LOAD_GAME}\nself.__update_list = UpdateList()", "if self.__character:\n player_is_alive = self.__character...
<|body_start_0|> self.__dungeon_map = DungeonMap() self.__character = None self.__enemy = None self.__game_start_mode = None self.__current_game_state = GAME_MENU self.__text_to_menu = {'new game': NEW_GAME, 'load': LOAD_GAME} self.__update_list = UpdateList() <|e...
DungeonGame
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DungeonGame: def __init__(self): """Constructor of DungeonGame. :param game_start_mode: the way how game should start. :type game_start_mode: GameStartMode""" <|body_0|> def should_run(self): """Function is used to undestand if game should continue. :return: True if ...
stack_v2_sparse_classes_36k_train_006837
3,715
permissive
[ { "docstring": "Constructor of DungeonGame. :param game_start_mode: the way how game should start. :type game_start_mode: GameStartMode", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Function is used to undestand if game should continue. :return: True if should, False...
4
null
Implement the Python class `DungeonGame` described below. Class description: Implement the DungeonGame class. Method signatures and docstrings: - def __init__(self): Constructor of DungeonGame. :param game_start_mode: the way how game should start. :type game_start_mode: GameStartMode - def should_run(self): Function...
Implement the Python class `DungeonGame` described below. Class description: Implement the DungeonGame class. Method signatures and docstrings: - def __init__(self): Constructor of DungeonGame. :param game_start_mode: the way how game should start. :type game_start_mode: GameStartMode - def should_run(self): Function...
291592e97b6d8fe9f9e6627dc0023875918d3463
<|skeleton|> class DungeonGame: def __init__(self): """Constructor of DungeonGame. :param game_start_mode: the way how game should start. :type game_start_mode: GameStartMode""" <|body_0|> def should_run(self): """Function is used to undestand if game should continue. :return: True if ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DungeonGame: def __init__(self): """Constructor of DungeonGame. :param game_start_mode: the way how game should start. :type game_start_mode: GameStartMode""" self.__dungeon_map = DungeonMap() self.__character = None self.__enemy = None self.__game_start_mode = None ...
the_stack_v2_python_sparse
Tihran_Katolikian/10/TKDungeonGamePkg/TKDungeonGamePkg/DungeonGame.py
SmischenkoB/campus_2018_python
train
0
bb5297c50a5ee20fddf2c6f288dcf554759fc0af
[ "folder_name = cls._install_archive_folder_template.format(version=version)\ntry:\n return list(glob.glob(cls.get_archive_path(source, folder_name)))[0]\nexcept IndexError:\n return ''", "file_name = cls._install_archive_name_template.format(version=version)\ntry:\n return list(glob.glob(cls.get_archive_...
<|body_start_0|> folder_name = cls._install_archive_folder_template.format(version=version) try: return list(glob.glob(cls.get_archive_path(source, folder_name)))[0] except IndexError: return '' <|end_body_0|> <|body_start_1|> file_name = cls._install_archive_nam...
An base-class which is meant share code across subclasses. This class is not meant to be used directly.
BaseHoudiniAdapter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseHoudiniAdapter: """An base-class which is meant share code across subclasses. This class is not meant to be used directly.""" def get_extracted_folder(cls, source, version): """Find the folder that first extracted .tar.gz will make. Args: source (str): The absolute path to the pa...
stack_v2_sparse_classes_36k_train_006838
10,636
permissive
[ { "docstring": "Find the folder that first extracted .tar.gz will make. Args: source (str): The absolute path to the package folder where the Houdini executable would be found. version (str): The specific installation of Houdini to get the folder of. Example: \"17.0.352\".", "name": "get_extracted_folder", ...
2
stack_v2_sparse_classes_30k_train_003017
Implement the Python class `BaseHoudiniAdapter` described below. Class description: An base-class which is meant share code across subclasses. This class is not meant to be used directly. Method signatures and docstrings: - def get_extracted_folder(cls, source, version): Find the folder that first extracted .tar.gz w...
Implement the Python class `BaseHoudiniAdapter` described below. Class description: An base-class which is meant share code across subclasses. This class is not meant to be used directly. Method signatures and docstrings: - def get_extracted_folder(cls, source, version): Find the folder that first extracted .tar.gz w...
e7efafcd1d7a44ed732e217182388dfa9190f2d0
<|skeleton|> class BaseHoudiniAdapter: """An base-class which is meant share code across subclasses. This class is not meant to be used directly.""" def get_extracted_folder(cls, source, version): """Find the folder that first extracted .tar.gz will make. Args: source (str): The absolute path to the pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseHoudiniAdapter: """An base-class which is meant share code across subclasses. This class is not meant to be used directly.""" def get_extracted_folder(cls, source, version): """Find the folder that first extracted .tar.gz will make. Args: source (str): The absolute path to the package folder ...
the_stack_v2_python_sparse
adapters/houdini_installation/houdini_installation_builder.py
demon7x/rezzurect
train
0
6382e1be7ae5ed612e42b5b8e5af541a421454f3
[ "form = self.form_class(self.request.GET)\nform.is_valid()\nform.save()\nreturn form.ranges", "context = super().get_context_data(**kwargs)\ncontext['form'] = self.form_class(self.request.GET)\nreturn context" ]
<|body_start_0|> form = self.form_class(self.request.GET) form.is_valid() form.save() return form.ranges <|end_body_0|> <|body_start_1|> context = super().get_context_data(**kwargs) context['form'] = self.form_class(self.request.GET) return context <|end_body_1|>...
View for product search page.
ShopifyProducts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShopifyProducts: """View for product search page.""" def get_queryset(self): """Return a queryset of product ranges filtered by the request's GET params.""" <|body_0|> def get_context_data(self, **kwargs): """Return context for the template.""" <|body_1|>...
stack_v2_sparse_classes_36k_train_006839
11,297
no_license
[ { "docstring": "Return a queryset of product ranges filtered by the request's GET params.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Return context for the template.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" ...
2
null
Implement the Python class `ShopifyProducts` described below. Class description: View for product search page. Method signatures and docstrings: - def get_queryset(self): Return a queryset of product ranges filtered by the request's GET params. - def get_context_data(self, **kwargs): Return context for the template.
Implement the Python class `ShopifyProducts` described below. Class description: View for product search page. Method signatures and docstrings: - def get_queryset(self): Return a queryset of product ranges filtered by the request's GET params. - def get_context_data(self, **kwargs): Return context for the template. ...
ba51d4e304b1aeb296fa2fe16611c892fcdbd471
<|skeleton|> class ShopifyProducts: """View for product search page.""" def get_queryset(self): """Return a queryset of product ranges filtered by the request's GET params.""" <|body_0|> def get_context_data(self, **kwargs): """Return context for the template.""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShopifyProducts: """View for product search page.""" def get_queryset(self): """Return a queryset of product ranges filtered by the request's GET params.""" form = self.form_class(self.request.GET) form.is_valid() form.save() return form.ranges def get_context...
the_stack_v2_python_sparse
channels/views.py
stcstores/stcadmin
train
0
767c15c3704311379ed46e413e881e9f30c92528
[ "AbstractDict.__init__(self)\nself._items = list()\nif sourceCollection:\n for key, value in sourceCollection.items():\n self[key] = value", "cursor = 0\nwhile cursor < len(self):\n yield self._items[cursor].key\n cursor += 1", "index = self._index(key)\nif index == -1:\n raise KeyError('miss...
<|body_start_0|> AbstractDict.__init__(self) self._items = list() if sourceCollection: for key, value in sourceCollection.items(): self[key] = value <|end_body_0|> <|body_start_1|> cursor = 0 while cursor < len(self): yield self._items[cur...
基于array的dict实现.
ArrayDict
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArrayDict: """基于array的dict实现.""" def __init__(self, sourceCollection=None): """如果存在,则将item从sourceCollection复制到集合中.""" <|body_0|> def __iter__(self): """提供字典中的keys.""" <|body_1|> def __getitem__(self, key): """前提: key在字典里面. Raises: 如果key不在字典里则...
stack_v2_sparse_classes_36k_train_006840
2,025
no_license
[ { "docstring": "如果存在,则将item从sourceCollection复制到集合中.", "name": "__init__", "signature": "def __init__(self, sourceCollection=None)" }, { "docstring": "提供字典中的keys.", "name": "__iter__", "signature": "def __iter__(self)" }, { "docstring": "前提: key在字典里面. Raises: 如果key不在字典里则抛出KeyError...
6
stack_v2_sparse_classes_30k_train_018237
Implement the Python class `ArrayDict` described below. Class description: 基于array的dict实现. Method signatures and docstrings: - def __init__(self, sourceCollection=None): 如果存在,则将item从sourceCollection复制到集合中. - def __iter__(self): 提供字典中的keys. - def __getitem__(self, key): 前提: key在字典里面. Raises: 如果key不在字典里则抛出KeyError. 返回与...
Implement the Python class `ArrayDict` described below. Class description: 基于array的dict实现. Method signatures and docstrings: - def __init__(self, sourceCollection=None): 如果存在,则将item从sourceCollection复制到集合中. - def __iter__(self): 提供字典中的keys. - def __getitem__(self, key): 前提: key在字典里面. Raises: 如果key不在字典里则抛出KeyError. 返回与...
dc1062df01cc53eb9a2a1849709d2f88e8b4488c
<|skeleton|> class ArrayDict: """基于array的dict实现.""" def __init__(self, sourceCollection=None): """如果存在,则将item从sourceCollection复制到集合中.""" <|body_0|> def __iter__(self): """提供字典中的keys.""" <|body_1|> def __getitem__(self, key): """前提: key在字典里面. Raises: 如果key不在字典里则...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArrayDict: """基于array的dict实现.""" def __init__(self, sourceCollection=None): """如果存在,则将item从sourceCollection复制到集合中.""" AbstractDict.__init__(self) self._items = list() if sourceCollection: for key, value in sourceCollection.items(): self[key] = v...
the_stack_v2_python_sparse
PyDemo/dataStructure/arrays/arraydict.py
RockJohnson503/MyDemo
train
5
de19f670f99c36aa3880e8259bda819eae61e713
[ "ConfigureMake.__init__(self, **kwargs)\nldconfig.__init__(self, **kwargs)\nrm.__init__(self, **kwargs)\ntar.__init__(self, **kwargs)\nwget.__init__(self, **kwargs)\nself.configure_opts = kwargs.get('configure_opts', ['--enable-cxx', '--enable-fortran'])\nself.prefix = kwargs.get('prefix', '/usr/local/hdf5')\nself....
<|body_start_0|> ConfigureMake.__init__(self, **kwargs) ldconfig.__init__(self, **kwargs) rm.__init__(self, **kwargs) tar.__init__(self, **kwargs) wget.__init__(self, **kwargs) self.configure_opts = kwargs.get('configure_opts', ['--enable-cxx', '--enable-fortran']) ...
The `hdf5` building block downloads, configures, builds, and installs the [HDF5](http://www.hdfgroup.org) component. Depending on the parameters, the source will be downloaded from the web (default) or copied from a source directory in the local build context. As a side effect, this building block modifies `PATH` to in...
hdf5
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class hdf5: """The `hdf5` building block downloads, configures, builds, and installs the [HDF5](http://www.hdfgroup.org) component. Depending on the parameters, the source will be downloaded from the web (default) or copied from a source directory in the local build context. As a side effect, this buil...
stack_v2_sparse_classes_36k_train_006841
10,505
permissive
[ { "docstring": "Initialize building block", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "String representation of the building block", "name": "__str__", "signature": "def __str__(self)" }, { "docstring": "Based on the Linux distribution, set...
5
stack_v2_sparse_classes_30k_train_020728
Implement the Python class `hdf5` described below. Class description: The `hdf5` building block downloads, configures, builds, and installs the [HDF5](http://www.hdfgroup.org) component. Depending on the parameters, the source will be downloaded from the web (default) or copied from a source directory in the local bui...
Implement the Python class `hdf5` described below. Class description: The `hdf5` building block downloads, configures, builds, and installs the [HDF5](http://www.hdfgroup.org) component. Depending on the parameters, the source will be downloaded from the web (default) or copied from a source directory in the local bui...
555093c0a5c98bd2b0114831b8c676c0c3c50dd7
<|skeleton|> class hdf5: """The `hdf5` building block downloads, configures, builds, and installs the [HDF5](http://www.hdfgroup.org) component. Depending on the parameters, the source will be downloaded from the web (default) or copied from a source directory in the local build context. As a side effect, this buil...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class hdf5: """The `hdf5` building block downloads, configures, builds, and installs the [HDF5](http://www.hdfgroup.org) component. Depending on the parameters, the source will be downloaded from the web (default) or copied from a source directory in the local build context. As a side effect, this building block mo...
the_stack_v2_python_sparse
hpccm/building_blocks/hdf5.py
DalavanCloud/hpc-container-maker
train
1
ecc9489d6394dca2b25d4616adc123f081466821
[ "self.wiki_lang = wiki_lang\nself.wiki_base_url = 'https://dumps.wikimedia.org/'\nself.dump_site = WikiDump(self.wiki_lang)\nif not wiki_date:\n self.wiki_date = self.dump_site.get_latest_dump()\nelse:\n if not self.dump_site.ready(wiki_date):\n latest_dump = self.dump_site.get_latest_dump()\n r...
<|body_start_0|> self.wiki_lang = wiki_lang self.wiki_base_url = 'https://dumps.wikimedia.org/' self.dump_site = WikiDump(self.wiki_lang) if not wiki_date: self.wiki_date = self.dump_site.get_latest_dump() else: if not self.dump_site.ready(wiki_date): ...
This class downloads an entire Wikipedia dump.
WikiDumpDownloader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WikiDumpDownloader: """This class downloads an entire Wikipedia dump.""" def __init__(self, wiki_lang: str='enwiki', wiki_date: str=None) -> None: """Initializes the class with an optional language and date. Args: wiki_lang (str, optional): A Wikipedia dump language (e.g. enwiki) to ...
stack_v2_sparse_classes_36k_train_006842
11,055
permissive
[ { "docstring": "Initializes the class with an optional language and date. Args: wiki_lang (str, optional): A Wikipedia dump language (e.g. enwiki) to download. Defaults to 'enwiki'. wiki_date (str, optional): A date string (e.g. 20210420) for the dump. Defaults to None. Raises: ValueError: This occurs if the wi...
3
stack_v2_sparse_classes_30k_val_000583
Implement the Python class `WikiDumpDownloader` described below. Class description: This class downloads an entire Wikipedia dump. Method signatures and docstrings: - def __init__(self, wiki_lang: str='enwiki', wiki_date: str=None) -> None: Initializes the class with an optional language and date. Args: wiki_lang (st...
Implement the Python class `WikiDumpDownloader` described below. Class description: This class downloads an entire Wikipedia dump. Method signatures and docstrings: - def __init__(self, wiki_lang: str='enwiki', wiki_date: str=None) -> None: Initializes the class with an optional language and date. Args: wiki_lang (st...
a369629b0eb8bbee37e2ec8484da9f09234cbca3
<|skeleton|> class WikiDumpDownloader: """This class downloads an entire Wikipedia dump.""" def __init__(self, wiki_lang: str='enwiki', wiki_date: str=None) -> None: """Initializes the class with an optional language and date. Args: wiki_lang (str, optional): A Wikipedia dump language (e.g. enwiki) to ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WikiDumpDownloader: """This class downloads an entire Wikipedia dump.""" def __init__(self, wiki_lang: str='enwiki', wiki_date: str=None) -> None: """Initializes the class with an optional language and date. Args: wiki_lang (str, optional): A Wikipedia dump language (e.g. enwiki) to download. Def...
the_stack_v2_python_sparse
kg/el/download_wikipedia.py
ToddMorrill/knowledge-graphs
train
4
5a8b0fd2fb40ca98919e32e661265235ac734f2d
[ "self.sock = None\nself.socketfile = socketfile\nif os.path.exists(socketfile):\n os.remove(socketfile)", "self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)\nself.sock.bind(self.socketfile)\nos.chmod(self.socketfile, 511)\nprint('open socket')\nself.sock.listen(0)\nreturn self.sock", "self.sock.s...
<|body_start_0|> self.sock = None self.socketfile = socketfile if os.path.exists(socketfile): os.remove(socketfile) <|end_body_0|> <|body_start_1|> self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) self.sock.bind(self.socketfile) os.chmod(self.soc...
context wrapper around unix socket
OpenUnixSocketServer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpenUnixSocketServer: """context wrapper around unix socket""" def __init__(self, socketfile): """init fn""" <|body_0|> def __enter__(self): """enter fn""" <|body_1|> def __exit__(self, exc_type, exc_value, traceback): """exit fn""" <...
stack_v2_sparse_classes_36k_train_006843
8,088
no_license
[ { "docstring": "init fn", "name": "__init__", "signature": "def __init__(self, socketfile)" }, { "docstring": "enter fn", "name": "__enter__", "signature": "def __enter__(self)" }, { "docstring": "exit fn", "name": "__exit__", "signature": "def __exit__(self, exc_type, ex...
3
stack_v2_sparse_classes_30k_train_004627
Implement the Python class `OpenUnixSocketServer` described below. Class description: context wrapper around unix socket Method signatures and docstrings: - def __init__(self, socketfile): init fn - def __enter__(self): enter fn - def __exit__(self, exc_type, exc_value, traceback): exit fn
Implement the Python class `OpenUnixSocketServer` described below. Class description: context wrapper around unix socket Method signatures and docstrings: - def __init__(self, socketfile): init fn - def __enter__(self): enter fn - def __exit__(self, exc_type, exc_value, traceback): exit fn <|skeleton|> class OpenUni...
cf7b401d32df537b26525035e72397a6729d3672
<|skeleton|> class OpenUnixSocketServer: """context wrapper around unix socket""" def __init__(self, socketfile): """init fn""" <|body_0|> def __enter__(self): """enter fn""" <|body_1|> def __exit__(self, exc_type, exc_value, traceback): """exit fn""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OpenUnixSocketServer: """context wrapper around unix socket""" def __init__(self, socketfile): """init fn""" self.sock = None self.socketfile = socketfile if os.path.exists(socketfile): os.remove(socketfile) def __enter__(self): """enter fn""" ...
the_stack_v2_python_sparse
garmin_app/util.py
ddboline/garmin_app
train
2
56291e8a1b954114f8c7d43b7f0e72d73b81e19a
[ "n = len(matrix)\nmatrix_new = [[0] * n for _ in range(n)]\nfor i in range(n):\n for j in range(n):\n matrix_new[j][n - i - 1] = matrix[i][j]\nmatrix[:] = matrix_new", "n = len(matrix)\nfor i in range(n // 2):\n for j in range((n + 1) // 2):\n matrix[i][j], matrix[n - j - 1][i], matrix[n - i -...
<|body_start_0|> n = len(matrix) matrix_new = [[0] * n for _ in range(n)] for i in range(n): for j in range(n): matrix_new[j][n - i - 1] = matrix[i][j] matrix[:] = matrix_new <|end_body_0|> <|body_start_1|> n = len(matrix) for i in range(n // ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate_1(self, matrix: List[List[int]]) -> None: """方法一:使用辅助数组 时间复杂度:O(N^2),其中 N 是 matrix 的边长。 空间复杂度:O(N^2),我们需要使用一个和 matrix 的大小相同的辅助数组。 Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate_2(self, matrix: List[List[int]]) -> None: ...
stack_v2_sparse_classes_36k_train_006844
3,242
no_license
[ { "docstring": "方法一:使用辅助数组 时间复杂度:O(N^2),其中 N 是 matrix 的边长。 空间复杂度:O(N^2),我们需要使用一个和 matrix 的大小相同的辅助数组。 Do not return anything, modify matrix in-place instead.", "name": "rotate_1", "signature": "def rotate_1(self, matrix: List[List[int]]) -> None" }, { "docstring": "方法二:原地旋转 时间复杂度:O(N^2),其中 N 是 ma...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate_1(self, matrix: List[List[int]]) -> None: 方法一:使用辅助数组 时间复杂度:O(N^2),其中 N 是 matrix 的边长。 空间复杂度:O(N^2),我们需要使用一个和 matrix 的大小相同的辅助数组。 Do not return anything, modify matrix in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate_1(self, matrix: List[List[int]]) -> None: 方法一:使用辅助数组 时间复杂度:O(N^2),其中 N 是 matrix 的边长。 空间复杂度:O(N^2),我们需要使用一个和 matrix 的大小相同的辅助数组。 Do not return anything, modify matrix in...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def rotate_1(self, matrix: List[List[int]]) -> None: """方法一:使用辅助数组 时间复杂度:O(N^2),其中 N 是 matrix 的边长。 空间复杂度:O(N^2),我们需要使用一个和 matrix 的大小相同的辅助数组。 Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate_2(self, matrix: List[List[int]]) -> None: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate_1(self, matrix: List[List[int]]) -> None: """方法一:使用辅助数组 时间复杂度:O(N^2),其中 N 是 matrix 的边长。 空间复杂度:O(N^2),我们需要使用一个和 matrix 的大小相同的辅助数组。 Do not return anything, modify matrix in-place instead.""" n = len(matrix) matrix_new = [[0] * n for _ in range(n)] for i in ra...
the_stack_v2_python_sparse
软件开发岗刷题(华为笔试准备)/数组和字符串/rotate.py
MaoningGuan/LeetCode
train
3
2eb3a7222cb17016e1dcac67b637426ea10f4ae3
[ "if function_dict['type'] == 'linear':\n\n def linear_generator_function(coefficient, bias, lower_bound, upper_bound, noise_std):\n if lower_bound is None:\n lower_bound = -np.inf\n if upper_bound is None:\n upper_bound = np.inf\n if get_mean_function:\n retu...
<|body_start_0|> if function_dict['type'] == 'linear': def linear_generator_function(coefficient, bias, lower_bound, upper_bound, noise_std): if lower_bound is None: lower_bound = -np.inf if upper_bound is None: upper_bound = n...
EnvironmentManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnvironmentManager: def create_n_clicks_function(cls, function_dict: dict, get_mean_function) -> IStochasticFunction: """Create the number of clicks function given a dictionary of template: { "type": ... "info": { ... } } :param function_dict: dictionary containing info related to the fu...
stack_v2_sparse_classes_36k_train_006845
8,125
permissive
[ { "docstring": "Create the number of clicks function given a dictionary of template: { \"type\": ... \"info\": { ... } } :param function_dict: dictionary containing info related to the function :param get_mean_function: whether to get the stochastic function or the mean function :return: an IStochasticFunction ...
3
stack_v2_sparse_classes_30k_train_015226
Implement the Python class `EnvironmentManager` described below. Class description: Implement the EnvironmentManager class. Method signatures and docstrings: - def create_n_clicks_function(cls, function_dict: dict, get_mean_function) -> IStochasticFunction: Create the number of clicks function given a dictionary of t...
Implement the Python class `EnvironmentManager` described below. Class description: Implement the EnvironmentManager class. Method signatures and docstrings: - def create_n_clicks_function(cls, function_dict: dict, get_mean_function) -> IStochasticFunction: Create the number of clicks function given a dictionary of t...
0ba1e0ee67a570bb53ad02e9481e0c58ffc69249
<|skeleton|> class EnvironmentManager: def create_n_clicks_function(cls, function_dict: dict, get_mean_function) -> IStochasticFunction: """Create the number of clicks function given a dictionary of template: { "type": ... "info": { ... } } :param function_dict: dictionary containing info related to the fu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnvironmentManager: def create_n_clicks_function(cls, function_dict: dict, get_mean_function) -> IStochasticFunction: """Create the number of clicks function given a dictionary of template: { "type": ... "info": { ... } } :param function_dict: dictionary containing info related to the function :param ...
the_stack_v2_python_sparse
environments/Settings/EnvironmentManager.py
riccardopoiani/pricing-and-advertising-machine-learning
train
3
f5ea7f63171ef4ed2b73b857a98055d1b310bed1
[ "qs = self.get_queryset()\nif md5:\n results = qs.filter(stat__md5=md5)\n if results.count():\n return results\nif fingerprint:\n try:\n master = file_operations.image_from_fingerprint(fingerprint)\n except ValueError as err:\n raise ValueError('incorrect fingerprint: %s' % err) fro...
<|body_start_0|> qs = self.get_queryset() if md5: results = qs.filter(stat__md5=md5) if results.count(): return results if fingerprint: try: master = file_operations.image_from_fingerprint(fingerprint) except ValueEr...
ImageFileManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageFileManager: def search(self, md5=None, fingerprint=None, filename=None, cutoff=0.5): """Search for images matching query.""" <|body_0|> def filename_search(self, file_name, similarity=0.5): """Fuzzy filename search""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_006846
13,987
permissive
[ { "docstring": "Search for images matching query.", "name": "search", "signature": "def search(self, md5=None, fingerprint=None, filename=None, cutoff=0.5)" }, { "docstring": "Fuzzy filename search", "name": "filename_search", "signature": "def filename_search(self, file_name, similarity...
2
null
Implement the Python class `ImageFileManager` described below. Class description: Implement the ImageFileManager class. Method signatures and docstrings: - def search(self, md5=None, fingerprint=None, filename=None, cutoff=0.5): Search for images matching query. - def filename_search(self, file_name, similarity=0.5):...
Implement the Python class `ImageFileManager` described below. Class description: Implement the ImageFileManager class. Method signatures and docstrings: - def search(self, md5=None, fingerprint=None, filename=None, cutoff=0.5): Search for images matching query. - def filename_search(self, file_name, similarity=0.5):...
911a2541c77eca522ba5a723f175786f4f9eb481
<|skeleton|> class ImageFileManager: def search(self, md5=None, fingerprint=None, filename=None, cutoff=0.5): """Search for images matching query.""" <|body_0|> def filename_search(self, file_name, similarity=0.5): """Fuzzy filename search""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageFileManager: def search(self, md5=None, fingerprint=None, filename=None, cutoff=0.5): """Search for images matching query.""" qs = self.get_queryset() if md5: results = qs.filter(stat__md5=md5) if results.count(): return results if f...
the_stack_v2_python_sparse
django/apps/photo/models.py
universitas/universitas.no
train
19
f8d2330698d2083c63dded14bb0ac11cd9475be4
[ "super(RawFileHandler, self).__init__(*args, **kwargs)\nraw_formatter = RawDataFormatter()\nself.setFormatter(raw_formatter)\nself.setLevel(RAW_DATA)\nraw_records_only_filter = SpecificLevelFilter(RAW_DATA)\nself.addFilter(raw_records_only_filter)", "if self.stream is None:\n self.stream = self._open()\ntry:\n...
<|body_start_0|> super(RawFileHandler, self).__init__(*args, **kwargs) raw_formatter = RawDataFormatter() self.setFormatter(raw_formatter) self.setLevel(RAW_DATA) raw_records_only_filter = SpecificLevelFilter(RAW_DATA) self.addFilter(raw_records_only_filter) <|end_body_0|...
RawFileHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RawFileHandler: def __init__(self, *args, **kwargs): """RawFileHandler must use RawDataFormatter and level == RAW_DATA only""" <|body_0|> def emit(self, record): """Emit a record. We don't want base class implementation since we don't want to do: stream.write(self.te...
stack_v2_sparse_classes_36k_train_006847
31,752
permissive
[ { "docstring": "RawFileHandler must use RawDataFormatter and level == RAW_DATA only", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Emit a record. We don't want base class implementation since we don't want to do: stream.write(self.terminator) We are n...
2
null
Implement the Python class `RawFileHandler` described below. Class description: Implement the RawFileHandler class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): RawFileHandler must use RawDataFormatter and level == RAW_DATA only - def emit(self, record): Emit a record. We don't want base c...
Implement the Python class `RawFileHandler` described below. Class description: Implement the RawFileHandler class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): RawFileHandler must use RawDataFormatter and level == RAW_DATA only - def emit(self, record): Emit a record. We don't want base c...
5a7bb06807b6e0124c77040367d0c20f42849a4c
<|skeleton|> class RawFileHandler: def __init__(self, *args, **kwargs): """RawFileHandler must use RawDataFormatter and level == RAW_DATA only""" <|body_0|> def emit(self, record): """Emit a record. We don't want base class implementation since we don't want to do: stream.write(self.te...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RawFileHandler: def __init__(self, *args, **kwargs): """RawFileHandler must use RawDataFormatter and level == RAW_DATA only""" super(RawFileHandler, self).__init__(*args, **kwargs) raw_formatter = RawDataFormatter() self.setFormatter(raw_formatter) self.setLevel(RAW_DAT...
the_stack_v2_python_sparse
moler/config/loggers.py
nokia/moler
train
60
6f75f999237a9960a961efe873f596b940c5705a
[ "self._color = _get_hex_color(_get_value(kwargs, ['color', 'c', 'edge_color', 'ec'], 'black'))\nself._edge_alpha = _get_value(kwargs, ['alpha', 'edge_alpha', 'ea'], 1.0)\nself._edge_width = _get_value(kwargs, ['edge_width', 'ew'], 1)\nprecision = _get_value(kwargs, ['precision'], 6)\nself._points = [_format_LatLng(...
<|body_start_0|> self._color = _get_hex_color(_get_value(kwargs, ['color', 'c', 'edge_color', 'ec'], 'black')) self._edge_alpha = _get_value(kwargs, ['alpha', 'edge_alpha', 'ea'], 1.0) self._edge_width = _get_value(kwargs, ['edge_width', 'ew'], 1) precision = _get_value(kwargs, ['precisi...
_Polyline
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Polyline: def __init__(self, lats, lngs, **kwargs): """Args: lats ([float]): Latitudes. lngs ([float]): Longitudes. Optional: Args: color/c/edge_color/ec (str): Color of the polyline. Can be hex ('#00FFFF'), named ('cyan'), or matplotlib-like ('c'). Defaults to black. alpha/edge_alpha/e...
stack_v2_sparse_classes_36k_train_006848
1,886
permissive
[ { "docstring": "Args: lats ([float]): Latitudes. lngs ([float]): Longitudes. Optional: Args: color/c/edge_color/ec (str): Color of the polyline. Can be hex ('#00FFFF'), named ('cyan'), or matplotlib-like ('c'). Defaults to black. alpha/edge_alpha/ea (float): Opacity of the polyline, ranging from 0 to 1. Default...
2
stack_v2_sparse_classes_30k_train_006086
Implement the Python class `_Polyline` described below. Class description: Implement the _Polyline class. Method signatures and docstrings: - def __init__(self, lats, lngs, **kwargs): Args: lats ([float]): Latitudes. lngs ([float]): Longitudes. Optional: Args: color/c/edge_color/ec (str): Color of the polyline. Can b...
Implement the Python class `_Polyline` described below. Class description: Implement the _Polyline class. Method signatures and docstrings: - def __init__(self, lats, lngs, **kwargs): Args: lats ([float]): Latitudes. lngs ([float]): Longitudes. Optional: Args: color/c/edge_color/ec (str): Color of the polyline. Can b...
0979c51467e25cfe870668d3990ce7885e317f85
<|skeleton|> class _Polyline: def __init__(self, lats, lngs, **kwargs): """Args: lats ([float]): Latitudes. lngs ([float]): Longitudes. Optional: Args: color/c/edge_color/ec (str): Color of the polyline. Can be hex ('#00FFFF'), named ('cyan'), or matplotlib-like ('c'). Defaults to black. alpha/edge_alpha/e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _Polyline: def __init__(self, lats, lngs, **kwargs): """Args: lats ([float]): Latitudes. lngs ([float]): Longitudes. Optional: Args: color/c/edge_color/ec (str): Color of the polyline. Can be hex ('#00FFFF'), named ('cyan'), or matplotlib-like ('c'). Defaults to black. alpha/edge_alpha/ea (float): Opa...
the_stack_v2_python_sparse
gmplot/drawables/polyline.py
tirkarthi/gmplot
train
0
357c8234038edbfdf2fef7c938966ef99f89b0d2
[ "from ..WidgetBu.ABuWGSellFactor import SellXDWidget, SellAtrNStopWidget, SellCloseAtrNWidget\nfrom ..WidgetBu.ABuWGSellFactor import SellPreAtrNWidget, SellDMWidget, SellNDWidget\nself.sf_array = []\nself.sf_array.append(SellAtrNStopWidget(self))\nself.sf_array.append(SellCloseAtrNWidget(self))\nself.sf_array.appe...
<|body_start_0|> from ..WidgetBu.ABuWGSellFactor import SellXDWidget, SellAtrNStopWidget, SellCloseAtrNWidget from ..WidgetBu.ABuWGSellFactor import SellPreAtrNWidget, SellDMWidget, SellNDWidget self.sf_array = [] self.sf_array.append(SellAtrNStopWidget(self)) self.sf_array.appen...
卖出策略组织类
SellFactorWGManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SellFactorWGManager: """卖出策略组织类""" def _init_widget(self): """构建内置的卖出策略可视化组件,构造出self.factor_box""" <|body_0|> def register(self, buy_factor_manger): """卖出manager内部因子注册接收买入因子添加的改变""" <|body_1|> <|end_skeleton|> <|body_start_0|> from ..WidgetBu.AB...
stack_v2_sparse_classes_36k_train_006849
5,391
permissive
[ { "docstring": "构建内置的卖出策略可视化组件,构造出self.factor_box", "name": "_init_widget", "signature": "def _init_widget(self)" }, { "docstring": "卖出manager内部因子注册接收买入因子添加的改变", "name": "register", "signature": "def register(self, buy_factor_manger)" } ]
2
stack_v2_sparse_classes_30k_train_006340
Implement the Python class `SellFactorWGManager` described below. Class description: 卖出策略组织类 Method signatures and docstrings: - def _init_widget(self): 构建内置的卖出策略可视化组件,构造出self.factor_box - def register(self, buy_factor_manger): 卖出manager内部因子注册接收买入因子添加的改变
Implement the Python class `SellFactorWGManager` described below. Class description: 卖出策略组织类 Method signatures and docstrings: - def _init_widget(self): 构建内置的卖出策略可视化组件,构造出self.factor_box - def register(self, buy_factor_manger): 卖出manager内部因子注册接收买入因子添加的改变 <|skeleton|> class SellFactorWGManager: """卖出策略组织类""" ...
2e5ab17f2d20deb3c68c927f6208ea89db7c639d
<|skeleton|> class SellFactorWGManager: """卖出策略组织类""" def _init_widget(self): """构建内置的卖出策略可视化组件,构造出self.factor_box""" <|body_0|> def register(self, buy_factor_manger): """卖出manager内部因子注册接收买入因子添加的改变""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SellFactorWGManager: """卖出策略组织类""" def _init_widget(self): """构建内置的卖出策略可视化组件,构造出self.factor_box""" from ..WidgetBu.ABuWGSellFactor import SellXDWidget, SellAtrNStopWidget, SellCloseAtrNWidget from ..WidgetBu.ABuWGSellFactor import SellPreAtrNWidget, SellDMWidget, SellNDWidget ...
the_stack_v2_python_sparse
abupy/WidgetBu/ABuWGSFBase.py
luqin/firefly
train
1
4416abba1571112e0a421f550f00d415f0cab1d5
[ "start = 0\nend = len(nums) - 1\nwhile start < end:\n print('start: {}, end: {}'.format(start, end))\n sums = nums[start] + nums[end]\n print('sums: ', sums)\n if sums == target:\n return (start, end)\n end -= 1\nreturn ()", "pair_dict = {}\nfor i in range(len(nums)):\n diff = target - nu...
<|body_start_0|> start = 0 end = len(nums) - 1 while start < end: print('start: {}, end: {}'.format(start, end)) sums = nums[start] + nums[end] print('sums: ', sums) if sums == target: return (start, end) end -= 1 ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def two_sum_sorted_array(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int] this solution works if the array is sorted""" <|body_0|> def two_sum_with_index(self, nums, target): """Given nums = [2, 7, 11, 15], target = 9, Becau...
stack_v2_sparse_classes_36k_train_006850
2,036
permissive
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int] this solution works if the array is sorted", "name": "two_sum_sorted_array", "signature": "def two_sum_sorted_array(self, nums, target)" }, { "docstring": "Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1]...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def two_sum_sorted_array(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] this solution works if the array is sorted - def two_sum_with_index(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def two_sum_sorted_array(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] this solution works if the array is sorted - def two_sum_with_index(self, ...
547c200b627c774535bc22880b16d5390183aeba
<|skeleton|> class Solution: def two_sum_sorted_array(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int] this solution works if the array is sorted""" <|body_0|> def two_sum_with_index(self, nums, target): """Given nums = [2, 7, 11, 15], target = 9, Becau...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def two_sum_sorted_array(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int] this solution works if the array is sorted""" start = 0 end = len(nums) - 1 while start < end: print('start: {}, end: {}'.format(start, end)) ...
the_stack_v2_python_sparse
two_sum.py
Sukhrobjon/leetcode
train
0
8421a6082ec7fedaf6619e132b14235deef021ec
[ "self.strlist = ['SeqIn']\nself.boollist = ['DocHTML']\nself.intlist = []\nself.numlist = []\nself.filelist = []\nself.listlist = []\nself.dictlist = []\nself.objlist = []\nself._setDefaults(str='None', bool=False, int=0, num=0.0, obj=None, setlist=True, setdict=True, setfile=True)\nself.setStr({})\nself.setBool({}...
<|body_start_0|> self.strlist = ['SeqIn'] self.boollist = ['DocHTML'] self.intlist = [] self.numlist = [] self.filelist = [] self.listlist = [] self.dictlist = [] self.objlist = [] self._setDefaults(str='None', bool=False, int=0, num=0.0, obj=None,...
GapSpanner Class. Author: Rich Edwards (2021). Str:str - SeqIn=FILE : Input sequence assembly [None] Bool:boolean - DocHTML=T/F : Generate HTML BUSCOMP documentation (*.info.html) instead of main run [False] Int:integer Num:float File:file handles with matching str filenames List:list Dict:dictionary Obj:RJE_Objects
GapSpanner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GapSpanner: """GapSpanner Class. Author: Rich Edwards (2021). Str:str - SeqIn=FILE : Input sequence assembly [None] Bool:boolean - DocHTML=T/F : Generate HTML BUSCOMP documentation (*.info.html) instead of main run [False] Int:integer Num:float File:file handles with matching str filenames List:l...
stack_v2_sparse_classes_36k_train_006851
37,334
no_license
[ { "docstring": "Sets Attributes of Object.", "name": "_setAttributes", "signature": "def _setAttributes(self)" }, { "docstring": "Sets attributes according to commandline parameters: - see .__doc__ or run with 'help' option", "name": "_cmdList", "signature": "def _cmdList(self)" }, {...
4
null
Implement the Python class `GapSpanner` described below. Class description: GapSpanner Class. Author: Rich Edwards (2021). Str:str - SeqIn=FILE : Input sequence assembly [None] Bool:boolean - DocHTML=T/F : Generate HTML BUSCOMP documentation (*.info.html) instead of main run [False] Int:integer Num:float File:file han...
Implement the Python class `GapSpanner` described below. Class description: GapSpanner Class. Author: Rich Edwards (2021). Str:str - SeqIn=FILE : Input sequence assembly [None] Bool:boolean - DocHTML=T/F : Generate HTML BUSCOMP documentation (*.info.html) instead of main run [False] Int:integer Num:float File:file han...
51b1222732291eff349df89790eae7f625a32e92
<|skeleton|> class GapSpanner: """GapSpanner Class. Author: Rich Edwards (2021). Str:str - SeqIn=FILE : Input sequence assembly [None] Bool:boolean - DocHTML=T/F : Generate HTML BUSCOMP documentation (*.info.html) instead of main run [False] Int:integer Num:float File:file handles with matching str filenames List:l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GapSpanner: """GapSpanner Class. Author: Rich Edwards (2021). Str:str - SeqIn=FILE : Input sequence assembly [None] Bool:boolean - DocHTML=T/F : Generate HTML BUSCOMP documentation (*.info.html) instead of main run [False] Int:integer Num:float File:file handles with matching str filenames List:list Dict:dict...
the_stack_v2_python_sparse
dev/gapspanner.py
slimsuite/SLiMSuite
train
20
9a9a7d82b81e31cc8d5bf5c9ced14fa7ed80b8a0
[ "a = list()\nn, m = (len(nums1), len(nums2))\ni, j = (0, 0)\nwhile i < n or j < m:\n if j >= m or (i < n and nums1[i] < nums2[j]):\n a.append(nums1[i])\n i += 1\n else:\n a.append(nums2[j])\n j += 1\nl = len(a)\nk = l // 2\nreturn a[k] if l % 2 == 1 else (a[k - 1] + a[k]) / 2.0", ...
<|body_start_0|> a = list() n, m = (len(nums1), len(nums2)) i, j = (0, 0) while i < n or j < m: if j >= m or (i < n and nums1[i] < nums2[j]): a.append(nums1[i]) i += 1 else: a.append(nums2[j]) j += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays_v1(self, nums1: List[int], nums2: List[int]) -> float: """Merge sort two arrays. Then get the middle point. Time: O(m + n). Space O(m + n)""" <|body_0|> def findMedianSortedArrays_v2(self, nums1: List[int], nums2: List[int]) -> float: ...
stack_v2_sparse_classes_36k_train_006852
3,072
no_license
[ { "docstring": "Merge sort two arrays. Then get the middle point. Time: O(m + n). Space O(m + n)", "name": "findMedianSortedArrays_v1", "signature": "def findMedianSortedArrays_v1(self, nums1: List[int], nums2: List[int]) -> float" }, { "docstring": "Merge sort and stop when reaching the middle ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays_v1(self, nums1: List[int], nums2: List[int]) -> float: Merge sort two arrays. Then get the middle point. Time: O(m + n). Space O(m + n) - def findMedia...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays_v1(self, nums1: List[int], nums2: List[int]) -> float: Merge sort two arrays. Then get the middle point. Time: O(m + n). Space O(m + n) - def findMedia...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def findMedianSortedArrays_v1(self, nums1: List[int], nums2: List[int]) -> float: """Merge sort two arrays. Then get the middle point. Time: O(m + n). Space O(m + n)""" <|body_0|> def findMedianSortedArrays_v2(self, nums1: List[int], nums2: List[int]) -> float: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMedianSortedArrays_v1(self, nums1: List[int], nums2: List[int]) -> float: """Merge sort two arrays. Then get the middle point. Time: O(m + n). Space O(m + n)""" a = list() n, m = (len(nums1), len(nums2)) i, j = (0, 0) while i < n or j < m: ...
the_stack_v2_python_sparse
python3/sorting_and_search/median_two_sorted_arrays.py
victorchu/algorithms
train
0
c7a43dac052f2d7dfe5c6c27f1a1fac913c6ea46
[ "line = stream.next()\nif not line.startswith('diff '):\n stream.push_back(line)\n return\nstartline = line[:-1]\ncols = ('path', 'date', 'time', 'timezone')\n\ndef parse_header(line):\n \"\"\"header\"\"\"\n return dict(zip(cols, line.rstrip().split()[1:]))\nfromfile = parse_header(stream.next())\ntofil...
<|body_start_0|> line = stream.next() if not line.startswith('diff '): stream.push_back(line) return startline = line[:-1] cols = ('path', 'date', 'time', 'timezone') def parse_header(line): """header""" return dict(zip(cols, line....
Diff result for one same file name in two sides
OneFileDiff
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OneFileDiff: """Diff result for one same file name in two sides""" def parse(cls, stream): """Parse a patch which should contains following parts: Start line Two lines header Serveral sections which of each is consist of: Range: start and count Hunks: context and different text Examp...
stack_v2_sparse_classes_36k_train_006853
9,040
no_license
[ { "docstring": "Parse a patch which should contains following parts: Start line Two lines header Serveral sections which of each is consist of: Range: start and count Hunks: context and different text Example: diff -r -u /home/xxx/tmp/images/img1/partition_table.txt /home/xxx/tmp/images/img2/partition_table.txt...
5
stack_v2_sparse_classes_30k_train_020357
Implement the Python class `OneFileDiff` described below. Class description: Diff result for one same file name in two sides Method signatures and docstrings: - def parse(cls, stream): Parse a patch which should contains following parts: Start line Two lines header Serveral sections which of each is consist of: Range...
Implement the Python class `OneFileDiff` described below. Class description: Diff result for one same file name in two sides Method signatures and docstrings: - def parse(cls, stream): Parse a patch which should contains following parts: Start line Two lines header Serveral sections which of each is consist of: Range...
3c3ccd8243b9d469de7448297b803d29cdf032b5
<|skeleton|> class OneFileDiff: """Diff result for one same file name in two sides""" def parse(cls, stream): """Parse a patch which should contains following parts: Start line Two lines header Serveral sections which of each is consist of: Range: start and count Hunks: context and different text Examp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OneFileDiff: """Diff result for one same file name in two sides""" def parse(cls, stream): """Parse a patch which should contains following parts: Start line Two lines header Serveral sections which of each is consist of: Range: start and count Hunks: context and different text Example: diff -r -...
the_stack_v2_python_sparse
imgdiff/unified.py
huanghao/nose-xcase
train
0
6de0436abd47ba94fac9bb05fdbe77550bf7c91f
[ "self.action: Action = kwargs.pop('action', None)\nself.column_name: str = kwargs.pop('column_name', None)\nself.exclude_init: List[str] = kwargs.pop('exclude_values', list)\nsuper().__init__(form_data, *args, **kwargs)\nself.set_field_from_dict('exclude_values')\nself.fields['exclude_values'].choices = get_rows(se...
<|body_start_0|> self.action: Action = kwargs.pop('action', None) self.column_name: str = kwargs.pop('column_name', None) self.exclude_init: List[str] = kwargs.pop('exclude_values', list) super().__init__(form_data, *args, **kwargs) self.set_field_from_dict('exclude_values') ...
Form to select a few fields to exclude.
ValueExcludeForm
[ "MIT", "LGPL-2.0-or-later", "Python-2.0", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValueExcludeForm: """Form to select a few fields to exclude.""" def __init__(self, form_data, *args, **kwargs): """Store action, column name and exclude init, adjust fields.""" <|body_0|> def clean(self): """Store the values in the field in the dictionary.""" ...
stack_v2_sparse_classes_36k_train_006854
20,237
permissive
[ { "docstring": "Store action, column name and exclude init, adjust fields.", "name": "__init__", "signature": "def __init__(self, form_data, *args, **kwargs)" }, { "docstring": "Store the values in the field in the dictionary.", "name": "clean", "signature": "def clean(self)" } ]
2
stack_v2_sparse_classes_30k_train_021315
Implement the Python class `ValueExcludeForm` described below. Class description: Form to select a few fields to exclude. Method signatures and docstrings: - def __init__(self, form_data, *args, **kwargs): Store action, column name and exclude init, adjust fields. - def clean(self): Store the values in the field in t...
Implement the Python class `ValueExcludeForm` described below. Class description: Form to select a few fields to exclude. Method signatures and docstrings: - def __init__(self, form_data, *args, **kwargs): Store action, column name and exclude init, adjust fields. - def clean(self): Store the values in the field in t...
5473e9faa24c71a2a1102d47ebc2cbf27608e42a
<|skeleton|> class ValueExcludeForm: """Form to select a few fields to exclude.""" def __init__(self, form_data, *args, **kwargs): """Store action, column name and exclude init, adjust fields.""" <|body_0|> def clean(self): """Store the values in the field in the dictionary.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValueExcludeForm: """Form to select a few fields to exclude.""" def __init__(self, form_data, *args, **kwargs): """Store action, column name and exclude init, adjust fields.""" self.action: Action = kwargs.pop('action', None) self.column_name: str = kwargs.pop('column_name', None)...
the_stack_v2_python_sparse
ontask/action/forms/run.py
LucasFranciscoCorreia/ontask_b
train
0
934b988101cc62a0e9fe48c1b3f0ec370e29222e
[ "writer = FirestoreWriter(**config)\nfor configured_stream in configured_catalog.streams:\n if configured_stream.destination_sync_mode == DestinationSyncMode.overwrite:\n writer.purge(configured_stream.stream.name)\nfor message in input_messages:\n if message.type == Type.STATE:\n yield message\...
<|body_start_0|> writer = FirestoreWriter(**config) for configured_stream in configured_catalog.streams: if configured_stream.destination_sync_mode == DestinationSyncMode.overwrite: writer.purge(configured_stream.stream.name) for message in input_messages: ...
DestinationFirestore
[ "Apache-2.0", "BSD-3-Clause", "MIT", "Elastic-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DestinationFirestore: def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMessage]: """TODO Reads the input stream of messages, config, and catalog to write data to the destination. This met...
stack_v2_sparse_classes_36k_train_006855
3,379
permissive
[ { "docstring": "TODO Reads the input stream of messages, config, and catalog to write data to the destination. This method returns an iterable (typically a generator of AirbyteMessages via yield) containing state messages received in the input message stream. Outputting a state message means that every AirbyteR...
2
null
Implement the Python class `DestinationFirestore` described below. Class description: Implement the DestinationFirestore class. Method signatures and docstrings: - def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMess...
Implement the Python class `DestinationFirestore` described below. Class description: Implement the DestinationFirestore class. Method signatures and docstrings: - def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMess...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class DestinationFirestore: def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMessage]: """TODO Reads the input stream of messages, config, and catalog to write data to the destination. This met...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DestinationFirestore: def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMessage]: """TODO Reads the input stream of messages, config, and catalog to write data to the destination. This method returns an...
the_stack_v2_python_sparse
dts/airbyte/airbyte-integrations/connectors/destination-firestore/destination_firestore/destination.py
alldatacenter/alldata
train
774
cb18606f5f6b731f5ab2c2a4ad57df89298e04f9
[ "self.vertices = vertices\nself.faces = faces\nself.flip_normal = flip_normal\nif anatomy is None:\n anatomy = BrainStructure('unknown', None, 'both', 'surface')\nself.anatomy = anatomy\nassert self.ndim == 3", "res = Mesh2D.read(gifti_filename)\ngifti_obj = nib.load(str(gifti_filename)) if isinstance(gifti_fi...
<|body_start_0|> self.vertices = vertices self.faces = faces self.flip_normal = flip_normal if anatomy is None: anatomy = BrainStructure('unknown', None, 'both', 'surface') self.anatomy = anatomy assert self.ndim == 3 <|end_body_0|> <|body_start_1|> r...
Describes a cortical mesh of a brain region Besides all the normal mesh operations defined in mesh.Mesh2D this object also contains information about the brain structure in the `anatomy` attribute This information is stored/used when reading/writing the file.
CorticalMesh
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CorticalMesh: """Describes a cortical mesh of a brain region Besides all the normal mesh operations defined in mesh.Mesh2D this object also contains information about the brain structure in the `anatomy` attribute This information is stored/used when reading/writing the file.""" def __init__...
stack_v2_sparse_classes_36k_train_006856
8,869
permissive
[ { "docstring": "Creates a new CorticalMesh :param vertices: (M, N) array with the vertices of the curve in M-dimensional space. :param faces: (2, K) index array with all the line segments. :param flip_normal: flips the normal when it is computed (used by `Mesh2D.apply_affine`, should normally not be used) :para...
5
null
Implement the Python class `CorticalMesh` described below. Class description: Describes a cortical mesh of a brain region Besides all the normal mesh operations defined in mesh.Mesh2D this object also contains information about the brain structure in the `anatomy` attribute This information is stored/used when reading...
Implement the Python class `CorticalMesh` described below. Class description: Describes a cortical mesh of a brain region Besides all the normal mesh operations defined in mesh.Mesh2D this object also contains information about the brain structure in the `anatomy` attribute This information is stored/used when reading...
de00c15b946a99a048694f3d8b6ad822a835b299
<|skeleton|> class CorticalMesh: """Describes a cortical mesh of a brain region Besides all the normal mesh operations defined in mesh.Mesh2D this object also contains information about the brain structure in the `anatomy` attribute This information is stored/used when reading/writing the file.""" def __init__...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CorticalMesh: """Describes a cortical mesh of a brain region Besides all the normal mesh operations defined in mesh.Mesh2D this object also contains information about the brain structure in the `anatomy` attribute This information is stored/used when reading/writing the file.""" def __init__(self, vertic...
the_stack_v2_python_sparse
mcot/core/surface/cortical_mesh.py
MichielCottaar/mcot.core
train
1
f479d0c043e81307d4dad56f088843eb3c85a051
[ "if not self.server.shutdown_flag:\n raw = self.request[0]\n if raw:\n raw = bytearray(raw)\n self.handle_raw_line(raw)", "try:\n self.request[1].sendto(event.create_response(), self.client_address)\nexcept Exception as exp:\n _LOGGER.error('Exception caught while responding to event: %s...
<|body_start_0|> if not self.server.shutdown_flag: raw = self.request[0] if raw: raw = bytearray(raw) self.handle_raw_line(raw) <|end_body_0|> <|body_start_1|> try: self.request[1].sendto(event.create_response(), self.client_address) ...
Class for UDP Handling.
SIAUDPHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SIAUDPHandler: """Class for UDP Handling.""" def handle(self) -> None: """Overwritten method for the RequestHandler.""" <|body_0|> def respond(self, event: SIAEvent) -> None: """Respond to the event.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_006857
2,823
permissive
[ { "docstring": "Overwritten method for the RequestHandler.", "name": "handle", "signature": "def handle(self) -> None" }, { "docstring": "Respond to the event.", "name": "respond", "signature": "def respond(self, event: SIAEvent) -> None" } ]
2
stack_v2_sparse_classes_30k_train_001206
Implement the Python class `SIAUDPHandler` described below. Class description: Class for UDP Handling. Method signatures and docstrings: - def handle(self) -> None: Overwritten method for the RequestHandler. - def respond(self, event: SIAEvent) -> None: Respond to the event.
Implement the Python class `SIAUDPHandler` described below. Class description: Class for UDP Handling. Method signatures and docstrings: - def handle(self) -> None: Overwritten method for the RequestHandler. - def respond(self, event: SIAEvent) -> None: Respond to the event. <|skeleton|> class SIAUDPHandler: """...
c5394b7e2911d154b0aac5600cd57878ec7094ac
<|skeleton|> class SIAUDPHandler: """Class for UDP Handling.""" def handle(self) -> None: """Overwritten method for the RequestHandler.""" <|body_0|> def respond(self, event: SIAEvent) -> None: """Respond to the event.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SIAUDPHandler: """Class for UDP Handling.""" def handle(self) -> None: """Overwritten method for the RequestHandler.""" if not self.server.shutdown_flag: raw = self.request[0] if raw: raw = bytearray(raw) self.handle_raw_line(raw) ...
the_stack_v2_python_sparse
src/pysiaalarm/sync/handler.py
mach0gr/pysiaalarm
train
1
fd4bafce42215876a71cdb4e88ea676cb2b7455d
[ "super().__init__()\nself.tau = tau\nself.t_0 = t_0\nself.amp = amplitude", "def wrap(time: Union[float, np.ndarray]) -> Union[float, np.ndarray]:\n return self.amp * np.exp(-((time - self.t_0) / self.tau) ** 2)\nreturn wrap" ]
<|body_start_0|> super().__init__() self.tau = tau self.t_0 = t_0 self.amp = amplitude <|end_body_0|> <|body_start_1|> def wrap(time: Union[float, np.ndarray]) -> Union[float, np.ndarray]: return self.amp * np.exp(-((time - self.t_0) / self.tau) ** 2) return ...
Represent a gaussian waveform to be attached to a source.
GaussianWaveform
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianWaveform: """Represent a gaussian waveform to be attached to a source.""" def __init__(self, tau: float, t_0: float, amplitude: float=1): """Represent a A*e^(-(t-t_0)/tau^2) function.""" <|body_0|> def func(self): """Return a gaussian waveform function.""...
stack_v2_sparse_classes_36k_train_006858
2,517
permissive
[ { "docstring": "Represent a A*e^(-(t-t_0)/tau^2) function.", "name": "__init__", "signature": "def __init__(self, tau: float, t_0: float, amplitude: float=1)" }, { "docstring": "Return a gaussian waveform function.", "name": "func", "signature": "def func(self)" } ]
2
stack_v2_sparse_classes_30k_train_005483
Implement the Python class `GaussianWaveform` described below. Class description: Represent a gaussian waveform to be attached to a source. Method signatures and docstrings: - def __init__(self, tau: float, t_0: float, amplitude: float=1): Represent a A*e^(-(t-t_0)/tau^2) function. - def func(self): Return a gaussian...
Implement the Python class `GaussianWaveform` described below. Class description: Represent a gaussian waveform to be attached to a source. Method signatures and docstrings: - def __init__(self, tau: float, t_0: float, amplitude: float=1): Represent a A*e^(-(t-t_0)/tau^2) function. - def func(self): Return a gaussian...
f2134cb3e36eabca1639b8ff4e428d3a268953bd
<|skeleton|> class GaussianWaveform: """Represent a gaussian waveform to be attached to a source.""" def __init__(self, tau: float, t_0: float, amplitude: float=1): """Represent a A*e^(-(t-t_0)/tau^2) function.""" <|body_0|> def func(self): """Return a gaussian waveform function.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianWaveform: """Represent a gaussian waveform to be attached to a source.""" def __init__(self, tau: float, t_0: float, amplitude: float=1): """Represent a A*e^(-(t-t_0)/tau^2) function.""" super().__init__() self.tau = tau self.t_0 = t_0 self.amp = amplitude ...
the_stack_v2_python_sparse
fdtd/waveforms.py
tiagovla/fdtd.py
train
4
f116ca7ee5c9b13c810867ced529c9420c7a37d3
[ "if self.pos > 0:\n raise StopIteration\nid_type = float\nweights, neighbors = self._readlines(id_type)\nself.pos += 1\nreturn W(neighbors, weights)", "self._complain_ifclosed(self.closed)\nif issubclass(type(obj), W):\n self._writelines(obj)\nelse:\n raise TypeError('Expected a pysal weights object, got...
<|body_start_0|> if self.pos > 0: raise StopIteration id_type = float weights, neighbors = self._readlines(id_type) self.pos += 1 return W(neighbors, weights) <|end_body_0|> <|body_start_1|> self._complain_ifclosed(self.closed) if issubclass(type(obj)...
Opens, reads, and writes file objects in DAT format. Spatial weights objects in DAT format are used in Dr. LeSage's MatLab Econ library. This DAT format is a simple text file with DAT or dat extension. Without header line, it includes three data columns for origin id, destination id, and weight values as follows: [Line...
DatIO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatIO: """Opens, reads, and writes file objects in DAT format. Spatial weights objects in DAT format are used in Dr. LeSage's MatLab Econ library. This DAT format is a simple text file with DAT or dat extension. Without header line, it includes three data columns for origin id, destination id, an...
stack_v2_sparse_classes_36k_train_006859
3,105
permissive
[ { "docstring": "Reads .dat file Returns a pysal.weights.weights.W object Examples -------- Type 'dir(w)' at the interpreter to see what methods are supported. Open .dat file and read it into a pysal weights object >>> import pysal.lib >>> w = pysal.lib.io.open(pysal.lib.examples.get_path('wmat.dat'),'r').read()...
2
stack_v2_sparse_classes_30k_train_019211
Implement the Python class `DatIO` described below. Class description: Opens, reads, and writes file objects in DAT format. Spatial weights objects in DAT format are used in Dr. LeSage's MatLab Econ library. This DAT format is a simple text file with DAT or dat extension. Without header line, it includes three data co...
Implement the Python class `DatIO` described below. Class description: Opens, reads, and writes file objects in DAT format. Spatial weights objects in DAT format are used in Dr. LeSage's MatLab Econ library. This DAT format is a simple text file with DAT or dat extension. Without header line, it includes three data co...
7e397bdb4c22d4e2442b4ee88bcd691d2421651d
<|skeleton|> class DatIO: """Opens, reads, and writes file objects in DAT format. Spatial weights objects in DAT format are used in Dr. LeSage's MatLab Econ library. This DAT format is a simple text file with DAT or dat extension. Without header line, it includes three data columns for origin id, destination id, an...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatIO: """Opens, reads, and writes file objects in DAT format. Spatial weights objects in DAT format are used in Dr. LeSage's MatLab Econ library. This DAT format is a simple text file with DAT or dat extension. Without header line, it includes three data columns for origin id, destination id, and weight valu...
the_stack_v2_python_sparse
pysal/lib/io/iohandlers/dat.py
ocefpaf/pysal
train
0
0f1d7bac784578e573f2618695d06be87318b8cb
[ "self.T = T\nself.act_list = act_list\nreturn", "MAX_ARMIES = 12\narmy_offset = MAX_ARMIES + 1\npass_value = army_offset - 1\naction_vector = np.zeros(len(self.act_list))\nfor act_index in range(len(self.act_list)):\n if self.act_list[act_index][0] == -1:\n action_vector[-1] = pass_value\n else:\n ...
<|body_start_0|> self.T = T self.act_list = act_list return <|end_body_0|> <|body_start_1|> MAX_ARMIES = 12 army_offset = MAX_ARMIES + 1 pass_value = army_offset - 1 action_vector = np.zeros(len(self.act_list)) for act_index in range(len(self.act_list)): ...
Class to hold the army difference q function
ManualAttack
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManualAttack: """Class to hold the army difference q function""" def __init__(self, T, act_list): """Constructor so ArmyDifference can be held as an object :param T: int, length of state, ignored :param act_list: 2D list mapping edges to territories :return : none""" <|body_0...
stack_v2_sparse_classes_36k_train_006860
3,404
no_license
[ { "docstring": "Constructor so ArmyDifference can be held as an object :param T: int, length of state, ignored :param act_list: 2D list mapping edges to territories :return : none", "name": "__init__", "signature": "def __init__(self, T, act_list)" }, { "docstring": "Function for executing maxim...
2
stack_v2_sparse_classes_30k_train_016805
Implement the Python class `ManualAttack` described below. Class description: Class to hold the army difference q function Method signatures and docstrings: - def __init__(self, T, act_list): Constructor so ArmyDifference can be held as an object :param T: int, length of state, ignored :param act_list: 2D list mappin...
Implement the Python class `ManualAttack` described below. Class description: Class to hold the army difference q function Method signatures and docstrings: - def __init__(self, T, act_list): Constructor so ArmyDifference can be held as an object :param T: int, length of state, ignored :param act_list: 2D list mappin...
e923bc9c7c723d73e9e69a0391813d093c53ef6c
<|skeleton|> class ManualAttack: """Class to hold the army difference q function""" def __init__(self, T, act_list): """Constructor so ArmyDifference can be held as an object :param T: int, length of state, ignored :param act_list: 2D list mapping edges to territories :return : none""" <|body_0...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ManualAttack: """Class to hold the army difference q function""" def __init__(self, T, act_list): """Constructor so ArmyDifference can be held as an object :param T: int, length of state, ignored :param act_list: 2D list mapping edges to territories :return : none""" self.T = T se...
the_stack_v2_python_sparse
q_funcs/attack/manual_attack.py
okreng/risk_learning
train
0
b1702183ee39602e24e55d5cacab72dd59f41274
[ "memo = {}\nfor p, s, e in trips:\n memo[s] = memo.get(s, 0) + p\n memo[e] = memo.get(e, 0) - p\ntakenSeats = 0\nfor k in sorted(memo.keys()):\n takenSeats += memo[k]\n if takenSeats > capacity:\n return False\nreturn True", "MAX_LOCATION = 1001\nmemo = [0] * MAX_LOCATION\nfor p, s, e in trips:...
<|body_start_0|> memo = {} for p, s, e in trips: memo[s] = memo.get(s, 0) + p memo[e] = memo.get(e, 0) - p takenSeats = 0 for k in sorted(memo.keys()): takenSeats += memo[k] if takenSeats > capacity: return False ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def carPooling(self, trips: List[List[int]], capacity: int) -> bool: """General solution without knowing the range of the start and end locations.""" <|body_0|> def carPooling2(self, trips: List[List[int]], capacity: int) -> bool: """Optimized by taking adv...
stack_v2_sparse_classes_36k_train_006861
1,165
no_license
[ { "docstring": "General solution without knowing the range of the start and end locations.", "name": "carPooling", "signature": "def carPooling(self, trips: List[List[int]], capacity: int) -> bool" }, { "docstring": "Optimized by taking advantage of the start and end locations. The restriction i...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def carPooling(self, trips: List[List[int]], capacity: int) -> bool: General solution without knowing the range of the start and end locations. - def carPooling2(self, trips: Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def carPooling(self, trips: List[List[int]], capacity: int) -> bool: General solution without knowing the range of the start and end locations. - def carPooling2(self, trips: Lis...
edb870f83f0c4568cce0cacec04ee70cf6b545bf
<|skeleton|> class Solution: def carPooling(self, trips: List[List[int]], capacity: int) -> bool: """General solution without knowing the range of the start and end locations.""" <|body_0|> def carPooling2(self, trips: List[List[int]], capacity: int) -> bool: """Optimized by taking adv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def carPooling(self, trips: List[List[int]], capacity: int) -> bool: """General solution without knowing the range of the start and end locations.""" memo = {} for p, s, e in trips: memo[s] = memo.get(s, 0) + p memo[e] = memo.get(e, 0) - p take...
the_stack_v2_python_sparse
2020/car_pooling.py
eronekogin/leetcode
train
0
5b054bfbfce548e90ceffd76b6369e87be690942
[ "LoginUserPage(app_page).login_user(data['username'], data['password'])\nsuccess = LoginUserPage(app_page).confirm_my()\nprint(success)\nlogging.info('开始断言')\ntry:\n assert success == data['check']\n logging.info('我的页面跳转成功')\nexcept:\n print('我的页面跳转失败')\n common.save_screenShot(app_page, model_name='我的页...
<|body_start_0|> LoginUserPage(app_page).login_user(data['username'], data['password']) success = LoginUserPage(app_page).confirm_my() print(success) logging.info('开始断言') try: assert success == data['check'] logging.info('我的页面跳转成功') except: ...
TestLoginUser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestLoginUser: def test_login_success_my(self, data, app_page): """我的页面跳转成功""" <|body_0|> def test_edit_user_info(self, data, app_page): """我的页面-个人信息编辑页面跳转成功""" <|body_1|> def test_change_user_name(self, data, app_page): """我的页面-个人信息编辑页面-更换昵称成功""...
stack_v2_sparse_classes_36k_train_006862
3,731
no_license
[ { "docstring": "我的页面跳转成功", "name": "test_login_success_my", "signature": "def test_login_success_my(self, data, app_page)" }, { "docstring": "我的页面-个人信息编辑页面跳转成功", "name": "test_edit_user_info", "signature": "def test_edit_user_info(self, data, app_page)" }, { "docstring": "我的页面-个人...
4
stack_v2_sparse_classes_30k_train_005786
Implement the Python class `TestLoginUser` described below. Class description: Implement the TestLoginUser class. Method signatures and docstrings: - def test_login_success_my(self, data, app_page): 我的页面跳转成功 - def test_edit_user_info(self, data, app_page): 我的页面-个人信息编辑页面跳转成功 - def test_change_user_name(self, data, app...
Implement the Python class `TestLoginUser` described below. Class description: Implement the TestLoginUser class. Method signatures and docstrings: - def test_login_success_my(self, data, app_page): 我的页面跳转成功 - def test_edit_user_info(self, data, app_page): 我的页面-个人信息编辑页面跳转成功 - def test_change_user_name(self, data, app...
b262c13e55a6e9eae1d4fa11d50b71814028261c
<|skeleton|> class TestLoginUser: def test_login_success_my(self, data, app_page): """我的页面跳转成功""" <|body_0|> def test_edit_user_info(self, data, app_page): """我的页面-个人信息编辑页面跳转成功""" <|body_1|> def test_change_user_name(self, data, app_page): """我的页面-个人信息编辑页面-更换昵称成功""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestLoginUser: def test_login_success_my(self, data, app_page): """我的页面跳转成功""" LoginUserPage(app_page).login_user(data['username'], data['password']) success = LoginUserPage(app_page).confirm_my() print(success) logging.info('开始断言') try: assert succe...
the_stack_v2_python_sparse
TestCase/test_app/test_user_info.py
xjx985426946/Test_UI
train
0
0e4aeb8c557e2180256e64bb82620e1d71bd9581
[ "pool_configs = config_reader.read(conf_key='dags.pools_config')\nif pool_configs is not None:\n self.create_spring_boot_jar_pools_for_dag(pool_configs, self.log)", "logger.debug('creating pools')\nfor pool_config in pool_configs:\n pool_name = pool_config.get('name')\n if not any((p.pool == pool_name fo...
<|body_start_0|> pool_configs = config_reader.read(conf_key='dags.pools_config') if pool_configs is not None: self.create_spring_boot_jar_pools_for_dag(pool_configs, self.log) <|end_body_0|> <|body_start_1|> logger.debug('creating pools') for pool_config in pool_configs: ...
PresidioPoolFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PresidioPoolFactory: def create(self, config_reader): """:param config_reader: should contain a configuration reader, in order to build pool""" <|body_0|> def create_spring_boot_jar_pools_for_dag(pool_configs, logger): """iterates over pools configurations and initia...
stack_v2_sparse_classes_36k_train_006863
1,269
no_license
[ { "docstring": ":param config_reader: should contain a configuration reader, in order to build pool", "name": "create", "signature": "def create(self, config_reader)" }, { "docstring": "iterates over pools configurations and initiates pools for them in the future we might want to add the pools p...
2
stack_v2_sparse_classes_30k_train_003711
Implement the Python class `PresidioPoolFactory` described below. Class description: Implement the PresidioPoolFactory class. Method signatures and docstrings: - def create(self, config_reader): :param config_reader: should contain a configuration reader, in order to build pool - def create_spring_boot_jar_pools_for_...
Implement the Python class `PresidioPoolFactory` described below. Class description: Implement the PresidioPoolFactory class. Method signatures and docstrings: - def create(self, config_reader): :param config_reader: should contain a configuration reader, in order to build pool - def create_spring_boot_jar_pools_for_...
68f3aa12c0d32e06b680d5cc6ad769f4d185fe32
<|skeleton|> class PresidioPoolFactory: def create(self, config_reader): """:param config_reader: should contain a configuration reader, in order to build pool""" <|body_0|> def create_spring_boot_jar_pools_for_dag(pool_configs, logger): """iterates over pools configurations and initia...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PresidioPoolFactory: def create(self, config_reader): """:param config_reader: should contain a configuration reader, in order to build pool""" pool_configs = config_reader.read(conf_key='dags.pools_config') if pool_configs is not None: self.create_spring_boot_jar_pools_for...
the_stack_v2_python_sparse
presidio-core/presidio-workflows/presidio/factories/presidio_pool_factory.py
dfeshed/nw-ueba-saas
train
0
70e4adff849c53d2efc692d5a0b0b7be6a6948f3
[ "m = {}\nfor index, num in enumerate(nums):\n if m.get(num, None):\n m[num][1].append(index)\n m[num][0] += 1\n else:\n m[num] = [1, [index]]\nfrequency_record = -1\nlength_record = -1\nfor num, info in m.items():\n length = info[1][-1] - info[1][0] + 1\n frequency = info[0]\n if...
<|body_start_0|> m = {} for index, num in enumerate(nums): if m.get(num, None): m[num][1].append(index) m[num][0] += 1 else: m[num] = [1, [index]] frequency_record = -1 length_record = -1 for num, info in m.i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findShortestSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findShortestSubArray1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> m = {} for index, ...
stack_v2_sparse_classes_36k_train_006864
1,968
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findShortestSubArray", "signature": "def findShortestSubArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findShortestSubArray1", "signature": "def findShortestSubArray1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_008965
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findShortestSubArray(self, nums): :type nums: List[int] :rtype: int - def findShortestSubArray1(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findShortestSubArray(self, nums): :type nums: List[int] :rtype: int - def findShortestSubArray1(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def findShortestSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findShortestSubArray1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findShortestSubArray(self, nums): """:type nums: List[int] :rtype: int""" m = {} for index, num in enumerate(nums): if m.get(num, None): m[num][1].append(index) m[num][0] += 1 else: m[num] = [1, [inde...
the_stack_v2_python_sparse
python/leetcode_bak/697_Degree_of_an_Array.py
bobcaoge/my-code
train
0
6a1a9484651712b759948491b64453f9a03fdca6
[ "out = self.nanoutput()\nfor cs in config.stimuli():\n if self.analysis('good_%s' % cs):\n out['repcount_%s' % cs], out['repcount_pair_%s' % cs] = self.event_counts(date.runs(['spontaneous', 'sated']), cs, 0.1)\n out['repcount_hungry_%s' % cs], out['repcount_pair_hungry_%s' % cs] = self.event_count...
<|body_start_0|> out = self.nanoutput() for cs in config.stimuli(): if self.analysis('good_%s' % cs): out['repcount_%s' % cs], out['repcount_pair_%s' % cs] = self.event_counts(date.runs(['spontaneous', 'sated']), cs, 0.1) out['repcount_hungry_%s' % cs], out['r...
Repcount
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Repcount: def run(self, date): """Run all analyses and returns results in a dictionary. Parameters ---------- date : Date object Returns ------- dict All of the output values""" <|body_0|> def event_counts(self, runs, cs, deconvolved_threshold=0.2, trange=(-2, 3)): "...
stack_v2_sparse_classes_36k_train_006865
2,964
no_license
[ { "docstring": "Run all analyses and returns results in a dictionary. Parameters ---------- date : Date object Returns ------- dict All of the output values", "name": "run", "signature": "def run(self, date)" }, { "docstring": "Find all replay events :param cs: :return:", "name": "event_coun...
2
null
Implement the Python class `Repcount` described below. Class description: Implement the Repcount class. Method signatures and docstrings: - def run(self, date): Run all analyses and returns results in a dictionary. Parameters ---------- date : Date object Returns ------- dict All of the output values - def event_coun...
Implement the Python class `Repcount` described below. Class description: Implement the Repcount class. Method signatures and docstrings: - def run(self, date): Run all analyses and returns results in a dictionary. Parameters ---------- date : Date object Returns ------- dict All of the output values - def event_coun...
c4e9699fb78db7bd7cc14bc1bd6bd7d2b4e3a16b
<|skeleton|> class Repcount: def run(self, date): """Run all analyses and returns results in a dictionary. Parameters ---------- date : Date object Returns ------- dict All of the output values""" <|body_0|> def event_counts(self, runs, cs, deconvolved_threshold=0.2, trange=(-2, 3)): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Repcount: def run(self, date): """Run all analyses and returns results in a dictionary. Parameters ---------- date : Date object Returns ------- dict All of the output values""" out = self.nanoutput() for cs in config.stimuli(): if self.analysis('good_%s' % cs): ...
the_stack_v2_python_sparse
pool/analyses/repcount.py
jzaremba/pool
train
0
28aafb3b6ad9509c895a524e3995edbf38b4a51a
[ "self._move_speed = move_speed\nself._pure_state = pure_state\nsuper(Humanoid, self).__init__(random=random)", "penetrating = True\nwhile penetrating:\n randomizers.randomize_limited_and_rotational_joints(physics, self.random)\n physics.after_reset()\n penetrating = physics.data.ncon > 0\nsuper(Humanoid,...
<|body_start_0|> self._move_speed = move_speed self._pure_state = pure_state super(Humanoid, self).__init__(random=random) <|end_body_0|> <|body_start_1|> penetrating = True while penetrating: randomizers.randomize_limited_and_rotational_joints(physics, self.random) ...
A humanoid task.
Humanoid
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Humanoid: """A humanoid task.""" def __init__(self, move_speed, pure_state, random=None): """Initializes an instance of `Humanoid`. Args: move_speed: A float. If this value is zero, reward is given simply for standing up. Otherwise this specifies a target horizontal velocity for the ...
stack_v2_sparse_classes_36k_train_006866
8,099
permissive
[ { "docstring": "Initializes an instance of `Humanoid`. Args: move_speed: A float. If this value is zero, reward is given simply for standing up. Otherwise this specifies a target horizontal velocity for the walking task. pure_state: A bool. Whether the observations consist of the pure MuJoCo state or includes s...
4
null
Implement the Python class `Humanoid` described below. Class description: A humanoid task. Method signatures and docstrings: - def __init__(self, move_speed, pure_state, random=None): Initializes an instance of `Humanoid`. Args: move_speed: A float. If this value is zero, reward is given simply for standing up. Other...
Implement the Python class `Humanoid` described below. Class description: A humanoid task. Method signatures and docstrings: - def __init__(self, move_speed, pure_state, random=None): Initializes an instance of `Humanoid`. Args: move_speed: A float. If this value is zero, reward is given simply for standing up. Other...
33d3ea2682409ee82bf9c5129ceaf06ab01cd48e
<|skeleton|> class Humanoid: """A humanoid task.""" def __init__(self, move_speed, pure_state, random=None): """Initializes an instance of `Humanoid`. Args: move_speed: A float. If this value is zero, reward is given simply for standing up. Otherwise this specifies a target horizontal velocity for the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Humanoid: """A humanoid task.""" def __init__(self, move_speed, pure_state, random=None): """Initializes an instance of `Humanoid`. Args: move_speed: A float. If this value is zero, reward is given simply for standing up. Otherwise this specifies a target horizontal velocity for the walking task....
the_stack_v2_python_sparse
src/env/dm_control/dm_control/suite/humanoid.py
nicklashansen/svea-vit
train
16
363dea8d03709e238804540500610e48bf56c0ab
[ "self.numGridEdges = 0\nself.numGridCells = 0\nself.ptr = c_void_p()\nself.obj = byref(self.ptr)\nMINTLIB.mnt_extensivefieldadaptor_new.argtypes = [POINTER(c_void_p)]\nier = MINTLIB.mnt_extensivefieldadaptor_new(self.obj)\nif ier:\n error_handler(FILE, '__init__', ier)", "MINTLIB.mnt_extensivefieldadaptor_del....
<|body_start_0|> self.numGridEdges = 0 self.numGridCells = 0 self.ptr = c_void_p() self.obj = byref(self.ptr) MINTLIB.mnt_extensivefieldadaptor_new.argtypes = [POINTER(c_void_p)] ier = MINTLIB.mnt_extensivefieldadaptor_new(self.obj) if ier: error_handl...
A class to convert extensive fields to vector fields and vice versa
ExtensiveFieldAdaptor
[ "0BSD" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtensiveFieldAdaptor: """A class to convert extensive fields to vector fields and vice versa""" def __init__(self): """Constructor.""" <|body_0|> def __del__(self): """Destructor.""" <|body_1|> def setGrid(self, grid): """Set the grid. :para...
stack_v2_sparse_classes_36k_train_006867
5,874
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Destructor.", "name": "__del__", "signature": "def __del__(self)" }, { "docstring": "Set the grid. :param grid: instance of Grid", "name": "setGrid", "signature": "def ...
5
null
Implement the Python class `ExtensiveFieldAdaptor` described below. Class description: A class to convert extensive fields to vector fields and vice versa Method signatures and docstrings: - def __init__(self): Constructor. - def __del__(self): Destructor. - def setGrid(self, grid): Set the grid. :param grid: instanc...
Implement the Python class `ExtensiveFieldAdaptor` described below. Class description: A class to convert extensive fields to vector fields and vice versa Method signatures and docstrings: - def __init__(self): Constructor. - def __del__(self): Destructor. - def setGrid(self, grid): Set the grid. :param grid: instanc...
50c2c66bce5e09cf14f9f244da67ab4be84fbe5b
<|skeleton|> class ExtensiveFieldAdaptor: """A class to convert extensive fields to vector fields and vice versa""" def __init__(self): """Constructor.""" <|body_0|> def __del__(self): """Destructor.""" <|body_1|> def setGrid(self, grid): """Set the grid. :para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExtensiveFieldAdaptor: """A class to convert extensive fields to vector fields and vice versa""" def __init__(self): """Constructor.""" self.numGridEdges = 0 self.numGridCells = 0 self.ptr = c_void_p() self.obj = byref(self.ptr) MINTLIB.mnt_extensivefieldad...
the_stack_v2_python_sparse
mint/extensive_field_adaptor.py
pletzer/mint
train
6
cf06d4c271acece9e23a2de1b3090a1d352d3749
[ "Expr.__init__(self, template, line)\nself._var = var\nself._nodes = nodes", "try:\n fn = self._env.get(self._var)\n params = [node.eval() for node in self._nodes]\n return fn(*params)\nexcept KeyError:\n raise UnknownVariableError('.'.join(self._var), self._template._filename, self._line)" ]
<|body_start_0|> Expr.__init__(self, template, line) self._var = var self._nodes = nodes <|end_body_0|> <|body_start_1|> try: fn = self._env.get(self._var) params = [node.eval() for node in self._nodes] return fn(*params) except KeyError: ...
A function expression node.
FuncExpr
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FuncExpr: """A function expression node.""" def __init__(self, template, line, var, nodes): """Initialize the node.""" <|body_0|> def eval(self): """Evaluate the expression.""" <|body_1|> <|end_skeleton|> <|body_start_0|> Expr.__init__(self, tem...
stack_v2_sparse_classes_36k_train_006868
3,521
permissive
[ { "docstring": "Initialize the node.", "name": "__init__", "signature": "def __init__(self, template, line, var, nodes)" }, { "docstring": "Evaluate the expression.", "name": "eval", "signature": "def eval(self)" } ]
2
stack_v2_sparse_classes_30k_train_010237
Implement the Python class `FuncExpr` described below. Class description: A function expression node. Method signatures and docstrings: - def __init__(self, template, line, var, nodes): Initialize the node. - def eval(self): Evaluate the expression.
Implement the Python class `FuncExpr` described below. Class description: A function expression node. Method signatures and docstrings: - def __init__(self, template, line, var, nodes): Initialize the node. - def eval(self): Evaluate the expression. <|skeleton|> class FuncExpr: """A function expression node.""" ...
6aeee9b229d3f62aace98a51d9014781bbe6cb52
<|skeleton|> class FuncExpr: """A function expression node.""" def __init__(self, template, line, var, nodes): """Initialize the node.""" <|body_0|> def eval(self): """Evaluate the expression.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FuncExpr: """A function expression node.""" def __init__(self, template, line, var, nodes): """Initialize the node.""" Expr.__init__(self, template, line) self._var = var self._nodes = nodes def eval(self): """Evaluate the expression.""" try: ...
the_stack_v2_python_sparse
mrbaviirc/template/expr.py
brianvanderburg2/mrbaviirc
train
0
ae94392bc08cf338d3b9447e38e958d49144632e
[ "cnt = 0\nfor i in range(len(A)):\n p, q = (0, i)\n while p < len(A) and q < len(B):\n while p < len(A) and q < len(B) and (A[p] != B[q]):\n p += 1\n q += 1\n t = 0\n while p < len(A) and q < len(B) and (A[p] == B[q]):\n p += 1\n q += 1\n ...
<|body_start_0|> cnt = 0 for i in range(len(A)): p, q = (0, i) while p < len(A) and q < len(B): while p < len(A) and q < len(B) and (A[p] != B[q]): p += 1 q += 1 t = 0 while p < len(A) and q <...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findLength(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" <|body_0|> def findLength1(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> cnt = 0 ...
stack_v2_sparse_classes_36k_train_006869
1,625
no_license
[ { "docstring": ":type A: List[int] :type B: List[int] :rtype: int", "name": "findLength", "signature": "def findLength(self, A, B)" }, { "docstring": ":type A: List[int] :type B: List[int] :rtype: int", "name": "findLength1", "signature": "def findLength1(self, A, B)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLength(self, A, B): :type A: List[int] :type B: List[int] :rtype: int - def findLength1(self, A, B): :type A: List[int] :type B: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLength(self, A, B): :type A: List[int] :type B: List[int] :rtype: int - def findLength1(self, A, B): :type A: List[int] :type B: List[int] :rtype: int <|skeleton|> class...
e5b018493bbd12edcdcd0434f35d9c358106d391
<|skeleton|> class Solution: def findLength(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" <|body_0|> def findLength1(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findLength(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" cnt = 0 for i in range(len(A)): p, q = (0, i) while p < len(A) and q < len(B): while p < len(A) and q < len(B) and (A[p] != B[q]): p...
the_stack_v2_python_sparse
py/leetcode/718.py
wfeng1991/learnpy
train
0
0ea57aa6288f485ad14c30faebbbf44973919a48
[ "self.debug = debug\nself.eopB1 = 213\nself.eopB2 = 214\nself.eopB3 = 215\nself.eopB4 = 216\nself.byteStuff = 0\nself.eop = bytes([self.eopB1]) + bytes([self.eopB2]) + bytes([self.eopB3]) + bytes([self.eopB4])\nself.stuffedEOP = bytes([self.eopB1]) + bytes([self.byteStuff]) + bytes([self.eopB2]) + bytes([self.byteS...
<|body_start_0|> self.debug = debug self.eopB1 = 213 self.eopB2 = 214 self.eopB3 = 215 self.eopB4 = 216 self.byteStuff = 0 self.eop = bytes([self.eopB1]) + bytes([self.eopB2]) + bytes([self.eopB3]) + bytes([self.eopB4]) self.stuffedEOP = bytes([self.eopB1]...
Common
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Common: def __init__(self, serialName, debug): """Initializes all the attributes.""" <|body_0|> def createCOM(self, serialName, connectionType): """Creates the COM attributes, which handles access to the serial port. TODO use the subprocess module to run 'python -m s...
stack_v2_sparse_classes_36k_train_006870
3,234
no_license
[ { "docstring": "Initializes all the attributes.", "name": "__init__", "signature": "def __init__(self, serialName, debug)" }, { "docstring": "Creates the COM attributes, which handles access to the serial port. TODO use the subprocess module to run 'python -m serial.tools.list_ports' and try to ...
4
stack_v2_sparse_classes_30k_train_005422
Implement the Python class `Common` described below. Class description: Implement the Common class. Method signatures and docstrings: - def __init__(self, serialName, debug): Initializes all the attributes. - def createCOM(self, serialName, connectionType): Creates the COM attributes, which handles access to the seri...
Implement the Python class `Common` described below. Class description: Implement the Common class. Method signatures and docstrings: - def __init__(self, serialName, debug): Initializes all the attributes. - def createCOM(self, serialName, connectionType): Creates the COM attributes, which handles access to the seri...
e8c6ee9672ad33c568d97ec07c3faa6dbf9359ac
<|skeleton|> class Common: def __init__(self, serialName, debug): """Initializes all the attributes.""" <|body_0|> def createCOM(self, serialName, connectionType): """Creates the COM attributes, which handles access to the serial port. TODO use the subprocess module to run 'python -m s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Common: def __init__(self, serialName, debug): """Initializes all the attributes.""" self.debug = debug self.eopB1 = 213 self.eopB2 = 214 self.eopB3 = 215 self.eopB4 = 216 self.byteStuff = 0 self.eop = bytes([self.eopB1]) + bytes([self.eopB2]) + ...
the_stack_v2_python_sparse
Projeto4/Common.py
VFermat/CamadaFisica
train
1
58eadd79d18ec3fbd8a75633d4c06083a53d3994
[ "forms = Form.objects.values('name', 'version')\nwsforms = []\nfor form in forms:\n wsforms.append(WsFormPreview(form))\nreturn wsforms", "name = sb64decode(name)\nform = Form.objects.get(name=name, version=version)\nreturn form.xml", "forms = []\nfor form_id in forms_id:\n form = Form.objects.get(id=form...
<|body_start_0|> forms = Form.objects.values('name', 'version') wsforms = [] for form in forms: wsforms.append(WsFormPreview(form)) return wsforms <|end_body_0|> <|body_start_1|> name = sb64decode(name) form = Form.objects.get(name=name, version=version) ...
SoapService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoapService: def get_all_forms_preview(self): """Sending the preview of the forms in the DB""" <|body_0|> def get_xmlform_by_name_version(self, name, version): """Sending the XML of a selected form by name-version""" <|body_1|> def get_forms_by_ids(self,...
stack_v2_sparse_classes_36k_train_006871
3,228
no_license
[ { "docstring": "Sending the preview of the forms in the DB", "name": "get_all_forms_preview", "signature": "def get_all_forms_preview(self)" }, { "docstring": "Sending the XML of a selected form by name-version", "name": "get_xmlform_by_name_version", "signature": "def get_xmlform_by_nam...
5
stack_v2_sparse_classes_30k_train_015291
Implement the Python class `SoapService` described below. Class description: Implement the SoapService class. Method signatures and docstrings: - def get_all_forms_preview(self): Sending the preview of the forms in the DB - def get_xmlform_by_name_version(self, name, version): Sending the XML of a selected form by na...
Implement the Python class `SoapService` described below. Class description: Implement the SoapService class. Method signatures and docstrings: - def get_all_forms_preview(self): Sending the preview of the forms in the DB - def get_xmlform_by_name_version(self, name, version): Sending the XML of a selected form by na...
a630824ca4b6bcab7dfdf02101d966d153d4a7db
<|skeleton|> class SoapService: def get_all_forms_preview(self): """Sending the preview of the forms in the DB""" <|body_0|> def get_xmlform_by_name_version(self, name, version): """Sending the XML of a selected form by name-version""" <|body_1|> def get_forms_by_ids(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SoapService: def get_all_forms_preview(self): """Sending the preview of the forms in the DB""" forms = Form.objects.values('name', 'version') wsforms = [] for form in forms: wsforms.append(WsFormPreview(form)) return wsforms def get_xmlform_by_name_vers...
the_stack_v2_python_sparse
BeeKeeper/trunk/BeeKeeper/ws_server/views.py
francabrera/turawet
train
0
7d834b9ffbbd61f8c441412d3d4c30f88557e420
[ "x = 4294967295\na, b = (a & x, b & x)\nwhile b != 0:\n a, b = (a ^ b, (a & b) << 1 & x)\nreturn a if a <= 2147483647 else ~(a ^ x)", "while b != 0:\n sum = a ^ b\n carry = (a & b) << 1\n a = sum\n b = carry\nreturn a", "if b == 0:\n return a\nreturn self.add2(a ^ b, (a & b) << 1)" ]
<|body_start_0|> x = 4294967295 a, b = (a & x, b & x) while b != 0: a, b = (a ^ b, (a & b) << 1 & x) return a if a <= 2147483647 else ~(a ^ x) <|end_body_0|> <|body_start_1|> while b != 0: sum = a ^ b carry = (a & b) << 1 a = sum ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def add(self, a: int, b: int) -> int: """思路: 1.不给我们用四则运算,那就只能用位运算了 2.不进位的和:异或,进位和:取余左移。然后相加(不能出现 + 就一直循环到进位和是0,最多32次)""" <|body_0|> def add1(self, a: int, b: int) -> int: """最多最多就是循环32次就行""" <|body_1|> def add2(self, a: int, b: int) -> int: ...
stack_v2_sparse_classes_36k_train_006872
1,719
permissive
[ { "docstring": "思路: 1.不给我们用四则运算,那就只能用位运算了 2.不进位的和:异或,进位和:取余左移。然后相加(不能出现 + 就一直循环到进位和是0,最多32次)", "name": "add", "signature": "def add(self, a: int, b: int) -> int" }, { "docstring": "最多最多就是循环32次就行", "name": "add1", "signature": "def add1(self, a: int, b: int) -> int" }, { "docstrin...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def add(self, a: int, b: int) -> int: 思路: 1.不给我们用四则运算,那就只能用位运算了 2.不进位的和:异或,进位和:取余左移。然后相加(不能出现 + 就一直循环到进位和是0,最多32次) - def add1(self, a: int, b: int) -> int: 最多最多就是循环32次就行 - def ad...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def add(self, a: int, b: int) -> int: 思路: 1.不给我们用四则运算,那就只能用位运算了 2.不进位的和:异或,进位和:取余左移。然后相加(不能出现 + 就一直循环到进位和是0,最多32次) - def add1(self, a: int, b: int) -> int: 最多最多就是循环32次就行 - def ad...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def add(self, a: int, b: int) -> int: """思路: 1.不给我们用四则运算,那就只能用位运算了 2.不进位的和:异或,进位和:取余左移。然后相加(不能出现 + 就一直循环到进位和是0,最多32次)""" <|body_0|> def add1(self, a: int, b: int) -> int: """最多最多就是循环32次就行""" <|body_1|> def add2(self, a: int, b: int) -> int: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def add(self, a: int, b: int) -> int: """思路: 1.不给我们用四则运算,那就只能用位运算了 2.不进位的和:异或,进位和:取余左移。然后相加(不能出现 + 就一直循环到进位和是0,最多32次)""" x = 4294967295 a, b = (a & x, b & x) while b != 0: a, b = (a ^ b, (a & b) << 1 & x) return a if a <= 2147483647 else ~(a ^ x) ...
the_stack_v2_python_sparse
lcof/65-bu-yong-jia-jian-cheng-chu-zuo-jia-fa-lcof.py
yuenliou/leetcode
train
0
9459da75311c991c93dbf96ffebf399ec11f5916
[ "super().__init__(game, neural_net, args, MCTS, DefaultAlphaZeroPlayer)\nif run_name is None:\n run_name = datetime.now().strftime('%Y%m%d-%H%M%S')\nself.log_dir = f'out/logs/AlphaZero/{self.neural_net.architecture}/' + run_name\nself.file_writer = tf.summary.create_file_writer(self.log_dir + '/metrics')\nself.f...
<|body_start_0|> super().__init__(game, neural_net, args, MCTS, DefaultAlphaZeroPlayer) if run_name is None: run_name = datetime.now().strftime('%Y%m%d-%H%M%S') self.log_dir = f'out/logs/AlphaZero/{self.neural_net.architecture}/' + run_name self.file_writer = tf.summary.creat...
Implement base Coach class to define proper data-batch sampling procedures and logging objects.
AlphaZeroCoach
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlphaZeroCoach: """Implement base Coach class to define proper data-batch sampling procedures and logging objects.""" def __init__(self, game, neural_net, args: DotDict, run_name: typing.Optional[str]=None) -> None: """Initialize the class for self-play. This inherited method initial...
stack_v2_sparse_classes_36k_train_006873
3,434
permissive
[ { "docstring": "Initialize the class for self-play. This inherited method initializes tensorboard logging. The super class is initialized with the proper search engine and agent-interface. (MCTS, AlphaZeroPlayer) :param game: Game Implementation of Game class for environment logic. :param neural_net: AlphaNeura...
2
stack_v2_sparse_classes_30k_train_018976
Implement the Python class `AlphaZeroCoach` described below. Class description: Implement base Coach class to define proper data-batch sampling procedures and logging objects. Method signatures and docstrings: - def __init__(self, game, neural_net, args: DotDict, run_name: typing.Optional[str]=None) -> None: Initiali...
Implement the Python class `AlphaZeroCoach` described below. Class description: Implement base Coach class to define proper data-batch sampling procedures and logging objects. Method signatures and docstrings: - def __init__(self, game, neural_net, args: DotDict, run_name: typing.Optional[str]=None) -> None: Initiali...
78478c6a8a0f0e0e740159236d6cbb30a9396f5a
<|skeleton|> class AlphaZeroCoach: """Implement base Coach class to define proper data-batch sampling procedures and logging objects.""" def __init__(self, game, neural_net, args: DotDict, run_name: typing.Optional[str]=None) -> None: """Initialize the class for self-play. This inherited method initial...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlphaZeroCoach: """Implement base Coach class to define proper data-batch sampling procedures and logging objects.""" def __init__(self, game, neural_net, args: DotDict, run_name: typing.Optional[str]=None) -> None: """Initialize the class for self-play. This inherited method initializes tensorbo...
the_stack_v2_python_sparse
AlphaZero/AlphaCoach.py
frankbryce/muzero
train
1
b16f980cb2face72ae520a466091e66a270bf997
[ "for template in code.filter_templates(recursive=code.RECURSE_OTHERS):\n chunks = []\n for param in template.params:\n if len(param.value) >= self.TEMPLATE_MERGE_THRESHOLD:\n self._merge_templates(param.value)\n chunks.append(param.value)\n if chunks:\n subst = ' '.join(...
<|body_start_0|> for template in code.filter_templates(recursive=code.RECURSE_OTHERS): chunks = [] for param in template.params: if len(param.value) >= self.TEMPLATE_MERGE_THRESHOLD: self._merge_templates(param.value) chunks.append(...
A parser that can strip and chunk wikicode article text.
ArticleTextParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleTextParser: """A parser that can strip and chunk wikicode article text.""" def _merge_templates(self, code): """Merge template contents in to wikicode when the values are long.""" <|body_0|> def _get_tokenizer(self): """Return a NLTK punctuation tokenizer ...
stack_v2_sparse_classes_36k_train_006874
14,045
permissive
[ { "docstring": "Merge template contents in to wikicode when the values are long.", "name": "_merge_templates", "signature": "def _merge_templates(self, code)" }, { "docstring": "Return a NLTK punctuation tokenizer for the article's language.", "name": "_get_tokenizer", "signature": "def ...
6
null
Implement the Python class `ArticleTextParser` described below. Class description: A parser that can strip and chunk wikicode article text. Method signatures and docstrings: - def _merge_templates(self, code): Merge template contents in to wikicode when the values are long. - def _get_tokenizer(self): Return a NLTK p...
Implement the Python class `ArticleTextParser` described below. Class description: A parser that can strip and chunk wikicode article text. Method signatures and docstrings: - def _merge_templates(self, code): Merge template contents in to wikicode when the values are long. - def _get_tokenizer(self): Return a NLTK p...
9ee44932f6e9afeb0e5eb4bd01f3bc88fdb00790
<|skeleton|> class ArticleTextParser: """A parser that can strip and chunk wikicode article text.""" def _merge_templates(self, code): """Merge template contents in to wikicode when the values are long.""" <|body_0|> def _get_tokenizer(self): """Return a NLTK punctuation tokenizer ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArticleTextParser: """A parser that can strip and chunk wikicode article text.""" def _merge_templates(self, code): """Merge template contents in to wikicode when the values are long.""" for template in code.filter_templates(recursive=code.RECURSE_OTHERS): chunks = [] ...
the_stack_v2_python_sparse
earwigbot/wiki/copyvios/parsers.py
earwig/earwigbot
train
23
e8c339aa2d79fc5be8e4267acd9b40b784f4382b
[ "def rserialize(root, s):\n if not root:\n s += 'null,'\n return s\n s += '{},'.format(root.val)\n s = rserialize(root.left, s)\n s = rserialize(root.right, s)\n return s\nreturn rserialize(root, '')", "l = []\n_tmp = data.split(',')\nfor item in _tmp:\n if item:\n l.append(...
<|body_start_0|> def rserialize(root, s): if not root: s += 'null,' return s s += '{},'.format(root.val) s = rserialize(root.left, s) s = rserialize(root.right, s) return s return rserialize(root, '') <|end_body_...
Codec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_006875
1,475
permissive
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_019036
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
ad5e724d20a8492b8eba03fc0f24e4ff5964b3ea
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def rserialize(root, s): if not root: s += 'null,' return s s += '{},'.format(root.val) s = rserialize(root.left, s) ...
the_stack_v2_python_sparse
dailyQuestion/2020/2020-06/06-15/python/solution_dfs.py
russellgao/algorithm
train
3
612a299db1506e7c78499d8bc219d414ab4e1192
[ "mod_obj = self.pool.get('ir.model.data')\nact_obj = self.pool.get('ir.actions.act_window')\ninv_obj = self.pool.get('account.invoice')\ntype = inv_obj.browse(cr, uid, context.get('active_id'), context=context).type\nif type == 'in_invoice':\n xml_id = 'action_invoice_tree2'\nif type == 'out_invoice':\n xml_i...
<|body_start_0|> mod_obj = self.pool.get('ir.model.data') act_obj = self.pool.get('ir.actions.act_window') inv_obj = self.pool.get('account.invoice') type = inv_obj.browse(cr, uid, context.get('active_id'), context=context).type if type == 'in_invoice': xml_id = 'acti...
account_invoice_merge
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class account_invoice_merge: def _openForm(self, cr, uid, domain, context=None): """Invoice is merge then Open the merge Invoice in tree view.""" <|body_0|> def mergeInvoices(self, cr, uid, ids, context=None): """Call the merge_invoice method of account.invoice object and ...
stack_v2_sparse_classes_36k_train_006876
2,798
no_license
[ { "docstring": "Invoice is merge then Open the merge Invoice in tree view.", "name": "_openForm", "signature": "def _openForm(self, cr, uid, domain, context=None)" }, { "docstring": "Call the merge_invoice method of account.invoice object and pass the related parameter.", "name": "mergeInvoi...
2
stack_v2_sparse_classes_30k_train_008523
Implement the Python class `account_invoice_merge` described below. Class description: Implement the account_invoice_merge class. Method signatures and docstrings: - def _openForm(self, cr, uid, domain, context=None): Invoice is merge then Open the merge Invoice in tree view. - def mergeInvoices(self, cr, uid, ids, c...
Implement the Python class `account_invoice_merge` described below. Class description: Implement the account_invoice_merge class. Method signatures and docstrings: - def _openForm(self, cr, uid, domain, context=None): Invoice is merge then Open the merge Invoice in tree view. - def mergeInvoices(self, cr, uid, ids, c...
3e35f7ba7246c54e5a5b31921b28aa5f1ab24999
<|skeleton|> class account_invoice_merge: def _openForm(self, cr, uid, domain, context=None): """Invoice is merge then Open the merge Invoice in tree view.""" <|body_0|> def mergeInvoices(self, cr, uid, ids, context=None): """Call the merge_invoice method of account.invoice object and ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class account_invoice_merge: def _openForm(self, cr, uid, domain, context=None): """Invoice is merge then Open the merge Invoice in tree view.""" mod_obj = self.pool.get('ir.model.data') act_obj = self.pool.get('ir.actions.act_window') inv_obj = self.pool.get('account.invoice') ...
the_stack_v2_python_sparse
account_invoice_merge_no_unlink_5/wizard/merge_invoice.py
mgielissen/julius-openobject-addons
train
1
c2ce97ab822b5f9eb23902211ca40ce393b28ea9
[ "if 'tipo_pregunta_modal' in self.request.POST and 'texto_pregunta_modal' in self.request.POST:\n post_data = dict(self.request.POST.lists())\n if (len(post_data['tipo_pregunta_modal']) > 0 and len(post_data['texto_pregunta_modal']) > 0) and len(post_data['texto_pregunta_modal']) == len(post_data['tipo_pregun...
<|body_start_0|> if 'tipo_pregunta_modal' in self.request.POST and 'texto_pregunta_modal' in self.request.POST: post_data = dict(self.request.POST.lists()) if (len(post_data['tipo_pregunta_modal']) > 0 and len(post_data['texto_pregunta_modal']) > 0) and len(post_data['texto_pregunta_moda...
! Clase que gestiona la creación de consultas @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 15-02-2017 @version 1.0.0
ConsultaCreate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConsultaCreate: """! Clase que gestiona la creación de consultas @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 15-02-2017 @version 1.0.0""" def get_context_data(self, **kwargs):...
stack_v2_sparse_classes_36k_train_006877
22,004
no_license
[ { "docstring": "! Metodo que permite cargar de nuevo valores en los datos de contexto de la vista @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright GNU/GPLv2 @date 16-02-2017 @param self <b>{object}</b> Objeto que instancia la clase @param kwargs <b>{object}</b> Objeto que contiene los datos de context...
3
stack_v2_sparse_classes_30k_train_005022
Implement the Python class `ConsultaCreate` described below. Class description: ! Clase que gestiona la creación de consultas @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 15-02-2017 @version 1.0.0 Metho...
Implement the Python class `ConsultaCreate` described below. Class description: ! Clase que gestiona la creación de consultas @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 15-02-2017 @version 1.0.0 Metho...
93cefc3c94c62e66b103510a2f668a419e5c5cae
<|skeleton|> class ConsultaCreate: """! Clase que gestiona la creación de consultas @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 15-02-2017 @version 1.0.0""" def get_context_data(self, **kwargs):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConsultaCreate: """! Clase que gestiona la creación de consultas @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 15-02-2017 @version 1.0.0""" def get_context_data(self, **kwargs): """!...
the_stack_v2_python_sparse
consulta/views.py
rudmanmrrod/gestor_consulta
train
1
adec246d73f917be8d4c48d30b6ae2a103992812
[ "now = datetime.now()\nmonth = now.month + from_now\nmonth = month % self.MAX_MONTHS or 1\nyear = now.year + month // self.MAX_MONTHS\nreturn (month, year)", "month, year = self.set_month(from_now)\nmonthdays: List[List[date]] = Calendar().monthdatescalendar(year, month)\nfirst_week = monthdays[0]\nlast_week = mo...
<|body_start_0|> now = datetime.now() month = now.month + from_now month = month % self.MAX_MONTHS or 1 year = now.year + month // self.MAX_MONTHS return (month, year) <|end_body_0|> <|body_start_1|> month, year = self.set_month(from_now) monthdays: List[List[dat...
Manager for Day.
DayManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DayManager: """Manager for Day.""" def set_month(self, from_now: int) -> Tuple[int, int]: """Return the month and the year. Args: from_now (int): the number of month from now. Returns: tuple: the month and the year.""" <|body_0|> def get_month(self, from_now: int=0, unti...
stack_v2_sparse_classes_36k_train_006878
3,139
permissive
[ { "docstring": "Return the month and the year. Args: from_now (int): the number of month from now. Returns: tuple: the month and the year.", "name": "set_month", "signature": "def set_month(self, from_now: int) -> Tuple[int, int]" }, { "docstring": "Get a month.", "name": "get_month", "s...
3
stack_v2_sparse_classes_30k_train_019179
Implement the Python class `DayManager` described below. Class description: Manager for Day. Method signatures and docstrings: - def set_month(self, from_now: int) -> Tuple[int, int]: Return the month and the year. Args: from_now (int): the number of month from now. Returns: tuple: the month and the year. - def get_m...
Implement the Python class `DayManager` described below. Class description: Manager for Day. Method signatures and docstrings: - def set_month(self, from_now: int) -> Tuple[int, int]: Return the month and the year. Args: from_now (int): the number of month from now. Returns: tuple: the month and the year. - def get_m...
f51fc1b81e434953bb41d13b466fc764d70cdb1f
<|skeleton|> class DayManager: """Manager for Day.""" def set_month(self, from_now: int) -> Tuple[int, int]: """Return the month and the year. Args: from_now (int): the number of month from now. Returns: tuple: the month and the year.""" <|body_0|> def get_month(self, from_now: int=0, unti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DayManager: """Manager for Day.""" def set_month(self, from_now: int) -> Tuple[int, int]: """Return the month and the year. Args: from_now (int): the number of month from now. Returns: tuple: the month and the year.""" now = datetime.now() month = now.month + from_now mont...
the_stack_v2_python_sparse
back/apps/worker/models.py
8area8/work-calendar
train
1
ed7240725b11029c918072dd99bd018bd75db441
[ "left, right = (0, len(nums))\nwhile left < right:\n pivot = (left + right) // 2\n if nums[pivot] > target or (is_left and nums[pivot] == target):\n right = pivot\n else:\n left = pivot + 1\nreturn left", "left_index = self.find_index(nums, target, True)\nif left_index == len(nums) or nums[...
<|body_start_0|> left, right = (0, len(nums)) while left < right: pivot = (left + right) // 2 if nums[pivot] > target or (is_left and nums[pivot] == target): right = pivot else: left = pivot + 1 return left <|end_body_0|> <|bod...
SortedArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SortedArray: def find_index(self, nums: List[int], target: int, is_left: bool) -> List[int]: """To find indexed of first and last position of target in repeated sorted array. :param nums: :param target: :param is_left: :return:""" <|body_0|> def get_first_and_last_position(s...
stack_v2_sparse_classes_36k_train_006879
1,480
no_license
[ { "docstring": "To find indexed of first and last position of target in repeated sorted array. :param nums: :param target: :param is_left: :return:", "name": "find_index", "signature": "def find_index(self, nums: List[int], target: int, is_left: bool) -> List[int]" }, { "docstring": "Approach: B...
2
null
Implement the Python class `SortedArray` described below. Class description: Implement the SortedArray class. Method signatures and docstrings: - def find_index(self, nums: List[int], target: int, is_left: bool) -> List[int]: To find indexed of first and last position of target in repeated sorted array. :param nums: ...
Implement the Python class `SortedArray` described below. Class description: Implement the SortedArray class. Method signatures and docstrings: - def find_index(self, nums: List[int], target: int, is_left: bool) -> List[int]: To find indexed of first and last position of target in repeated sorted array. :param nums: ...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class SortedArray: def find_index(self, nums: List[int], target: int, is_left: bool) -> List[int]: """To find indexed of first and last position of target in repeated sorted array. :param nums: :param target: :param is_left: :return:""" <|body_0|> def get_first_and_last_position(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SortedArray: def find_index(self, nums: List[int], target: int, is_left: bool) -> List[int]: """To find indexed of first and last position of target in repeated sorted array. :param nums: :param target: :param is_left: :return:""" left, right = (0, len(nums)) while left < right: ...
the_stack_v2_python_sparse
data_structures/first_last_position_of_element.py
Shiv2157k/leet_code
train
1
52a4559246719125a2034a28b51c88d2bf9792c5
[ "self.profilers = profilers\nif default_profiler is None:\n default_profiler = DefaultStreamProfiler\nself.default_profiler = default_profiler", "consumers = list()\nif self.profilers is None:\n for i, name in enumerate(schema):\n consumers.append((i, name, self.default_profiler()))\nelse:\n for p...
<|body_start_0|> self.profilers = profilers if default_profiler is None: default_profiler = DefaultStreamProfiler self.default_profiler = default_profiler <|end_body_0|> <|body_start_1|> consumers = list() if self.profilers is None: for i, name in enumera...
ProfileOperator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileOperator: def __init__(self, profilers: Optional[ColumnProfiler]=None, default_profiler: Optional[Type]=None): """Profiling operator one or more columns in the data stream. By default all columns in the data stream are profiled independently using the default stream profiler. The ...
stack_v2_sparse_classes_36k_train_006880
14,641
permissive
[ { "docstring": "Profiling operator one or more columns in the data stream. By default all columns in the data stream are profiled independently using the default stream profiler. The optional list of profilers allows to override the default behavior by providing a list of column references and (optional) profil...
2
stack_v2_sparse_classes_30k_train_013650
Implement the Python class `ProfileOperator` described below. Class description: Implement the ProfileOperator class. Method signatures and docstrings: - def __init__(self, profilers: Optional[ColumnProfiler]=None, default_profiler: Optional[Type]=None): Profiling operator one or more columns in the data stream. By d...
Implement the Python class `ProfileOperator` described below. Class description: Implement the ProfileOperator class. Method signatures and docstrings: - def __init__(self, profilers: Optional[ColumnProfiler]=None, default_profiler: Optional[Type]=None): Profiling operator one or more columns in the data stream. By d...
e3d0e04f90468c49f29ca53edc2feb12465c24d5
<|skeleton|> class ProfileOperator: def __init__(self, profilers: Optional[ColumnProfiler]=None, default_profiler: Optional[Type]=None): """Profiling operator one or more columns in the data stream. By default all columns in the data stream are profiled independently using the default stream profiler. The ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProfileOperator: def __init__(self, profilers: Optional[ColumnProfiler]=None, default_profiler: Optional[Type]=None): """Profiling operator one or more columns in the data stream. By default all columns in the data stream are profiled independently using the default stream profiler. The optional list ...
the_stack_v2_python_sparse
openclean/profiling/dataset.py
Denisfench/openclean-core
train
0
7c8cd7976c91325dce9864a787f040e0d746033d
[ "search = self.cleaned_data['search']\nif search.isnumeric() and 1 < int(search) < 99999:\n self.search_type = 'proposal'\nelif self._search_is_fileroot(search):\n self.search_type = 'fileroot'\nelse:\n raise forms.ValidationError('Invalid search term {}. Please provide proposal number or file root.'.forma...
<|body_start_0|> search = self.cleaned_data['search'] if search.isnumeric() and 1 < int(search) < 99999: self.search_type = 'proposal' elif self._search_is_fileroot(search): self.search_type = 'fileroot' else: raise forms.ValidationError('Invalid searc...
Single-field form to search for a proposal or fileroot.
FileSearchForm
[ "BSD-3-Clause", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileSearchForm: """Single-field form to search for a proposal or fileroot.""" def clean_search(self): """Validate the "search" field. Check that the input is either a proposal or fileroot, and one that matches files in the filesystem. Returns ------- str The cleaned data input into t...
stack_v2_sparse_classes_36k_train_006881
13,519
permissive
[ { "docstring": "Validate the \"search\" field. Check that the input is either a proposal or fileroot, and one that matches files in the filesystem. Returns ------- str The cleaned data input into the \"search\" field", "name": "clean_search", "signature": "def clean_search(self)" }, { "docstring...
3
stack_v2_sparse_classes_30k_train_014391
Implement the Python class `FileSearchForm` described below. Class description: Single-field form to search for a proposal or fileroot. Method signatures and docstrings: - def clean_search(self): Validate the "search" field. Check that the input is either a proposal or fileroot, and one that matches files in the file...
Implement the Python class `FileSearchForm` described below. Class description: Single-field form to search for a proposal or fileroot. Method signatures and docstrings: - def clean_search(self): Validate the "search" field. Check that the input is either a proposal or fileroot, and one that matches files in the file...
2ae74c51594925f81dde2f28b51548ffcdc257fd
<|skeleton|> class FileSearchForm: """Single-field form to search for a proposal or fileroot.""" def clean_search(self): """Validate the "search" field. Check that the input is either a proposal or fileroot, and one that matches files in the filesystem. Returns ------- str The cleaned data input into t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileSearchForm: """Single-field form to search for a proposal or fileroot.""" def clean_search(self): """Validate the "search" field. Check that the input is either a proposal or fileroot, and one that matches files in the filesystem. Returns ------- str The cleaned data input into the "search" f...
the_stack_v2_python_sparse
jwql/website/apps/jwql/forms.py
catherine-martlin/jwql
train
1
10c9ed8ad814817fe457f5246b008e261ae29589
[ "self.authentication_type = authentication_type\nself.banner_enabled = banner_enabled\nself.cluster_domains = cluster_domains\nself.cluster_software_version = cluster_software_version\nself.cluster_type = cluster_type\nself.dodin_mode_enabled = dodin_mode_enabled\nself.domains = domains\nself.helios_control_plane_e...
<|body_start_0|> self.authentication_type = authentication_type self.banner_enabled = banner_enabled self.cluster_domains = cluster_domains self.cluster_software_version = cluster_software_version self.cluster_type = cluster_type self.dodin_mode_enabled = dodin_mode_enabl...
Implementation of the 'BasicClusterInfo' model. Specifies basic information about the Cohesity Cluster. Attributes: authentication_type (AuthenticationTypeEnum): Specifies the authentication scheme for the cluster. 'kPasswordOnly' indicates the normal cohesity authentication type. 'kCertificateOnly' indicates that cert...
BasicClusterInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicClusterInfo: """Implementation of the 'BasicClusterInfo' model. Specifies basic information about the Cohesity Cluster. Attributes: authentication_type (AuthenticationTypeEnum): Specifies the authentication scheme for the cluster. 'kPasswordOnly' indicates the normal cohesity authentication ...
stack_v2_sparse_classes_36k_train_006882
7,457
permissive
[ { "docstring": "Constructor for the BasicClusterInfo class", "name": "__init__", "signature": "def __init__(self, authentication_type=None, banner_enabled=None, cluster_domains=None, cluster_software_version=None, cluster_type=None, dodin_mode_enabled=None, domains=None, helios_control_plane_env=None, i...
2
null
Implement the Python class `BasicClusterInfo` described below. Class description: Implementation of the 'BasicClusterInfo' model. Specifies basic information about the Cohesity Cluster. Attributes: authentication_type (AuthenticationTypeEnum): Specifies the authentication scheme for the cluster. 'kPasswordOnly' indica...
Implement the Python class `BasicClusterInfo` described below. Class description: Implementation of the 'BasicClusterInfo' model. Specifies basic information about the Cohesity Cluster. Attributes: authentication_type (AuthenticationTypeEnum): Specifies the authentication scheme for the cluster. 'kPasswordOnly' indica...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class BasicClusterInfo: """Implementation of the 'BasicClusterInfo' model. Specifies basic information about the Cohesity Cluster. Attributes: authentication_type (AuthenticationTypeEnum): Specifies the authentication scheme for the cluster. 'kPasswordOnly' indicates the normal cohesity authentication ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicClusterInfo: """Implementation of the 'BasicClusterInfo' model. Specifies basic information about the Cohesity Cluster. Attributes: authentication_type (AuthenticationTypeEnum): Specifies the authentication scheme for the cluster. 'kPasswordOnly' indicates the normal cohesity authentication type. 'kCerti...
the_stack_v2_python_sparse
cohesity_management_sdk/models/basic_cluster_info.py
cohesity/management-sdk-python
train
24
0f8d19978a382e2ef69bc76a6e3488b43629220f
[ "if isinstance(n, tuple):\n index = str(n)[1:-1]\nelse:\n index = str(n)\nreturn self.parent()('%s(%s)' % (self._name, index))", "if isinstance(n, tuple):\n index = str(n)[1:-1]\nelse:\n index = str(n)\nself.parent().eval('%s(%s) = %s' % (self._name, index, value))", "from sage.matrix.all import Mat...
<|body_start_0|> if isinstance(n, tuple): index = str(n)[1:-1] else: index = str(n) return self.parent()('%s(%s)' % (self._name, index)) <|end_body_0|> <|body_start_1|> if isinstance(n, tuple): index = str(n)[1:-1] else: index = st...
ScilabElement
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScilabElement: def __getitem__(self, n): """Use parenthesis for Scilab matrices instead. EXAMPLES:: sage: M = scilab('[1,2,3;4,5,6;7,8,9]') # optional - scilab sage: M[1] # optional - scilab 1. sage: M[7] # optional - scilab 3. sage: M[3,2] # optional - scilab 8.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_006883
18,723
no_license
[ { "docstring": "Use parenthesis for Scilab matrices instead. EXAMPLES:: sage: M = scilab('[1,2,3;4,5,6;7,8,9]') # optional - scilab sage: M[1] # optional - scilab 1. sage: M[7] # optional - scilab 3. sage: M[3,2] # optional - scilab 8.", "name": "__getitem__", "signature": "def __getitem__(self, n)" }...
4
null
Implement the Python class `ScilabElement` described below. Class description: Implement the ScilabElement class. Method signatures and docstrings: - def __getitem__(self, n): Use parenthesis for Scilab matrices instead. EXAMPLES:: sage: M = scilab('[1,2,3;4,5,6;7,8,9]') # optional - scilab sage: M[1] # optional - sc...
Implement the Python class `ScilabElement` described below. Class description: Implement the ScilabElement class. Method signatures and docstrings: - def __getitem__(self, n): Use parenthesis for Scilab matrices instead. EXAMPLES:: sage: M = scilab('[1,2,3;4,5,6;7,8,9]') # optional - scilab sage: M[1] # optional - sc...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class ScilabElement: def __getitem__(self, n): """Use parenthesis for Scilab matrices instead. EXAMPLES:: sage: M = scilab('[1,2,3;4,5,6;7,8,9]') # optional - scilab sage: M[1] # optional - scilab 1. sage: M[7] # optional - scilab 3. sage: M[3,2] # optional - scilab 8.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScilabElement: def __getitem__(self, n): """Use parenthesis for Scilab matrices instead. EXAMPLES:: sage: M = scilab('[1,2,3;4,5,6;7,8,9]') # optional - scilab sage: M[1] # optional - scilab 1. sage: M[7] # optional - scilab 3. sage: M[3,2] # optional - scilab 8.""" if isinstance(n, tuple): ...
the_stack_v2_python_sparse
sage/src/sage/interfaces/scilab.py
bopopescu/geosci
train
0
94fbe5b545975b1823633bb6341883b7bb556496
[ "self.configuration = PaccMannRLProteinBasedGenerator(algorithm_version=algorithm_version, temperature=temperature, generated_length=generated_length, batch_size=batch_size)\nself.batch_size = batch_size\nself.algorithm = PaccMannRL(configuration=self.configuration, target='')\nself.model = self.configuration.get_c...
<|body_start_0|> self.configuration = PaccMannRLProteinBasedGenerator(algorithm_version=algorithm_version, temperature=temperature, generated_length=generated_length, batch_size=batch_size) self.batch_size = batch_size self.algorithm = PaccMannRL(configuration=self.configuration, target='') ...
Molecular generator as implemented in https://doi.org/10.1016/j.isci.2021.102269
PaccMannVaeDefaultGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaccMannVaeDefaultGenerator: """Molecular generator as implemented in https://doi.org/10.1016/j.isci.2021.102269""" def __init__(self, temperature: float=1.4, batch_size: int=32, algorithm_version: str='v0', generated_length: int=100) -> None: """Initialize the generator. Args: batch...
stack_v2_sparse_classes_36k_train_006884
3,894
permissive
[ { "docstring": "Initialize the generator. Args: batch_size: batch size used for generation. algorithm_version: algorithm version for the PaccMannRLProteinBasedGenerator. NOTE: Only the decoder of that model is used here. temperature: temperature for the sampling. Defaults to 1.4. generated_length: maximum lengt...
2
stack_v2_sparse_classes_30k_train_002442
Implement the Python class `PaccMannVaeDefaultGenerator` described below. Class description: Molecular generator as implemented in https://doi.org/10.1016/j.isci.2021.102269 Method signatures and docstrings: - def __init__(self, temperature: float=1.4, batch_size: int=32, algorithm_version: str='v0', generated_length...
Implement the Python class `PaccMannVaeDefaultGenerator` described below. Class description: Molecular generator as implemented in https://doi.org/10.1016/j.isci.2021.102269 Method signatures and docstrings: - def __init__(self, temperature: float=1.4, batch_size: int=32, algorithm_version: str='v0', generated_length...
0b69b7d5b261f2f9af3984793c1295b9b80cd01a
<|skeleton|> class PaccMannVaeDefaultGenerator: """Molecular generator as implemented in https://doi.org/10.1016/j.isci.2021.102269""" def __init__(self, temperature: float=1.4, batch_size: int=32, algorithm_version: str='v0', generated_length: int=100) -> None: """Initialize the generator. Args: batch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PaccMannVaeDefaultGenerator: """Molecular generator as implemented in https://doi.org/10.1016/j.isci.2021.102269""" def __init__(self, temperature: float=1.4, batch_size: int=32, algorithm_version: str='v0', generated_length: int=100) -> None: """Initialize the generator. Args: batch_size: batch ...
the_stack_v2_python_sparse
src/gt4sd/algorithms/generation/paccmann_vae/implementation.py
GT4SD/gt4sd-core
train
239
05dfefe8e13cc327415f3cba317b71870af23dc6
[ "self.scene_dict = {}\nself.scene_name = None\nself.scene = None\nself.FPS = 30", "self.scene_dict = scene_dict\nself.scene_name = start_scene\nself.scene = self.scene_dict[self.scene_name]\nself.scene.manager = self", "previous = self.scene_name\nself.scene_name = self.scene.next\npersist = self.scene.cleanup(...
<|body_start_0|> self.scene_dict = {} self.scene_name = None self.scene = None self.FPS = 30 <|end_body_0|> <|body_start_1|> self.scene_dict = scene_dict self.scene_name = start_scene self.scene = self.scene_dict[self.scene_name] self.scene.manager = self...
Manager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Manager: def __init__(self): """Sets up a blank manager""" <|body_0|> def setup_scenes(self, scene_dict, start_scene): """Sets up the scenes Arguments: scene_dict {dict} -- Dictionary containing the name of scene and the scene object {"Name": Scene_Object(), "Name2":...
stack_v2_sparse_classes_36k_train_006885
1,313
no_license
[ { "docstring": "Sets up a blank manager", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Sets up the scenes Arguments: scene_dict {dict} -- Dictionary containing the name of scene and the scene object {\"Name\": Scene_Object(), \"Name2\": Scene_Object2()} start_scene {s...
3
stack_v2_sparse_classes_30k_train_009387
Implement the Python class `Manager` described below. Class description: Implement the Manager class. Method signatures and docstrings: - def __init__(self): Sets up a blank manager - def setup_scenes(self, scene_dict, start_scene): Sets up the scenes Arguments: scene_dict {dict} -- Dictionary containing the name of ...
Implement the Python class `Manager` described below. Class description: Implement the Manager class. Method signatures and docstrings: - def __init__(self): Sets up a blank manager - def setup_scenes(self, scene_dict, start_scene): Sets up the scenes Arguments: scene_dict {dict} -- Dictionary containing the name of ...
31bba8383e49540810a1737f2a5f3cb940c780a0
<|skeleton|> class Manager: def __init__(self): """Sets up a blank manager""" <|body_0|> def setup_scenes(self, scene_dict, start_scene): """Sets up the scenes Arguments: scene_dict {dict} -- Dictionary containing the name of scene and the scene object {"Name": Scene_Object(), "Name2":...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Manager: def __init__(self): """Sets up a blank manager""" self.scene_dict = {} self.scene_name = None self.scene = None self.FPS = 30 def setup_scenes(self, scene_dict, start_scene): """Sets up the scenes Arguments: scene_dict {dict} -- Dictionary containi...
the_stack_v2_python_sparse
Scenes/Manager.py
alastairrmcneill/Platformer
train
0
f4bc3beff1db383718f90c811ca0c44154ed05a5
[ "if not nums:\n return []\nranked_nums = sorted(nums, reverse=True)\nres = ['0'] * len(nums)\nfor i in range(1, len(ranked_nums) + 1):\n if i == 1:\n res[nums.index(ranked_nums[i - 1])] = 'Gold Medal'\n elif i == 2:\n res[nums.index(ranked_nums[i - 1])] = 'Silver Medal'\n elif i == 3:\n ...
<|body_start_0|> if not nums: return [] ranked_nums = sorted(nums, reverse=True) res = ['0'] * len(nums) for i in range(1, len(ranked_nums) + 1): if i == 1: res[nums.index(ranked_nums[i - 1])] = 'Gold Medal' elif i == 2: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findRelativeRanks(self, nums): """:type nums: List[int] :rtype: List[str]""" <|body_0|> def findRelativeRanks2(self, nums): """:type nums: List[int] :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: ...
stack_v2_sparse_classes_36k_train_006886
1,488
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[str]", "name": "findRelativeRanks", "signature": "def findRelativeRanks(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[str]", "name": "findRelativeRanks2", "signature": "def findRelativeRanks2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_005944
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRelativeRanks(self, nums): :type nums: List[int] :rtype: List[str] - def findRelativeRanks2(self, nums): :type nums: List[int] :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRelativeRanks(self, nums): :type nums: List[int] :rtype: List[str] - def findRelativeRanks2(self, nums): :type nums: List[int] :rtype: List[str] <|skeleton|> class Solut...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def findRelativeRanks(self, nums): """:type nums: List[int] :rtype: List[str]""" <|body_0|> def findRelativeRanks2(self, nums): """:type nums: List[int] :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findRelativeRanks(self, nums): """:type nums: List[int] :rtype: List[str]""" if not nums: return [] ranked_nums = sorted(nums, reverse=True) res = ['0'] * len(nums) for i in range(1, len(ranked_nums) + 1): if i == 1: ...
the_stack_v2_python_sparse
506. Relative Ranks/rank.py
Macielyoung/LeetCode
train
1
dd1325090d40d4493cfa66d0e5a6127576bda873
[ "self.collections = kwargs.pop('collections', None)\nsuper(Synchronizable, self).__init__(*args, scope=kwargs.pop('scope', 'synchronizable'), **kwargs)\nself.define_inputs('_values')\nself.define_outputs('sync')\nself.add_graph_fn('_values', 'sync', self._graph_fn_sync, flatten_ops=False)", "syncs = list()\nparen...
<|body_start_0|> self.collections = kwargs.pop('collections', None) super(Synchronizable, self).__init__(*args, scope=kwargs.pop('scope', 'synchronizable'), **kwargs) self.define_inputs('_values') self.define_outputs('sync') self.add_graph_fn('_values', 'sync', self._graph_fn_syn...
The Synchronizable Component adds a simple synchronization API to arbitrary Components to which this Synchronizable is added (and connected via `connections=CONNECT_ALL`). This is useful for constructions like a target network in DQN or for distributed setups where e.g. local policies need to be sync'd from a global mo...
Synchronizable
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Synchronizable: """The Synchronizable Component adds a simple synchronization API to arbitrary Components to which this Synchronizable is added (and connected via `connections=CONNECT_ALL`). This is useful for constructions like a target network in DQN or for distributed setups where e.g. local p...
stack_v2_sparse_classes_36k_train_006887
4,545
permissive
[ { "docstring": "Keyword Args: collections (set): A set of specifiers (currently only tf), that determine which Variables of the parent Component to synchronize.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Generates the op that syncs this Synchroniz...
2
stack_v2_sparse_classes_30k_train_007978
Implement the Python class `Synchronizable` described below. Class description: The Synchronizable Component adds a simple synchronization API to arbitrary Components to which this Synchronizable is added (and connected via `connections=CONNECT_ALL`). This is useful for constructions like a target network in DQN or fo...
Implement the Python class `Synchronizable` described below. Class description: The Synchronizable Component adds a simple synchronization API to arbitrary Components to which this Synchronizable is added (and connected via `connections=CONNECT_ALL`). This is useful for constructions like a target network in DQN or fo...
ff7d4768579c0e30aa6ceb932cd16f1e51940010
<|skeleton|> class Synchronizable: """The Synchronizable Component adds a simple synchronization API to arbitrary Components to which this Synchronizable is added (and connected via `connections=CONNECT_ALL`). This is useful for constructions like a target network in DQN or for distributed setups where e.g. local p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Synchronizable: """The Synchronizable Component adds a simple synchronization API to arbitrary Components to which this Synchronizable is added (and connected via `connections=CONNECT_ALL`). This is useful for constructions like a target network in DQN or for distributed setups where e.g. local policies need ...
the_stack_v2_python_sparse
yarl/components/common/synchronizable.py
pascalwhoop/YARL
train
0
816af26fa0f9aa35190ca20942f368e0f5826c1a
[ "if ipts_id is None:\n last_run_query = super(DataRunManager, self).get_queryset().filter(instrument_id=instrument_id)\nelse:\n last_run_query = super(DataRunManager, self).get_queryset().filter(instrument_id=instrument_id, ipts_id=ipts_id)\nif len(last_run_query) > 0:\n last_run_query = last_run_query.ord...
<|body_start_0|> if ipts_id is None: last_run_query = super(DataRunManager, self).get_queryset().filter(instrument_id=instrument_id) else: last_run_query = super(DataRunManager, self).get_queryset().filter(instrument_id=instrument_id, ipts_id=ipts_id) if len(last_run_quer...
DataRunManager
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataRunManager: def get_last_run(self, instrument_id, ipts_id=None): """Get the last run for a given instrument and experiment. Returns None if nothing was found. :param instrument_id: Instrument object :param ipts_id: IPTS object""" <|body_0|> def get_last_cached_run(self, ...
stack_v2_sparse_classes_36k_train_006888
17,148
permissive
[ { "docstring": "Get the last run for a given instrument and experiment. Returns None if nothing was found. :param instrument_id: Instrument object :param ipts_id: IPTS object", "name": "get_last_run", "signature": "def get_last_run(self, instrument_id, ipts_id=None)" }, { "docstring": "Try to ge...
2
stack_v2_sparse_classes_30k_test_000139
Implement the Python class `DataRunManager` described below. Class description: Implement the DataRunManager class. Method signatures and docstrings: - def get_last_run(self, instrument_id, ipts_id=None): Get the last run for a given instrument and experiment. Returns None if nothing was found. :param instrument_id: ...
Implement the Python class `DataRunManager` described below. Class description: Implement the DataRunManager class. Method signatures and docstrings: - def get_last_run(self, instrument_id, ipts_id=None): Get the last run for a given instrument and experiment. Returns None if nothing was found. :param instrument_id: ...
ff55e4e1a0203a6966fc9dab6b49e0d6dd03d18d
<|skeleton|> class DataRunManager: def get_last_run(self, instrument_id, ipts_id=None): """Get the last run for a given instrument and experiment. Returns None if nothing was found. :param instrument_id: Instrument object :param ipts_id: IPTS object""" <|body_0|> def get_last_cached_run(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataRunManager: def get_last_run(self, instrument_id, ipts_id=None): """Get the last run for a given instrument and experiment. Returns None if nothing was found. :param instrument_id: Instrument object :param ipts_id: IPTS object""" if ipts_id is None: last_run_query = super(DataR...
the_stack_v2_python_sparse
src/workflow_app/workflow/database/report/models.py
neutrons/data_workflow
train
4
7028a5d53970da5ecf5021a20146dca16f4ebd9f
[ "super().__init__(capacity, alpha, beta, beta_increment, epsilon)\nself.threshold = threshold\nself.decay = decay\nself.p_scale = p_scale\nself.window_size = 0 if threshold == 0 else np.floor(np.log(threshold) / np.log(decay))\ncurrent_index = self.priorities.next_index()\nfor i in range(1, self.window_size + 1):\n...
<|body_start_0|> super().__init__(capacity, alpha, beta, beta_increment, epsilon) self.threshold = threshold self.decay = decay self.p_scale = p_scale self.window_size = 0 if threshold == 0 else np.floor(np.log(threshold) / np.log(decay)) current_index = self.priorities.n...
An implementation of Prioritized Sequence Experience Replay using torch. https://arxiv.org/pdf/1905.12726.pdf
TorchPSER
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TorchPSER: """An implementation of Prioritized Sequence Experience Replay using torch. https://arxiv.org/pdf/1905.12726.pdf""" def __init__(self, capacity: int, alpha: float, beta: float, beta_increment: float, epsilon: float, threshold=0, decay=0.65, p_scale=0.7): """Creates a new P...
stack_v2_sparse_classes_36k_train_006889
2,266
permissive
[ { "docstring": "Creates a new PSER buffer with the given parameters. The window size is computed as floor(ln(threshold)/ln(decay)) Args: capacity (int): The capacity of the replay buffer. alpha (float): The alpha value for the prioritization, between 0 and 1 inclusive. beta (float): The beta value for the impor...
2
null
Implement the Python class `TorchPSER` described below. Class description: An implementation of Prioritized Sequence Experience Replay using torch. https://arxiv.org/pdf/1905.12726.pdf Method signatures and docstrings: - def __init__(self, capacity: int, alpha: float, beta: float, beta_increment: float, epsilon: floa...
Implement the Python class `TorchPSER` described below. Class description: An implementation of Prioritized Sequence Experience Replay using torch. https://arxiv.org/pdf/1905.12726.pdf Method signatures and docstrings: - def __init__(self, capacity: int, alpha: float, beta: float, beta_increment: float, epsilon: floa...
cde3be1c69bfd76fe4a78fa529e851d0a78318c7
<|skeleton|> class TorchPSER: """An implementation of Prioritized Sequence Experience Replay using torch. https://arxiv.org/pdf/1905.12726.pdf""" def __init__(self, capacity: int, alpha: float, beta: float, beta_increment: float, epsilon: float, threshold=0, decay=0.65, p_scale=0.7): """Creates a new P...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TorchPSER: """An implementation of Prioritized Sequence Experience Replay using torch. https://arxiv.org/pdf/1905.12726.pdf""" def __init__(self, capacity: int, alpha: float, beta: float, beta_increment: float, epsilon: float, threshold=0, decay=0.65, p_scale=0.7): """Creates a new PSER buffer wi...
the_stack_v2_python_sparse
hlrl/torch/experience_replay/pser.py
Chainso/HLRL
train
3
5fec9e8e113a5a8afc2621cc9efc7d41fd3b8f06
[ "super().__init__(self.PARAMS, parameters)\nself.type_tag = parameters['type_tag']\nself.type_values = parameters['type_values']", "if sidecar and (not isinstance(sidecar, Sidecar)):\n sidecar = Sidecar(sidecar)\ninput_data = TabularInput(df, sidecar=sidecar, name=name)\ndf_list = [input_data.dataframe.copy()]...
<|body_start_0|> super().__init__(self.PARAMS, parameters) self.type_tag = parameters['type_tag'] self.type_values = parameters['type_values'] <|end_body_0|> <|body_start_1|> if sidecar and (not isinstance(sidecar, Sidecar)): sidecar = Sidecar(sidecar) input_data = T...
Create tabular file factors from type variables and append to tabular data. Required remodeling parameters: - **type_tag** (*str*): HED tag used to find the factors (most commonly `condition-variable`). - **type_values** (*list*): Factor values to include. If empty all values of that type_tag are used.
FactorHedTypeOp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FactorHedTypeOp: """Create tabular file factors from type variables and append to tabular data. Required remodeling parameters: - **type_tag** (*str*): HED tag used to find the factors (most commonly `condition-variable`). - **type_values** (*list*): Factor values to include. If empty all values ...
stack_v2_sparse_classes_36k_train_006890
3,321
permissive
[ { "docstring": "Constructor for the factor HED type operation. Parameters: parameters (dict): Actual values of the parameters for the operation. :raises KeyError: - If a required parameter is missing. - If an unexpected parameter is provided. :raises TypeError: - If a parameter has the wrong type. :raises Value...
2
null
Implement the Python class `FactorHedTypeOp` described below. Class description: Create tabular file factors from type variables and append to tabular data. Required remodeling parameters: - **type_tag** (*str*): HED tag used to find the factors (most commonly `condition-variable`). - **type_values** (*list*): Factor ...
Implement the Python class `FactorHedTypeOp` described below. Class description: Create tabular file factors from type variables and append to tabular data. Required remodeling parameters: - **type_tag** (*str*): HED tag used to find the factors (most commonly `condition-variable`). - **type_values** (*list*): Factor ...
b871cae44bdf0ee68c688562c3b0af50b93343f5
<|skeleton|> class FactorHedTypeOp: """Create tabular file factors from type variables and append to tabular data. Required remodeling parameters: - **type_tag** (*str*): HED tag used to find the factors (most commonly `condition-variable`). - **type_values** (*list*): Factor values to include. If empty all values ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FactorHedTypeOp: """Create tabular file factors from type variables and append to tabular data. Required remodeling parameters: - **type_tag** (*str*): HED tag used to find the factors (most commonly `condition-variable`). - **type_values** (*list*): Factor values to include. If empty all values of that type_...
the_stack_v2_python_sparse
hed/tools/remodeling/operations/factor_hed_type_op.py
hed-standard/hed-python
train
5
66c4659fd093b940f682fe026b124b960fad6512
[ "self.language = language\nself.compiler = language.get_compiler()\nself.plugin_stub = language.plugin_stub", "if not os.path.exists(self.language.get_build_directory()):\n os.makedirs(self.language.get_build_directory())\nif not os.path.exists(self.language.get_output_directory()):\n os.makedirs(self.langu...
<|body_start_0|> self.language = language self.compiler = language.get_compiler() self.plugin_stub = language.plugin_stub <|end_body_0|> <|body_start_1|> if not os.path.exists(self.language.get_build_directory()): os.makedirs(self.language.get_build_directory()) if n...
Object which builds Python plugins. Attributes: plugin_stub: madz.plugin.PythonPluginStub object
Builder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Builder: """Object which builds Python plugins. Attributes: plugin_stub: madz.plugin.PythonPluginStub object""" def __init__(self, language): """Constructor for Python Builder. Args: language: A Language object""" <|body_0|> def prep(self): """Performs any pre-co...
stack_v2_sparse_classes_36k_train_006891
1,494
no_license
[ { "docstring": "Constructor for Python Builder. Args: language: A Language object", "name": "__init__", "signature": "def __init__(self, language)" }, { "docstring": "Performs any pre-compile stage prep work for plugin.", "name": "prep", "signature": "def prep(self)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_007372
Implement the Python class `Builder` described below. Class description: Object which builds Python plugins. Attributes: plugin_stub: madz.plugin.PythonPluginStub object Method signatures and docstrings: - def __init__(self, language): Constructor for Python Builder. Args: language: A Language object - def prep(self)...
Implement the Python class `Builder` described below. Class description: Object which builds Python plugins. Attributes: plugin_stub: madz.plugin.PythonPluginStub object Method signatures and docstrings: - def __init__(self, language): Constructor for Python Builder. Args: language: A Language object - def prep(self)...
b3fd3ebb4f63957c0cb6a9f1577d8556dc554bda
<|skeleton|> class Builder: """Object which builds Python plugins. Attributes: plugin_stub: madz.plugin.PythonPluginStub object""" def __init__(self, language): """Constructor for Python Builder. Args: language: A Language object""" <|body_0|> def prep(self): """Performs any pre-co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Builder: """Object which builds Python plugins. Attributes: plugin_stub: madz.plugin.PythonPluginStub object""" def __init__(self, language): """Constructor for Python Builder. Args: language: A Language object""" self.language = language self.compiler = language.get_compiler() ...
the_stack_v2_python_sparse
madz/language/python/build.py
OffByOneStudios/massive-dangerzone
train
0
c0596b3a3948293a3696c25e7f5b2d3a0d5caf36
[ "for cls in self.VALUE_CLASSES:\n if cls.isValidFor(valueText):\n return cls(valueText)\nelse:\n return None", "for cls in self.SCOPE_VALUE_CLASSES:\n if cls.isValidFor(valueText):\n return cls(valueText)\nelse:\n return None" ]
<|body_start_0|> for cls in self.VALUE_CLASSES: if cls.isValidFor(valueText): return cls(valueText) else: return None <|end_body_0|> <|body_start_1|> for cls in self.SCOPE_VALUE_CLASSES: if cls.isValidFor(valueText): return cls...
Factory to construct the proper Value Object for a given text
ValueFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValueFactory: """Factory to construct the proper Value Object for a given text""" def build(self, valueText): """Build the value object for the given text""" <|body_0|> def buildScopeValue(self, valueText): """Build the value object's only from the scope""" ...
stack_v2_sparse_classes_36k_train_006892
1,080
no_license
[ { "docstring": "Build the value object for the given text", "name": "build", "signature": "def build(self, valueText)" }, { "docstring": "Build the value object's only from the scope", "name": "buildScopeValue", "signature": "def buildScopeValue(self, valueText)" } ]
2
stack_v2_sparse_classes_30k_train_015403
Implement the Python class `ValueFactory` described below. Class description: Factory to construct the proper Value Object for a given text Method signatures and docstrings: - def build(self, valueText): Build the value object for the given text - def buildScopeValue(self, valueText): Build the value object's only fr...
Implement the Python class `ValueFactory` described below. Class description: Factory to construct the proper Value Object for a given text Method signatures and docstrings: - def build(self, valueText): Build the value object for the given text - def buildScopeValue(self, valueText): Build the value object's only fr...
19b7bf08658ce329c7b076ce2014bae9f5f09268
<|skeleton|> class ValueFactory: """Factory to construct the proper Value Object for a given text""" def build(self, valueText): """Build the value object for the given text""" <|body_0|> def buildScopeValue(self, valueText): """Build the value object's only from the scope""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValueFactory: """Factory to construct the proper Value Object for a given text""" def build(self, valueText): """Build the value object for the given text""" for cls in self.VALUE_CLASSES: if cls.isValidFor(valueText): return cls(valueText) else: ...
the_stack_v2_python_sparse
src/knot/loader/token/value/value_factory.py
cloew/Knot
train
1
2acaa12054cce1d69125acacb60f531c376dc40f
[ "permission_classes: list = [IsAdminUser]\nif self.action == 'list':\n permission_classes.append(IsOperator)\nreturn [permission() for permission in permission_classes]", "total_permissions = self.get_permissions()\nnot_permissions = len(total_permissions)\nfor permission in total_permissions:\n if not perm...
<|body_start_0|> permission_classes: list = [IsAdminUser] if self.action == 'list': permission_classes.append(IsOperator) return [permission() for permission in permission_classes] <|end_body_0|> <|body_start_1|> total_permissions = self.get_permissions() not_permiss...
Store House view set. Handle CRUD of Store House.
StoreHouseViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StoreHouseViewSet: """Store House view set. Handle CRUD of Store House.""" def get_permissions(self): """Instantiates and returns the list of permissions that this view requires.""" <|body_0|> def check_permissions(self, request): """Check if the request should b...
stack_v2_sparse_classes_36k_train_006893
2,129
no_license
[ { "docstring": "Instantiates and returns the list of permissions that this view requires.", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Check if the request should be permitted. Raises an appropriate exception if the request is not permitted.", "nam...
2
stack_v2_sparse_classes_30k_train_007969
Implement the Python class `StoreHouseViewSet` described below. Class description: Store House view set. Handle CRUD of Store House. Method signatures and docstrings: - def get_permissions(self): Instantiates and returns the list of permissions that this view requires. - def check_permissions(self, request): Check if...
Implement the Python class `StoreHouseViewSet` described below. Class description: Store House view set. Handle CRUD of Store House. Method signatures and docstrings: - def get_permissions(self): Instantiates and returns the list of permissions that this view requires. - def check_permissions(self, request): Check if...
cfa19bc42c9fa1b62f793b4b4e679fa6efb529b0
<|skeleton|> class StoreHouseViewSet: """Store House view set. Handle CRUD of Store House.""" def get_permissions(self): """Instantiates and returns the list of permissions that this view requires.""" <|body_0|> def check_permissions(self, request): """Check if the request should b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StoreHouseViewSet: """Store House view set. Handle CRUD of Store House.""" def get_permissions(self): """Instantiates and returns the list of permissions that this view requires.""" permission_classes: list = [IsAdminUser] if self.action == 'list': permission_classes.a...
the_stack_v2_python_sparse
api/apps/storehouse/views/storehouse.py
DavidJMS/worldmarket
train
0
5dae4251d4c02a798880f85493ba9593ea1f4a96
[ "self.lst = head\nself.length = 0\nwhile head != None:\n self.length, head = (self.length + 1, head.next)", "pos = random.randint(0, self.length - 1)\nnew_head = self.lst\nwhile pos > 0:\n new_head, pos = (new_head.next, pos - 1)\nreturn new_head.val" ]
<|body_start_0|> self.lst = head self.length = 0 while head != None: self.length, head = (self.length + 1, head.next) <|end_body_0|> <|body_start_1|> pos = random.randint(0, self.length - 1) new_head = self.lst while pos > 0: new_head, pos = (new_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int""" ...
stack_v2_sparse_classes_36k_train_006894
930
no_license
[ { "docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode", "name": "__init__", "signature": "def __init__(self, head)" }, { "docstring": "Returns a random node's value. :rtype: int", "name": "g...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
2418b3eed1ab85cfd9cac039c6cfdc1a349ad345
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" self.lst = head self.length = 0 while head != None: self.length, head = (self.length...
the_stack_v2_python_sparse
leetcode-first_time/leetcode382(Linked List Random Node)_random.py
HopeCheung/leetcode
train
0
bde9ad1cbaa666ffde8bdf117ff2394e36d265e4
[ "notebooks = get_list_or_404(Notebook)\nserializer = Notebooks(notebooks, many=True)\nreturn Response(serializer.data, status=status.HTTP_200_OK)", "serializer = Notebooks(data=request.data)\nif serializer.is_valid():\n serializer.save(user=request.user)\n return Response(serializer.data, status=status.HTTP...
<|body_start_0|> notebooks = get_list_or_404(Notebook) serializer = Notebooks(notebooks, many=True) return Response(serializer.data, status=status.HTTP_200_OK) <|end_body_0|> <|body_start_1|> serializer = Notebooks(data=request.data) if serializer.is_valid(): seriali...
NotebookList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotebookList: def get(self, request): """Retrieves all notebooks user has created. --- request_serializer: notes.apps.writer.resources.Notebooks responseMessages: - code: 200 message: Retrieval succeeded. - code: 404 message: No notebooks found. - code: 401 message: Unauthorized.""" ...
stack_v2_sparse_classes_36k_train_006895
6,451
permissive
[ { "docstring": "Retrieves all notebooks user has created. --- request_serializer: notes.apps.writer.resources.Notebooks responseMessages: - code: 200 message: Retrieval succeeded. - code: 404 message: No notebooks found. - code: 401 message: Unauthorized.", "name": "get", "signature": "def get(self, req...
2
stack_v2_sparse_classes_30k_train_016868
Implement the Python class `NotebookList` described below. Class description: Implement the NotebookList class. Method signatures and docstrings: - def get(self, request): Retrieves all notebooks user has created. --- request_serializer: notes.apps.writer.resources.Notebooks responseMessages: - code: 200 message: Ret...
Implement the Python class `NotebookList` described below. Class description: Implement the NotebookList class. Method signatures and docstrings: - def get(self, request): Retrieves all notebooks user has created. --- request_serializer: notes.apps.writer.resources.Notebooks responseMessages: - code: 200 message: Ret...
310cd45f5d1fad25034a274bc497504259c69907
<|skeleton|> class NotebookList: def get(self, request): """Retrieves all notebooks user has created. --- request_serializer: notes.apps.writer.resources.Notebooks responseMessages: - code: 200 message: Retrieval succeeded. - code: 404 message: No notebooks found. - code: 401 message: Unauthorized.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotebookList: def get(self, request): """Retrieves all notebooks user has created. --- request_serializer: notes.apps.writer.resources.Notebooks responseMessages: - code: 200 message: Retrieval succeeded. - code: 404 message: No notebooks found. - code: 401 message: Unauthorized.""" notebooks ...
the_stack_v2_python_sparse
notes/apps/writer/api.py
NTsystems/NoTes-API
train
0
436401614ffa035e139b5733d613bbcbbf69900a
[ "nums = list(range(1, n + 1))\nif k > n:\n return []\nif k == n:\n return [nums]\ncombo = []\nmask = [True] * n\nself.backtrack(n, k, [], nums, mask, combo)\nreturn combo", "if len(parts) == k:\n combo.append(parts[:])\n return\nfor i, num in enumerate(nums):\n if mask[i] and (not parts or num > pa...
<|body_start_0|> nums = list(range(1, n + 1)) if k > n: return [] if k == n: return [nums] combo = [] mask = [True] * n self.backtrack(n, k, [], nums, mask, combo) return combo <|end_body_0|> <|body_start_1|> if len(parts) == k: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combine(self, n, k): """:type n: int :type k: int :rtype: List[List[int]]""" <|body_0|> def backtrack(self, n, k, parts, nums, mask, combo): """parts: the stack store the current pieces""" <|body_1|> <|end_skeleton|> <|body_start_0|> n...
stack_v2_sparse_classes_36k_train_006896
1,101
no_license
[ { "docstring": ":type n: int :type k: int :rtype: List[List[int]]", "name": "combine", "signature": "def combine(self, n, k)" }, { "docstring": "parts: the stack store the current pieces", "name": "backtrack", "signature": "def backtrack(self, n, k, parts, nums, mask, combo)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combine(self, n, k): :type n: int :type k: int :rtype: List[List[int]] - def backtrack(self, n, k, parts, nums, mask, combo): parts: the stack store the current pieces
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combine(self, n, k): :type n: int :type k: int :rtype: List[List[int]] - def backtrack(self, n, k, parts, nums, mask, combo): parts: the stack store the current pieces <|ske...
e00cf94c5b86c8cca27e3bee69ad21e727b7679b
<|skeleton|> class Solution: def combine(self, n, k): """:type n: int :type k: int :rtype: List[List[int]]""" <|body_0|> def backtrack(self, n, k, parts, nums, mask, combo): """parts: the stack store the current pieces""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def combine(self, n, k): """:type n: int :type k: int :rtype: List[List[int]]""" nums = list(range(1, n + 1)) if k > n: return [] if k == n: return [nums] combo = [] mask = [True] * n self.backtrack(n, k, [], nums, mask,...
the_stack_v2_python_sparse
backtracking/prob77.py
binchen15/leet-python
train
1
e027a9183c2c149dd94aeeaa48900e5a483960bd
[ "super().__init__()\nself.is_image_feature = config.get('is_image_feature', True)\nself._img_size = config.get('img_size')\nself._input_channel = config.get('input_channel')\nself._filter_sizes = config.get('filter_size')\nself._kernel_size = config.get('kernel_size')\nself._padding = padding\nself._stride = stride...
<|body_start_0|> super().__init__() self.is_image_feature = config.get('is_image_feature', True) self._img_size = config.get('img_size') self._input_channel = config.get('input_channel') self._filter_sizes = config.get('filter_size') self._kernel_size = config.get('kernel...
Stochastic_Conv_Encoder
Conv_Reparameterization_Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv_Reparameterization_Encoder: """Stochastic_Conv_Encoder""" def __init__(self, config, padding=0, stride=2, dilation=1): """NP""" <|body_0|> def forward(self, inputs): """Args: input : imamges (num_tasks, n_way, k_shot, num_channel, img_size, img_size) Return:...
stack_v2_sparse_classes_36k_train_006897
18,202
no_license
[ { "docstring": "NP", "name": "__init__", "signature": "def __init__(self, config, padding=0, stride=2, dilation=1)" }, { "docstring": "Args: input : imamges (num_tasks, n_way, k_shot, num_channel, img_size, img_size) Return: output : encoded_img, kl_loss", "name": "forward", "signature":...
2
stack_v2_sparse_classes_30k_train_017376
Implement the Python class `Conv_Reparameterization_Encoder` described below. Class description: Stochastic_Conv_Encoder Method signatures and docstrings: - def __init__(self, config, padding=0, stride=2, dilation=1): NP - def forward(self, inputs): Args: input : imamges (num_tasks, n_way, k_shot, num_channel, img_si...
Implement the Python class `Conv_Reparameterization_Encoder` described below. Class description: Stochastic_Conv_Encoder Method signatures and docstrings: - def __init__(self, config, padding=0, stride=2, dilation=1): NP - def forward(self, inputs): Args: input : imamges (num_tasks, n_way, k_shot, num_channel, img_si...
c7e1bfb49ebaec6937ed7b186689227f95a43e0f
<|skeleton|> class Conv_Reparameterization_Encoder: """Stochastic_Conv_Encoder""" def __init__(self, config, padding=0, stride=2, dilation=1): """NP""" <|body_0|> def forward(self, inputs): """Args: input : imamges (num_tasks, n_way, k_shot, num_channel, img_size, img_size) Return:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Conv_Reparameterization_Encoder: """Stochastic_Conv_Encoder""" def __init__(self, config, padding=0, stride=2, dilation=1): """NP""" super().__init__() self.is_image_feature = config.get('is_image_feature', True) self._img_size = config.get('img_size') self._input_...
the_stack_v2_python_sparse
model/MAML/Part/encoder.py
MingyuKim87/MLwM
train
0
f1b537b3865b0aa315b8685656e6862a20b14e85
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
The JobController provides methods to manage jobs.
JobControllerServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobControllerServicer: """The JobController provides methods to manage jobs.""" def SubmitJob(self, request, context): """Submits a job to a cluster.""" <|body_0|> def GetJob(self, request, context): """Gets the resource representation for a job in a project.""" ...
stack_v2_sparse_classes_36k_train_006898
6,938
permissive
[ { "docstring": "Submits a job to a cluster.", "name": "SubmitJob", "signature": "def SubmitJob(self, request, context)" }, { "docstring": "Gets the resource representation for a job in a project.", "name": "GetJob", "signature": "def GetJob(self, request, context)" }, { "docstrin...
6
stack_v2_sparse_classes_30k_train_018357
Implement the Python class `JobControllerServicer` described below. Class description: The JobController provides methods to manage jobs. Method signatures and docstrings: - def SubmitJob(self, request, context): Submits a job to a cluster. - def GetJob(self, request, context): Gets the resource representation for a ...
Implement the Python class `JobControllerServicer` described below. Class description: The JobController provides methods to manage jobs. Method signatures and docstrings: - def SubmitJob(self, request, context): Submits a job to a cluster. - def GetJob(self, request, context): Gets the resource representation for a ...
d897d56bce03d1fda98b79afb08264e51d46c421
<|skeleton|> class JobControllerServicer: """The JobController provides methods to manage jobs.""" def SubmitJob(self, request, context): """Submits a job to a cluster.""" <|body_0|> def GetJob(self, request, context): """Gets the resource representation for a job in a project.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JobControllerServicer: """The JobController provides methods to manage jobs.""" def SubmitJob(self, request, context): """Submits a job to a cluster.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError...
the_stack_v2_python_sparse
dataproc/google/cloud/dataproc_v1/proto/jobs_pb2_grpc.py
tswast/google-cloud-python
train
1
53dd76935b6892ef56b107546bb965de6ec58b7a
[ "course_id = self.cleaned_data.get('course_id')\nif course_id:\n try:\n return CourseKey.from_string(course_id)\n except InvalidKeyError:\n raise ValidationError(f\"'{course_id}' is not a valid course id.\")\nreturn course_id", "usernames_csv_string = self.cleaned_data.get('username')\nif user...
<|body_start_0|> course_id = self.cleaned_data.get('course_id') if course_id: try: return CourseKey.from_string(course_id) except InvalidKeyError: raise ValidationError(f"'{course_id}' is not a valid course id.") return course_id <|end_body...
A form that validates the query string parameters for the CourseEnrollmentsApiListView.
CourseEnrollmentsApiListForm
[ "MIT", "AGPL-3.0-only", "AGPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CourseEnrollmentsApiListForm: """A form that validates the query string parameters for the CourseEnrollmentsApiListView.""" def clean_course_id(self): """Validate and return a course ID.""" <|body_0|> def clean_username(self): """Validate a string of comma-separa...
stack_v2_sparse_classes_36k_train_006899
1,824
permissive
[ { "docstring": "Validate and return a course ID.", "name": "clean_course_id", "signature": "def clean_course_id(self)" }, { "docstring": "Validate a string of comma-separated usernames and return a list of usernames.", "name": "clean_username", "signature": "def clean_username(self)" }...
2
null
Implement the Python class `CourseEnrollmentsApiListForm` described below. Class description: A form that validates the query string parameters for the CourseEnrollmentsApiListView. Method signatures and docstrings: - def clean_course_id(self): Validate and return a course ID. - def clean_username(self): Validate a s...
Implement the Python class `CourseEnrollmentsApiListForm` described below. Class description: A form that validates the query string parameters for the CourseEnrollmentsApiListView. Method signatures and docstrings: - def clean_course_id(self): Validate and return a course ID. - def clean_username(self): Validate a s...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class CourseEnrollmentsApiListForm: """A form that validates the query string parameters for the CourseEnrollmentsApiListView.""" def clean_course_id(self): """Validate and return a course ID.""" <|body_0|> def clean_username(self): """Validate a string of comma-separa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CourseEnrollmentsApiListForm: """A form that validates the query string parameters for the CourseEnrollmentsApiListView.""" def clean_course_id(self): """Validate and return a course ID.""" course_id = self.cleaned_data.get('course_id') if course_id: try: ...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/enrollments/forms.py
luque/better-ways-of-thinking-about-software
train
3