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
1bf838d87df81fc399ad22ff9bcbe43e59e34449
[ "super().__init__(auth_provider)\nself._available_users = available_users\nself._ip_address = ip_addr\nself._allow_bypass_login = allow_bypass_login", "try:\n cast(TrustedNetworksAuthProvider, self._auth_provider).async_validate_access(self._ip_address)\nexcept InvalidAuthError:\n return self.async_abort(re...
<|body_start_0|> super().__init__(auth_provider) self._available_users = available_users self._ip_address = ip_addr self._allow_bypass_login = allow_bypass_login <|end_body_0|> <|body_start_1|> try: cast(TrustedNetworksAuthProvider, self._auth_provider).async_validat...
Handler for the login flow.
TrustedNetworksLoginFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrustedNetworksLoginFlow: """Handler for the login flow.""" def __init__(self, auth_provider: TrustedNetworksAuthProvider, ip_addr: IPAddress, available_users: dict[str, str | None], allow_bypass_login: bool) -> None: """Initialize the login flow.""" <|body_0|> async def...
stack_v2_sparse_classes_36k_train_004000
8,219
permissive
[ { "docstring": "Initialize the login flow.", "name": "__init__", "signature": "def __init__(self, auth_provider: TrustedNetworksAuthProvider, ip_addr: IPAddress, available_users: dict[str, str | None], allow_bypass_login: bool) -> None" }, { "docstring": "Handle the step of the form.", "name...
2
null
Implement the Python class `TrustedNetworksLoginFlow` described below. Class description: Handler for the login flow. Method signatures and docstrings: - def __init__(self, auth_provider: TrustedNetworksAuthProvider, ip_addr: IPAddress, available_users: dict[str, str | None], allow_bypass_login: bool) -> None: Initia...
Implement the Python class `TrustedNetworksLoginFlow` described below. Class description: Handler for the login flow. Method signatures and docstrings: - def __init__(self, auth_provider: TrustedNetworksAuthProvider, ip_addr: IPAddress, available_users: dict[str, str | None], allow_bypass_login: bool) -> None: Initia...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class TrustedNetworksLoginFlow: """Handler for the login flow.""" def __init__(self, auth_provider: TrustedNetworksAuthProvider, ip_addr: IPAddress, available_users: dict[str, str | None], allow_bypass_login: bool) -> None: """Initialize the login flow.""" <|body_0|> async def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrustedNetworksLoginFlow: """Handler for the login flow.""" def __init__(self, auth_provider: TrustedNetworksAuthProvider, ip_addr: IPAddress, available_users: dict[str, str | None], allow_bypass_login: bool) -> None: """Initialize the login flow.""" super().__init__(auth_provider) ...
the_stack_v2_python_sparse
homeassistant/auth/providers/trusted_networks.py
home-assistant/core
train
35,501
4461b2eba907b9afb6292ad0ef79f692485cc5db
[ "super(RegressionTaskModel, self).__init__()\nmodel_type = model_config.get('model_type', 'transformer')\nhidden_size = model_config.get('hidden_size', 512)\nin_channels = hidden_size * 2 if model_type == 'lstm' else hidden_size\nself.fc_decoder = nn.Sequential(nn.Linear(in_features=in_channels, out_features=hidden...
<|body_start_0|> super(RegressionTaskModel, self).__init__() model_type = model_config.get('model_type', 'transformer') hidden_size = model_config.get('hidden_size', 512) in_channels = hidden_size * 2 if model_type == 'lstm' else hidden_size self.fc_decoder = nn.Sequential(nn.Lin...
RegressionTaskModel
RegressionTaskModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegressionTaskModel: """RegressionTaskModel""" def __init__(self, model_config, encoder_model): """__init__""" <|body_0|> def forward(self, input, pos): """forward""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(RegressionTaskModel, self)....
stack_v2_sparse_classes_36k_train_004001
17,522
permissive
[ { "docstring": "__init__", "name": "__init__", "signature": "def __init__(self, model_config, encoder_model)" }, { "docstring": "forward", "name": "forward", "signature": "def forward(self, input, pos)" } ]
2
stack_v2_sparse_classes_30k_train_006709
Implement the Python class `RegressionTaskModel` described below. Class description: RegressionTaskModel Method signatures and docstrings: - def __init__(self, model_config, encoder_model): __init__ - def forward(self, input, pos): forward
Implement the Python class `RegressionTaskModel` described below. Class description: RegressionTaskModel Method signatures and docstrings: - def __init__(self, model_config, encoder_model): __init__ - def forward(self, input, pos): forward <|skeleton|> class RegressionTaskModel: """RegressionTaskModel""" de...
e6ab0261eb719c21806bbadfd94001ecfe27de45
<|skeleton|> class RegressionTaskModel: """RegressionTaskModel""" def __init__(self, model_config, encoder_model): """__init__""" <|body_0|> def forward(self, input, pos): """forward""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegressionTaskModel: """RegressionTaskModel""" def __init__(self, model_config, encoder_model): """__init__""" super(RegressionTaskModel, self).__init__() model_type = model_config.get('model_type', 'transformer') hidden_size = model_config.get('hidden_size', 512) ...
the_stack_v2_python_sparse
pahelix/model_zoo/protein_sequence_model.py
PaddlePaddle/PaddleHelix
train
771
9b94e0d2934d8de56d5f1ffe11aad42d5a41cc0d
[ "GObject.GObject.__init__(self)\nself.set_transient_for(parent)\nself.set_modal(True)\nself.set_name(PROGRAM_NAME)\nself.set_version(VERSION)\nself.set_copyright(COPYRIGHT_MSG)\nself.set_artists([_(\"Much of Gramps' artwork is either from\\nthe Tango Project or derived from the Tango\\nProject. This artwork is rele...
<|body_start_0|> GObject.GObject.__init__(self) self.set_transient_for(parent) self.set_modal(True) self.set_name(PROGRAM_NAME) self.set_version(VERSION) self.set_copyright(COPYRIGHT_MSG) self.set_artists([_("Much of Gramps' artwork is either from\nthe Tango Proje...
Create an About dialog with all fields set.
GrampsAboutDialog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GrampsAboutDialog: """Create an About dialog with all fields set.""" def __init__(self, parent): """Setup all the fields shown in the About dialog.""" <|body_0|> def get_versions(self): """Obtain version information of core dependencies""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_004002
8,673
no_license
[ { "docstring": "Setup all the fields shown in the About dialog.", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "Obtain version information of core dependencies", "name": "get_versions", "signature": "def get_versions(self)" } ]
2
stack_v2_sparse_classes_30k_train_015501
Implement the Python class `GrampsAboutDialog` described below. Class description: Create an About dialog with all fields set. Method signatures and docstrings: - def __init__(self, parent): Setup all the fields shown in the About dialog. - def get_versions(self): Obtain version information of core dependencies
Implement the Python class `GrampsAboutDialog` described below. Class description: Create an About dialog with all fields set. Method signatures and docstrings: - def __init__(self, parent): Setup all the fields shown in the About dialog. - def get_versions(self): Obtain version information of core dependencies <|sk...
0c79561bed7ff42c88714edbc85197fa9235e188
<|skeleton|> class GrampsAboutDialog: """Create an About dialog with all fields set.""" def __init__(self, parent): """Setup all the fields shown in the About dialog.""" <|body_0|> def get_versions(self): """Obtain version information of core dependencies""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GrampsAboutDialog: """Create an About dialog with all fields set.""" def __init__(self, parent): """Setup all the fields shown in the About dialog.""" GObject.GObject.__init__(self) self.set_transient_for(parent) self.set_modal(True) self.set_name(PROGRAM_NAME) ...
the_stack_v2_python_sparse
gui/aboutdialog.py
balrok/gramps_addon
train
2
60d943019663a7241697aa6a37838469a7db9581
[ "roots = np.asarray(roots)\nif len(roots.shape) != 1:\n raise ArgumentError('one-dimensional array of roots expected.')\nself.roots = roots", "from numpy.polynomial import Polynomial as P\np = P.fromroots(self.roots)\nreturn p.deriv(1).roots()", "p = np.asarray(points)\nif len(p.shape) > 1:\n raise Argume...
<|body_start_0|> roots = np.asarray(roots) if len(roots.shape) != 1: raise ArgumentError('one-dimensional array of roots expected.') self.roots = roots <|end_body_0|> <|body_start_1|> from numpy.polynomial import Polynomial as P p = P.fromroots(self.roots) re...
NormalizedRootsPolynomial
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NormalizedRootsPolynomial: def __init__(self, roots): """A polynomial with specified roots and p(0)=1. Represents the polynomial .. math:: p(\\lambda) = \\prod_{i=1}^n \\left(1-\\frac{\\lambda}{\\theta_i}\\right). :param roots: array with roots :math:`\\theta_1,\\dots,\\theta_n` of the p...
stack_v2_sparse_classes_36k_train_004003
10,845
permissive
[ { "docstring": "A polynomial with specified roots and p(0)=1. Represents the polynomial .. math:: p(\\\\lambda) = \\\\prod_{i=1}^n \\\\left(1-\\\\frac{\\\\lambda}{\\\\theta_i}\\\\right). :param roots: array with roots :math:`\\\\theta_1,\\\\dots,\\\\theta_n` of the polynomial and ``roots.shape==(n,)``.", "n...
3
stack_v2_sparse_classes_30k_train_007054
Implement the Python class `NormalizedRootsPolynomial` described below. Class description: Implement the NormalizedRootsPolynomial class. Method signatures and docstrings: - def __init__(self, roots): A polynomial with specified roots and p(0)=1. Represents the polynomial .. math:: p(\\lambda) = \\prod_{i=1}^n \\left...
Implement the Python class `NormalizedRootsPolynomial` described below. Class description: Implement the NormalizedRootsPolynomial class. Method signatures and docstrings: - def __init__(self, roots): A polynomial with specified roots and p(0)=1. Represents the polynomial .. math:: p(\\lambda) = \\prod_{i=1}^n \\left...
e6af3d227f1512c84a528f9c4407934973231b42
<|skeleton|> class NormalizedRootsPolynomial: def __init__(self, roots): """A polynomial with specified roots and p(0)=1. Represents the polynomial .. math:: p(\\lambda) = \\prod_{i=1}^n \\left(1-\\frac{\\lambda}{\\theta_i}\\right). :param roots: array with roots :math:`\\theta_1,\\dots,\\theta_n` of the p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NormalizedRootsPolynomial: def __init__(self, roots): """A polynomial with specified roots and p(0)=1. Represents the polynomial .. math:: p(\\lambda) = \\prod_{i=1}^n \\left(1-\\frac{\\lambda}{\\theta_i}\\right). :param roots: array with roots :math:`\\theta_1,\\dots,\\theta_n` of the polynomial and ...
the_stack_v2_python_sparse
src/krylov/utils.py
mohamedlaminebabou/krylov
train
0
848bdea728b98ab322402d9ca52f3c750b936002
[ "self.parameters = {'encoding': 'utf-8', 'text': True}\nself.stdout = None\nself.stderr = None\nself.returncode = None", "from subprocess import DEVNULL, PIPE, Popen, STDOUT\n\ndef comunicate(parameters):\n popen = Popen(**parameters)\n stdout, stderr = popen.communicate()\n return (popen, stdout, stderr...
<|body_start_0|> self.parameters = {'encoding': 'utf-8', 'text': True} self.stdout = None self.stderr = None self.returncode = None <|end_body_0|> <|body_start_1|> from subprocess import DEVNULL, PIPE, Popen, STDOUT def comunicate(parameters): popen = Popen(...
A helper class for executing a command line process.
Process
[ "MIT", "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Process: """A helper class for executing a command line process.""" def __init__(self) -> None: """Initialize a Process instance.""" <|body_0|> def execute(cls, args: list[str], shell: bool=False, capture_output: bool=True, split: bool=True, outpath: str=None) -> Process...
stack_v2_sparse_classes_36k_train_004004
2,615
permissive
[ { "docstring": "Initialize a Process instance.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Execute a command line process. Args: args (list[str]): The command line arguments to execute. shell (bool, optional): If True, execute the command line using the she...
2
null
Implement the Python class `Process` described below. Class description: A helper class for executing a command line process. Method signatures and docstrings: - def __init__(self) -> None: Initialize a Process instance. - def execute(cls, args: list[str], shell: bool=False, capture_output: bool=True, split: bool=Tru...
Implement the Python class `Process` described below. Class description: A helper class for executing a command line process. Method signatures and docstrings: - def __init__(self) -> None: Initialize a Process instance. - def execute(cls, args: list[str], shell: bool=False, capture_output: bool=True, split: bool=Tru...
00e14fc190ebff66cf50ff911f25cf5ad3529f8f
<|skeleton|> class Process: """A helper class for executing a command line process.""" def __init__(self) -> None: """Initialize a Process instance.""" <|body_0|> def execute(cls, args: list[str], shell: bool=False, capture_output: bool=True, split: bool=True, outpath: str=None) -> Process...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Process: """A helper class for executing a command line process.""" def __init__(self) -> None: """Initialize a Process instance.""" self.parameters = {'encoding': 'utf-8', 'text': True} self.stdout = None self.stderr = None self.returncode = None def execute(...
the_stack_v2_python_sparse
scripts/addon_library/local/ImagePaste/imagepaste/process.py
Tilapiatsu/blender-custom_config
train
6
9a3bead54105efa3ba9e4ac09ef41fc7847c1f50
[ "if handler not in self.handlers:\n self.handlers[handler] = {}\n self.handlers[handler]['file'] = file_to_handle\n self.handlers[handler]['fh'] = open(file_to_handle, 'w', encoding='utf-8')\nreturn self.handlers[handler]['fh']", "destination_file = '{directory}/{db}.{table}.sql'.format(directory=self.di...
<|body_start_0|> if handler not in self.handlers: self.handlers[handler] = {} self.handlers[handler]['file'] = file_to_handle self.handlers[handler]['fh'] = open(file_to_handle, 'w', encoding='utf-8') return self.handlers[handler]['fh'] <|end_body_0|> <|body_start_1|...
The class implement a formatter of SQL type which is able to convert a list of dict of data into one file of SQL statement
Sql
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sql: """The class implement a formatter of SQL type which is able to convert a list of dict of data into one file of SQL statement""" def get_handler(self, handler=None, file_to_handle=None): """Return a file handler if it already exists or create a new one""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_004005
3,364
permissive
[ { "docstring": "Return a file handler if it already exists or create a new one", "name": "get_handler", "signature": "def get_handler(self, handler=None, file_to_handle=None)" }, { "docstring": "The write method which should be implemented because of ineherited Formatter class The name of the fi...
2
stack_v2_sparse_classes_30k_train_011612
Implement the Python class `Sql` described below. Class description: The class implement a formatter of SQL type which is able to convert a list of dict of data into one file of SQL statement Method signatures and docstrings: - def get_handler(self, handler=None, file_to_handle=None): Return a file handler if it alre...
Implement the Python class `Sql` described below. Class description: The class implement a formatter of SQL type which is able to convert a list of dict of data into one file of SQL statement Method signatures and docstrings: - def get_handler(self, handler=None, file_to_handle=None): Return a file handler if it alre...
73a9e6377a44b64a759f663bf99ac798e4ec026a
<|skeleton|> class Sql: """The class implement a formatter of SQL type which is able to convert a list of dict of data into one file of SQL statement""" def get_handler(self, handler=None, file_to_handle=None): """Return a file handler if it already exists or create a new one""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sql: """The class implement a formatter of SQL type which is able to convert a list of dict of data into one file of SQL statement""" def get_handler(self, handler=None, file_to_handle=None): """Return a file handler if it already exists or create a new one""" if handler not in self.handl...
the_stack_v2_python_sparse
osarchiver/destination/file/sql.py
ovh/osarchiver
train
19
760d5168f4a32fc286485913717ee250692e0ba4
[ "log = ResultLog.ResultLog()\ntry:\n br = webdriver.Firefox()\nexcept:\n log.info('浏览器初始化失败了')\nbr.get('http://www.xebest.com:8000')\nreturn br", "log = ResultLog.ResultLog()\ntry:\n br = webdriver.Firefox()\nexcept:\n log.info('浏览器初始化失败了')\nbr.get('https://user.xebest.com:8443/loginAction!init.action...
<|body_start_0|> log = ResultLog.ResultLog() try: br = webdriver.Firefox() except: log.info('浏览器初始化失败了') br.get('http://www.xebest.com:8000') return br <|end_body_0|> <|body_start_1|> log = ResultLog.ResultLog() try: br = webdr...
Browser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Browser: def init_browser(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" <|body_0|> def init_browserByCustomerCenter(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" <|body_1|> def init_browserByRegister(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" ...
stack_v2_sparse_classes_36k_train_004006
1,205
no_license
[ { "docstring": "该函数主要是初始化浏览器对象并返回一个webdriver对象", "name": "init_browser", "signature": "def init_browser(self)" }, { "docstring": "该函数主要是初始化浏览器对象并返回一个webdriver对象", "name": "init_browserByCustomerCenter", "signature": "def init_browserByCustomerCenter(self)" }, { "docstring": "该函数主...
3
stack_v2_sparse_classes_30k_train_000727
Implement the Python class `Browser` described below. Class description: Implement the Browser class. Method signatures and docstrings: - def init_browser(self): 该函数主要是初始化浏览器对象并返回一个webdriver对象 - def init_browserByCustomerCenter(self): 该函数主要是初始化浏览器对象并返回一个webdriver对象 - def init_browserByRegister(self): 该函数主要是初始化浏览器对象并返...
Implement the Python class `Browser` described below. Class description: Implement the Browser class. Method signatures and docstrings: - def init_browser(self): 该函数主要是初始化浏览器对象并返回一个webdriver对象 - def init_browserByCustomerCenter(self): 该函数主要是初始化浏览器对象并返回一个webdriver对象 - def init_browserByRegister(self): 该函数主要是初始化浏览器对象并返...
4dd065806f20bfdec885fa2b40f2c22e5a8d4f15
<|skeleton|> class Browser: def init_browser(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" <|body_0|> def init_browserByCustomerCenter(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" <|body_1|> def init_browserByRegister(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Browser: def init_browser(self): """该函数主要是初始化浏览器对象并返回一个webdriver对象""" log = ResultLog.ResultLog() try: br = webdriver.Firefox() except: log.info('浏览器初始化失败了') br.get('http://www.xebest.com:8000') return br def init_browserByCustomerCe...
the_stack_v2_python_sparse
Action/Browser.py
Hardworking-tester/HuaYing
train
0
d6508d909d9da78ebf9728c295a7d38e159ac53f
[ "self.set_header('content-type', 'application/json')\ntry:\n user_list = UserDao().get_user_detail_list()\n manage_groups = GroupDao().get_manage_groups(self.group.id)\n result = [user for user in user_list if user['group_id'] in manage_groups]\n self.finish(json_dumps({'status': 200, 'msg': 'ok', 'valu...
<|body_start_0|> self.set_header('content-type', 'application/json') try: user_list = UserDao().get_user_detail_list() manage_groups = GroupDao().get_manage_groups(self.group.id) result = [user for user in user_list if user['group_id'] in manage_groups] se...
UserListHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserListHandler: def get(self): """list all users @API summary: list all users notes: get detail of users tags: - auth responses: '200': description: users schema: $ref: '#/definitions/User' default: description: Unexcepted error schema: $ref: '#/definitions/Error'""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_004007
6,245
permissive
[ { "docstring": "list all users @API summary: list all users notes: get detail of users tags: - auth responses: '200': description: users schema: $ref: '#/definitions/User' default: description: Unexcepted error schema: $ref: '#/definitions/Error'", "name": "get", "signature": "def get(self)" }, { ...
2
null
Implement the Python class `UserListHandler` described below. Class description: Implement the UserListHandler class. Method signatures and docstrings: - def get(self): list all users @API summary: list all users notes: get detail of users tags: - auth responses: '200': description: users schema: $ref: '#/definitions...
Implement the Python class `UserListHandler` described below. Class description: Implement the UserListHandler class. Method signatures and docstrings: - def get(self): list all users @API summary: list all users notes: get detail of users tags: - auth responses: '200': description: users schema: $ref: '#/definitions...
2e32e6e7b225e0bd87ee8c847c22862f12c51bb1
<|skeleton|> class UserListHandler: def get(self): """list all users @API summary: list all users notes: get detail of users tags: - auth responses: '200': description: users schema: $ref: '#/definitions/User' default: description: Unexcepted error schema: $ref: '#/definitions/Error'""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserListHandler: def get(self): """list all users @API summary: list all users notes: get detail of users tags: - auth responses: '200': description: users schema: $ref: '#/definitions/User' default: description: Unexcepted error schema: $ref: '#/definitions/Error'""" self.set_header('content-...
the_stack_v2_python_sparse
nebula/views/user.py
threathunterX/nebula_web
train
2
b41893c9d8fe370d24fde34039977d2efb92d2eb
[ "inv.Inventory.__init__(self, item_code, description, market_price, rental_price)\nself.material = material\nself.size = size", "outputdict = {}\noutputdict['item_code'] = self.item_code\noutputdict['description'] = self.description\noutputdict['market_price'] = self.market_price\noutputdict['rental_price'] = sel...
<|body_start_0|> inv.Inventory.__init__(self, item_code, description, market_price, rental_price) self.material = material self.size = size <|end_body_0|> <|body_start_1|> outputdict = {} outputdict['item_code'] = self.item_code outputdict['description'] = self.descripti...
some stuff5
Furniture
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Furniture: """some stuff5""" def __init__(self, item_code, description, market_price, rental_price, material, size): """some stuff6""" <|body_0|> def return_as_dictionary(self): """some stuff7""" <|body_1|> <|end_skeleton|> <|body_start_0|> inv....
stack_v2_sparse_classes_36k_train_004008
899
no_license
[ { "docstring": "some stuff6", "name": "__init__", "signature": "def __init__(self, item_code, description, market_price, rental_price, material, size)" }, { "docstring": "some stuff7", "name": "return_as_dictionary", "signature": "def return_as_dictionary(self)" } ]
2
stack_v2_sparse_classes_30k_train_009022
Implement the Python class `Furniture` described below. Class description: some stuff5 Method signatures and docstrings: - def __init__(self, item_code, description, market_price, rental_price, material, size): some stuff6 - def return_as_dictionary(self): some stuff7
Implement the Python class `Furniture` described below. Class description: some stuff5 Method signatures and docstrings: - def __init__(self, item_code, description, market_price, rental_price, material, size): some stuff6 - def return_as_dictionary(self): some stuff7 <|skeleton|> class Furniture: """some stuff5...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class Furniture: """some stuff5""" def __init__(self, item_code, description, market_price, rental_price, material, size): """some stuff6""" <|body_0|> def return_as_dictionary(self): """some stuff7""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Furniture: """some stuff5""" def __init__(self, item_code, description, market_price, rental_price, material, size): """some stuff6""" inv.Inventory.__init__(self, item_code, description, market_price, rental_price) self.material = material self.size = size def return...
the_stack_v2_python_sparse
students/ScotchWSplenda/lesson01/assignment/inventory_management/furniture_class.py
JavaRod/SP_Python220B_2019
train
1
f7438088a05c367827876095eefac71f75b3e724
[ "app = self.get_argument('app', default='')\ntype = self.get_argument('type', default='')\nsimple = self.get_argument('simple', default='false')\nsimple = simple == 'true'\nself.set_header('content-type', 'application/json')\ntry:\n result = EventModelDefaultDao().list_all_models()\n if app:\n result =...
<|body_start_0|> app = self.get_argument('app', default='') type = self.get_argument('type', default='') simple = self.get_argument('simple', default='false') simple = simple == 'true' self.set_header('content-type', 'application/json') try: result = EventMode...
EventModelListHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventModelListHandler: def get(self): """获取相应的event配置类型 @API summary: 获取相应的event配置类型 notes: 根据app和类型来获取相应的event tags: - default parameters: - name: app in: query required: false type: string description: event的app - name: type in: query required: false type: string description: event的类型 ...
stack_v2_sparse_classes_36k_train_004009
8,714
permissive
[ { "docstring": "获取相应的event配置类型 @API summary: 获取相应的event配置类型 notes: 根据app和类型来获取相应的event tags: - default parameters: - name: app in: query required: false type: string description: event的app - name: type in: query required: false type: string description: event的类型 - name: simple in: query required: false type: bo...
3
stack_v2_sparse_classes_30k_train_019025
Implement the Python class `EventModelListHandler` described below. Class description: Implement the EventModelListHandler class. Method signatures and docstrings: - def get(self): 获取相应的event配置类型 @API summary: 获取相应的event配置类型 notes: 根据app和类型来获取相应的event tags: - default parameters: - name: app in: query required: false ...
Implement the Python class `EventModelListHandler` described below. Class description: Implement the EventModelListHandler class. Method signatures and docstrings: - def get(self): 获取相应的event配置类型 @API summary: 获取相应的event配置类型 notes: 根据app和类型来获取相应的event tags: - default parameters: - name: app in: query required: false ...
2e32e6e7b225e0bd87ee8c847c22862f12c51bb1
<|skeleton|> class EventModelListHandler: def get(self): """获取相应的event配置类型 @API summary: 获取相应的event配置类型 notes: 根据app和类型来获取相应的event tags: - default parameters: - name: app in: query required: false type: string description: event的app - name: type in: query required: false type: string description: event的类型 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventModelListHandler: def get(self): """获取相应的event配置类型 @API summary: 获取相应的event配置类型 notes: 根据app和类型来获取相应的event tags: - default parameters: - name: app in: query required: false type: string description: event的app - name: type in: query required: false type: string description: event的类型 - name: simple...
the_stack_v2_python_sparse
nebula/views/event_model_default.py
threathunterX/nebula_web
train
2
c51c611608792ff2897a0c93478fa62d4cf29cd5
[ "if kwargs.get('configuration') is None and kwargs.get('connection_id') is None:\n kwargs['connection_id'] = PublicId('fetchai', 'http_client', '0.1.0')\nsuper().__init__(**kwargs)\nself.channel = HTTPClientChannel(self.address, provider_address, provider_port, connection_id=self.connection_id, excluded_protocol...
<|body_start_0|> if kwargs.get('configuration') is None and kwargs.get('connection_id') is None: kwargs['connection_id'] = PublicId('fetchai', 'http_client', '0.1.0') super().__init__(**kwargs) self.channel = HTTPClientChannel(self.address, provider_address, provider_port, connection...
Proxy to the functionality of the web client.
HTTPClientConnection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTTPClientConnection: """Proxy to the functionality of the web client.""" def __init__(self, provider_address: str, provider_port: int, **kwargs): """Initialize a connection. :param provider_address: server hostname / IP address :param provider_port: server port number""" <|b...
stack_v2_sparse_classes_36k_train_004010
9,528
permissive
[ { "docstring": "Initialize a connection. :param provider_address: server hostname / IP address :param provider_port: server port number", "name": "__init__", "signature": "def __init__(self, provider_address: str, provider_port: int, **kwargs)" }, { "docstring": "Connect to a HTTP server. :retur...
6
stack_v2_sparse_classes_30k_train_007188
Implement the Python class `HTTPClientConnection` described below. Class description: Proxy to the functionality of the web client. Method signatures and docstrings: - def __init__(self, provider_address: str, provider_port: int, **kwargs): Initialize a connection. :param provider_address: server hostname / IP addres...
Implement the Python class `HTTPClientConnection` described below. Class description: Proxy to the functionality of the web client. Method signatures and docstrings: - def __init__(self, provider_address: str, provider_port: int, **kwargs): Initialize a connection. :param provider_address: server hostname / IP addres...
9bd1d51530fc21bf41b5adea031cda19a94b048b
<|skeleton|> class HTTPClientConnection: """Proxy to the functionality of the web client.""" def __init__(self, provider_address: str, provider_port: int, **kwargs): """Initialize a connection. :param provider_address: server hostname / IP address :param provider_port: server port number""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HTTPClientConnection: """Proxy to the functionality of the web client.""" def __init__(self, provider_address: str, provider_port: int, **kwargs): """Initialize a connection. :param provider_address: server hostname / IP address :param provider_port: server port number""" if kwargs.get('c...
the_stack_v2_python_sparse
packages/fetchai/connections/http_client/connection.py
pbukva/agents-aea
train
0
41a99e6f5963771541a3d24bf3b54f019328a3e0
[ "with document.file.open('rb') as file:\n text = extract_text(BytesIO(file.read()))\nreturn text", "with document.file.open('rb') as file:\n result = mammoth.extract_raw_text(file)\nreturn result.value" ]
<|body_start_0|> with document.file.open('rb') as file: text = extract_text(BytesIO(file.read())) return text <|end_body_0|> <|body_start_1|> with document.file.open('rb') as file: result = mammoth.extract_raw_text(file) return result.value <|end_body_1|>
Extract files text
TextExtractor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextExtractor: """Extract files text""" def from_pdf(document): """Extract pdf text""" <|body_0|> def from_docx(document): """Extract docx text""" <|body_1|> <|end_skeleton|> <|body_start_0|> with document.file.open('rb') as file: te...
stack_v2_sparse_classes_36k_train_004011
883
permissive
[ { "docstring": "Extract pdf text", "name": "from_pdf", "signature": "def from_pdf(document)" }, { "docstring": "Extract docx text", "name": "from_docx", "signature": "def from_docx(document)" } ]
2
stack_v2_sparse_classes_30k_train_001122
Implement the Python class `TextExtractor` described below. Class description: Extract files text Method signatures and docstrings: - def from_pdf(document): Extract pdf text - def from_docx(document): Extract docx text
Implement the Python class `TextExtractor` described below. Class description: Extract files text Method signatures and docstrings: - def from_pdf(document): Extract pdf text - def from_docx(document): Extract docx text <|skeleton|> class TextExtractor: """Extract files text""" def from_pdf(document): ...
22e4afa728a851bb4c2479fbb6f5944a75984b9b
<|skeleton|> class TextExtractor: """Extract files text""" def from_pdf(document): """Extract pdf text""" <|body_0|> def from_docx(document): """Extract docx text""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextExtractor: """Extract files text""" def from_pdf(document): """Extract pdf text""" with document.file.open('rb') as file: text = extract_text(BytesIO(file.read())) return text def from_docx(document): """Extract docx text""" with document.file....
the_stack_v2_python_sparse
src/backend/partaj/core/services/file_handler.py
MTES-MCT/partaj
train
4
5434cb3fceed40c7c842d5f1b4b2b38b78f57d81
[ "self.maxheap = []\nself.minheap = []\nself.median = -sys.maxint - 1", "heapq.heappush(self.maxheap, -num)\nt = heapq.heappop(self.maxheap)\nheapq.heappush(self.minheap, -t)\nif len(self.minheap) > len(self.maxheap):\n x = heapq.heappop(self.minheap)\n heapq.heappush(self.maxheap, -x)", "m, n = (len(self....
<|body_start_0|> self.maxheap = [] self.minheap = [] self.median = -sys.maxint - 1 <|end_body_0|> <|body_start_1|> heapq.heappush(self.maxheap, -num) t = heapq.heappop(self.maxheap) heapq.heappush(self.minheap, -t) if len(self.minheap) > len(self.maxheap): ...
MedianFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedianFinder: def __init__(self): """Initialize your data structure here.""" <|body_0|> def addNum(self, num): """Adds a num into the data structure. :type num: int :rtype: void""" <|body_1|> def findMedian(self): """Returns the median of current...
stack_v2_sparse_classes_36k_train_004012
966
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Adds a num into the data structure. :type num: int :rtype: void", "name": "addNum", "signature": "def addNum(self, num)" }, { "docstring": "Returns the ...
3
stack_v2_sparse_classes_30k_val_000462
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def addNum(self, num): Adds a num into the data structure. :type num: int :rtype: void - def findMedian(self): ...
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def addNum(self, num): Adds a num into the data structure. :type num: int :rtype: void - def findMedian(self): ...
f46ab3bcafbca4d0209df3aa9114dad52bda76b2
<|skeleton|> class MedianFinder: def __init__(self): """Initialize your data structure here.""" <|body_0|> def addNum(self, num): """Adds a num into the data structure. :type num: int :rtype: void""" <|body_1|> def findMedian(self): """Returns the median of current...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MedianFinder: def __init__(self): """Initialize your data structure here.""" self.maxheap = [] self.minheap = [] self.median = -sys.maxint - 1 def addNum(self, num): """Adds a num into the data structure. :type num: int :rtype: void""" heapq.heappush(self.m...
the_stack_v2_python_sparse
findMedian.py
ankitomss/python_practice
train
0
1cac1555a7173861e64dcd0166c179adbda9b727
[ "if compute is None:\n compute = impl.get_runtime().default_ip\nreturn tf_impl.type_factory.custom_int(bits, signed, compute)", "frac_type = Quant.int(bits=frac, signed=signed, compute=ti.i32)\nif signed:\n scale = range / 2 ** (frac - 1)\nelse:\n scale = range / 2 ** frac\nif compute is None:\n compu...
<|body_start_0|> if compute is None: compute = impl.get_runtime().default_ip return tf_impl.type_factory.custom_int(bits, signed, compute) <|end_body_0|> <|body_start_1|> frac_type = Quant.int(bits=frac, signed=signed, compute=ti.i32) if signed: scale = range / 2...
Generator of quantized types. For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf.
Quant
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Quant: """Generator of quantized types. For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf.""" def int(bits, signed=False, compute=None): """Generates a quantized type for integers. Args: bits (int): Number of bits. signed (bool): Signe...
stack_v2_sparse_classes_36k_train_004013
2,606
permissive
[ { "docstring": "Generates a quantized type for integers. Args: bits (int): Number of bits. signed (bool): Signed or unsigned. compute (DataType): Type for computation. Returns: DataType: The specified type.", "name": "int", "signature": "def int(bits, signed=False, compute=None)" }, { "docstring...
3
stack_v2_sparse_classes_30k_train_007879
Implement the Python class `Quant` described below. Class description: Generator of quantized types. For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf. Method signatures and docstrings: - def int(bits, signed=False, compute=None): Generates a quantized type for integer...
Implement the Python class `Quant` described below. Class description: Generator of quantized types. For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf. Method signatures and docstrings: - def int(bits, signed=False, compute=None): Generates a quantized type for integer...
c9b8166d7b019734438232d9b247eb3555e0d6f0
<|skeleton|> class Quant: """Generator of quantized types. For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf.""" def int(bits, signed=False, compute=None): """Generates a quantized type for integers. Args: bits (int): Number of bits. signed (bool): Signe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Quant: """Generator of quantized types. For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf.""" def int(bits, signed=False, compute=None): """Generates a quantized type for integers. Args: bits (int): Number of bits. signed (bool): Signed or unsigned...
the_stack_v2_python_sparse
python/taichi/lang/quant_impl.py
ljcc0930/taichi
train
2
227d3b2c5ec60b422a3a2448e92725b3408b44e0
[ "if isinstance(obs, np.ndarray) and obs.ndim == 2:\n obs = [obs[:, i] for i in range(obs.shape[1])]\nif isinstance(sigs, np.ndarray) and sigs.ndim == 2:\n sigs = [sigs[:, i] for i in range(sigs.shape[1])]\nif (ms_obs or ms_feat) and ms_warn:\n PE.warn(PE.PyAValError(f'Be aware: Mean will be subtracted from...
<|body_start_0|> if isinstance(obs, np.ndarray) and obs.ndim == 2: obs = [obs[:, i] for i in range(obs.shape[1])] if isinstance(sigs, np.ndarray) and sigs.ndim == 2: sigs = [sigs[:, i] for i in range(sigs.shape[1])] if (ms_obs or ms_feat) and ms_warn: PE.warn(...
SysRem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SysRem: def __init__(self, obs, sigs, ms_obs=True, ms_feat=False, a0=None, ms_warn=True): """Implementation of the SysRem algorithm. SysRem was described by `Tamuz et al. 2005 (MNRAS 356, 1466) <https://ui.adsabs.harvard.edu/abs/2005MNRAS.356.1466T/abstract>`_ in the context of correctin...
stack_v2_sparse_classes_36k_train_004014
11,569
permissive
[ { "docstring": "Implementation of the SysRem algorithm. SysRem was described by `Tamuz et al. 2005 (MNRAS 356, 1466) <https://ui.adsabs.harvard.edu/abs/2005MNRAS.356.1466T/abstract>`_ in the context of correcting systematic effects in samples of light curves, but has been applied in other areas such as planetar...
4
stack_v2_sparse_classes_30k_train_015726
Implement the Python class `SysRem` described below. Class description: Implement the SysRem class. Method signatures and docstrings: - def __init__(self, obs, sigs, ms_obs=True, ms_feat=False, a0=None, ms_warn=True): Implementation of the SysRem algorithm. SysRem was described by `Tamuz et al. 2005 (MNRAS 356, 1466)...
Implement the Python class `SysRem` described below. Class description: Implement the SysRem class. Method signatures and docstrings: - def __init__(self, obs, sigs, ms_obs=True, ms_feat=False, a0=None, ms_warn=True): Implementation of the SysRem algorithm. SysRem was described by `Tamuz et al. 2005 (MNRAS 356, 1466)...
e85314678882624baf870443c670b4f5abb70e7d
<|skeleton|> class SysRem: def __init__(self, obs, sigs, ms_obs=True, ms_feat=False, a0=None, ms_warn=True): """Implementation of the SysRem algorithm. SysRem was described by `Tamuz et al. 2005 (MNRAS 356, 1466) <https://ui.adsabs.harvard.edu/abs/2005MNRAS.356.1466T/abstract>`_ in the context of correctin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SysRem: def __init__(self, obs, sigs, ms_obs=True, ms_feat=False, a0=None, ms_warn=True): """Implementation of the SysRem algorithm. SysRem was described by `Tamuz et al. 2005 (MNRAS 356, 1466) <https://ui.adsabs.harvard.edu/abs/2005MNRAS.356.1466T/abstract>`_ in the context of correcting systematic e...
the_stack_v2_python_sparse
src/pyasl/asl/aslExt_1/sysrem.py
sczesla/PyAstronomy
train
129
496d6c0f27d5661dc42b57e1d0732a8168fe47b3
[ "self.__spiDAC = spidev.SpiDev()\nself.__spiDAC.open(0, 1)\nself.__spiDAC.max_speed_hz = 20000000\nif gainFactor != 1 and gainFactor != 2:\n raise ValueError('DAC __init__: Invalid gain factor. Must be 1 or 2')\nelse:\n self.gain = gainFactor\n self.maxdacvoltage = self.__dacMax...
<|body_start_0|> self.__spiDAC = spidev.SpiDev() self.__spiDAC.open(0, 1) self.__spiDAC.max_speed_hz = 20000000 if gainFactor != 1 and gainFactor != 2: raise ValueError('DAC __init__: Invalid gain factor. Must be 1 or 2') else: ...
Based on the Microchip MCP4822 Define SPI bus and init
DAC
[ "Apache-2.0", "GPL-2.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DAC: """Based on the Microchip MCP4822 Define SPI bus and init""" def __init__(self, gainFactor=1): """Class Constructor gainFactor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Whe...
stack_v2_sparse_classes_36k_train_004015
31,508
permissive
[ { "docstring": "Class Constructor gainFactor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G is gain factor, Vref (for this chip) is 2.048 and D is the 12-bit digital value", "name": "__init__", ...
3
stack_v2_sparse_classes_30k_train_006430
Implement the Python class `DAC` described below. Class description: Based on the Microchip MCP4822 Define SPI bus and init Method signatures and docstrings: - def __init__(self, gainFactor=1): Class Constructor gainFactor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine outp...
Implement the Python class `DAC` described below. Class description: Based on the Microchip MCP4822 Define SPI bus and init Method signatures and docstrings: - def __init__(self, gainFactor=1): Class Constructor gainFactor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine outp...
2529ca149d7f584ede780de1cb695a2f55b7031f
<|skeleton|> class DAC: """Based on the Microchip MCP4822 Define SPI bus and init""" def __init__(self, gainFactor=1): """Class Constructor gainFactor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Whe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DAC: """Based on the Microchip MCP4822 Define SPI bus and init""" def __init__(self, gainFactor=1): """Class Constructor gainFactor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G is gain ...
the_stack_v2_python_sparse
reinvent-2020/RhythmCloud/lib/ABElectronics_Python_Libraries/ExpanderPi/ExpanderPi.py
aws-samples/aws-builders-fair-projects
train
89
72ac68bffa1d84db40cb76f5cdc7565ea8dd241e
[ "coleccion = Coleccion\ncoleccion.dic_imgs = {0: ('suj1', 'img1'), 1: ('suj1', 'img2'), 2: ('suj2', 'img1'), 3: ('suj2', 'img2')}\ncoleccion.total_sujs = 2\ncoleccion.total_imgs = 4\nentrenamiento = object.__new__(Entrenamiento)\nentrenamiento.obt_indices_entrenamiento(coleccion, 70)\nself.assertTrue(len(entrenamie...
<|body_start_0|> coleccion = Coleccion coleccion.dic_imgs = {0: ('suj1', 'img1'), 1: ('suj1', 'img2'), 2: ('suj2', 'img1'), 3: ('suj2', 'img2')} coleccion.total_sujs = 2 coleccion.total_imgs = 4 entrenamiento = object.__new__(Entrenamiento) entrenamiento.obt_indices_entre...
Clase encargada de probar funciones y fragmentos importantes de código para el modulo modelo.entrenamiento
TestEntrenamiento
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEntrenamiento: """Clase encargada de probar funciones y fragmentos importantes de código para el modulo modelo.entrenamiento""" def test_obt_indices_entrenamiento(self): """Entradas: Coleccion y el porcentaje de la coleccion que vamos a utilizar para el entrenamiento Resultado es...
stack_v2_sparse_classes_36k_train_004016
6,512
no_license
[ { "docstring": "Entradas: Coleccion y el porcentaje de la coleccion que vamos a utilizar para el entrenamiento Resultado esperado: Lista de indices que representan una imagen dentro de la coleccion. Se debe haber tomado igual cantidad de imagenes para cada sujeto @param Sin parametros @return Sin retorno", ...
5
stack_v2_sparse_classes_30k_train_005587
Implement the Python class `TestEntrenamiento` described below. Class description: Clase encargada de probar funciones y fragmentos importantes de código para el modulo modelo.entrenamiento Method signatures and docstrings: - def test_obt_indices_entrenamiento(self): Entradas: Coleccion y el porcentaje de la coleccio...
Implement the Python class `TestEntrenamiento` described below. Class description: Clase encargada de probar funciones y fragmentos importantes de código para el modulo modelo.entrenamiento Method signatures and docstrings: - def test_obt_indices_entrenamiento(self): Entradas: Coleccion y el porcentaje de la coleccio...
30513a8b81cbb97ee475855c75628419a207c0e0
<|skeleton|> class TestEntrenamiento: """Clase encargada de probar funciones y fragmentos importantes de código para el modulo modelo.entrenamiento""" def test_obt_indices_entrenamiento(self): """Entradas: Coleccion y el porcentaje de la coleccion que vamos a utilizar para el entrenamiento Resultado es...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestEntrenamiento: """Clase encargada de probar funciones y fragmentos importantes de código para el modulo modelo.entrenamiento""" def test_obt_indices_entrenamiento(self): """Entradas: Coleccion y el porcentaje de la coleccion que vamos a utilizar para el entrenamiento Resultado esperado: Lista...
the_stack_v2_python_sparse
Codigo/pruebas/unitarias/test_entrenamiento.py
JulianSalinas/eigenfaces-qa
train
0
7c8a599d62fc0b5e9012f440a9613baf220951de
[ "queryset = self.queryset.filter(reply_type=kwargs['reply_type'])\nreply_account = self.request.query_params.get('reply_account')\nif reply_account:\n queryset = queryset.filter(reply_account=reply_account)\nif queryset.first() is None:\n return Response(dict(data=None))\nelse:\n serializer = self.get_seri...
<|body_start_0|> queryset = self.queryset.filter(reply_type=kwargs['reply_type']) reply_account = self.request.query_params.get('reply_account') if reply_account: queryset = queryset.filter(reply_account=reply_account) if queryset.first() is None: return Response(...
关注回复或消息回复
MessageAndAttentionReplyViewManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageAndAttentionReplyViewManager: """关注回复或消息回复""" def retrieve(self, request, *args, **kwargs): """检索关注回复或消息回复""" <|body_0|> def create_or_update(self, request, *args, **kwargs): """新建关注回复或消息回复""" <|body_1|> def update_status(self, request, *args,...
stack_v2_sparse_classes_36k_train_004017
5,675
no_license
[ { "docstring": "检索关注回复或消息回复", "name": "retrieve", "signature": "def retrieve(self, request, *args, **kwargs)" }, { "docstring": "新建关注回复或消息回复", "name": "create_or_update", "signature": "def create_or_update(self, request, *args, **kwargs)" }, { "docstring": "删除关注回复或消息回复", "nam...
3
stack_v2_sparse_classes_30k_train_019616
Implement the Python class `MessageAndAttentionReplyViewManager` described below. Class description: 关注回复或消息回复 Method signatures and docstrings: - def retrieve(self, request, *args, **kwargs): 检索关注回复或消息回复 - def create_or_update(self, request, *args, **kwargs): 新建关注回复或消息回复 - def update_status(self, request, *args, **k...
Implement the Python class `MessageAndAttentionReplyViewManager` described below. Class description: 关注回复或消息回复 Method signatures and docstrings: - def retrieve(self, request, *args, **kwargs): 检索关注回复或消息回复 - def create_or_update(self, request, *args, **kwargs): 新建关注回复或消息回复 - def update_status(self, request, *args, **k...
0d32f98f42591b43e0b4da5e978b627da517f758
<|skeleton|> class MessageAndAttentionReplyViewManager: """关注回复或消息回复""" def retrieve(self, request, *args, **kwargs): """检索关注回复或消息回复""" <|body_0|> def create_or_update(self, request, *args, **kwargs): """新建关注回复或消息回复""" <|body_1|> def update_status(self, request, *args,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MessageAndAttentionReplyViewManager: """关注回复或消息回复""" def retrieve(self, request, *args, **kwargs): """检索关注回复或消息回复""" queryset = self.queryset.filter(reply_type=kwargs['reply_type']) reply_account = self.request.query_params.get('reply_account') if reply_account: ...
the_stack_v2_python_sparse
payserver/padmin/views/subscription_account_manage.py
yiyuhao/FukuanUnion
train
0
d73fbd63a078effc9dcfc66f1b37f5122cfa1984
[ "print(f'Algorithm: {params.algorithm_key}')\nprint(f'Hyperparamters: {params.algorithm_hyperparameters}')\nvideo_record_path = params.save_folder if params.video_record_test else None\nif params.algorithm_key in ['DDPG', 'DQN', 'TD3']:\n print('Setting number of train environments to 1 because apparently', para...
<|body_start_0|> print(f'Algorithm: {params.algorithm_key}') print(f'Hyperparamters: {params.algorithm_hyperparameters}') video_record_path = params.save_folder if params.video_record_test else None if params.algorithm_key in ['DDPG', 'DQN', 'TD3']: print('Setting number of t...
Trainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trainer: def prepare(self, params: ConfigParams): """Prepares parameters required for training :param params: :return:""" <|body_0|> def train(self, **kwargs): """Starts training procedure :param kwargs: :return:""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_004018
3,310
no_license
[ { "docstring": "Prepares parameters required for training :param params: :return:", "name": "prepare", "signature": "def prepare(self, params: ConfigParams)" }, { "docstring": "Starts training procedure :param kwargs: :return:", "name": "train", "signature": "def train(self, **kwargs)" ...
2
stack_v2_sparse_classes_30k_train_013776
Implement the Python class `Trainer` described below. Class description: Implement the Trainer class. Method signatures and docstrings: - def prepare(self, params: ConfigParams): Prepares parameters required for training :param params: :return: - def train(self, **kwargs): Starts training procedure :param kwargs: :re...
Implement the Python class `Trainer` described below. Class description: Implement the Trainer class. Method signatures and docstrings: - def prepare(self, params: ConfigParams): Prepares parameters required for training :param params: :return: - def train(self, **kwargs): Starts training procedure :param kwargs: :re...
a6135e1b1836266beacc8ec0a5c6c3b5bbaa2b97
<|skeleton|> class Trainer: def prepare(self, params: ConfigParams): """Prepares parameters required for training :param params: :return:""" <|body_0|> def train(self, **kwargs): """Starts training procedure :param kwargs: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Trainer: def prepare(self, params: ConfigParams): """Prepares parameters required for training :param params: :return:""" print(f'Algorithm: {params.algorithm_key}') print(f'Hyperparamters: {params.algorithm_hyperparameters}') video_record_path = params.save_folder if params.vi...
the_stack_v2_python_sparse
exp/training/trainer.py
bartekwojcik/SportBettingRL
train
0
71d4689d054126195b899474efa7654b0eec14bb
[ "s = 'nothingremovedhere'\nresult = findbestmatch._clean_non_chars(s)\nself.assertEqual(s, result)", "s = '#$%#^$%&**'\nresult = findbestmatch._clean_non_chars(s)\nself.assertEqual('', result)", "s = ''\nresult = findbestmatch._clean_non_chars(s)\nself.assertEqual('', result)" ]
<|body_start_0|> s = 'nothingremovedhere' result = findbestmatch._clean_non_chars(s) self.assertEqual(s, result) <|end_body_0|> <|body_start_1|> s = '#$%#^$%&**' result = findbestmatch._clean_non_chars(s) self.assertEqual('', result) <|end_body_1|> <|body_start_2|> ...
TestFindBestMatch
[ "BSD-3-Clause", "LGPL-2.1-or-later", "LGPL-2.1-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFindBestMatch: def testclean_text_1(self): """Test for _clean_non_chars (alphanumeric symbols)""" <|body_0|> def testclean_text_2(self): """Test for _clean_non_chars (special symbols)""" <|body_1|> def testclean_text_3(self): """Test for _cle...
stack_v2_sparse_classes_36k_train_004019
4,823
permissive
[ { "docstring": "Test for _clean_non_chars (alphanumeric symbols)", "name": "testclean_text_1", "signature": "def testclean_text_1(self)" }, { "docstring": "Test for _clean_non_chars (special symbols)", "name": "testclean_text_2", "signature": "def testclean_text_2(self)" }, { "do...
3
stack_v2_sparse_classes_30k_train_016581
Implement the Python class `TestFindBestMatch` described below. Class description: Implement the TestFindBestMatch class. Method signatures and docstrings: - def testclean_text_1(self): Test for _clean_non_chars (alphanumeric symbols) - def testclean_text_2(self): Test for _clean_non_chars (special symbols) - def tes...
Implement the Python class `TestFindBestMatch` described below. Class description: Implement the TestFindBestMatch class. Method signatures and docstrings: - def testclean_text_1(self): Test for _clean_non_chars (alphanumeric symbols) - def testclean_text_2(self): Test for _clean_non_chars (special symbols) - def tes...
bf7f789d01b7c66ccd0c213db0a029da7e588c9e
<|skeleton|> class TestFindBestMatch: def testclean_text_1(self): """Test for _clean_non_chars (alphanumeric symbols)""" <|body_0|> def testclean_text_2(self): """Test for _clean_non_chars (special symbols)""" <|body_1|> def testclean_text_3(self): """Test for _cle...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestFindBestMatch: def testclean_text_1(self): """Test for _clean_non_chars (alphanumeric symbols)""" s = 'nothingremovedhere' result = findbestmatch._clean_non_chars(s) self.assertEqual(s, result) def testclean_text_2(self): """Test for _clean_non_chars (special s...
the_stack_v2_python_sparse
pywinauto/unittests/test_findbestmatch.py
pywinauto/pywinauto
train
4,466
4c8b0a33e51f216919a8f2a7ebb33e8e2cc477dd
[ "self.model = model\nself.pca_components = pca_components\nself.model_params = model_params", "self.model_final = self.model.set_params(**self.model_params)\nself.pca = PCA(n_components=self.pca_components)\nX_small = self.pca.fit_transform(X)\nself.model_final.fit(X_small, y)", "X_small = self.pca.transform(X)...
<|body_start_0|> self.model = model self.pca_components = pca_components self.model_params = model_params <|end_body_0|> <|body_start_1|> self.model_final = self.model.set_params(**self.model_params) self.pca = PCA(n_components=self.pca_components) X_small = self.pca.fit...
Model that first do PCA on the data before it fits's data on the model
Model
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Model: """Model that first do PCA on the data before it fits's data on the model""" def __init__(self, model=None, pca_components=1, model_params={}): """:param model: model to fit, predict :param pca_components: param for PCA :param model_params: parameters for the model""" ...
stack_v2_sparse_classes_36k_train_004020
4,723
no_license
[ { "docstring": ":param model: model to fit, predict :param pca_components: param for PCA :param model_params: parameters for the model", "name": "__init__", "signature": "def __init__(self, model=None, pca_components=1, model_params={})" }, { "docstring": "First transform the data with PCA and t...
3
stack_v2_sparse_classes_30k_train_005929
Implement the Python class `Model` described below. Class description: Model that first do PCA on the data before it fits's data on the model Method signatures and docstrings: - def __init__(self, model=None, pca_components=1, model_params={}): :param model: model to fit, predict :param pca_components: param for PCA ...
Implement the Python class `Model` described below. Class description: Model that first do PCA on the data before it fits's data on the model Method signatures and docstrings: - def __init__(self, model=None, pca_components=1, model_params={}): :param model: model to fit, predict :param pca_components: param for PCA ...
62e386d81ffc5dab7165ea228f62861c4bbee57b
<|skeleton|> class Model: """Model that first do PCA on the data before it fits's data on the model""" def __init__(self, model=None, pca_components=1, model_params={}): """:param model: model to fit, predict :param pca_components: param for PCA :param model_params: parameters for the model""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Model: """Model that first do PCA on the data before it fits's data on the model""" def __init__(self, model=None, pca_components=1, model_params={}): """:param model: model to fit, predict :param pca_components: param for PCA :param model_params: parameters for the model""" self.model = ...
the_stack_v2_python_sparse
src/plot_quality_prediction/quality_prediction.py
AndrejHafner/how-good-is-my-plot
train
3
9df8371d80eaab48fc3f2ccc9e817943a7e4ea1a
[ "try:\n if isinstance(lvl, int) and min(_utils.LEVELS) <= lvl <= max(_utils.LEVELS):\n return _utils.REPR_INT\n if isinstance(lvl, str):\n if lvl in _utils.REVERSE_NAMES:\n return _utils.REPR_NAME\n elif min(_utils.LEVELS) <= int(lvl) <= max(_utils.LEVELS):\n return ...
<|body_start_0|> try: if isinstance(lvl, int) and min(_utils.LEVELS) <= lvl <= max(_utils.LEVELS): return _utils.REPR_INT if isinstance(lvl, str): if lvl in _utils.REVERSE_NAMES: return _utils.REPR_NAME elif min(_utils.L...
_utils
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _utils: def getReprType(lvl): """For the given log level argument, return its type: REPR_INT, REPR_NAME, or REPR_STR. For example: 2 -> REPR_INT "INFO" -> REPR_NAME "2" -> REPR_STR If `lvl` is not a valid log level, return None.""" <|body_0|> def normalize(lvl): """C...
stack_v2_sparse_classes_36k_train_004021
34,035
permissive
[ { "docstring": "For the given log level argument, return its type: REPR_INT, REPR_NAME, or REPR_STR. For example: 2 -> REPR_INT \"INFO\" -> REPR_NAME \"2\" -> REPR_STR If `lvl` is not a valid log level, return None.", "name": "getReprType", "signature": "def getReprType(lvl)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_003033
Implement the Python class `_utils` described below. Class description: Implement the _utils class. Method signatures and docstrings: - def getReprType(lvl): For the given log level argument, return its type: REPR_INT, REPR_NAME, or REPR_STR. For example: 2 -> REPR_INT "INFO" -> REPR_NAME "2" -> REPR_STR If `lvl` is ...
Implement the Python class `_utils` described below. Class description: Implement the _utils class. Method signatures and docstrings: - def getReprType(lvl): For the given log level argument, return its type: REPR_INT, REPR_NAME, or REPR_STR. For example: 2 -> REPR_INT "INFO" -> REPR_NAME "2" -> REPR_STR If `lvl` is ...
6b873defc9327d6f8b51a826dd7a7ef6c3e41396
<|skeleton|> class _utils: def getReprType(lvl): """For the given log level argument, return its type: REPR_INT, REPR_NAME, or REPR_STR. For example: 2 -> REPR_INT "INFO" -> REPR_NAME "2" -> REPR_STR If `lvl` is not a valid log level, return None.""" <|body_0|> def normalize(lvl): """C...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _utils: def getReprType(lvl): """For the given log level argument, return its type: REPR_INT, REPR_NAME, or REPR_STR. For example: 2 -> REPR_INT "INFO" -> REPR_NAME "2" -> REPR_STR If `lvl` is not a valid log level, return None.""" try: if isinstance(lvl, int) and min(_utils.LEVELS...
the_stack_v2_python_sparse
shared/log.py
joseangel-sc/conducto
train
1
f5814a14cac21a6a84bc92c72c371ecb179231b1
[ "engine = db_connect()\ncreate_nieuws_table(engine)\nself.Session = sessionmaker(bind=engine)", "session = self.Session()\nnieuws = Nieuws(**item)\ntry:\n session.add(nieuws)\n session.commit()\nexcept:\n session.rollback()\n raise\nfinally:\n session.close()\nreturn item" ]
<|body_start_0|> engine = db_connect() create_nieuws_table(engine) self.Session = sessionmaker(bind=engine) <|end_body_0|> <|body_start_1|> session = self.Session() nieuws = Nieuws(**item) try: session.add(nieuws) session.commit() except: ...
Nieuws pipeline for storing scraped items in the database
NieuwsPipeline
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NieuwsPipeline: """Nieuws pipeline for storing scraped items in the database""" def __init__(self): """Initializes database connection and sessionmaker. Creates nieuws table.""" <|body_0|> def process_item(self, item, spider): """Save nieuws in the database. This...
stack_v2_sparse_classes_36k_train_004022
882
no_license
[ { "docstring": "Initializes database connection and sessionmaker. Creates nieuws table.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Save nieuws in the database. This method is called for every item pipeline component.", "name": "process_item", "signature": ...
2
stack_v2_sparse_classes_30k_val_000887
Implement the Python class `NieuwsPipeline` described below. Class description: Nieuws pipeline for storing scraped items in the database Method signatures and docstrings: - def __init__(self): Initializes database connection and sessionmaker. Creates nieuws table. - def process_item(self, item, spider): Save nieuws ...
Implement the Python class `NieuwsPipeline` described below. Class description: Nieuws pipeline for storing scraped items in the database Method signatures and docstrings: - def __init__(self): Initializes database connection and sessionmaker. Creates nieuws table. - def process_item(self, item, spider): Save nieuws ...
14e4427ae3e1bc047f7b747b07eb65201643892d
<|skeleton|> class NieuwsPipeline: """Nieuws pipeline for storing scraped items in the database""" def __init__(self): """Initializes database connection and sessionmaker. Creates nieuws table.""" <|body_0|> def process_item(self, item, spider): """Save nieuws in the database. This...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NieuwsPipeline: """Nieuws pipeline for storing scraped items in the database""" def __init__(self): """Initializes database connection and sessionmaker. Creates nieuws table.""" engine = db_connect() create_nieuws_table(engine) self.Session = sessionmaker(bind=engine) ...
the_stack_v2_python_sparse
scrapers/nieuws/pipelines.py
timostrating/ponypicpy
train
1
5ffe2ba1dd325b0a8488a81e4a0f539e86c069b4
[ "self.sumList = []\na = 0\nfor num in nums:\n a += num\n self.sumList.append(a)", "if i == 0:\n return self.sumList[j]\nreturn self.sumList[j] - self.sumList[i - 1]" ]
<|body_start_0|> self.sumList = [] a = 0 for num in nums: a += num self.sumList.append(a) <|end_body_0|> <|body_start_1|> if i == 0: return self.sumList[j] return self.sumList[j] - self.sumList[i - 1] <|end_body_1|>
记录一个累和数组
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: """记录一个累和数组""" def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.sumList = [] a = 0 ...
stack_v2_sparse_classes_36k_train_004023
645
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
stack_v2_sparse_classes_30k_train_003483
Implement the Python class `NumArray` described below. Class description: 记录一个累和数组 Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: 记录一个累和数组 Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: """记录一个累和数组""" def __init__(self, nums): ...
7167f1a7c6cb16cca63675c80037682752ee2a7d
<|skeleton|> class NumArray: """记录一个累和数组""" def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: """记录一个累和数组""" def __init__(self, nums): """:type nums: List[int]""" self.sumList = [] a = 0 for num in nums: a += num self.sumList.append(a) def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" if i =...
the_stack_v2_python_sparse
Everyday/No303.py
kikihiter/LeetCode2
train
4
4a269258154b8515146db12d6e7ca6d32b89b919
[ "rs_field = hyperopt_utils.get_search_algorithm_random_state_field(self.type)\nif rs_field is not None and self.__getattribute__(rs_field) is None:\n self.__setattr__(rs_field, ludwig_random_state)", "missing_packages = []\nmissing_installs = []\nfor package_name, install_name in hyperopt_utils.get_search_algo...
<|body_start_0|> rs_field = hyperopt_utils.get_search_algorithm_random_state_field(self.type) if rs_field is not None and self.__getattribute__(rs_field) is None: self.__setattr__(rs_field, ludwig_random_state) <|end_body_0|> <|body_start_1|> missing_packages = [] missing_in...
Basic search algorithm settings.
BaseSearchAlgorithmConfig
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseSearchAlgorithmConfig: """Basic search algorithm settings.""" def set_random_state(self, ludwig_random_state: int) -> None: """Overwrite the config random state. Search algorithms refer to random state by different names, however we want to overwrite unset random states with the ...
stack_v2_sparse_classes_36k_train_004024
22,089
permissive
[ { "docstring": "Overwrite the config random state. Search algorithms refer to random state by different names, however we want to overwrite unset random states with the Ludwig random state. This method uses a registry of random state field names to provide a single interface across all search algorithms.", ...
2
null
Implement the Python class `BaseSearchAlgorithmConfig` described below. Class description: Basic search algorithm settings. Method signatures and docstrings: - def set_random_state(self, ludwig_random_state: int) -> None: Overwrite the config random state. Search algorithms refer to random state by different names, h...
Implement the Python class `BaseSearchAlgorithmConfig` described below. Class description: Basic search algorithm settings. Method signatures and docstrings: - def set_random_state(self, ludwig_random_state: int) -> None: Overwrite the config random state. Search algorithms refer to random state by different names, h...
e1d023e41606c9b76b35e1d231c2f13368a30eca
<|skeleton|> class BaseSearchAlgorithmConfig: """Basic search algorithm settings.""" def set_random_state(self, ludwig_random_state: int) -> None: """Overwrite the config random state. Search algorithms refer to random state by different names, however we want to overwrite unset random states with the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseSearchAlgorithmConfig: """Basic search algorithm settings.""" def set_random_state(self, ludwig_random_state: int) -> None: """Overwrite the config random state. Search algorithms refer to random state by different names, however we want to overwrite unset random states with the Ludwig random...
the_stack_v2_python_sparse
ludwig/schema/hyperopt/search_algorithm.py
ludwig-ai/ludwig
train
2,567
4f42e2b8293b02fa3d604beea0422a1c3d918f1b
[ "filename = os.path.join(TMP_FOLDER, out_file + '.' + cls.filetype)\nparsed_schema = schema.parse(schema_str)\nrec_writer = io.DatumWriter(parsed_schema)\nfile_writer = datafile.DataFileWriter(open(filename, 'wb'), rec_writer, parsed_schema)\nfor _ in range(num_rows):\n data = {}\n data['name'] = ''.join((ran...
<|body_start_0|> filename = os.path.join(TMP_FOLDER, out_file + '.' + cls.filetype) parsed_schema = schema.parse(schema_str) rec_writer = io.DatumWriter(parsed_schema) file_writer = datafile.DataFileWriter(open(filename, 'wb'), rec_writer, parsed_schema) for _ in range(num_rows):...
TestAvroParser
[ "Apache-2.0", "BSD-3-Clause", "MIT", "Elastic-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAvroParser: def generate_avro_file(cls, schema_str: str, out_file, num_rows: int) -> str: """Creates an avro file and saves to tmp folder to be used by test cases :param schema_str: valid avro schema as a string :param out_file: name of file to be created :param num_rows: number of r...
stack_v2_sparse_classes_36k_train_004025
4,125
permissive
[ { "docstring": "Creates an avro file and saves to tmp folder to be used by test cases :param schema_str: valid avro schema as a string :param out_file: name of file to be created :param num_rows: number of rows to be generated :return: string with path to the file created", "name": "generate_avro_file", ...
2
null
Implement the Python class `TestAvroParser` described below. Class description: Implement the TestAvroParser class. Method signatures and docstrings: - def generate_avro_file(cls, schema_str: str, out_file, num_rows: int) -> str: Creates an avro file and saves to tmp folder to be used by test cases :param schema_str:...
Implement the Python class `TestAvroParser` described below. Class description: Implement the TestAvroParser class. Method signatures and docstrings: - def generate_avro_file(cls, schema_str: str, out_file, num_rows: int) -> str: Creates an avro file and saves to tmp folder to be used by test cases :param schema_str:...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class TestAvroParser: def generate_avro_file(cls, schema_str: str, out_file, num_rows: int) -> str: """Creates an avro file and saves to tmp folder to be used by test cases :param schema_str: valid avro schema as a string :param out_file: name of file to be created :param num_rows: number of r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAvroParser: def generate_avro_file(cls, schema_str: str, out_file, num_rows: int) -> str: """Creates an avro file and saves to tmp folder to be used by test cases :param schema_str: valid avro schema as a string :param out_file: name of file to be created :param num_rows: number of rows to be gene...
the_stack_v2_python_sparse
dts/airbyte/airbyte-integrations/connectors/source-s3/unit_tests/test_avro_parser.py
alldatacenter/alldata
train
774
d45833cd406bed8d7365cbd9e7c0bc0c4124e17b
[ "super().save(*args, **kwargs)\nself.book_list.updated_date = timezone.now()\nself.book_list.save(broadcast=False, update_fields=['updated_date'])", "if self.book_list.user == viewer:\n return\nis_group_member = GroupMember.objects.filter(group=self.book_list.group, user=viewer).exists()\nif is_group_member:\n...
<|body_start_0|> super().save(*args, **kwargs) self.book_list.updated_date = timezone.now() self.book_list.save(broadcast=False, update_fields=['updated_date']) <|end_body_0|> <|body_start_1|> if self.book_list.user == viewer: return is_group_member = GroupMember.obj...
ok
ListItem
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListItem: """ok""" def save(self, *args, **kwargs): """Update the list's date""" <|body_0|> def raise_not_deletable(self, viewer): """the associated user OR the list owner can delete""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().save(*...
stack_v2_sparse_classes_36k_train_004026
5,915
no_license
[ { "docstring": "Update the list's date", "name": "save", "signature": "def save(self, *args, **kwargs)" }, { "docstring": "the associated user OR the list owner can delete", "name": "raise_not_deletable", "signature": "def raise_not_deletable(self, viewer)" } ]
2
stack_v2_sparse_classes_30k_train_011866
Implement the Python class `ListItem` described below. Class description: ok Method signatures and docstrings: - def save(self, *args, **kwargs): Update the list's date - def raise_not_deletable(self, viewer): the associated user OR the list owner can delete
Implement the Python class `ListItem` described below. Class description: ok Method signatures and docstrings: - def save(self, *args, **kwargs): Update the list's date - def raise_not_deletable(self, viewer): the associated user OR the list owner can delete <|skeleton|> class ListItem: """ok""" def save(se...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class ListItem: """ok""" def save(self, *args, **kwargs): """Update the list's date""" <|body_0|> def raise_not_deletable(self, viewer): """the associated user OR the list owner can delete""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListItem: """ok""" def save(self, *args, **kwargs): """Update the list's date""" super().save(*args, **kwargs) self.book_list.updated_date = timezone.now() self.book_list.save(broadcast=False, update_fields=['updated_date']) def raise_not_deletable(self, viewer): ...
the_stack_v2_python_sparse
bookwyrm/models/list.py
bookwyrm-social/bookwyrm
train
1,398
2006349a88ac9f86999dbcd899d206755ed8d7df
[ "related_models = [f.related_model for f in Cell._meta.get_fields() if f.one_to_one]\nrelated_qs = [cls.objects.filter(cell=self) for cls in related_models if len(cls.objects.filter(cell=self)) > 0]\nif len(related_qs) > 1:\n raise DashBoardException('Cell data with id %d assosiated with multiple Cell types' % s...
<|body_start_0|> related_models = [f.related_model for f in Cell._meta.get_fields() if f.one_to_one] related_qs = [cls.objects.filter(cell=self) for cls in related_models if len(cls.objects.filter(cell=self)) > 0] if len(related_qs) > 1: raise DashBoardException('Cell data with id %d...
Cell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cell: def get_related_object(self): """Get the related model instance object for this model via a onetoone relationship.""" <|body_0|> def get_related_model(cls, name): """Given a name, get the related model that matches the name""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_004027
2,344
no_license
[ { "docstring": "Get the related model instance object for this model via a onetoone relationship.", "name": "get_related_object", "signature": "def get_related_object(self)" }, { "docstring": "Given a name, get the related model that matches the name", "name": "get_related_model", "signa...
2
stack_v2_sparse_classes_30k_train_001810
Implement the Python class `Cell` described below. Class description: Implement the Cell class. Method signatures and docstrings: - def get_related_object(self): Get the related model instance object for this model via a onetoone relationship. - def get_related_model(cls, name): Given a name, get the related model th...
Implement the Python class `Cell` described below. Class description: Implement the Cell class. Method signatures and docstrings: - def get_related_object(self): Get the related model instance object for this model via a onetoone relationship. - def get_related_model(cls, name): Given a name, get the related model th...
825c64f0148767883272c5be1e867660c969ab56
<|skeleton|> class Cell: def get_related_object(self): """Get the related model instance object for this model via a onetoone relationship.""" <|body_0|> def get_related_model(cls, name): """Given a name, get the related model that matches the name""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cell: def get_related_object(self): """Get the related model instance object for this model via a onetoone relationship.""" related_models = [f.related_model for f in Cell._meta.get_fields() if f.one_to_one] related_qs = [cls.objects.filter(cell=self) for cls in related_models if len(c...
the_stack_v2_python_sparse
p3app/dash_board/models.py
vdazrat/id8
train
0
da3965619727141edbc97cb4a29100fcc56fe2fb
[ "super(Highlighter, self).__init__(parent)\nself.highlighting_rules = []\nblack_bold_format = QTextCharFormat()\nblack_bold_format.setFontWeight(QFont.Bold)\nself.highlighting_rules = [(QRegExp(pattern, cs=Qt.CaseInsensitive), black_bold_format) for pattern in blackbold_patterns]\nred_bold_format = QTextCharFormat(...
<|body_start_0|> super(Highlighter, self).__init__(parent) self.highlighting_rules = [] black_bold_format = QTextCharFormat() black_bold_format.setFontWeight(QFont.Bold) self.highlighting_rules = [(QRegExp(pattern, cs=Qt.CaseInsensitive), black_bold_format) for pattern in blackbo...
Class for handling syntax highlighting in editable text
Highlighter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Highlighter: """Class for handling syntax highlighting in editable text""" def __init__(self, parent, blackbold_patterns, redbold_patterns): """Define highlighting rules - inputs = lists of patterns""" <|body_0|> def highlightBlock(self, text): """Redefined funct...
stack_v2_sparse_classes_36k_train_004028
19,107
no_license
[ { "docstring": "Define highlighting rules - inputs = lists of patterns", "name": "__init__", "signature": "def __init__(self, parent, blackbold_patterns, redbold_patterns)" }, { "docstring": "Redefined function to apply the highlighting rules", "name": "highlightBlock", "signature": "def...
2
stack_v2_sparse_classes_30k_train_009539
Implement the Python class `Highlighter` described below. Class description: Class for handling syntax highlighting in editable text Method signatures and docstrings: - def __init__(self, parent, blackbold_patterns, redbold_patterns): Define highlighting rules - inputs = lists of patterns - def highlightBlock(self, t...
Implement the Python class `Highlighter` described below. Class description: Class for handling syntax highlighting in editable text Method signatures and docstrings: - def __init__(self, parent, blackbold_patterns, redbold_patterns): Define highlighting rules - inputs = lists of patterns - def highlightBlock(self, t...
61920e434ab79114d977f499d6e1c801b23e81fe
<|skeleton|> class Highlighter: """Class for handling syntax highlighting in editable text""" def __init__(self, parent, blackbold_patterns, redbold_patterns): """Define highlighting rules - inputs = lists of patterns""" <|body_0|> def highlightBlock(self, text): """Redefined funct...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Highlighter: """Class for handling syntax highlighting in editable text""" def __init__(self, parent, blackbold_patterns, redbold_patterns): """Define highlighting rules - inputs = lists of patterns""" super(Highlighter, self).__init__(parent) self.highlighting_rules = [] ...
the_stack_v2_python_sparse
bipeditor/TextInteraction.py
BlasTJSN/BIPEditor
train
0
b48093fd46576645ea8d51f9fe496fab1ef1cc78
[ "ret = build_pb2.BuildInfra()\nret.ParseFromString(self.infra)\nreturn ret", "proto = self.parse()\nyield proto\nself.infra = proto.SerializeToString()" ]
<|body_start_0|> ret = build_pb2.BuildInfra() ret.ParseFromString(self.infra) return ret <|end_body_0|> <|body_start_1|> proto = self.parse() yield proto self.infra = proto.SerializeToString() <|end_body_1|>
Stores buildbucket.v2.Build.infra.
BuildInfra
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildInfra: """Stores buildbucket.v2.Build.infra.""" def parse(self): """Deserializes infra.""" <|body_0|> def mutate(self): """Returns a context manager that provides a mutable BuildInfra proto. Deserializes infra, yields it, and serializes back.""" <|bo...
stack_v2_sparse_classes_36k_train_004029
23,989
permissive
[ { "docstring": "Deserializes infra.", "name": "parse", "signature": "def parse(self)" }, { "docstring": "Returns a context manager that provides a mutable BuildInfra proto. Deserializes infra, yields it, and serializes back.", "name": "mutate", "signature": "def mutate(self)" } ]
2
null
Implement the Python class `BuildInfra` described below. Class description: Stores buildbucket.v2.Build.infra. Method signatures and docstrings: - def parse(self): Deserializes infra. - def mutate(self): Returns a context manager that provides a mutable BuildInfra proto. Deserializes infra, yields it, and serializes ...
Implement the Python class `BuildInfra` described below. Class description: Stores buildbucket.v2.Build.infra. Method signatures and docstrings: - def parse(self): Deserializes infra. - def mutate(self): Returns a context manager that provides a mutable BuildInfra proto. Deserializes infra, yields it, and serializes ...
b5d4783f99461438ca9e6a477535617fadab6ba3
<|skeleton|> class BuildInfra: """Stores buildbucket.v2.Build.infra.""" def parse(self): """Deserializes infra.""" <|body_0|> def mutate(self): """Returns a context manager that provides a mutable BuildInfra proto. Deserializes infra, yields it, and serializes back.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BuildInfra: """Stores buildbucket.v2.Build.infra.""" def parse(self): """Deserializes infra.""" ret = build_pb2.BuildInfra() ret.ParseFromString(self.infra) return ret def mutate(self): """Returns a context manager that provides a mutable BuildInfra proto. Des...
the_stack_v2_python_sparse
appengine/cr-buildbucket/model.py
xinghun61/infra
train
2
bac192a712995eb015617aa410cf905788ae7070
[ "super().__init__()\nself.input_dim = input_dim\nself.hidden_size = hidden_size\nself.num_layers = num_layers\nself.num_classes = num_classes\nself.output_dim = output_dim\nself.lstm_layer = nn.LSTM(input_dim, hidden_size, num_layers, batch_first=True)\nself.linear = nn.Linear(self.hidden_size, output_dim)\nself.ou...
<|body_start_0|> super().__init__() self.input_dim = input_dim self.hidden_size = hidden_size self.num_layers = num_layers self.num_classes = num_classes self.output_dim = output_dim self.lstm_layer = nn.LSTM(input_dim, hidden_size, num_layers, batch_first=True) ...
Simple LSTM decoder.
LSTM_attention_embedding_decoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTM_attention_embedding_decoder: """Simple LSTM decoder.""" def __init__(self, input_dim, hidden_size, output_dim, num_classes, num_layers=1): """Initialize model with params.""" <|body_0|> def forward(self, inp, hidden): """Forward pass through LSTM layer. shap...
stack_v2_sparse_classes_36k_train_004030
1,863
permissive
[ { "docstring": "Initialize model with params.", "name": "__init__", "signature": "def __init__(self, input_dim, hidden_size, output_dim, num_classes, num_layers=1)" }, { "docstring": "Forward pass through LSTM layer. shape of lstm_out: [input_size, batch_size, hidden_dim] shape of self.hidden: (...
2
stack_v2_sparse_classes_30k_val_001160
Implement the Python class `LSTM_attention_embedding_decoder` described below. Class description: Simple LSTM decoder. Method signatures and docstrings: - def __init__(self, input_dim, hidden_size, output_dim, num_classes, num_layers=1): Initialize model with params. - def forward(self, inp, hidden): Forward pass thr...
Implement the Python class `LSTM_attention_embedding_decoder` described below. Class description: Simple LSTM decoder. Method signatures and docstrings: - def __init__(self, input_dim, hidden_size, output_dim, num_classes, num_layers=1): Initialize model with params. - def forward(self, inp, hidden): Forward pass thr...
9cdbf270487751a0ad6862b2fea2ccc0e23a0b67
<|skeleton|> class LSTM_attention_embedding_decoder: """Simple LSTM decoder.""" def __init__(self, input_dim, hidden_size, output_dim, num_classes, num_layers=1): """Initialize model with params.""" <|body_0|> def forward(self, inp, hidden): """Forward pass through LSTM layer. shap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LSTM_attention_embedding_decoder: """Simple LSTM decoder.""" def __init__(self, input_dim, hidden_size, output_dim, num_classes, num_layers=1): """Initialize model with params.""" super().__init__() self.input_dim = input_dim self.hidden_size = hidden_size self.num...
the_stack_v2_python_sparse
caspr/models/lstm_decoder.py
microsoft/CASPR
train
29
d8594a4753883f61dd150a247c7d777996d68b8f
[ "self._string_list_parser = ListParser()\nself._boolean_list_parser = BooleanListParser()\nself._metric_names = metric_names\nself._maximize_fitnesses = maximize_fitnesses\nself._objective_dictionary_list = objective_dictionary_list", "objectives = self.parse_fitness_objectives()\nobjectives_list = copy.copy(obje...
<|body_start_0|> self._string_list_parser = ListParser() self._boolean_list_parser = BooleanListParser() self._metric_names = metric_names self._maximize_fitnesses = maximize_fitnesses self._objective_dictionary_list = objective_dictionary_list <|end_body_0|> <|body_start_1|> ...
Class which keeps track of all the Fitness Objective data for an experiment. The idea behind this class is that this guy: 1. Parses fitness information from common injected properties 2. Centralizes the access to fitness information 3. Is dependency injected into other policy classes' constructors as this information i...
FitnessObjectivesBuilder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FitnessObjectivesBuilder: """Class which keeps track of all the Fitness Objective data for an experiment. The idea behind this class is that this guy: 1. Parses fitness information from common injected properties 2. Centralizes the access to fitness information 3. Is dependency injected into othe...
stack_v2_sparse_classes_36k_train_004031
6,107
no_license
[ { "docstring": "Constructor. :param metric_names: a single space-delimited string containing the one or more field names of the Metrics Record that correspond to fitness objectives. :param maximize_fitnesses: a single space-delimited string containing one or more booleans which describe whether the metric name ...
6
stack_v2_sparse_classes_30k_train_012289
Implement the Python class `FitnessObjectivesBuilder` described below. Class description: Class which keeps track of all the Fitness Objective data for an experiment. The idea behind this class is that this guy: 1. Parses fitness information from common injected properties 2. Centralizes the access to fitness informat...
Implement the Python class `FitnessObjectivesBuilder` described below. Class description: Class which keeps track of all the Fitness Objective data for an experiment. The idea behind this class is that this guy: 1. Parses fitness information from common injected properties 2. Centralizes the access to fitness informat...
99c2f401d6c4b203ee439ed607985a918d0c3c7e
<|skeleton|> class FitnessObjectivesBuilder: """Class which keeps track of all the Fitness Objective data for an experiment. The idea behind this class is that this guy: 1. Parses fitness information from common injected properties 2. Centralizes the access to fitness information 3. Is dependency injected into othe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FitnessObjectivesBuilder: """Class which keeps track of all the Fitness Objective data for an experiment. The idea behind this class is that this guy: 1. Parses fitness information from common injected properties 2. Centralizes the access to fitness information 3. Is dependency injected into other policy clas...
the_stack_v2_python_sparse
servicecommon/fitness/fitness_objectives_builder.py
Cognizant-CDB-AIA-BAI-AI-OI/LEAF-ENN-Training-V2
train
0
11ef01f03025f4049d8a9c4b631680f48a632216
[ "self.operands: List[Operand] = list(operands)\nfor i in range(len(self.operands)):\n self.operands[i] = Operand.validate_operand(self.operands[i])\nsuper().__init__()", "incomplete_expression = False\nfor operand in self.operands:\n if not issubclass(type(operand), Operand):\n raise RuntimeError(f'O...
<|body_start_0|> self.operands: List[Operand] = list(operands) for i in range(len(self.operands)): self.operands[i] = Operand.validate_operand(self.operands[i]) super().__init__() <|end_body_0|> <|body_start_1|> incomplete_expression = False for operand in self.opera...
Or operator class for filtering JumpStart content.
Or
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Or: """Or operator class for filtering JumpStart content.""" def __init__(self, *operands: Union[Operand, str]) -> None: """Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the operands cannot be validated.""" <|body_0|> def ...
stack_v2_sparse_classes_36k_train_004032
16,623
permissive
[ { "docstring": "Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the operands cannot be validated.", "name": "__init__", "signature": "def __init__(self, *operands: Union[Operand, str]) -> None" }, { "docstring": "Evaluates operator. Raises: RuntimeE...
3
stack_v2_sparse_classes_30k_train_002104
Implement the Python class `Or` described below. Class description: Or operator class for filtering JumpStart content. Method signatures and docstrings: - def __init__(self, *operands: Union[Operand, str]) -> None: Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the oper...
Implement the Python class `Or` described below. Class description: Or operator class for filtering JumpStart content. Method signatures and docstrings: - def __init__(self, *operands: Union[Operand, str]) -> None: Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the oper...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class Or: """Or operator class for filtering JumpStart content.""" def __init__(self, *operands: Union[Operand, str]) -> None: """Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the operands cannot be validated.""" <|body_0|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Or: """Or operator class for filtering JumpStart content.""" def __init__(self, *operands: Union[Operand, str]) -> None: """Instantiates Or object. Args: operands (Operand): Operand for Or-ing. Raises: RuntimeError: If the operands cannot be validated.""" self.operands: List[Operand] = li...
the_stack_v2_python_sparse
src/sagemaker/jumpstart/filters.py
aws/sagemaker-python-sdk
train
2,050
2b5718603423712bade7ba9528f3b40731036501
[ "acting_user = UserFactory.create()\norder = OrderFactory.create()\noriginal_before_json = serialize_model_object(order)\noriginal_before_json['lines'] = []\nassert OrderAudit.objects.count() == 0\norder.save_and_log(acting_user)\nassert OrderAudit.objects.count() == 1\noriginal_after_json = serialize_model_object(...
<|body_start_0|> acting_user = UserFactory.create() order = OrderFactory.create() original_before_json = serialize_model_object(order) original_before_json['lines'] = [] assert OrderAudit.objects.count() == 0 order.save_and_log(acting_user) assert OrderAudit.objec...
Tests for abstract models
ModelsTests
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelsTests: """Tests for abstract models""" def test_save_and_log(self): """Tests that save_and_log() creates an audit record with the correct information.""" <|body_0|> def test_to_dict(self): """assert output of to_dict""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_004033
2,214
permissive
[ { "docstring": "Tests that save_and_log() creates an audit record with the correct information.", "name": "test_save_and_log", "signature": "def test_save_and_log(self)" }, { "docstring": "assert output of to_dict", "name": "test_to_dict", "signature": "def test_to_dict(self)" } ]
2
stack_v2_sparse_classes_30k_train_002313
Implement the Python class `ModelsTests` described below. Class description: Tests for abstract models Method signatures and docstrings: - def test_save_and_log(self): Tests that save_and_log() creates an audit record with the correct information. - def test_to_dict(self): assert output of to_dict
Implement the Python class `ModelsTests` described below. Class description: Tests for abstract models Method signatures and docstrings: - def test_save_and_log(self): Tests that save_and_log() creates an audit record with the correct information. - def test_to_dict(self): assert output of to_dict <|skeleton|> class...
339c67b84b661a37ffe32580da72383d95666c5c
<|skeleton|> class ModelsTests: """Tests for abstract models""" def test_save_and_log(self): """Tests that save_and_log() creates an audit record with the correct information.""" <|body_0|> def test_to_dict(self): """assert output of to_dict""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelsTests: """Tests for abstract models""" def test_save_and_log(self): """Tests that save_and_log() creates an audit record with the correct information.""" acting_user = UserFactory.create() order = OrderFactory.create() original_before_json = serialize_model_object(or...
the_stack_v2_python_sparse
main/models_test.py
mitodl/bootcamp-ecommerce
train
6
236e095119e026f3d122a24d26c154997b812528
[ "super(LCNN, self).__init__()\nmodules = [LCNNBlock(n_occupancy * n_neighbor_sites, n_features)]\nfor i in range(n_conv - 1):\n modules.append(LCNNBlock(n_features * n_neighbor_sites, n_features, n_permutation))\nself.LCNN_blocks = nn.Sequential(*modules)\nself.Atom_wise_Conv = Atom_Wise_Convolution(n_features, ...
<|body_start_0|> super(LCNN, self).__init__() modules = [LCNNBlock(n_occupancy * n_neighbor_sites, n_features)] for i in range(n_conv - 1): modules.append(LCNNBlock(n_features * n_neighbor_sites, n_features, n_permutation)) self.LCNN_blocks = nn.Sequential(*modules) s...
The Lattice Convolution Neural Network (LCNN) This model takes lattice representation of Adsorbate Surface to predict coverage effects taking into consideration the adjacent elements interaction energies. The model follows the following steps [1] It performs n lattice convolution operations. For more details look at th...
LCNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LCNN: """The Lattice Convolution Neural Network (LCNN) This model takes lattice representation of Adsorbate Surface to predict coverage effects taking into consideration the adjacent elements interaction energies. The model follows the following steps [1] It performs n lattice convolution operati...
stack_v2_sparse_classes_36k_train_004034
18,579
permissive
[ { "docstring": "Parameters ---------- n_occupancy: int, default 3 number of possible occupancy n_neighbor_sites_list: int, default 19 Number of neighbors of each site. n_permutation: int, default 6 Diffrent permutations taken along diffrent directions. n_task: int, default 1 Number of tasks dropout_rate: float,...
2
stack_v2_sparse_classes_30k_train_000560
Implement the Python class `LCNN` described below. Class description: The Lattice Convolution Neural Network (LCNN) This model takes lattice representation of Adsorbate Surface to predict coverage effects taking into consideration the adjacent elements interaction energies. The model follows the following steps [1] It...
Implement the Python class `LCNN` described below. Class description: The Lattice Convolution Neural Network (LCNN) This model takes lattice representation of Adsorbate Surface to predict coverage effects taking into consideration the adjacent elements interaction energies. The model follows the following steps [1] It...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class LCNN: """The Lattice Convolution Neural Network (LCNN) This model takes lattice representation of Adsorbate Surface to predict coverage effects taking into consideration the adjacent elements interaction energies. The model follows the following steps [1] It performs n lattice convolution operati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LCNN: """The Lattice Convolution Neural Network (LCNN) This model takes lattice representation of Adsorbate Surface to predict coverage effects taking into consideration the adjacent elements interaction energies. The model follows the following steps [1] It performs n lattice convolution operations. For more...
the_stack_v2_python_sparse
deepchem/models/torch_models/lcnn.py
deepchem/deepchem
train
4,876
65af826a38b585370c8030a8852221ba9a78c0aa
[ "N = len(nums)\ntotal = 0\nS = [0]\nfor num in nums:\n total += num\n S.append(total)\nfor i in xrange(0, N - 1, 1):\n for j in xrange(i + 2, N + 1, 1):\n tmp = S[j] - S[i]\n if k == 0 and tmp == 0:\n return True\n elif k != 0 and tmp % k == 0:\n return True\nretu...
<|body_start_0|> N = len(nums) total = 0 S = [0] for num in nums: total += num S.append(total) for i in xrange(0, N - 1, 1): for j in xrange(i + 2, N + 1, 1): tmp = S[j] - S[i] if k == 0 and tmp == 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkSubarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def checkSubarraySum2(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_004035
1,274
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "checkSubarraySum", "signature": "def checkSubarraySum(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "checkSubarraySum2", "signature": "def checkSubarraySum2(self, num...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkSubarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def checkSubarraySum2(self, nums, k): :type nums: List[int] :type k: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkSubarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def checkSubarraySum2(self, nums, k): :type nums: List[int] :type k: int :rtype: bool <|sk...
70a580603d996d9843cda3c167c6e63c29df6656
<|skeleton|> class Solution: def checkSubarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def checkSubarraySum2(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def checkSubarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" N = len(nums) total = 0 S = [0] for num in nums: total += num S.append(total) for i in xrange(0, N - 1, 1): for j in xrange(i...
the_stack_v2_python_sparse
src/code/code_523.py
fanzijian/leet-code-practice
train
1
101f3f4be9889cb1673103418b4a0cb12404702a
[ "super().__init__(definition, cutoff_point, features_interval, prediction_start_day, prediction_interval)\nself.scale = scale\nself.denoising = denoising", "X_train, y_train = self._resample(X_train, y_train)\nautoencoder = AutoEncoderTraining(self.batch_size, torch.cuda.is_available(), self.scale, flatten=False)...
<|body_start_0|> super().__init__(definition, cutoff_point, features_interval, prediction_start_day, prediction_interval) self.scale = scale self.denoising = denoising <|end_body_0|> <|body_start_1|> X_train, y_train = self._resample(X_train, y_train) autoencoder = AutoEncoderTr...
XGBoostAutoencodersPredict
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XGBoostAutoencodersPredict: def __init__(self, definition, cutoff_point, features_interval, prediction_start_day, prediction_interval, scale, denoising): """The constructor of the XGBoostPredict class Parameters ---------- definition: string The definition that you will get the labels fo...
stack_v2_sparse_classes_36k_train_004036
7,854
no_license
[ { "docstring": "The constructor of the XGBoostPredict class Parameters ---------- definition: string The definition that you will get the labels for cutoff_point: int The maximum cutoff_point where you will look your time series features_interval: int The number of days in the past that you will look the time s...
2
stack_v2_sparse_classes_30k_val_000215
Implement the Python class `XGBoostAutoencodersPredict` described below. Class description: Implement the XGBoostAutoencodersPredict class. Method signatures and docstrings: - def __init__(self, definition, cutoff_point, features_interval, prediction_start_day, prediction_interval, scale, denoising): The constructor ...
Implement the Python class `XGBoostAutoencodersPredict` described below. Class description: Implement the XGBoostAutoencodersPredict class. Method signatures and docstrings: - def __init__(self, definition, cutoff_point, features_interval, prediction_start_day, prediction_interval, scale, denoising): The constructor ...
d7e42676b64d177ded11d4731e11130c129d477b
<|skeleton|> class XGBoostAutoencodersPredict: def __init__(self, definition, cutoff_point, features_interval, prediction_start_day, prediction_interval, scale, denoising): """The constructor of the XGBoostPredict class Parameters ---------- definition: string The definition that you will get the labels fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XGBoostAutoencodersPredict: def __init__(self, definition, cutoff_point, features_interval, prediction_start_day, prediction_interval, scale, denoising): """The constructor of the XGBoostPredict class Parameters ---------- definition: string The definition that you will get the labels for cutoff_point...
the_stack_v2_python_sparse
code/prediction/xgboost_prediction_autoencoders.py
mcbuehler/ssw-prediction
train
1
bcf1b9c13fa954c345b9ae9778b1cea8e402d049
[ "super(ToKlein, self).__init__()\nself.min_norm = min_norm\nself.sum = ReduceSum(keep_dims=True)\nself.klein_constraint = KleinConstraint(self.min_norm)", "x_2 = self.sum(x * x, -1)\nx_klein = 2 * x / (1.0 + x_2)\nx_klein = self.klein_constraint(x_klein)\nreturn x_klein" ]
<|body_start_0|> super(ToKlein, self).__init__() self.min_norm = min_norm self.sum = ReduceSum(keep_dims=True) self.klein_constraint = KleinConstraint(self.min_norm) <|end_body_0|> <|body_start_1|> x_2 = self.sum(x * x, -1) x_klein = 2 * x / (1.0 + x_2) x_klein =...
to klein class
ToKlein
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToKlein: """to klein class""" def __init__(self, min_norm): """init fun""" <|body_0|> def construct(self, x, c): """class construction""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(ToKlein, self).__init__() self.min_norm = min_no...
stack_v2_sparse_classes_36k_train_004037
8,596
permissive
[ { "docstring": "init fun", "name": "__init__", "signature": "def __init__(self, min_norm)" }, { "docstring": "class construction", "name": "construct", "signature": "def construct(self, x, c)" } ]
2
null
Implement the Python class `ToKlein` described below. Class description: to klein class Method signatures and docstrings: - def __init__(self, min_norm): init fun - def construct(self, x, c): class construction
Implement the Python class `ToKlein` described below. Class description: to klein class Method signatures and docstrings: - def __init__(self, min_norm): init fun - def construct(self, x, c): class construction <|skeleton|> class ToKlein: """to klein class""" def __init__(self, min_norm): """init fu...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class ToKlein: """to klein class""" def __init__(self, min_norm): """init fun""" <|body_0|> def construct(self, x, c): """class construction""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ToKlein: """to klein class""" def __init__(self, min_norm): """init fun""" super(ToKlein, self).__init__() self.min_norm = min_norm self.sum = ReduceSum(keep_dims=True) self.klein_constraint = KleinConstraint(self.min_norm) def construct(self, x, c): "...
the_stack_v2_python_sparse
research/nlp/hypertext/src/poincare.py
mindspore-ai/models
train
301
59b31be914a2537691382f86b0e408af190c0fa4
[ "if not nums:\n return 0\ndp = []\nfor i in range(len(nums)):\n dp.append(1)\n for j in range(i):\n if nums[i] > nums[j]:\n dp[i] = max(dp[i], dp[j] + 1)\nreturn max(dp)", "dp = {1: 1, 2: 2}\nfor i in range(3, n + 1):\n dp[i] = dp[i - 1] + dp[i - 2]\nreturn dp[n]", "dp = [[0, 0]] *...
<|body_start_0|> if not nums: return 0 dp = [] for i in range(len(nums)): dp.append(1) for j in range(i): if nums[i] > nums[j]: dp[i] = max(dp[i], dp[j] + 1) return max(dp) <|end_body_0|> <|body_start_1|> dp...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS(self, nums: List[int]) -> int: """300. 最长递增子序列 给你一个整数数组 nums ,找到其中最长严格递增子序列的长度。 子序列是由数组派生而来的序列,删除(或不删除)数组中的元素而不改变其余元素的顺序。 例如,[3,6,2,7] 是数组 [0,3,1,6,2,2,7] 的子序列。""" <|body_0|> def climb(self, n: int) -> int: """70. 爬楼梯问题 一次只能爬一步或者两步,一共n阶台阶 转移...
stack_v2_sparse_classes_36k_train_004038
3,592
no_license
[ { "docstring": "300. 最长递增子序列 给你一个整数数组 nums ,找到其中最长严格递增子序列的长度。 子序列是由数组派生而来的序列,删除(或不删除)数组中的元素而不改变其余元素的顺序。 例如,[3,6,2,7] 是数组 [0,3,1,6,2,2,7] 的子序列。", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums: List[int]) -> int" }, { "docstring": "70. 爬楼梯问题 一次只能爬一步或者两步,一共n阶台阶 转移方程 f(i) = f(i - 1...
4
stack_v2_sparse_classes_30k_train_021266
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums: List[int]) -> int: 300. 最长递增子序列 给你一个整数数组 nums ,找到其中最长严格递增子序列的长度。 子序列是由数组派生而来的序列,删除(或不删除)数组中的元素而不改变其余元素的顺序。 例如,[3,6,2,7] 是数组 [0,3,1,6,2,2,7] 的子序列。 - de...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums: List[int]) -> int: 300. 最长递增子序列 给你一个整数数组 nums ,找到其中最长严格递增子序列的长度。 子序列是由数组派生而来的序列,删除(或不删除)数组中的元素而不改变其余元素的顺序。 例如,[3,6,2,7] 是数组 [0,3,1,6,2,2,7] 的子序列。 - de...
330330ef6bc42eeb17f4dea53c30d230506b4e8f
<|skeleton|> class Solution: def lengthOfLIS(self, nums: List[int]) -> int: """300. 最长递增子序列 给你一个整数数组 nums ,找到其中最长严格递增子序列的长度。 子序列是由数组派生而来的序列,删除(或不删除)数组中的元素而不改变其余元素的顺序。 例如,[3,6,2,7] 是数组 [0,3,1,6,2,2,7] 的子序列。""" <|body_0|> def climb(self, n: int) -> int: """70. 爬楼梯问题 一次只能爬一步或者两步,一共n阶台阶 转移...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLIS(self, nums: List[int]) -> int: """300. 最长递增子序列 给你一个整数数组 nums ,找到其中最长严格递增子序列的长度。 子序列是由数组派生而来的序列,删除(或不删除)数组中的元素而不改变其余元素的顺序。 例如,[3,6,2,7] 是数组 [0,3,1,6,2,2,7] 的子序列。""" if not nums: return 0 dp = [] for i in range(len(nums)): dp.appe...
the_stack_v2_python_sparse
Code/leetcode_everyday/0310.py
NiceToMeeetU/ToGetReady
train
0
3880ab9a7769fed7f48a901f05c43c93616a002e
[ "self.word_size_bits = word_size_bits\nself.word_size = word_size = 1 << word_size_bits\nself.offset_mask = (1 << (word_size << 2)) - 1\nself.word_fmt = b'%%0%dx' % word_size\nif size is None:\n size = self.offset_mask + 1\nsuper(OffsetsStream, self).__init__(size)", "offset = self._offset\noffset_mask = self....
<|body_start_0|> self.word_size_bits = word_size_bits self.word_size = word_size = 1 << word_size_bits self.offset_mask = (1 << (word_size << 2)) - 1 self.word_fmt = b'%%0%dx' % word_size if size is None: size = self.offset_mask + 1 super(OffsetsStream, self)....
>>> s = OffsetsStream(word_size_bits = 3) >>> # this bytes comparison way supports doctest under both Py2 & Py3 >>> s.read(0) == b'' True >>> s.read(1) == b'0' True >>> s.read(7) == b'0000000' True >>> s.tell() 8 >>> s.read(8) == b'00000008' True >>> s.seek(0xDEADBEEF) == 3735928559 True >>> # ... b'deadbee0', b'deadbe...
OffsetsStream
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OffsetsStream: """>>> s = OffsetsStream(word_size_bits = 3) >>> # this bytes comparison way supports doctest under both Py2 & Py3 >>> s.read(0) == b'' True >>> s.read(1) == b'0' True >>> s.read(7) == b'0000000' True >>> s.tell() 8 >>> s.read(8) == b'00000008' True >>> s.seek(0xDEADBEEF) == 373592...
stack_v2_sparse_classes_36k_train_004039
2,618
permissive
[ { "docstring": ":param word_size_bits: log2 of word size. A word is hexadecimal ASCII representation of that word offset. :param size: logical size of the stream. `None`: size is big enough to fit all words.", "name": "__init__", "signature": "def __init__(self, word_size_bits=4, size=None)" }, { ...
2
stack_v2_sparse_classes_30k_train_019236
Implement the Python class `OffsetsStream` described below. Class description: >>> s = OffsetsStream(word_size_bits = 3) >>> # this bytes comparison way supports doctest under both Py2 & Py3 >>> s.read(0) == b'' True >>> s.read(1) == b'0' True >>> s.read(7) == b'0000000' True >>> s.tell() 8 >>> s.read(8) == b'00000008...
Implement the Python class `OffsetsStream` described below. Class description: >>> s = OffsetsStream(word_size_bits = 3) >>> # this bytes comparison way supports doctest under both Py2 & Py3 >>> s.read(0) == b'' True >>> s.read(1) == b'0' True >>> s.read(7) == b'0000000' True >>> s.tell() 8 >>> s.read(8) == b'00000008...
93e03c2b3f880f5c7c9f90e1ba5593dbf602bdb9
<|skeleton|> class OffsetsStream: """>>> s = OffsetsStream(word_size_bits = 3) >>> # this bytes comparison way supports doctest under both Py2 & Py3 >>> s.read(0) == b'' True >>> s.read(1) == b'0' True >>> s.read(7) == b'0000000' True >>> s.tell() 8 >>> s.read(8) == b'00000008' True >>> s.seek(0xDEADBEEF) == 373592...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OffsetsStream: """>>> s = OffsetsStream(word_size_bits = 3) >>> # this bytes comparison way supports doctest under both Py2 & Py3 >>> s.read(0) == b'' True >>> s.read(1) == b'0' True >>> s.read(7) == b'0000000' True >>> s.tell() 8 >>> s.read(8) == b'00000008' True >>> s.seek(0xDEADBEEF) == 3735928559 True >>>...
the_stack_v2_python_sparse
common/offsets_stream.py
ispras/qdt
train
38
bdfb529d93d4abd67815271d4954078cb8124a6d
[ "super().__init__(out_dir=out_dir, model=model, test_loader=test_loader)\nassert inspect.ismethod(model.predict_3D), 'model must have the method `predict_3D`'\nif pseudo_3D:\n assert inspect.ismethod(model.predict_3D_pseudo3D_2Dconv), 'model must have the method `predict_3D_pseudo3D_2Dconv`'\nself.pseudo_3D = ps...
<|body_start_0|> super().__init__(out_dir=out_dir, model=model, test_loader=test_loader) assert inspect.ismethod(model.predict_3D), 'model must have the method `predict_3D`' if pseudo_3D: assert inspect.ismethod(model.predict_3D_pseudo3D_2Dconv), 'model must have the method `predict_...
Inference for a single model for every file generated by `test_loader`. Predictions are saved in `out_dir`. Predictions are done on the resized predictions. Post-processing only includes removing small 3D connected components.
General3DPredictor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class General3DPredictor: """Inference for a single model for every file generated by `test_loader`. Predictions are saved in `out_dir`. Predictions are done on the resized predictions. Post-processing only includes removing small 3D connected components.""" def __init__(self, out_dir, model, test...
stack_v2_sparse_classes_36k_train_004040
2,477
permissive
[ { "docstring": "Attributes out_dir (str): path to the output directory to store predictions model (torch.nn.Module): class with the `predict_3D` method for predicting a single patient volume. test_loader: Iterable instance for generating data (pref. torch DataLoader) must have the __len__ arg. pred_3D_params (d...
2
stack_v2_sparse_classes_30k_train_018066
Implement the Python class `General3DPredictor` described below. Class description: Inference for a single model for every file generated by `test_loader`. Predictions are saved in `out_dir`. Predictions are done on the resized predictions. Post-processing only includes removing small 3D connected components. Method ...
Implement the Python class `General3DPredictor` described below. Class description: Inference for a single model for every file generated by `test_loader`. Predictions are saved in `out_dir`. Predictions are done on the resized predictions. Post-processing only includes removing small 3D connected components. Method ...
81d7413022220ea86a23212737b3682e84ae74a4
<|skeleton|> class General3DPredictor: """Inference for a single model for every file generated by `test_loader`. Predictions are saved in `out_dir`. Predictions are done on the resized predictions. Post-processing only includes removing small 3D connected components.""" def __init__(self, out_dir, model, test...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class General3DPredictor: """Inference for a single model for every file generated by `test_loader`. Predictions are saved in `out_dir`. Predictions are done on the resized predictions. Post-processing only includes removing small 3D connected components.""" def __init__(self, out_dir, model, test_loader, pseu...
the_stack_v2_python_sparse
kits19cnn/inference/general_predictors.py
jchen42703/kits19-2d-reproduce
train
9
1bebf5d0ceac2ebb9379f272ee52d5b9dac018d6
[ "library_key = LibraryLocatorV2.from_string(lib_key_str)\napi.require_permission_for_library_key(library_key, request.user, permissions.CAN_VIEW_THIS_CONTENT_LIBRARY)\nqueryset = api.ContentLibrary.objects.get_by_key(library_key).import_tasks\nresult = ContentLibraryBlockImportTaskSerializer(queryset, many=True).da...
<|body_start_0|> library_key = LibraryLocatorV2.from_string(lib_key_str) api.require_permission_for_library_key(library_key, request.user, permissions.CAN_VIEW_THIS_CONTENT_LIBRARY) queryset = api.ContentLibrary.objects.get_by_key(library_key).import_tasks result = ContentLibraryBlockImp...
Import blocks from Courseware through modulestore.
LibraryImportTaskViewSet
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LibraryImportTaskViewSet: """Import blocks from Courseware through modulestore.""" def list(self, request, lib_key_str): """List all import tasks for this library.""" <|body_0|> def create(self, request, lib_key_str): """Create and queue an import tasks for this ...
stack_v2_sparse_classes_36k_train_004041
42,120
permissive
[ { "docstring": "List all import tasks for this library.", "name": "list", "signature": "def list(self, request, lib_key_str)" }, { "docstring": "Create and queue an import tasks for this library.", "name": "create", "signature": "def create(self, request, lib_key_str)" }, { "docs...
3
null
Implement the Python class `LibraryImportTaskViewSet` described below. Class description: Import blocks from Courseware through modulestore. Method signatures and docstrings: - def list(self, request, lib_key_str): List all import tasks for this library. - def create(self, request, lib_key_str): Create and queue an i...
Implement the Python class `LibraryImportTaskViewSet` described below. Class description: Import blocks from Courseware through modulestore. Method signatures and docstrings: - def list(self, request, lib_key_str): List all import tasks for this library. - def create(self, request, lib_key_str): Create and queue an i...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class LibraryImportTaskViewSet: """Import blocks from Courseware through modulestore.""" def list(self, request, lib_key_str): """List all import tasks for this library.""" <|body_0|> def create(self, request, lib_key_str): """Create and queue an import tasks for this ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LibraryImportTaskViewSet: """Import blocks from Courseware through modulestore.""" def list(self, request, lib_key_str): """List all import tasks for this library.""" library_key = LibraryLocatorV2.from_string(lib_key_str) api.require_permission_for_library_key(library_key, reques...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/content_libraries/views.py
luque/better-ways-of-thinking-about-software
train
3
5c247065e6b7794a8becc9aa5e092f7d5e2dd1bf
[ "super(MonomialBasisFunctionsMethod, self).__init__(A, B=B, p=p, ti=ti, options=options, verbose=verbose)\nif ti == []:\n self.t1 = 1.0 / self.tau0\nelse:\n if isinstance(ti, list):\n ti = numpy.array(ti)\n elif isinstance(ti, Number):\n ti = numpy.array([ti])\n if ti.size != 1:\n r...
<|body_start_0|> super(MonomialBasisFunctionsMethod, self).__init__(A, B=B, p=p, ti=ti, options=options, verbose=verbose) if ti == []: self.t1 = 1.0 / self.tau0 else: if isinstance(ti, list): ti = numpy.array(ti) elif isinstance(ti, Number): ...
Interpolate Schatten norm (or anti-norm) of an affine matrix function using monomial basis functions (MBF) method. This class accepts only *one* interpolant point (:math:`q = 1`). That is, the argument ``ti`` should be only one number or a list of the length 1. A better method is ``'imbf'`` which accepts arbitrary numb...
MonomialBasisFunctionsMethod
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MonomialBasisFunctionsMethod: """Interpolate Schatten norm (or anti-norm) of an affine matrix function using monomial basis functions (MBF) method. This class accepts only *one* interpolant point (:math:`q = 1`). That is, the argument ``ti`` should be only one number or a list of the length 1. A ...
stack_v2_sparse_classes_36k_train_004042
14,850
permissive
[ { "docstring": "Initializes the base class and attributes, namely, the trace at the interpolant point.", "name": "__init__", "signature": "def __init__(self, A, B=None, p=2, options={}, verbose=False, ti=[])" }, { "docstring": "Computes the trace at the interpolant point. This function is used i...
3
stack_v2_sparse_classes_30k_train_013004
Implement the Python class `MonomialBasisFunctionsMethod` described below. Class description: Interpolate Schatten norm (or anti-norm) of an affine matrix function using monomial basis functions (MBF) method. This class accepts only *one* interpolant point (:math:`q = 1`). That is, the argument ``ti`` should be only o...
Implement the Python class `MonomialBasisFunctionsMethod` described below. Class description: Interpolate Schatten norm (or anti-norm) of an affine matrix function using monomial basis functions (MBF) method. This class accepts only *one* interpolant point (:math:`q = 1`). That is, the argument ``ti`` should be only o...
de867f131a4cda7d60a68bf0558e896fae89d776
<|skeleton|> class MonomialBasisFunctionsMethod: """Interpolate Schatten norm (or anti-norm) of an affine matrix function using monomial basis functions (MBF) method. This class accepts only *one* interpolant point (:math:`q = 1`). That is, the argument ``ti`` should be only one number or a list of the length 1. A ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MonomialBasisFunctionsMethod: """Interpolate Schatten norm (or anti-norm) of an affine matrix function using monomial basis functions (MBF) method. This class accepts only *one* interpolant point (:math:`q = 1`). That is, the argument ``ti`` should be only one number or a list of the length 1. A better method...
the_stack_v2_python_sparse
imate/interpolator/_monomial_basis_functions_method.py
ameli/imate
train
5
486bf90aaebe5f015056c626ce14a695a50a6c63
[ "super().__init__()\nself.overhead_time_queue = queue\nself.data_incoming = True\nConsumerThread.id_counter += 1\nself.id = ConsumerThread.id_counter", "if len(self.overhead_time_queue) == 0:\n print(f'Consumer {self.id} is sleeping since queue is empty')\n time.sleep(0.75)\nwhile self.data_incoming or len(...
<|body_start_0|> super().__init__() self.overhead_time_queue = queue self.data_incoming = True ConsumerThread.id_counter += 1 self.id = ConsumerThread.id_counter <|end_body_0|> <|body_start_1|> if len(self.overhead_time_queue) == 0: print(f'Consumer {self.id}...
Consumes data from CityOverheadTimeQueue.
ConsumerThread
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConsumerThread: """Consumes data from CityOverheadTimeQueue.""" def __init__(self, queue: CityOverheadTimeQueue): """:param queue: a CityOverheadTimeQueue""" <|body_0|> def run(self) -> None: """Gets data from the queue and prints it.""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_004043
3,229
no_license
[ { "docstring": ":param queue: a CityOverheadTimeQueue", "name": "__init__", "signature": "def __init__(self, queue: CityOverheadTimeQueue)" }, { "docstring": "Gets data from the queue and prints it.", "name": "run", "signature": "def run(self) -> None" } ]
2
stack_v2_sparse_classes_30k_train_021627
Implement the Python class `ConsumerThread` described below. Class description: Consumes data from CityOverheadTimeQueue. Method signatures and docstrings: - def __init__(self, queue: CityOverheadTimeQueue): :param queue: a CityOverheadTimeQueue - def run(self) -> None: Gets data from the queue and prints it.
Implement the Python class `ConsumerThread` described below. Class description: Consumes data from CityOverheadTimeQueue. Method signatures and docstrings: - def __init__(self, queue: CityOverheadTimeQueue): :param queue: a CityOverheadTimeQueue - def run(self) -> None: Gets data from the queue and prints it. <|skel...
11c3806aee78fa0e78bdf8037d4c203645df5500
<|skeleton|> class ConsumerThread: """Consumes data from CityOverheadTimeQueue.""" def __init__(self, queue: CityOverheadTimeQueue): """:param queue: a CityOverheadTimeQueue""" <|body_0|> def run(self) -> None: """Gets data from the queue and prints it.""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConsumerThread: """Consumes data from CityOverheadTimeQueue.""" def __init__(self, queue: CityOverheadTimeQueue): """:param queue: a CityOverheadTimeQueue""" super().__init__() self.overhead_time_queue = queue self.data_incoming = True ConsumerThread.id_counter += ...
the_stack_v2_python_sparse
Labs/Lab10/producer_consumer.py
chrisyandev/PythonAssignments
train
0
99fd14e433ce72ec855a699c8327fc057f812260
[ "super().__init__()\nself.resizable(width=False, height=False)\nself.geometry()\nself.title('Zip File Maker')\nself.treeview_frame = ttk.Frame(self)\nself.button_row_frame = ttk.Frame(self)\nself.files_treeview = ttk.Treeview(self.treeview_frame, columns=('path',), selectmode='browse', show='tree')\nself.files_tree...
<|body_start_0|> super().__init__() self.resizable(width=False, height=False) self.geometry() self.title('Zip File Maker') self.treeview_frame = ttk.Frame(self) self.button_row_frame = ttk.Frame(self) self.files_treeview = ttk.Treeview(self.treeview_frame, columns...
The class for interacting with tkinter.
MainWindow
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainWindow: """The class for interacting with tkinter.""" def __init__(self): """Initialize main window.""" <|body_0|> def add_files(self): """Ask user to give file path and save new file.""" <|body_1|> def remove_file(self): """Remove curren...
stack_v2_sparse_classes_36k_train_004044
4,820
permissive
[ { "docstring": "Initialize main window.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Ask user to give file path and save new file.", "name": "add_files", "signature": "def add_files(self)" }, { "docstring": "Remove currently selected file.", "nam...
4
stack_v2_sparse_classes_30k_train_000892
Implement the Python class `MainWindow` described below. Class description: The class for interacting with tkinter. Method signatures and docstrings: - def __init__(self): Initialize main window. - def add_files(self): Ask user to give file path and save new file. - def remove_file(self): Remove currently selected fi...
Implement the Python class `MainWindow` described below. Class description: The class for interacting with tkinter. Method signatures and docstrings: - def __init__(self): Initialize main window. - def add_files(self): Ask user to give file path and save new file. - def remove_file(self): Remove currently selected fi...
73b554d9796510fc86e5fc55016732aa866266c6
<|skeleton|> class MainWindow: """The class for interacting with tkinter.""" def __init__(self): """Initialize main window.""" <|body_0|> def add_files(self): """Ask user to give file path and save new file.""" <|body_1|> def remove_file(self): """Remove curren...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MainWindow: """The class for interacting with tkinter.""" def __init__(self): """Initialize main window.""" super().__init__() self.resizable(width=False, height=False) self.geometry() self.title('Zip File Maker') self.treeview_frame = ttk.Frame(self) ...
the_stack_v2_python_sparse
Files/Zip File Maker/zip_file_maker.pyw
fossabot/IdeaBag2-Solutions
train
0
1d4abea7461146eea951c58128195b614eddf9a1
[ "args = ['modeling/airports.csv']\nopts = {}\ncall_command('import_airport', *args, **opts)", "args = ['modeling/boards.csv']\nopts = {}\ncall_command('import_board', *args, **opts)", "args = ['modeling/hotels.csv']\nopts = {}\ncall_command('import_hotel', *args, **opts)", "args = ['modeling/markets.csv']\nop...
<|body_start_0|> args = ['modeling/airports.csv'] opts = {} call_command('import_airport', *args, **opts) <|end_body_0|> <|body_start_1|> args = ['modeling/boards.csv'] opts = {} call_command('import_board', *args, **opts) <|end_body_1|> <|body_start_2|> args = ...
CommandsTestCase
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandsTestCase: def test_import_airport(self): """Test import_airport command.""" <|body_0|> def test_import_board(self): """Test import_board command.""" <|body_1|> def test_import_hotel(self): """Test import_hotel command.""" <|body_2...
stack_v2_sparse_classes_36k_train_004045
5,159
permissive
[ { "docstring": "Test import_airport command.", "name": "test_import_airport", "signature": "def test_import_airport(self)" }, { "docstring": "Test import_board command.", "name": "test_import_board", "signature": "def test_import_board(self)" }, { "docstring": "Test import_hotel ...
6
stack_v2_sparse_classes_30k_train_019017
Implement the Python class `CommandsTestCase` described below. Class description: Implement the CommandsTestCase class. Method signatures and docstrings: - def test_import_airport(self): Test import_airport command. - def test_import_board(self): Test import_board command. - def test_import_hotel(self): Test import_h...
Implement the Python class `CommandsTestCase` described below. Class description: Implement the CommandsTestCase class. Method signatures and docstrings: - def test_import_airport(self): Test import_airport command. - def test_import_board(self): Test import_board command. - def test_import_hotel(self): Test import_h...
0abcb82bf30540ac5cd57d5ec9178e692a1a2ca6
<|skeleton|> class CommandsTestCase: def test_import_airport(self): """Test import_airport command.""" <|body_0|> def test_import_board(self): """Test import_board command.""" <|body_1|> def test_import_hotel(self): """Test import_hotel command.""" <|body_2...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommandsTestCase: def test_import_airport(self): """Test import_airport command.""" args = ['modeling/airports.csv'] opts = {} call_command('import_airport', *args, **opts) def test_import_board(self): """Test import_board command.""" args = ['modeling/boar...
the_stack_v2_python_sparse
mdm/test.py
lordoftheflies/gargantula-scrapersite
train
0
5b7253d5f0c707b4dd5cfa1bf0ebb5a437c24aed
[ "self.capacity = capacity\nself.current = 0\nself.start = Node(0, 0)\nself.end = Node(0, 0)\nself.start.next = self.end\nself.end.prev = self.start\nself.node_map = {}", "if key not in self.node_map:\n return -1\nnode = self.node_map[key]\nnode.next.prev = node.prev\nnode.prev.next = node.next\nnode.next = sel...
<|body_start_0|> self.capacity = capacity self.current = 0 self.start = Node(0, 0) self.end = Node(0, 0) self.start.next = self.end self.end.prev = self.start self.node_map = {} <|end_body_0|> <|body_start_1|> if key not in self.node_map: retu...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_004046
1,953
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
30bfafb6a7727c9305b22933b63d9d645182c633
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.current = 0 self.start = Node(0, 0) self.end = Node(0, 0) self.start.next = self.end self.end.prev = self.start self.node_map = {} def get(self, ...
the_stack_v2_python_sparse
leetcode/Design/lru-cache.py
iCodeIN/competitive-programming-5
train
0
0cabedfadb79d035c5e8bbd8a8b5155911fe6fe4
[ "super().__init__(img=bullet_img, x=x, y=y)\nself.set_sprite_center()\nself.speed = 300\nself.visible = True", "if self.visible:\n self.move(self.speed * dt)\n if self.x < 0 or self.x > 1024 or self.y > 768:\n self.visible = False" ]
<|body_start_0|> super().__init__(img=bullet_img, x=x, y=y) self.set_sprite_center() self.speed = 300 self.visible = True <|end_body_0|> <|body_start_1|> if self.visible: self.move(self.speed * dt) if self.x < 0 or self.x > 1024 or self.y > 768: ...
炮弹精灵
BulletSprite
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BulletSprite: """炮弹精灵""" def __init__(self, x=0, y=0): """初始化""" <|body_0|> def fire_move(self, dt): """移动炮弹""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__(img=bullet_img, x=x, y=y) self.set_sprite_center() self...
stack_v2_sparse_classes_36k_train_004047
4,509
no_license
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self, x=0, y=0)" }, { "docstring": "移动炮弹", "name": "fire_move", "signature": "def fire_move(self, dt)" } ]
2
null
Implement the Python class `BulletSprite` described below. Class description: 炮弹精灵 Method signatures and docstrings: - def __init__(self, x=0, y=0): 初始化 - def fire_move(self, dt): 移动炮弹
Implement the Python class `BulletSprite` described below. Class description: 炮弹精灵 Method signatures and docstrings: - def __init__(self, x=0, y=0): 初始化 - def fire_move(self, dt): 移动炮弹 <|skeleton|> class BulletSprite: """炮弹精灵""" def __init__(self, x=0, y=0): """初始化""" <|body_0|> def fir...
941e29d5f39092b02f8486a435e61c7ec2bdcdb6
<|skeleton|> class BulletSprite: """炮弹精灵""" def __init__(self, x=0, y=0): """初始化""" <|body_0|> def fire_move(self, dt): """移动炮弹""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BulletSprite: """炮弹精灵""" def __init__(self, x=0, y=0): """初始化""" super().__init__(img=bullet_img, x=x, y=y) self.set_sprite_center() self.speed = 300 self.visible = True def fire_move(self, dt): """移动炮弹""" if self.visible: self.move...
the_stack_v2_python_sparse
Python趣味编程:从入门到人工智能/第31课_捕鱼达人/示例程序/version3/game_sprites.py
zhy0313/children-python
train
0
83e7fb03dcb79eb6b1b7ca25aeac32d5380d25e9
[ "if num_splits is None:\n num_splits = len(self.list_of_blocks)\nif other_axis_partition is not None:\n return self._wrap_partitions(self.deploy_func_between_two_axis_partitions(self.axis, func, num_splits, len(self.list_of_blocks), kwargs, *tuple(self.list_of_blocks + other_axis_partition.list_of_blocks)))\n...
<|body_start_0|> if num_splits is None: num_splits = len(self.list_of_blocks) if other_axis_partition is not None: return self._wrap_partitions(self.deploy_func_between_two_axis_partitions(self.axis, func, num_splits, len(self.list_of_blocks), kwargs, *tuple(self.list_of_blocks +...
This abstract class is created to simplify and consolidate the code for AxisPartitions that run pandas. Because much of the code is similar, this allows us to reuse this code. Subclasses must implement `list_of_blocks` which unwraps the `RemotePartition` objects and creates something interpretable as a pandas DataFrame...
PandasFrameAxisPartition
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PandasFrameAxisPartition: """This abstract class is created to simplify and consolidate the code for AxisPartitions that run pandas. Because much of the code is similar, this allows us to reuse this code. Subclasses must implement `list_of_blocks` which unwraps the `RemotePartition` objects and c...
stack_v2_sparse_classes_36k_train_004048
10,118
permissive
[ { "docstring": "Applies func to the object in the plasma store. See notes in Parent class about this method. Args: func: The function to apply. num_splits: The number of times to split the result object. other_axis_partition: Another `PandasOnRayFrameAxisPartition` object to apply to func with this one. maintai...
4
stack_v2_sparse_classes_30k_train_006845
Implement the Python class `PandasFrameAxisPartition` described below. Class description: This abstract class is created to simplify and consolidate the code for AxisPartitions that run pandas. Because much of the code is similar, this allows us to reuse this code. Subclasses must implement `list_of_blocks` which unwr...
Implement the Python class `PandasFrameAxisPartition` described below. Class description: This abstract class is created to simplify and consolidate the code for AxisPartitions that run pandas. Because much of the code is similar, this allows us to reuse this code. Subclasses must implement `list_of_blocks` which unwr...
90191f115e0ad57394598551fd2fd2ee8f70ed43
<|skeleton|> class PandasFrameAxisPartition: """This abstract class is created to simplify and consolidate the code for AxisPartitions that run pandas. Because much of the code is similar, this allows us to reuse this code. Subclasses must implement `list_of_blocks` which unwraps the `RemotePartition` objects and c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PandasFrameAxisPartition: """This abstract class is created to simplify and consolidate the code for AxisPartitions that run pandas. Because much of the code is similar, this allows us to reuse this code. Subclasses must implement `list_of_blocks` which unwraps the `RemotePartition` objects and creates someth...
the_stack_v2_python_sparse
modin/engines/base/frame/axis_partition.py
devin-petersohn/modin
train
2
2d0a694ebbca739474979d7b314d7748d2cde069
[ "budget_pool = self.pool.get('account.budget')\nbudget_line_pool = self.pool.get('account.budget.lines')\nfor r in self.browse(cr, uid, ids, context=context):\n if r.type == 'transfer' and (not r.line_ids):\n raise osv.except_osv(_('Error!'), _('You cannot complete Transfer Operations without any Budget l...
<|body_start_0|> budget_pool = self.pool.get('account.budget') budget_line_pool = self.pool.get('account.budget.lines') for r in self.browse(cr, uid, ids, context=context): if r.type == 'transfer' and (not r.line_ids): raise osv.except_osv(_('Error!'), _('You cannot c...
Account Budget Operation. Allow accountant to transfer special amount from multiple budget lines to another for cash/plan budgets, Beside budget increase operation.
account_budget_operation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class account_budget_operation: """Account Budget Operation. Allow accountant to transfer special amount from multiple budget lines to another for cash/plan budgets, Beside budget increase operation.""" def complete(self, cr, uid, ids, context={}): """Workflow function change state to comp...
stack_v2_sparse_classes_36k_train_004049
5,063
no_license
[ { "docstring": "Workflow function change state to complete and compute amount value & set operation number @return: True", "name": "complete", "signature": "def complete(self, cr, uid, ids, context={})" }, { "docstring": "Execute the operation by calling transfer function in budget line and chan...
2
stack_v2_sparse_classes_30k_train_003685
Implement the Python class `account_budget_operation` described below. Class description: Account Budget Operation. Allow accountant to transfer special amount from multiple budget lines to another for cash/plan budgets, Beside budget increase operation. Method signatures and docstrings: - def complete(self, cr, uid,...
Implement the Python class `account_budget_operation` described below. Class description: Account Budget Operation. Allow accountant to transfer special amount from multiple budget lines to another for cash/plan budgets, Beside budget increase operation. Method signatures and docstrings: - def complete(self, cr, uid,...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class account_budget_operation: """Account Budget Operation. Allow accountant to transfer special amount from multiple budget lines to another for cash/plan budgets, Beside budget increase operation.""" def complete(self, cr, uid, ids, context={}): """Workflow function change state to comp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class account_budget_operation: """Account Budget Operation. Allow accountant to transfer special amount from multiple budget lines to another for cash/plan budgets, Beside budget increase operation.""" def complete(self, cr, uid, ids, context={}): """Workflow function change state to complete and comp...
the_stack_v2_python_sparse
v_7/GDS/common_shamil_v3/account_budget_cash/account_budget_operation.py
musabahmed/baba
train
0
1aa1a0058a6e7d11a04fac660de3b22d5d2813f1
[ "super().__init__(params)\nself.lr = lr\nself.momentum = momentum\nself.v_weights = [np.zeros_like(t.weights) for t in self.params]\nself.v_bias = [np.zeros_like(t.bias) for t in self.params]", "for i, object in enumerate(self.params):\n self.v_weights[i] = self.momentum * self.v_weights[i]\n self.v_bias[i]...
<|body_start_0|> super().__init__(params) self.lr = lr self.momentum = momentum self.v_weights = [np.zeros_like(t.weights) for t in self.params] self.v_bias = [np.zeros_like(t.bias) for t in self.params] <|end_body_0|> <|body_start_1|> for i, object in enumerate(self.par...
SGD
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SGD: def __init__(self, params, lr=0.001, momentum=0.0): """The Stochastic Gradient Descent optimzer (SGD) :param lr: the learning rate to use :param momentum: Value variable between 0 and 1. Determines the velocity of the gradient descent""" <|body_0|> def step(self): ...
stack_v2_sparse_classes_36k_train_004050
3,421
no_license
[ { "docstring": "The Stochastic Gradient Descent optimzer (SGD) :param lr: the learning rate to use :param momentum: Value variable between 0 and 1. Determines the velocity of the gradient descent", "name": "__init__", "signature": "def __init__(self, params, lr=0.001, momentum=0.0)" }, { "docstr...
2
stack_v2_sparse_classes_30k_val_000149
Implement the Python class `SGD` described below. Class description: Implement the SGD class. Method signatures and docstrings: - def __init__(self, params, lr=0.001, momentum=0.0): The Stochastic Gradient Descent optimzer (SGD) :param lr: the learning rate to use :param momentum: Value variable between 0 and 1. Dete...
Implement the Python class `SGD` described below. Class description: Implement the SGD class. Method signatures and docstrings: - def __init__(self, params, lr=0.001, momentum=0.0): The Stochastic Gradient Descent optimzer (SGD) :param lr: the learning rate to use :param momentum: Value variable between 0 and 1. Dete...
07ff58ae68264e3a9b820d10e84d82f8a3ca99b5
<|skeleton|> class SGD: def __init__(self, params, lr=0.001, momentum=0.0): """The Stochastic Gradient Descent optimzer (SGD) :param lr: the learning rate to use :param momentum: Value variable between 0 and 1. Determines the velocity of the gradient descent""" <|body_0|> def step(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SGD: def __init__(self, params, lr=0.001, momentum=0.0): """The Stochastic Gradient Descent optimzer (SGD) :param lr: the learning rate to use :param momentum: Value variable between 0 and 1. Determines the velocity of the gradient descent""" super().__init__(params) self.lr = lr ...
the_stack_v2_python_sparse
wavegrad/optimizers.py
vlnraf/WaveGrad
train
1
51c504ccd7085f189941e9a1e48b821439d5c1cc
[ "import rdkit.Chem\nimport logging\nrdmol = rdkit.Chem.MolFromSmiles('CCC')\nmessage = debug_rdkit_mol(rdmol, level=logging.INFO)\nself.assertIsNotNone(message)", "mol = Molecule().from_adjacency_list('\\n1 C u0 p0 c0 {2,D} {3,S} {4,S}\\n2 O u0 p2 c0 {1,D}\\n3 H u0 p0 c0 {1,S}\\n4 H u0 p0 c0 {1,S}\\n')\nrdmol = t...
<|body_start_0|> import rdkit.Chem import logging rdmol = rdkit.Chem.MolFromSmiles('CCC') message = debug_rdkit_mol(rdmol, level=logging.INFO) self.assertIsNotNone(message) <|end_body_0|> <|body_start_1|> mol = Molecule().from_adjacency_list('\n1 C u0 p0 c0 {2,D} {3,S} {...
RDKitTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RDKitTest: def test_debugger(self): """Test the debug_rdkit_mol(rdmol) function doesn't crash We can't really test it in the unit testing framework, because that already captures and redirects standard output, and that conflicts with the function, but this checks it doesn't crash.""" ...
stack_v2_sparse_classes_36k_train_004051
7,587
permissive
[ { "docstring": "Test the debug_rdkit_mol(rdmol) function doesn't crash We can't really test it in the unit testing framework, because that already captures and redirects standard output, and that conflicts with the function, but this checks it doesn't crash.", "name": "test_debugger", "signature": "def ...
4
null
Implement the Python class `RDKitTest` described below. Class description: Implement the RDKitTest class. Method signatures and docstrings: - def test_debugger(self): Test the debug_rdkit_mol(rdmol) function doesn't crash We can't really test it in the unit testing framework, because that already captures and redirec...
Implement the Python class `RDKitTest` described below. Class description: Implement the RDKitTest class. Method signatures and docstrings: - def test_debugger(self): Test the debug_rdkit_mol(rdmol) function doesn't crash We can't really test it in the unit testing framework, because that already captures and redirec...
349a4af759cf8877197772cd7eaca1e51d46eff5
<|skeleton|> class RDKitTest: def test_debugger(self): """Test the debug_rdkit_mol(rdmol) function doesn't crash We can't really test it in the unit testing framework, because that already captures and redirects standard output, and that conflicts with the function, but this checks it doesn't crash.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RDKitTest: def test_debugger(self): """Test the debug_rdkit_mol(rdmol) function doesn't crash We can't really test it in the unit testing framework, because that already captures and redirects standard output, and that conflicts with the function, but this checks it doesn't crash.""" import rd...
the_stack_v2_python_sparse
rmgpy/molecule/converterTest.py
CanePan-cc/CanePanWorkshop
train
2
f976c2242466f0bb05e759080fbbf959bb7ef18e
[ "x = [i.replace(',', '') for i in list]\ny = [i for i in x if i != '--']\nz = [i for i in y if i != '0']\nints = [int(i) for i in z]\nreturn ints", "x = [i for i in list if i != '--']\ny = [i for i in x if i != '0']\nreal = [float(i) for i in y]\nreturn real" ]
<|body_start_0|> x = [i.replace(',', '') for i in list] y = [i for i in x if i != '--'] z = [i for i in y if i != '0'] ints = [int(i) for i in z] return ints <|end_body_0|> <|body_start_1|> x = [i for i in list if i != '--'] y = [i for i in x if i != '0'] ...
Used to process a list of strings to a list of usable integers or floats.
DataTypes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataTypes: """Used to process a list of strings to a list of usable integers or floats.""" def integers(cls, list): """Returns a list of integers, from a list of strings""" <|body_0|> def floats(cls, list): """Returns a list of floats from a list of strings""" ...
stack_v2_sparse_classes_36k_train_004052
48,979
no_license
[ { "docstring": "Returns a list of integers, from a list of strings", "name": "integers", "signature": "def integers(cls, list)" }, { "docstring": "Returns a list of floats from a list of strings", "name": "floats", "signature": "def floats(cls, list)" } ]
2
stack_v2_sparse_classes_30k_train_018919
Implement the Python class `DataTypes` described below. Class description: Used to process a list of strings to a list of usable integers or floats. Method signatures and docstrings: - def integers(cls, list): Returns a list of integers, from a list of strings - def floats(cls, list): Returns a list of floats from a ...
Implement the Python class `DataTypes` described below. Class description: Used to process a list of strings to a list of usable integers or floats. Method signatures and docstrings: - def integers(cls, list): Returns a list of integers, from a list of strings - def floats(cls, list): Returns a list of floats from a ...
8004577bd11d60534d6106fb1893209431a70697
<|skeleton|> class DataTypes: """Used to process a list of strings to a list of usable integers or floats.""" def integers(cls, list): """Returns a list of integers, from a list of strings""" <|body_0|> def floats(cls, list): """Returns a list of floats from a list of strings""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataTypes: """Used to process a list of strings to a list of usable integers or floats.""" def integers(cls, list): """Returns a list of integers, from a list of strings""" x = [i.replace(',', '') for i in list] y = [i for i in x if i != '--'] z = [i for i in y if i != '0'...
the_stack_v2_python_sparse
main/data_functions.py
ytrevor81/NFL-Stats-Library
train
1
f022a6d164c5e16b5ae514cd391b1e5e01c2c93c
[ "pobj = pickle.dumps(obj, protocol)\nzobj = zlib.compress(pobj)\nreturn self.send(zobj, flags=flags)", "zobj = self.recv(flags)\npobj = zlib.decompress(zobj)\nreturn pickle.loads(pobj)", "md = dict(dtype=str(A.dtype), shape=A.shape)\nself.send_json(md, flags | zmq.SNDMORE)\nreturn self.send(A, flags, copy=copy,...
<|body_start_0|> pobj = pickle.dumps(obj, protocol) zobj = zlib.compress(pobj) return self.send(zobj, flags=flags) <|end_body_0|> <|body_start_1|> zobj = self.recv(flags) pobj = zlib.decompress(zobj) return pickle.loads(pobj) <|end_body_1|> <|body_start_2|> md =...
A class with some extra serialization methods send_zipped_pickle is just like send_pyobj, but uses zlib to compress the stream before sending. send_array sends numpy arrays with metadata necessary for reconstructing the array on the other side (dtype,shape).
SerializingSocket
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SerializingSocket: """A class with some extra serialization methods send_zipped_pickle is just like send_pyobj, but uses zlib to compress the stream before sending. send_array sends numpy arrays with metadata necessary for reconstructing the array on the other side (dtype,shape).""" def send...
stack_v2_sparse_classes_36k_train_004053
3,404
permissive
[ { "docstring": "pack and compress an object with pickle and zlib.", "name": "send_zipped_pickle", "signature": "def send_zipped_pickle(self, obj, flags=0, protocol=-1)" }, { "docstring": "reconstruct a Python object sent with zipped_pickle", "name": "recv_zipped_pickle", "signature": "de...
4
stack_v2_sparse_classes_30k_train_018520
Implement the Python class `SerializingSocket` described below. Class description: A class with some extra serialization methods send_zipped_pickle is just like send_pyobj, but uses zlib to compress the stream before sending. send_array sends numpy arrays with metadata necessary for reconstructing the array on the oth...
Implement the Python class `SerializingSocket` described below. Class description: A class with some extra serialization methods send_zipped_pickle is just like send_pyobj, but uses zlib to compress the stream before sending. send_array sends numpy arrays with metadata necessary for reconstructing the array on the oth...
e1c3c9717e9d0d3667ca7e4809eab167a726e1ff
<|skeleton|> class SerializingSocket: """A class with some extra serialization methods send_zipped_pickle is just like send_pyobj, but uses zlib to compress the stream before sending. send_array sends numpy arrays with metadata necessary for reconstructing the array on the other side (dtype,shape).""" def send...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SerializingSocket: """A class with some extra serialization methods send_zipped_pickle is just like send_pyobj, but uses zlib to compress the stream before sending. send_array sends numpy arrays with metadata necessary for reconstructing the array on the other side (dtype,shape).""" def send_zipped_pickl...
the_stack_v2_python_sparse
python/uptune/template/pipeline.py
cornell-zhang/uptune
train
32
be4fb3ce40811c90b808da75c0fd9695b1d5f9cb
[ "super().__init__()\nself.embedding = tf.keras.layers.Embedding(input_dim=vocab, output_dim=embedding)\nself.gru = tf.keras.layers.GRU(units=units, kernel_initializer='glorot_uniform', return_sequences=True, return_state=True)\nself.F = tf.keras.layers.Dense(units=vocab)\nself.attention = SelfAttention(units)", "...
<|body_start_0|> super().__init__() self.embedding = tf.keras.layers.Embedding(input_dim=vocab, output_dim=embedding) self.gru = tf.keras.layers.GRU(units=units, kernel_initializer='glorot_uniform', return_sequences=True, return_state=True) self.F = tf.keras.layers.Dense(units=vocab) ...
class RNNDecoder
RNNDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNDecoder: """class RNNDecoder""" def __init__(self, vocab, embedding, units, batch): """Initializer. Args: vocab: (int) representing the size of the output vocabulary. embedding: (int) representing the dimensionality of the embedding vector. units: (int) representing the number of ...
stack_v2_sparse_classes_36k_train_004054
2,152
no_license
[ { "docstring": "Initializer. Args: vocab: (int) representing the size of the output vocabulary. embedding: (int) representing the dimensionality of the embedding vector. units: (int) representing the number of hidden units in the RNN cell. batch: (int) representing the batch size.", "name": "__init__", ...
2
stack_v2_sparse_classes_30k_train_010472
Implement the Python class `RNNDecoder` described below. Class description: class RNNDecoder Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Initializer. Args: vocab: (int) representing the size of the output vocabulary. embedding: (int) representing the dimensionality of the e...
Implement the Python class `RNNDecoder` described below. Class description: class RNNDecoder Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Initializer. Args: vocab: (int) representing the size of the output vocabulary. embedding: (int) representing the dimensionality of the e...
75274394adb52d740f6cd4000cc00bbde44b9b72
<|skeleton|> class RNNDecoder: """class RNNDecoder""" def __init__(self, vocab, embedding, units, batch): """Initializer. Args: vocab: (int) representing the size of the output vocabulary. embedding: (int) representing the dimensionality of the embedding vector. units: (int) representing the number of ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNNDecoder: """class RNNDecoder""" def __init__(self, vocab, embedding, units, batch): """Initializer. Args: vocab: (int) representing the size of the output vocabulary. embedding: (int) representing the dimensionality of the embedding vector. units: (int) representing the number of hidden units ...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/2-rnn_decoder.py
jdarangop/holbertonschool-machine_learning
train
2
5f39c69c3a1ec7529867363b981096bb2f006489
[ "orig = forward = head\ncnt = 0\nwhile forward.next and cnt < n:\n forward = forward.next\n cnt += 1\nif cnt == n - 1:\n orig = orig.next\nelif cnt < n:\n return orig\nelse:\n while forward.next:\n head = head.next\n forward = forward.next\n head.next = head.next.next\nreturn orig", ...
<|body_start_0|> orig = forward = head cnt = 0 while forward.next and cnt < n: forward = forward.next cnt += 1 if cnt == n - 1: orig = orig.next elif cnt < n: return orig else: while forward.next: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def rewrite(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_1|> def rewrite2(self, head, n): """:ty...
stack_v2_sparse_classes_36k_train_004055
3,246
no_license
[ { "docstring": ":type head: ListNode :type n: int :rtype: ListNode", "name": "removeNthFromEnd", "signature": "def removeNthFromEnd(self, head, n)" }, { "docstring": ":type head: ListNode :type n: int :rtype: ListNode", "name": "rewrite", "signature": "def rewrite(self, head, n)" }, ...
3
stack_v2_sparse_classes_30k_train_006688
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def rewrite(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def rew...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def rewrite(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def rew...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def rewrite(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_1|> def rewrite2(self, head, n): """:ty...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" orig = forward = head cnt = 0 while forward.next and cnt < n: forward = forward.next cnt += 1 if cnt == n - 1: orig = orig.next ...
the_stack_v2_python_sparse
co_fb/19_Remove_Nth_Node_From_End_of_List.py
vsdrun/lc_public
train
6
4380bb6366fcb206205af5758f11ae8b49c5573c
[ "units = _get_test_data_dir('crash-corpus')\ncoverage_dir = _make_coverage_dir(tmp_path)\nprofraw_file = os.path.join(coverage_dir, 'test_crash.profraw')\ncrashes_dir = _make_crashes_dir(tmp_path)\nrun_coverage.do_coverage_run(self.COVERAGE_BINARY_PATH, units, profraw_file, crashes_dir)\nassert os.listdir(crashes_d...
<|body_start_0|> units = _get_test_data_dir('crash-corpus') coverage_dir = _make_coverage_dir(tmp_path) profraw_file = os.path.join(coverage_dir, 'test_crash.profraw') crashes_dir = _make_crashes_dir(tmp_path) run_coverage.do_coverage_run(self.COVERAGE_BINARY_PATH, units, profraw...
Integration tests for run_coverage.py
TestIntegrationRunCoverage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestIntegrationRunCoverage: """Integration tests for run_coverage.py""" def test_integration_do_coverage_run_crash(self, tmp_path): """Test that do_coverage_run returns crashing inputs.""" <|body_0|> def test_integration_do_coverage_run_no_crash(self, tmp_path): ...
stack_v2_sparse_classes_36k_train_004056
4,054
permissive
[ { "docstring": "Test that do_coverage_run returns crashing inputs.", "name": "test_integration_do_coverage_run_crash", "signature": "def test_integration_do_coverage_run_crash(self, tmp_path)" }, { "docstring": "Test that do_coverage_run doesn't return crashing inputs when there are none.", ...
3
stack_v2_sparse_classes_30k_train_017688
Implement the Python class `TestIntegrationRunCoverage` described below. Class description: Integration tests for run_coverage.py Method signatures and docstrings: - def test_integration_do_coverage_run_crash(self, tmp_path): Test that do_coverage_run returns crashing inputs. - def test_integration_do_coverage_run_no...
Implement the Python class `TestIntegrationRunCoverage` described below. Class description: Integration tests for run_coverage.py Method signatures and docstrings: - def test_integration_do_coverage_run_crash(self, tmp_path): Test that do_coverage_run returns crashing inputs. - def test_integration_do_coverage_run_no...
ff8ef0c6da62268521061a432c5b9e228c2f53dc
<|skeleton|> class TestIntegrationRunCoverage: """Integration tests for run_coverage.py""" def test_integration_do_coverage_run_crash(self, tmp_path): """Test that do_coverage_run returns crashing inputs.""" <|body_0|> def test_integration_do_coverage_run_no_crash(self, tmp_path): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestIntegrationRunCoverage: """Integration tests for run_coverage.py""" def test_integration_do_coverage_run_crash(self, tmp_path): """Test that do_coverage_run returns crashing inputs.""" units = _get_test_data_dir('crash-corpus') coverage_dir = _make_coverage_dir(tmp_path) ...
the_stack_v2_python_sparse
experiment/measurer/test_run_coverage.py
google/fuzzbench
train
1,005
47b1e796708ee421f462e4a68b1e71be170df340
[ "super().__init__(**kwargs)\nself.identifier_required = identifier_required\nself.disallowed_asset_types = disallowed_asset_types\nself.coingecko_obj = coingecko\nself.cryptocompare_obj = cryptocompare", "asset_type = data.pop('asset_type')\nif self.disallowed_asset_types is not None and asset_type in self.disall...
<|body_start_0|> super().__init__(**kwargs) self.identifier_required = identifier_required self.disallowed_asset_types = disallowed_asset_types self.coingecko_obj = coingecko self.cryptocompare_obj = cryptocompare <|end_body_0|> <|body_start_1|> asset_type = data.pop('as...
AssetSchema
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssetSchema: def __init__(self, identifier_required: bool, disallowed_asset_types: Optional[list[AssetType]]=None, coingecko: Optional['Coingecko']=None, cryptocompare: Optional['Cryptocompare']=None, **kwargs: Any) -> None: """Initializes an asset schema depending on the given asset typ...
stack_v2_sparse_classes_36k_train_004057
13,942
permissive
[ { "docstring": "Initializes an asset schema depending on the given asset type. If identifier_required is True then the identifier field is required. Provided asset_type must not be in disallowed_asset_types list. If coingecko is not None then the coingecko identifier has to be valid. If cryptocompare is not Non...
2
stack_v2_sparse_classes_30k_train_014135
Implement the Python class `AssetSchema` described below. Class description: Implement the AssetSchema class. Method signatures and docstrings: - def __init__(self, identifier_required: bool, disallowed_asset_types: Optional[list[AssetType]]=None, coingecko: Optional['Coingecko']=None, cryptocompare: Optional['Crypto...
Implement the Python class `AssetSchema` described below. Class description: Implement the AssetSchema class. Method signatures and docstrings: - def __init__(self, identifier_required: bool, disallowed_asset_types: Optional[list[AssetType]]=None, coingecko: Optional['Coingecko']=None, cryptocompare: Optional['Crypto...
496948458b89afc41458f19d1cba0e971ab67c8b
<|skeleton|> class AssetSchema: def __init__(self, identifier_required: bool, disallowed_asset_types: Optional[list[AssetType]]=None, coingecko: Optional['Coingecko']=None, cryptocompare: Optional['Cryptocompare']=None, **kwargs: Any) -> None: """Initializes an asset schema depending on the given asset typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AssetSchema: def __init__(self, identifier_required: bool, disallowed_asset_types: Optional[list[AssetType]]=None, coingecko: Optional['Coingecko']=None, cryptocompare: Optional['Cryptocompare']=None, **kwargs: Any) -> None: """Initializes an asset schema depending on the given asset type. If identifi...
the_stack_v2_python_sparse
rotkehlchen/serialization/schemas.py
LefterisJP/rotkehlchen
train
0
e2cfdcc2649cf467072e1c1931367c1dff6129ef
[ "if instance.form_definition.form_template_name:\n self.render_template = instance.form_definition.form_template_name\nelse:\n self.render_template = settings.DEFAULT_FORM_TEMPLATE\nreturn self.render_template", "sekizai_varname = sekizai_get_varname()\ncontext = {'instance': instance, 'config': config, sek...
<|body_start_0|> if instance.form_definition.form_template_name: self.render_template = instance.form_definition.form_template_name else: self.render_template = settings.DEFAULT_FORM_TEMPLATE return self.render_template <|end_body_0|> <|body_start_1|> sekizai_var...
Plugin for rendering Form designer form RUS: Класс плагин Дизайнера форм FormDesignerPlugin
FormDesignerPlugin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormDesignerPlugin: """Plugin for rendering Form designer form RUS: Класс плагин Дизайнера форм FormDesignerPlugin""" def get_render_template(self, request, instance, **kwargs): """RUS: Возвращает выбранный из списка шаблон формы для рендеринга, если он не выбран - используется шабло...
stack_v2_sparse_classes_36k_train_004058
2,528
permissive
[ { "docstring": "RUS: Возвращает выбранный из списка шаблон формы для рендеринга, если он не выбран - используется шаблон формы по умолчанию.", "name": "get_render_template", "signature": "def get_render_template(self, request, instance, **kwargs)" }, { "docstring": "Return the context to use in ...
2
stack_v2_sparse_classes_30k_val_000224
Implement the Python class `FormDesignerPlugin` described below. Class description: Plugin for rendering Form designer form RUS: Класс плагин Дизайнера форм FormDesignerPlugin Method signatures and docstrings: - def get_render_template(self, request, instance, **kwargs): RUS: Возвращает выбранный из списка шаблон фор...
Implement the Python class `FormDesignerPlugin` described below. Class description: Plugin for rendering Form designer form RUS: Класс плагин Дизайнера форм FormDesignerPlugin Method signatures and docstrings: - def get_render_template(self, request, instance, **kwargs): RUS: Возвращает выбранный из списка шаблон фор...
186c783b4e4ed58199db7165703253cac1189c5a
<|skeleton|> class FormDesignerPlugin: """Plugin for rendering Form designer form RUS: Класс плагин Дизайнера форм FormDesignerPlugin""" def get_render_template(self, request, instance, **kwargs): """RUS: Возвращает выбранный из списка шаблон формы для рендеринга, если он не выбран - используется шабло...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FormDesignerPlugin: """Plugin for rendering Form designer form RUS: Класс плагин Дизайнера форм FormDesignerPlugin""" def get_render_template(self, request, instance, **kwargs): """RUS: Возвращает выбранный из списка шаблон формы для рендеринга, если он не выбран - используется шаблон формы по ум...
the_stack_v2_python_sparse
edw_fluent/plugins/form_designer_plugin/content_plugins.py
infolabs/django-edw-fluent
train
0
99ec9eea977b63fa6bc30eb49ff79122b177b0d0
[ "self.input_size = input_size\nself.output_size = output_size\nself.alpha = 0.01\nself.alpha_decay = 0.01\nself.gamma = 1", "neural_net = Sequential()\nneural_net.add(Dense(52, input_dim=self.input_size, activation='tanh'))\nneural_net.add(Dense(128, activation='tanh'))\nneural_net.add(Dense(self.output_size * 2 ...
<|body_start_0|> self.input_size = input_size self.output_size = output_size self.alpha = 0.01 self.alpha_decay = 0.01 self.gamma = 1 <|end_body_0|> <|body_start_1|> neural_net = Sequential() neural_net.add(Dense(52, input_dim=self.input_size, activation='tanh'))...
'Controller' class that manages the updating of neural networks for a list of agents.
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """'Controller' class that manages the updating of neural networks for a list of agents.""" def __init__(self, input_size: int, output_size: int): """Initialise the class with learning parameters.""" <|body_0|> def make_agent(self): """Create agent us...
stack_v2_sparse_classes_36k_train_004059
4,546
no_license
[ { "docstring": "Initialise the class with learning parameters.", "name": "__init__", "signature": "def __init__(self, input_size: int, output_size: int)" }, { "docstring": "Create agent using Keras neural network.", "name": "make_agent", "signature": "def make_agent(self)" }, { "...
4
stack_v2_sparse_classes_30k_val_000710
Implement the Python class `Controller` described below. Class description: 'Controller' class that manages the updating of neural networks for a list of agents. Method signatures and docstrings: - def __init__(self, input_size: int, output_size: int): Initialise the class with learning parameters. - def make_agent(s...
Implement the Python class `Controller` described below. Class description: 'Controller' class that manages the updating of neural networks for a list of agents. Method signatures and docstrings: - def __init__(self, input_size: int, output_size: int): Initialise the class with learning parameters. - def make_agent(s...
c72db39f7e49bd2c4ba9d8446f6ac7b3678928fd
<|skeleton|> class Controller: """'Controller' class that manages the updating of neural networks for a list of agents.""" def __init__(self, input_size: int, output_size: int): """Initialise the class with learning parameters.""" <|body_0|> def make_agent(self): """Create agent us...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Controller: """'Controller' class that manages the updating of neural networks for a list of agents.""" def __init__(self, input_size: int, output_size: int): """Initialise the class with learning parameters.""" self.input_size = input_size self.output_size = output_size s...
the_stack_v2_python_sparse
Machine_Learning/DeepQ/RLController.py
JamesNunns/Robotics-Group-Studies
train
8
7a5a7bd6c640be015635d1ebcce9f243eb59337d
[ "super(LCAModel, self).__init__()\nself.lca_layer = lca_layer\nself.num_lca_dim = num_lca_dim\nself.num_simulations = num_simulations\nself.num_time_steps = num_time_steps\nself.save_activities = save_activities", "dev = 'cuda:0'\nactive = torch.ones(size=(self.num_simulations, 1), device=dev)\nif self.save_activ...
<|body_start_0|> super(LCAModel, self).__init__() self.lca_layer = lca_layer self.num_lca_dim = num_lca_dim self.num_simulations = num_simulations self.num_time_steps = num_time_steps self.save_activities = save_activities <|end_body_0|> <|body_start_1|> dev = 'c...
LCAModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LCAModel: def __init__(self, lca_layer: LCALayer, num_lca_dim: int, num_simulations: int=10000, num_time_steps: int=3000, save_activities: bool=False): """A model that simulates a leaky competing accumulator model (Usher and McClelland). References: Usher M, McClelland JL. The time cours...
stack_v2_sparse_classes_36k_train_004060
12,763
permissive
[ { "docstring": "A model that simulates a leaky competing accumulator model (Usher and McClelland). References: Usher M, McClelland JL. The time course of perceptual choice: the leaky, competing accumulator model. Psychol Rev. 2001 Jul;108(3):550-92. doi: 10.1037/0033-295x.108.3.550. PMID: 11488378. Args: lca_la...
2
stack_v2_sparse_classes_30k_train_005390
Implement the Python class `LCAModel` described below. Class description: Implement the LCAModel class. Method signatures and docstrings: - def __init__(self, lca_layer: LCALayer, num_lca_dim: int, num_simulations: int=10000, num_time_steps: int=3000, save_activities: bool=False): A model that simulates a leaky compe...
Implement the Python class `LCAModel` described below. Class description: Implement the LCAModel class. Method signatures and docstrings: - def __init__(self, lca_layer: LCALayer, num_lca_dim: int, num_simulations: int=10000, num_time_steps: int=3000, save_activities: bool=False): A model that simulates a leaky compe...
424971b04d55a2cddbae4c05a0aae2d7b3502c20
<|skeleton|> class LCAModel: def __init__(self, lca_layer: LCALayer, num_lca_dim: int, num_simulations: int=10000, num_time_steps: int=3000, save_activities: bool=False): """A model that simulates a leaky competing accumulator model (Usher and McClelland). References: Usher M, McClelland JL. The time cours...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LCAModel: def __init__(self, lca_layer: LCALayer, num_lca_dim: int, num_simulations: int=10000, num_time_steps: int=3000, save_activities: bool=False): """A model that simulates a leaky competing accumulator model (Usher and McClelland). References: Usher M, McClelland JL. The time course of perceptua...
the_stack_v2_python_sparse
Scripts/Debug/stability_flexibility/pytorch_lca.py
PrincetonUniversity/PsyNeuLink
train
79
2600e73c375869a188c306f8f26c7160346612a5
[ "self.name = name\nself.sequence = sequence\nself.codon_table = create_codon_table()\nself.codon_to_bases = {str(value): key for key, value in create_codon_index().items()}\nself.acid_table = create_aminoacids_table()\nself.acid_to_codon_table = create_aminoacids_to_codon_index_table()\nself.example_gene_representa...
<|body_start_0|> self.name = name self.sequence = sequence self.codon_table = create_codon_table() self.codon_to_bases = {str(value): key for key, value in create_codon_index().items()} self.acid_table = create_aminoacids_table() self.acid_to_codon_table = create_aminoaci...
A class for a particular protein sequence (made from amino acids) The space is all synonymous sequences of genes representing this amino acid sequence (represented in terms of bases)
ProteinBaseParameter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProteinBaseParameter: """A class for a particular protein sequence (made from amino acids) The space is all synonymous sequences of genes representing this amino acid sequence (represented in terms of bases)""" def __init__(self, name: str, sequence: str): """:param name: Name of par...
stack_v2_sparse_classes_36k_train_004061
4,499
permissive
[ { "docstring": ":param name: Name of parameter :Sequence: input gene", "name": "__init__", "signature": "def __init__(self, name: str, sequence: str)" }, { "docstring": "Generates multiple random gene representations of the amino acid :param point_count: number of data points to generate. :retur...
2
stack_v2_sparse_classes_30k_train_016334
Implement the Python class `ProteinBaseParameter` described below. Class description: A class for a particular protein sequence (made from amino acids) The space is all synonymous sequences of genes representing this amino acid sequence (represented in terms of bases) Method signatures and docstrings: - def __init__(...
Implement the Python class `ProteinBaseParameter` described below. Class description: A class for a particular protein sequence (made from amino acids) The space is all synonymous sequences of genes representing this amino acid sequence (represented in terms of bases) Method signatures and docstrings: - def __init__(...
f19eaf7231ed007cce9e12fba0f7f936eb48cfdb
<|skeleton|> class ProteinBaseParameter: """A class for a particular protein sequence (made from amino acids) The space is all synonymous sequences of genes representing this amino acid sequence (represented in terms of bases)""" def __init__(self, name: str, sequence: str): """:param name: Name of par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProteinBaseParameter: """A class for a particular protein sequence (made from amino acids) The space is all synonymous sequences of genes representing this amino acid sequence (represented in terms of bases)""" def __init__(self, name: str, sequence: str): """:param name: Name of parameter :Seque...
the_stack_v2_python_sparse
boss/code/parameters/protein_base_parameter.py
henrymoss/BOSS
train
25
7171f5552b963e13550383d4b5229120d2230f9b
[ "if isinstance(id, int):\n return session.query(Dataset).filter(Dataset.id == id).one()\nraise ValueError('id must be integer')", "if isinstance(id, int):\n return session.query(Dataset).filter(Dataset.problem_id == id).all()\nraise ValueError('id must be integer')" ]
<|body_start_0|> if isinstance(id, int): return session.query(Dataset).filter(Dataset.id == id).one() raise ValueError('id must be integer') <|end_body_0|> <|body_start_1|> if isinstance(id, int): return session.query(Dataset).filter(Dataset.problem_id == id).all() ...
DatasetRepository
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatasetRepository: def get_by_id(session, id): """Gets a dataset with the specified id :param session: :param id: :return: a dataset""" <|body_0|> def get_by_problem_id(session, id): """Gets a dataset for the problem with the specified id :param session: :param id: :...
stack_v2_sparse_classes_36k_train_004062
1,004
permissive
[ { "docstring": "Gets a dataset with the specified id :param session: :param id: :return: a dataset", "name": "get_by_id", "signature": "def get_by_id(session, id)" }, { "docstring": "Gets a dataset for the problem with the specified id :param session: :param id: :return: a dataset", "name": ...
2
stack_v2_sparse_classes_30k_train_008395
Implement the Python class `DatasetRepository` described below. Class description: Implement the DatasetRepository class. Method signatures and docstrings: - def get_by_id(session, id): Gets a dataset with the specified id :param session: :param id: :return: a dataset - def get_by_problem_id(session, id): Gets a data...
Implement the Python class `DatasetRepository` described below. Class description: Implement the DatasetRepository class. Method signatures and docstrings: - def get_by_id(session, id): Gets a dataset with the specified id :param session: :param id: :return: a dataset - def get_by_problem_id(session, id): Gets a data...
428719b8589b3ca9922ae0c6fa527f47f8a98690
<|skeleton|> class DatasetRepository: def get_by_id(session, id): """Gets a dataset with the specified id :param session: :param id: :return: a dataset""" <|body_0|> def get_by_problem_id(session, id): """Gets a dataset for the problem with the specified id :param session: :param id: :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatasetRepository: def get_by_id(session, id): """Gets a dataset with the specified id :param session: :param id: :return: a dataset""" if isinstance(id, int): return session.query(Dataset).filter(Dataset.id == id).one() raise ValueError('id must be integer') def get_b...
the_stack_v2_python_sparse
DB/Repositories/DatasetRepository.py
valiro21/mlc
train
0
8b6f68877cc8ea312f3b73537d8b62a24c12554c
[ "req = query_production.parse_args(strict=True)\ncondition = []\nif req.get('merchant_code'):\n condition.append(TbMerchant.code == req['merchant_code'])\nmerchants = TbMerchant.query.filter(*condition).paginate(page=req['page'], per_page=req['page_size'])\nreturn ({'results': [{'merchant_name': i.name, 'merchan...
<|body_start_0|> req = query_production.parse_args(strict=True) condition = [] if req.get('merchant_code'): condition.append(TbMerchant.code == req['merchant_code']) merchants = TbMerchant.query.filter(*condition).paginate(page=req['page'], per_page=req['page_size']) ...
Production
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Production: def get(self): """获取产品列表""" <|body_0|> def put(self): """更新产品信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> req = query_production.parse_args(strict=True) condition = [] if req.get('merchant_code'): condit...
stack_v2_sparse_classes_36k_train_004063
9,260
no_license
[ { "docstring": "获取产品列表", "name": "get", "signature": "def get(self)" }, { "docstring": "更新产品信息", "name": "put", "signature": "def put(self)" } ]
2
stack_v2_sparse_classes_30k_train_011801
Implement the Python class `Production` described below. Class description: Implement the Production class. Method signatures and docstrings: - def get(self): 获取产品列表 - def put(self): 更新产品信息
Implement the Python class `Production` described below. Class description: Implement the Production class. Method signatures and docstrings: - def get(self): 获取产品列表 - def put(self): 更新产品信息 <|skeleton|> class Production: def get(self): """获取产品列表""" <|body_0|> def put(self): """更新产品信...
9f4553a6ea6d703f0ff3e330b090ee10e2b9a12a
<|skeleton|> class Production: def get(self): """获取产品列表""" <|body_0|> def put(self): """更新产品信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Production: def get(self): """获取产品列表""" req = query_production.parse_args(strict=True) condition = [] if req.get('merchant_code'): condition.append(TbMerchant.code == req['merchant_code']) merchants = TbMerchant.query.filter(*condition).paginate(page=req['pa...
the_stack_v2_python_sparse
xxw/support/src/modules/business_user/public.py
GSIL-Monitor/xxw
train
0
54c4f3520d5d633aec41806b924b17ff1faf61a8
[ "QtWidgets.QDialog.__init__(self)\nself.df = pandaTable\nself.layout = QtWidgets.QGridLayout(self)\nself.columnSelect = QtWidgets.QComboBox()\nself.columnSelect.addItems(self.df.columns.values)\nself.layout.addWidget(self.columnSelect, 0, 1)\nself.layout.addWidget(QtWidgets.QLabel('Column:'), 0, 0)\nself.separatorL...
<|body_start_0|> QtWidgets.QDialog.__init__(self) self.df = pandaTable self.layout = QtWidgets.QGridLayout(self) self.columnSelect = QtWidgets.QComboBox() self.columnSelect.addItems(self.df.columns.values) self.layout.addWidget(self.columnSelect, 0, 1) self.layout...
A dialog box to get the information required by the newRowsOnSeparator function.
NewRowsOnSeparatorDialogBox
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewRowsOnSeparatorDialogBox: """A dialog box to get the information required by the newRowsOnSeparator function.""" def __init__(self, pandaTable, parent): """Initializes the UI and sets the two dropdowns to display column names of the active Panda.""" <|body_0|> def get...
stack_v2_sparse_classes_36k_train_004064
29,548
no_license
[ { "docstring": "Initializes the UI and sets the two dropdowns to display column names of the active Panda.", "name": "__init__", "signature": "def __init__(self, pandaTable, parent)" }, { "docstring": "Returns the user's input", "name": "getResults", "signature": "def getResults(self, pa...
2
stack_v2_sparse_classes_30k_train_016191
Implement the Python class `NewRowsOnSeparatorDialogBox` described below. Class description: A dialog box to get the information required by the newRowsOnSeparator function. Method signatures and docstrings: - def __init__(self, pandaTable, parent): Initializes the UI and sets the two dropdowns to display column name...
Implement the Python class `NewRowsOnSeparatorDialogBox` described below. Class description: A dialog box to get the information required by the newRowsOnSeparator function. Method signatures and docstrings: - def __init__(self, pandaTable, parent): Initializes the UI and sets the two dropdowns to display column name...
1a3c5ad967472faf66236a311cc07a5128f5f911
<|skeleton|> class NewRowsOnSeparatorDialogBox: """A dialog box to get the information required by the newRowsOnSeparator function.""" def __init__(self, pandaTable, parent): """Initializes the UI and sets the two dropdowns to display column names of the active Panda.""" <|body_0|> def get...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NewRowsOnSeparatorDialogBox: """A dialog box to get the information required by the newRowsOnSeparator function.""" def __init__(self, pandaTable, parent): """Initializes the UI and sets the two dropdowns to display column names of the active Panda.""" QtWidgets.QDialog.__init__(self) ...
the_stack_v2_python_sparse
datatool/gui/Model.py
scottawalton/datatool
train
0
76234a31da876af5664d45294a19409368869f3d
[ "cfg = '# auto-generated by RADVD service (utility.py)\\n'\nfor iface in node.get_ifaces(control=False):\n prefixes = list(map(cls.subnetentry, iface.ips()))\n if len(prefixes) < 1:\n continue\n cfg += f'interface {iface.name}\\n{{\\n AdvSendAdvert on;\\n MinRtrAdvInterval 3;\\n ...
<|body_start_0|> cfg = '# auto-generated by RADVD service (utility.py)\n' for iface in node.get_ifaces(control=False): prefixes = list(map(cls.subnetentry, iface.ips())) if len(prefixes) < 1: continue cfg += f'interface {iface.name}\n{{\n AdvSen...
RadvdService
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RadvdService: def generate_config(cls, node: CoreNode, filename: str) -> str: """Generate a RADVD router advertisement daemon config file using the network address of each interface.""" <|body_0|> def subnetentry(ip: netaddr.IPNetwork) -> str: """Generate a subnet de...
stack_v2_sparse_classes_36k_train_004065
19,801
permissive
[ { "docstring": "Generate a RADVD router advertisement daemon config file using the network address of each interface.", "name": "generate_config", "signature": "def generate_config(cls, node: CoreNode, filename: str) -> str" }, { "docstring": "Generate a subnet declaration block given an IPv6 pr...
2
null
Implement the Python class `RadvdService` described below. Class description: Implement the RadvdService class. Method signatures and docstrings: - def generate_config(cls, node: CoreNode, filename: str) -> str: Generate a RADVD router advertisement daemon config file using the network address of each interface. - de...
Implement the Python class `RadvdService` described below. Class description: Implement the RadvdService class. Method signatures and docstrings: - def generate_config(cls, node: CoreNode, filename: str) -> str: Generate a RADVD router advertisement daemon config file using the network address of each interface. - de...
20071eed2e73a2287aa385698dd604f4933ae7ff
<|skeleton|> class RadvdService: def generate_config(cls, node: CoreNode, filename: str) -> str: """Generate a RADVD router advertisement daemon config file using the network address of each interface.""" <|body_0|> def subnetentry(ip: netaddr.IPNetwork) -> str: """Generate a subnet de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RadvdService: def generate_config(cls, node: CoreNode, filename: str) -> str: """Generate a RADVD router advertisement daemon config file using the network address of each interface.""" cfg = '# auto-generated by RADVD service (utility.py)\n' for iface in node.get_ifaces(control=False)...
the_stack_v2_python_sparse
daemon/core/services/utility.py
coreemu/core
train
606
955f644102887748654b61f89170995d69784322
[ "self.mean = np.zeros(shape, np.float64)\nself.var = np.ones(shape, np.float64)\nself.count = epsilon", "batch_mean = np.mean(arr, axis=0)\nbatch_var = np.var(arr, axis=0)\nbatch_count = arr.shape[0]\nself.update_from_moments(batch_mean, batch_var, batch_count)", "delta = batch_mean - self.mean\ntot_count = sel...
<|body_start_0|> self.mean = np.zeros(shape, np.float64) self.var = np.ones(shape, np.float64) self.count = epsilon <|end_body_0|> <|body_start_1|> batch_mean = np.mean(arr, axis=0) batch_var = np.var(arr, axis=0) batch_count = arr.shape[0] self.update_from_momen...
Calulates the running mean and std of a data stream. Attributes: mean (np.array): mean of data stream. var (np.array): variance of data stream. count (float): total count of data steam.
RunningMeanStd
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunningMeanStd: """Calulates the running mean and std of a data stream. Attributes: mean (np.array): mean of data stream. var (np.array): variance of data stream. count (float): total count of data steam.""" def __init__(self, epsilon=0.0001, shape=()): """Initializes containers for ...
stack_v2_sparse_classes_36k_train_004066
6,361
permissive
[ { "docstring": "Initializes containers for data mean and variance. Args: epsilon (float): helps with arithmetic issues. shape (tuple): the shape of the data stream's output.", "name": "__init__", "signature": "def __init__(self, epsilon=0.0001, shape=())" }, { "docstring": "Update current stats ...
3
null
Implement the Python class `RunningMeanStd` described below. Class description: Calulates the running mean and std of a data stream. Attributes: mean (np.array): mean of data stream. var (np.array): variance of data stream. count (float): total count of data steam. Method signatures and docstrings: - def __init__(sel...
Implement the Python class `RunningMeanStd` described below. Class description: Calulates the running mean and std of a data stream. Attributes: mean (np.array): mean of data stream. var (np.array): variance of data stream. count (float): total count of data steam. Method signatures and docstrings: - def __init__(sel...
140ed17dbd91d73a1f6537520b610adff732b9aa
<|skeleton|> class RunningMeanStd: """Calulates the running mean and std of a data stream. Attributes: mean (np.array): mean of data stream. var (np.array): variance of data stream. count (float): total count of data steam.""" def __init__(self, epsilon=0.0001, shape=()): """Initializes containers for ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunningMeanStd: """Calulates the running mean and std of a data stream. Attributes: mean (np.array): mean of data stream. var (np.array): variance of data stream. count (float): total count of data steam.""" def __init__(self, epsilon=0.0001, shape=()): """Initializes containers for data mean and...
the_stack_v2_python_sparse
safe_control_gym/math_and_models/normalization.py
utiasDSL/safe-control-gym
train
387
a3cbf372835466e3515f5c5f93ccf9b95bbf026d
[ "with patch('modules.exercises.mod_11_testing.process.MyConnection') as con_class:\n mock_db = MagicMock(name='db_mock')\n con_class.return_value = mock_db\n mock_db.get_book.side_effect = [{'book_id': '10', 'author_name': 'test__another_1', 'name': 'name_1'}, {'book_id': '11', 'author_name': 'test__anothe...
<|body_start_0|> with patch('modules.exercises.mod_11_testing.process.MyConnection') as con_class: mock_db = MagicMock(name='db_mock') con_class.return_value = mock_db mock_db.get_book.side_effect = [{'book_id': '10', 'author_name': 'test__another_1', 'name': 'name_1'}, {'boo...
Test class for get_info_list method of GetBookAuthor. We will increase coverage of this method. We do not inheritate for TestCase as we dont want to be discovered by nosetests, just for checking
TestGetAllBookAuthor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGetAllBookAuthor: """Test class for get_info_list method of GetBookAuthor. We will increase coverage of this method. We do not inheritate for TestCase as we dont want to be discovered by nosetests, just for checking""" def test_get_all_books_work(self): """When database module is...
stack_v2_sparse_classes_36k_train_004067
3,022
no_license
[ { "docstring": "When database module is working we check that our process return a valid list", "name": "test_get_all_books_work", "signature": "def test_get_all_books_work(self)" }, { "docstring": "TEst that database error is handled in our process module and we dont raise any exception up", ...
2
null
Implement the Python class `TestGetAllBookAuthor` described below. Class description: Test class for get_info_list method of GetBookAuthor. We will increase coverage of this method. We do not inheritate for TestCase as we dont want to be discovered by nosetests, just for checking Method signatures and docstrings: - d...
Implement the Python class `TestGetAllBookAuthor` described below. Class description: Test class for get_info_list method of GetBookAuthor. We will increase coverage of this method. We do not inheritate for TestCase as we dont want to be discovered by nosetests, just for checking Method signatures and docstrings: - d...
8f082201e24f0f2b991d9388500fdbf95d6f073d
<|skeleton|> class TestGetAllBookAuthor: """Test class for get_info_list method of GetBookAuthor. We will increase coverage of this method. We do not inheritate for TestCase as we dont want to be discovered by nosetests, just for checking""" def test_get_all_books_work(self): """When database module is...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestGetAllBookAuthor: """Test class for get_info_list method of GetBookAuthor. We will increase coverage of this method. We do not inheritate for TestCase as we dont want to be discovered by nosetests, just for checking""" def test_get_all_books_work(self): """When database module is working we c...
the_stack_v2_python_sparse
modules/exercises/mod_11_testing/solution.py
garciacastano09/pycourse
train
0
b35564543de5a9afcb9b650a03bb42d0e97a2cd1
[ "self.env_type = env_type\nself.protected_count = protected_count\nself.protected_size_bytes = protected_size_bytes\nself.unprotected_count = unprotected_count\nself.unprotected_size_bytes = unprotected_size_bytes", "if dictionary is None:\n return None\nenv_type = dictionary.get('envType')\nprotected_count = ...
<|body_start_0|> self.env_type = env_type self.protected_count = protected_count self.protected_size_bytes = protected_size_bytes self.unprotected_count = unprotected_count self.unprotected_size_bytes = unprotected_size_bytes <|end_body_0|> <|body_start_1|> if dictionary...
Implementation of the 'ProtectedObjectsByEnv' model. Number of Protected Objects by Type. Attributes: env_type (string): Environment Type. protected_count (int): Number of Protected Objects. protected_size_bytes (long|int): Size of Protected Objects. unprotected_count (int): Number of Unprotected Objects. unprotected_s...
ProtectedObjectsByEnv
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectedObjectsByEnv: """Implementation of the 'ProtectedObjectsByEnv' model. Number of Protected Objects by Type. Attributes: env_type (string): Environment Type. protected_count (int): Number of Protected Objects. protected_size_bytes (long|int): Size of Protected Objects. unprotected_count (i...
stack_v2_sparse_classes_36k_train_004068
2,553
permissive
[ { "docstring": "Constructor for the ProtectedObjectsByEnv class", "name": "__init__", "signature": "def __init__(self, env_type=None, protected_count=None, protected_size_bytes=None, unprotected_count=None, unprotected_size_bytes=None)" }, { "docstring": "Creates an instance of this model from a...
2
stack_v2_sparse_classes_30k_train_012558
Implement the Python class `ProtectedObjectsByEnv` described below. Class description: Implementation of the 'ProtectedObjectsByEnv' model. Number of Protected Objects by Type. Attributes: env_type (string): Environment Type. protected_count (int): Number of Protected Objects. protected_size_bytes (long|int): Size of ...
Implement the Python class `ProtectedObjectsByEnv` described below. Class description: Implementation of the 'ProtectedObjectsByEnv' model. Number of Protected Objects by Type. Attributes: env_type (string): Environment Type. protected_count (int): Number of Protected Objects. protected_size_bytes (long|int): Size of ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ProtectedObjectsByEnv: """Implementation of the 'ProtectedObjectsByEnv' model. Number of Protected Objects by Type. Attributes: env_type (string): Environment Type. protected_count (int): Number of Protected Objects. protected_size_bytes (long|int): Size of Protected Objects. unprotected_count (i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProtectedObjectsByEnv: """Implementation of the 'ProtectedObjectsByEnv' model. Number of Protected Objects by Type. Attributes: env_type (string): Environment Type. protected_count (int): Number of Protected Objects. protected_size_bytes (long|int): Size of Protected Objects. unprotected_count (int): Number o...
the_stack_v2_python_sparse
cohesity_management_sdk/models/protected_objects_by_env.py
cohesity/management-sdk-python
train
24
12bea1e6d507b0dd669f8d71a32d5741dcbc2555
[ "rx_time = time.time()\nmsg_type, rem_ch, loc_ch = struct.unpack('>III', data[0:12])\nif msg_type == 1 and rem_ch == 0:\n logging.warning('Client should not get INIT messages')\n return\nledbattest = self._tests.get(rem_ch)\nif ledbattest is None:\n logging.warning('Could not find ledbat test with our id: ...
<|body_start_0|> rx_time = time.time() msg_type, rem_ch, loc_ch = struct.unpack('>III', data[0:12]) if msg_type == 1 and rem_ch == 0: logging.warning('Client should not get INIT messages') return ledbattest = self._tests.get(rem_ch) if ledbattest is None: ...
description of class
ClientRole
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientRole: """description of class""" def datagram_received(self, data, addr): """Process the received datagram""" <|body_0|> def start_client(self, **kwargs): """Start the functioning of the client by starting a new test""" <|body_1|> def _stop_tes...
stack_v2_sparse_classes_36k_train_004069
3,998
permissive
[ { "docstring": "Process the received datagram", "name": "datagram_received", "signature": "def datagram_received(self, data, addr)" }, { "docstring": "Start the functioning of the client by starting a new test", "name": "start_client", "signature": "def start_client(self, **kwargs)" },...
5
stack_v2_sparse_classes_30k_train_007164
Implement the Python class `ClientRole` described below. Class description: description of class Method signatures and docstrings: - def datagram_received(self, data, addr): Process the received datagram - def start_client(self, **kwargs): Start the functioning of the client by starting a new test - def _stop_test(se...
Implement the Python class `ClientRole` described below. Class description: description of class Method signatures and docstrings: - def datagram_received(self, data, addr): Process the received datagram - def start_client(self, **kwargs): Start the functioning of the client by starting a new test - def _stop_test(se...
16d61db9d8838ec3f4088c8a04ec9f5daa1ab532
<|skeleton|> class ClientRole: """description of class""" def datagram_received(self, data, addr): """Process the received datagram""" <|body_0|> def start_client(self, **kwargs): """Start the functioning of the client by starting a new test""" <|body_1|> def _stop_tes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClientRole: """description of class""" def datagram_received(self, data, addr): """Process the received datagram""" rx_time = time.time() msg_type, rem_ch, loc_ch = struct.unpack('>III', data[0:12]) if msg_type == 1 and rem_ch == 0: logging.warning('Client shou...
the_stack_v2_python_sparse
pyledbat/testledbat/clientrole.py
justas-/pyledbat
train
10
72de027ad380186edcd59b98e76f4f1eb3effbe9
[ "self.layers = layers\nself.features = features\nself.codebook = {}", "if codeword in self.codebook:\n return self.codebook[codeword]\ncount = len(self.codebook)\nif count >= self.features:\n return hash(codeword) % self.features\nelse:\n self.codebook[codeword] = count\n return count", "scaled_floa...
<|body_start_0|> self.layers = layers self.features = features self.codebook = {} <|end_body_0|> <|body_start_1|> if codeword in self.codebook: return self.codebook[codeword] count = len(self.codebook) if count >= self.features: return hash(codewo...
砖瓦编码
TileCoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TileCoder: """砖瓦编码""" def __init__(self, layers, features): """layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征""" <|body_0|> def get_feature(self, codeword): """codeword 数据坐标(层数 坐标 坐标 动作)""" <|body_1|> def __call__(self, floats=(), ints=()): """将观测值向量...
stack_v2_sparse_classes_36k_train_004070
22,277
no_license
[ { "docstring": "layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征", "name": "__init__", "signature": "def __init__(self, layers, features)" }, { "docstring": "codeword 数据坐标(层数 坐标 坐标 动作)", "name": "get_feature", "signature": "def get_feature(self, codeword)" }, { "docstring": "将观测值向量转化为 坐标 f...
3
stack_v2_sparse_classes_30k_train_011581
Implement the Python class `TileCoder` described below. Class description: 砖瓦编码 Method signatures and docstrings: - def __init__(self, layers, features): layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征 - def get_feature(self, codeword): codeword 数据坐标(层数 坐标 坐标 动作) - def __call__(self, floats=(), ints=()): 将观测值向量转化为 坐标 floats 特...
Implement the Python class `TileCoder` described below. Class description: 砖瓦编码 Method signatures and docstrings: - def __init__(self, layers, features): layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征 - def get_feature(self, codeword): codeword 数据坐标(层数 坐标 坐标 动作) - def __call__(self, floats=(), ints=()): 将观测值向量转化为 坐标 floats 特...
e6526e9e38fcb5be91b46cb40715c15242198a0b
<|skeleton|> class TileCoder: """砖瓦编码""" def __init__(self, layers, features): """layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征""" <|body_0|> def get_feature(self, codeword): """codeword 数据坐标(层数 坐标 坐标 动作)""" <|body_1|> def __call__(self, floats=(), ints=()): """将观测值向量...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TileCoder: """砖瓦编码""" def __init__(self, layers, features): """layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征""" self.layers = layers self.features = features self.codebook = {} def get_feature(self, codeword): """codeword 数据坐标(层数 坐标 坐标 动作)""" if codeword in s...
the_stack_v2_python_sparse
mountain_car/function_approx.py
lwzswufe/gym_learning
train
0
1ee789cf35ba4d00e8154c7c287cd1646c73f0c9
[ "self.sckt = sckt\nself.msg_cnt = 0\nself.client_private_key = None\nself.client_public_key = None\nself.shared_key = None", "if self.msg_cnt == 0:\n new_msg = bytes('Hello'.encode('utf-8'))\n self.msg_cnt += 1\nelif self.msg_cnt == 1:\n txt1 = msg[:268]\n txt2 = msg[268:]\n parameters = load_der_p...
<|body_start_0|> self.sckt = sckt self.msg_cnt = 0 self.client_private_key = None self.client_public_key = None self.shared_key = None <|end_body_0|> <|body_start_1|> if self.msg_cnt == 0: new_msg = bytes('Hello'.encode('utf-8')) self.msg_cnt += 1...
Classe que implementa a funcionalidade de um CLIENTE.
Client
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Client: """Classe que implementa a funcionalidade de um CLIENTE.""" def __init__(self, sckt=None): """Construtor da classe.""" <|body_0|> def process(self, msg=b''): """Processa uma mensagem (`bytestring`) enviada pelo SERVIDOR. Retorna a mensagem a transmitir co...
stack_v2_sparse_classes_36k_train_004071
3,319
no_license
[ { "docstring": "Construtor da classe.", "name": "__init__", "signature": "def __init__(self, sckt=None)" }, { "docstring": "Processa uma mensagem (`bytestring`) enviada pelo SERVIDOR. Retorna a mensagem a transmitir como resposta (`None` para finalizar ligação)", "name": "process", "sign...
2
stack_v2_sparse_classes_30k_train_021522
Implement the Python class `Client` described below. Class description: Classe que implementa a funcionalidade de um CLIENTE. Method signatures and docstrings: - def __init__(self, sckt=None): Construtor da classe. - def process(self, msg=b''): Processa uma mensagem (`bytestring`) enviada pelo SERVIDOR. Retorna a men...
Implement the Python class `Client` described below. Class description: Classe que implementa a funcionalidade de um CLIENTE. Method signatures and docstrings: - def __init__(self, sckt=None): Construtor da classe. - def process(self, msg=b''): Processa uma mensagem (`bytestring`) enviada pelo SERVIDOR. Retorna a men...
719c1336eec8653987f2a39e93150649752cdd04
<|skeleton|> class Client: """Classe que implementa a funcionalidade de um CLIENTE.""" def __init__(self, sckt=None): """Construtor da classe.""" <|body_0|> def process(self, msg=b''): """Processa uma mensagem (`bytestring`) enviada pelo SERVIDOR. Retorna a mensagem a transmitir co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Client: """Classe que implementa a funcionalidade de um CLIENTE.""" def __init__(self, sckt=None): """Construtor da classe.""" self.sckt = sckt self.msg_cnt = 0 self.client_private_key = None self.client_public_key = None self.shared_key = None def pro...
the_stack_v2_python_sparse
Criptografia e Segurança de Informação/Tecnologias Criptográficas/G6/Client.py
JoelGama/Projects
train
0
937f2ec2754e48e80fd878e044c2ba0e7f7f3a62
[ "for book in Book.objects.all():\n if book.ISBNCode == validated_data['ISBNCode']:\n return Response(status=status.HTTP_400_BAD_REQUEST)\nreturn Book.objects.create(**validated_data)", "instance.isbncode = validated_data.get('isbncode', instance.title)\ninstance.title = validated_data.get('title', insta...
<|body_start_0|> for book in Book.objects.all(): if book.ISBNCode == validated_data['ISBNCode']: return Response(status=status.HTTP_400_BAD_REQUEST) return Book.objects.create(**validated_data) <|end_body_0|> <|body_start_1|> instance.isbncode = validated_data.get('i...
BookSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookSerializer: def create(self, validated_data): """Create and return a new `Book` instance, given the validated data.""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `Book` instance, given the validated data.""" <|...
stack_v2_sparse_classes_36k_train_004072
1,288
no_license
[ { "docstring": "Create and return a new `Book` instance, given the validated data.", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Update and return an existing `Book` instance, given the validated data.", "name": "update", "signature": "def update(...
2
stack_v2_sparse_classes_30k_train_000456
Implement the Python class `BookSerializer` described below. Class description: Implement the BookSerializer class. Method signatures and docstrings: - def create(self, validated_data): Create and return a new `Book` instance, given the validated data. - def update(self, instance, validated_data): Update and return a...
Implement the Python class `BookSerializer` described below. Class description: Implement the BookSerializer class. Method signatures and docstrings: - def create(self, validated_data): Create and return a new `Book` instance, given the validated data. - def update(self, instance, validated_data): Update and return a...
c0da48013a6aa4d5ee3638c60109ceaf938f7af5
<|skeleton|> class BookSerializer: def create(self, validated_data): """Create and return a new `Book` instance, given the validated data.""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `Book` instance, given the validated data.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BookSerializer: def create(self, validated_data): """Create and return a new `Book` instance, given the validated data.""" for book in Book.objects.all(): if book.ISBNCode == validated_data['ISBNCode']: return Response(status=status.HTTP_400_BAD_REQUEST) ret...
the_stack_v2_python_sparse
Django API/TransparentCDNApi/book/serializers.py
rafagarciac/TransparentCDNProject
train
3
66c68f37af977b34b03765b3fd8e7a51f9c3243c
[ "try:\n self.object = User.objects.get(username=self.request.user)\n print(self.object)\n return self.object\nexcept:\n return None", "obj = self.get_object()\nprint(obj)\nif obj is not None:\n initial_data = model_to_dict(obj)\n print(initial_data)\n initial_data.update(model_to_dict(obj))\n...
<|body_start_0|> try: self.object = User.objects.get(username=self.request.user) print(self.object) return self.object except: return None <|end_body_0|> <|body_start_1|> obj = self.get_object() print(obj) if obj is not None: ...
UploadProfilePic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UploadProfilePic: def get_object(self): """Check if data already exists""" <|body_0|> def get_initial(self): """Pre-fill the form if data exists""" <|body_1|> def form_valid(self, form): """Save to the database. If data exists, update else create...
stack_v2_sparse_classes_36k_train_004073
6,927
no_license
[ { "docstring": "Check if data already exists", "name": "get_object", "signature": "def get_object(self)" }, { "docstring": "Pre-fill the form if data exists", "name": "get_initial", "signature": "def get_initial(self)" }, { "docstring": "Save to the database. If data exists, upda...
3
stack_v2_sparse_classes_30k_train_015200
Implement the Python class `UploadProfilePic` described below. Class description: Implement the UploadProfilePic class. Method signatures and docstrings: - def get_object(self): Check if data already exists - def get_initial(self): Pre-fill the form if data exists - def form_valid(self, form): Save to the database. I...
Implement the Python class `UploadProfilePic` described below. Class description: Implement the UploadProfilePic class. Method signatures and docstrings: - def get_object(self): Check if data already exists - def get_initial(self): Pre-fill the form if data exists - def form_valid(self, form): Save to the database. I...
4e466eefaac29d9aebd162a320be32785f221d24
<|skeleton|> class UploadProfilePic: def get_object(self): """Check if data already exists""" <|body_0|> def get_initial(self): """Pre-fill the form if data exists""" <|body_1|> def form_valid(self, form): """Save to the database. If data exists, update else create...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UploadProfilePic: def get_object(self): """Check if data already exists""" try: self.object = User.objects.get(username=self.request.user) print(self.object) return self.object except: return None def get_initial(self): """Pr...
the_stack_v2_python_sparse
SocialNetwork/dashboard/views.py
Nitu22499/SocialMediaClone
train
0
cfd67a60b14509ef84e84268f2c29e507bf2585f
[ "self._io_stream = io_stream\nself._output_format = output_format\nBase.__init__(self, **kw)", "while True:\n batch = self._batch_q.pop()\n if batch is None:\n break\n self._io_stream.write(batch.formatted_str(self._output_format))\n self._io_stream.flush()" ]
<|body_start_0|> self._io_stream = io_stream self._output_format = output_format Base.__init__(self, **kw) <|end_body_0|> <|body_start_1|> while True: batch = self._batch_q.pop() if batch is None: break self._io_stream.write(batch.form...
Output records into IO stream
IoStream
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IoStream: """Output records into IO stream""" def __init__(self, io_stream, output_format='json', **kw): """Setup ostream :param io_stream: stream to `write()` :param output_format: ouput format of each record. One of 'json', 'csv' are supported. :param **kw: passed to :func:`Base.__...
stack_v2_sparse_classes_36k_train_004074
991
permissive
[ { "docstring": "Setup ostream :param io_stream: stream to `write()` :param output_format: ouput format of each record. One of 'json', 'csv' are supported. :param **kw: passed to :func:`Base.__init__()`", "name": "__init__", "signature": "def __init__(self, io_stream, output_format='json', **kw)" }, ...
2
stack_v2_sparse_classes_30k_train_006173
Implement the Python class `IoStream` described below. Class description: Output records into IO stream Method signatures and docstrings: - def __init__(self, io_stream, output_format='json', **kw): Setup ostream :param io_stream: stream to `write()` :param output_format: ouput format of each record. One of 'json', '...
Implement the Python class `IoStream` described below. Class description: Output records into IO stream Method signatures and docstrings: - def __init__(self, io_stream, output_format='json', **kw): Setup ostream :param io_stream: stream to `write()` :param output_format: ouput format of each record. One of 'json', '...
a1e34af507b94d51ba588ad4a039ce0115b46475
<|skeleton|> class IoStream: """Output records into IO stream""" def __init__(self, io_stream, output_format='json', **kw): """Setup ostream :param io_stream: stream to `write()` :param output_format: ouput format of each record. One of 'json', 'csv' are supported. :param **kw: passed to :func:`Base.__...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IoStream: """Output records into IO stream""" def __init__(self, io_stream, output_format='json', **kw): """Setup ostream :param io_stream: stream to `write()` :param output_format: ouput format of each record. One of 'json', 'csv' are supported. :param **kw: passed to :func:`Base.__init__()`""" ...
the_stack_v2_python_sparse
shellstreaming/ostream/io_stream.py
laysakura/shellstreaming
train
1
c24a8a62f0be9ef21da40a74873c7cf08a57ecb6
[ "super().__init__(attacker, defender, enemy=enemy)\nself._move_file_name = join('moves', 'ice_beam.png')\nself._fps = 20\nif enemy:\n self._particle_systems = [MoveLinearParticleSystem(self._move_file_name, 1, (140, 70), 60, dx=-4, dy=2, duration=1), MoveLinearParticleSystem(self._move_file_name, 1, (140, 40), 6...
<|body_start_0|> super().__init__(attacker, defender, enemy=enemy) self._move_file_name = join('moves', 'ice_beam.png') self._fps = 20 if enemy: self._particle_systems = [MoveLinearParticleSystem(self._move_file_name, 1, (140, 70), 60, dx=-4, dy=2, duration=1), MoveLinearPart...
IceBeam
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IceBeam: def __init__(self, attacker, defender, enemy=False): """Displays the ice beam animation. This animation consists of two particle systems that generate crystals that follow a linear path towards the opponent. The player jiggles and is tinted while it is getting hit by the beam. T...
stack_v2_sparse_classes_36k_train_004075
4,101
no_license
[ { "docstring": "Displays the ice beam animation. This animation consists of two particle systems that generate crystals that follow a linear path towards the opponent. The player jiggles and is tinted while it is getting hit by the beam. The tint expires at the end of the move. Ice shards are played after the b...
3
stack_v2_sparse_classes_30k_train_018467
Implement the Python class `IceBeam` described below. Class description: Implement the IceBeam class. Method signatures and docstrings: - def __init__(self, attacker, defender, enemy=False): Displays the ice beam animation. This animation consists of two particle systems that generate crystals that follow a linear pa...
Implement the Python class `IceBeam` described below. Class description: Implement the IceBeam class. Method signatures and docstrings: - def __init__(self, attacker, defender, enemy=False): Displays the ice beam animation. This animation consists of two particle systems that generate crystals that follow a linear pa...
6718fdb6555d87f0b7b331c10d64a604431f8e81
<|skeleton|> class IceBeam: def __init__(self, attacker, defender, enemy=False): """Displays the ice beam animation. This animation consists of two particle systems that generate crystals that follow a linear path towards the opponent. The player jiggles and is tinted while it is getting hit by the beam. T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IceBeam: def __init__(self, attacker, defender, enemy=False): """Displays the ice beam animation. This animation consists of two particle systems that generate crystals that follow a linear path towards the opponent. The player jiggles and is tinted while it is getting hit by the beam. The tint expire...
the_stack_v2_python_sparse
pokered/modules/animations/moves/ice_beam.py
surranc20/pokered
train
44
f8bcf9c38da426f45171d975250c44d716df0c5f
[ "super().__init__()\nself.label_arr = np.asarray(['NULL'] + classes)\npath_to_ckpt = inference_graph\nself.detection_graph = tf.Graph()\nwith self.detection_graph.as_default():\n od_graph_def = tf.GraphDef()\n with tf.gfile.GFile(path_to_ckpt, 'rb') as fid:\n serialized_graph = fid.read()\n od_g...
<|body_start_0|> super().__init__() self.label_arr = np.asarray(['NULL'] + classes) path_to_ckpt = inference_graph self.detection_graph = tf.Graph() with self.detection_graph.as_default(): od_graph_def = tf.GraphDef() with tf.gfile.GFile(path_to_ckpt, 'rb'...
TFDetector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TFDetector: def __init__(self, classes, inference_graph='frozen_graph.pb'): """Initialize Detector Object""" <|body_0|> def predict(self, images_data, batch_size=10, min_confidence=0.7): """Predict results from list of images to list of boxes""" <|body_1|> <...
stack_v2_sparse_classes_36k_train_004076
2,196
permissive
[ { "docstring": "Initialize Detector Object", "name": "__init__", "signature": "def __init__(self, classes, inference_graph='frozen_graph.pb')" }, { "docstring": "Predict results from list of images to list of boxes", "name": "predict", "signature": "def predict(self, images_data, batch_s...
2
stack_v2_sparse_classes_30k_train_008391
Implement the Python class `TFDetector` described below. Class description: Implement the TFDetector class. Method signatures and docstrings: - def __init__(self, classes, inference_graph='frozen_graph.pb'): Initialize Detector Object - def predict(self, images_data, batch_size=10, min_confidence=0.7): Predict result...
Implement the Python class `TFDetector` described below. Class description: Implement the TFDetector class. Method signatures and docstrings: - def __init__(self, classes, inference_graph='frozen_graph.pb'): Initialize Detector Object - def predict(self, images_data, batch_size=10, min_confidence=0.7): Predict result...
7a20d4350c630017d11f964a4996dce8b9a8251b
<|skeleton|> class TFDetector: def __init__(self, classes, inference_graph='frozen_graph.pb'): """Initialize Detector Object""" <|body_0|> def predict(self, images_data, batch_size=10, min_confidence=0.7): """Predict results from list of images to list of boxes""" <|body_1|> <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TFDetector: def __init__(self, classes, inference_graph='frozen_graph.pb'): """Initialize Detector Object""" super().__init__() self.label_arr = np.asarray(['NULL'] + classes) path_to_ckpt = inference_graph self.detection_graph = tf.Graph() with self.detection_g...
the_stack_v2_python_sparse
train/tf_detector.py
CatalystCode/active-learning-detect
train
5
059e83a3f1c7a999df0f2ab18dc8000302497dbf
[ "main_data = self.get_main_data(imdb_id, api_data)\nratings_data = self.get_ratings_data(imdb_id, api_data)\nif ratings_data and main_data:\n return {'omdb_main': main_data, 'omdb_ratings': ratings_data}\nelse:\n raise GatherException(imdb_id, 'Failed standardise')", "try:\n main_data = [{'imdb_id': imdb...
<|body_start_0|> main_data = self.get_main_data(imdb_id, api_data) ratings_data = self.get_ratings_data(imdb_id, api_data) if ratings_data and main_data: return {'omdb_main': main_data, 'omdb_ratings': ratings_data} else: raise GatherException(imdb_id, 'Failed sta...
This class standardises the response returned from the OMDB API, removing unwanted data, and structuring the remaining data so that it is easier to handle in later processes.
StandardiseResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandardiseResponse: """This class standardises the response returned from the OMDB API, removing unwanted data, and structuring the remaining data so that it is easier to handle in later processes.""" def standardise(self, imdb_id, api_data): """Constructs a new dictionary from the ...
stack_v2_sparse_classes_36k_train_004077
5,419
permissive
[ { "docstring": "Constructs a new dictionary from the API data. :param imdb_id: The imdb_id for the requested film :param api_data: The raw response from the OMDB API :return: A standardised dictionary.", "name": "standardise", "signature": "def standardise(self, imdb_id, api_data)" }, { "docstri...
3
stack_v2_sparse_classes_30k_test_000859
Implement the Python class `StandardiseResponse` described below. Class description: This class standardises the response returned from the OMDB API, removing unwanted data, and structuring the remaining data so that it is easier to handle in later processes. Method signatures and docstrings: - def standardise(self, ...
Implement the Python class `StandardiseResponse` described below. Class description: This class standardises the response returned from the OMDB API, removing unwanted data, and structuring the remaining data so that it is easier to handle in later processes. Method signatures and docstrings: - def standardise(self, ...
cd6974764f8136529e5d4a3c191ad34865bfe732
<|skeleton|> class StandardiseResponse: """This class standardises the response returned from the OMDB API, removing unwanted data, and structuring the remaining data so that it is easier to handle in later processes.""" def standardise(self, imdb_id, api_data): """Constructs a new dictionary from the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StandardiseResponse: """This class standardises the response returned from the OMDB API, removing unwanted data, and structuring the remaining data so that it is easier to handle in later processes.""" def standardise(self, imdb_id, api_data): """Constructs a new dictionary from the API data. :pa...
the_stack_v2_python_sparse
processes/get_omdb.py
kinoreel/kino-gather
train
0
bd106e2ad64713b98c60a2cda940d4b6d2ccfd16
[ "pk = uuid.uuid4()\nrequest = self.context['request']\nif not request.data.get('path'):\n raise serializers.ValidationError('没有上传文件')\nreturn PriorScheme.objects.create(pk=pk, **validated_data)", "instance.staff_id = validated_data.get('staff_id', instance.staff_id)\ninstance.name = validated_data.get('name', ...
<|body_start_0|> pk = uuid.uuid4() request = self.context['request'] if not request.data.get('path'): raise serializers.ValidationError('没有上传文件') return PriorScheme.objects.create(pk=pk, **validated_data) <|end_body_0|> <|body_start_1|> instance.staff_id = validated_...
应急方案序列化器
PriorSchemeSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PriorSchemeSerializer: """应急方案序列化器""" def create(self, validated_data): """新建""" <|body_0|> def update(self, instance, validated_data): """更新,instance为要更新的对象实例""" <|body_1|> <|end_skeleton|> <|body_start_0|> pk = uuid.uuid4() request = s...
stack_v2_sparse_classes_36k_train_004078
1,631
no_license
[ { "docstring": "新建", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "更新,instance为要更新的对象实例", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_003726
Implement the Python class `PriorSchemeSerializer` described below. Class description: 应急方案序列化器 Method signatures and docstrings: - def create(self, validated_data): 新建 - def update(self, instance, validated_data): 更新,instance为要更新的对象实例
Implement the Python class `PriorSchemeSerializer` described below. Class description: 应急方案序列化器 Method signatures and docstrings: - def create(self, validated_data): 新建 - def update(self, instance, validated_data): 更新,instance为要更新的对象实例 <|skeleton|> class PriorSchemeSerializer: """应急方案序列化器""" def create(self...
3645bc3a396727af208db924c6fdee38abc0f894
<|skeleton|> class PriorSchemeSerializer: """应急方案序列化器""" def create(self, validated_data): """新建""" <|body_0|> def update(self, instance, validated_data): """更新,instance为要更新的对象实例""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PriorSchemeSerializer: """应急方案序列化器""" def create(self, validated_data): """新建""" pk = uuid.uuid4() request = self.context['request'] if not request.data.get('path'): raise serializers.ValidationError('没有上传文件') return PriorScheme.objects.create(pk=pk, **...
the_stack_v2_python_sparse
ruidun_system/safe/serializers/priorscheme_serializer.py
TingxieLi/django-restframework
train
0
40680345831dfd7d498593132e85cfbaf1febdc7
[ "path = self._get_path()\nfor trait_name, value in self._changed.items():\n if self._is_preference_trait(trait_name):\n self.preferences.set('%s.%s' % (path, trait_name), value)\nself._changed.clear()\nreturn", "if trait_name.endswith('_items'):\n trait_name = trait_name[:-6]\n if self._is_prefere...
<|body_start_0|> path = self._get_path() for trait_name, value in self._changed.items(): if self._is_preference_trait(trait_name): self.preferences.set('%s.%s' % (path, trait_name), value) self._changed.clear() return <|end_body_0|> <|body_start_1|> i...
A page in a preferences dialog.
PreferencesPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreferencesPage: """A page in a preferences dialog.""" def apply(self): """Apply the page's preferences.""" <|body_0|> def _anytrait_changed(self, trait_name, old, new): """Static trait change handler. This is an important override! In the base-class when a trait...
stack_v2_sparse_classes_36k_train_004079
4,275
no_license
[ { "docstring": "Apply the page's preferences.", "name": "apply", "signature": "def apply(self)" }, { "docstring": "Static trait change handler. This is an important override! In the base-class when a trait is changed the preferences node is updated too. Here, we stop that from happening and just...
3
null
Implement the Python class `PreferencesPage` described below. Class description: A page in a preferences dialog. Method signatures and docstrings: - def apply(self): Apply the page's preferences. - def _anytrait_changed(self, trait_name, old, new): Static trait change handler. This is an important override! In the ba...
Implement the Python class `PreferencesPage` described below. Class description: A page in a preferences dialog. Method signatures and docstrings: - def apply(self): Apply the page's preferences. - def _anytrait_changed(self, trait_name, old, new): Static trait change handler. This is an important override! In the ba...
5466f5858dbd2f1f082fa0d7417b57c8fb068fad
<|skeleton|> class PreferencesPage: """A page in a preferences dialog.""" def apply(self): """Apply the page's preferences.""" <|body_0|> def _anytrait_changed(self, trait_name, old, new): """Static trait change handler. This is an important override! In the base-class when a trait...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PreferencesPage: """A page in a preferences dialog.""" def apply(self): """Apply the page's preferences.""" path = self._get_path() for trait_name, value in self._changed.items(): if self._is_preference_trait(trait_name): self.preferences.set('%s.%s' % ...
the_stack_v2_python_sparse
maps/build/AppTools/enthought/preferences/ui/preferences_page.py
m-elhussieny/code
train
0
fec9cb5ca579b887938c1288af05664db07ba9bd
[ "self.s = compressedString\nself.p = 0\nself.num = 0\nself.ch = ''", "if not self.hasNext():\n return ' '\nif self.num == 0:\n self.ch = self.s[self.p]\n self.p += 1\n while self.p < len(self.s) and (not self.s[self.p].isalpha()):\n self.num = self.num * 10 + int(self.s[self.p])\n self.p...
<|body_start_0|> self.s = compressedString self.p = 0 self.num = 0 self.ch = '' <|end_body_0|> <|body_start_1|> if not self.hasNext(): return ' ' if self.num == 0: self.ch = self.s[self.p] self.p += 1 while self.p < len(sel...
StringIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_36k_train_004080
1,101
no_license
[ { "docstring": ":type compressedString: str", "name": "__init__", "signature": "def __init__(self, compressedString)" }, { "docstring": ":rtype: str", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext", "signature": "def hasN...
3
null
Implement the Python class `StringIterator` described below. Class description: Implement the StringIterator class. Method signatures and docstrings: - def __init__(self, compressedString): :type compressedString: str - def next(self): :rtype: str - def hasNext(self): :rtype: bool
Implement the Python class `StringIterator` described below. Class description: Implement the StringIterator class. Method signatures and docstrings: - def __init__(self, compressedString): :type compressedString: str - def next(self): :rtype: str - def hasNext(self): :rtype: bool <|skeleton|> class StringIterator: ...
36cb33af758b1d01da35982481a8bbfbee5c2810
<|skeleton|> class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" self.s = compressedString self.p = 0 self.num = 0 self.ch = '' def next(self): """:rtype: str""" if not self.hasNext(): return ' ' if self.nu...
the_stack_v2_python_sparse
LeetCode/designCompressedStringIterator.py
dicao425/algorithmExercise
train
0
b05c89fdba66c10dbccbcac279ac924066219267
[ "query = g.db.query(MatchTeam)\nquery = query.filter(MatchTeam.match_id == match_id)\nrows = query.all()\nret = []\nfor row in rows:\n record = row.as_dict()\n record['url'] = url_for('matches.team', match_id=match_id, team_id=row.team_id, _external=True)\n ret.append(record)\nreturn jsonify(ret)", "args...
<|body_start_0|> query = g.db.query(MatchTeam) query = query.filter(MatchTeam.match_id == match_id) rows = query.all() ret = [] for row in rows: record = row.as_dict() record['url'] = url_for('matches.team', match_id=match_id, team_id=row.team_id, _externa...
All teams in a match
MatchTeamsAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatchTeamsAPI: """All teams in a match""" def get(self, match_id): """Find teams by match""" <|body_0|> def post(self, match_id): """Add a team to a match""" <|body_1|> <|end_skeleton|> <|body_start_0|> query = g.db.query(MatchTeam) quer...
stack_v2_sparse_classes_36k_train_004081
24,829
permissive
[ { "docstring": "Find teams by match", "name": "get", "signature": "def get(self, match_id)" }, { "docstring": "Add a team to a match", "name": "post", "signature": "def post(self, match_id)" } ]
2
null
Implement the Python class `MatchTeamsAPI` described below. Class description: All teams in a match Method signatures and docstrings: - def get(self, match_id): Find teams by match - def post(self, match_id): Add a team to a match
Implement the Python class `MatchTeamsAPI` described below. Class description: All teams in a match Method signatures and docstrings: - def get(self, match_id): Find teams by match - def post(self, match_id): Add a team to a match <|skeleton|> class MatchTeamsAPI: """All teams in a match""" def get(self, ma...
9825cb22b26b577b715f2ce95453363bf90ecc7e
<|skeleton|> class MatchTeamsAPI: """All teams in a match""" def get(self, match_id): """Find teams by match""" <|body_0|> def post(self, match_id): """Add a team to a match""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MatchTeamsAPI: """All teams in a match""" def get(self, match_id): """Find teams by match""" query = g.db.query(MatchTeam) query = query.filter(MatchTeam.match_id == match_id) rows = query.all() ret = [] for row in rows: record = row.as_dict() ...
the_stack_v2_python_sparse
driftbase/api/matches.py
dgnorth/drift-base
train
1
a92161ab392b15224d8d167017d8b28dd13796c6
[ "super().__init__(renderer, player_id, goal)\nself.difficulty = difficulty\nif difficulty > 5:\n difficulty = 5\nself._number_of_scenarios = {0: 5, 1: 10, 2: 25, 3: 50, 4: 100, 5: 150}[difficulty]", "scenarios = []\nbest_score = 0\nbest_scenario_index = 0\nfor scenario_number in range(self._number_of_scenarios...
<|body_start_0|> super().__init__(renderer, player_id, goal) self.difficulty = difficulty if difficulty > 5: difficulty = 5 self._number_of_scenarios = {0: 5, 1: 10, 2: 25, 3: 50, 4: 100, 5: 150}[difficulty] <|end_body_0|> <|body_start_1|> scenarios = [] best...
A smart player that searches through many random moves and picks the best scoring scenario. This player is runned by the computer. The amount of ramdom scenarios that this player will look through depends on the difficulty attributed to itself. These are the amount of moves that this player will consider, according to ...
SmartPlayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmartPlayer: """A smart player that searches through many random moves and picks the best scoring scenario. This player is runned by the computer. The amount of ramdom scenarios that this player will look through depends on the difficulty attributed to itself. These are the amount of moves that t...
stack_v2_sparse_classes_36k_train_004082
13,079
no_license
[ { "docstring": "Initialize this SmartPlayer.", "name": "__init__", "signature": "def __init__(self, renderer: Renderer, player_id: int, goal: Goal, difficulty: int) -> None" }, { "docstring": "Make a smart move, which is based on the difficulty level. The difficulty level is the amount of random...
2
stack_v2_sparse_classes_30k_train_011998
Implement the Python class `SmartPlayer` described below. Class description: A smart player that searches through many random moves and picks the best scoring scenario. This player is runned by the computer. The amount of ramdom scenarios that this player will look through depends on the difficulty attributed to itsel...
Implement the Python class `SmartPlayer` described below. Class description: A smart player that searches through many random moves and picks the best scoring scenario. This player is runned by the computer. The amount of ramdom scenarios that this player will look through depends on the difficulty attributed to itsel...
01185e1eab994b42d7e0ec33223eed742b83233e
<|skeleton|> class SmartPlayer: """A smart player that searches through many random moves and picks the best scoring scenario. This player is runned by the computer. The amount of ramdom scenarios that this player will look through depends on the difficulty attributed to itself. These are the amount of moves that t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SmartPlayer: """A smart player that searches through many random moves and picks the best scoring scenario. This player is runned by the computer. The amount of ramdom scenarios that this player will look through depends on the difficulty attributed to itself. These are the amount of moves that this player wi...
the_stack_v2_python_sparse
CSC148/assignments/a2/backup/player.py
rcase31/UofTCourses
train
1
f98024562c6b8058f65e26c6435b8143352ad026
[ "backend = self.get_backend_for_app(app_id)\nauth_client = get_backend_authenticated_client(request.user.username, backend)\nenv_vars = auth_client.get_application_env_variables(app_id)\nreturn self.respond(env_vars)", "env_vars = json.loads(request.body)\nbackend = self.get_backend_for_app(app_id)\nauth_client =...
<|body_start_0|> backend = self.get_backend_for_app(app_id) auth_client = get_backend_authenticated_client(request.user.username, backend) env_vars = auth_client.get_application_env_variables(app_id) return self.respond(env_vars) <|end_body_0|> <|body_start_1|> env_vars = json.l...
AppEnvVariablesApiView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppEnvVariablesApiView: def get(self, request, app_id): """Get the environmental variables :param django.http.HttpRequest request: the request object :param str app_id: the ID of the app :rtype: django.http.HttpResponse""" <|body_0|> def post(self, request, app_id): ...
stack_v2_sparse_classes_36k_train_004083
1,963
no_license
[ { "docstring": "Get the environmental variables :param django.http.HttpRequest request: the request object :param str app_id: the ID of the app :rtype: django.http.HttpResponse", "name": "get", "signature": "def get(self, request, app_id)" }, { "docstring": "Set the environmental variables The b...
2
stack_v2_sparse_classes_30k_test_000070
Implement the Python class `AppEnvVariablesApiView` described below. Class description: Implement the AppEnvVariablesApiView class. Method signatures and docstrings: - def get(self, request, app_id): Get the environmental variables :param django.http.HttpRequest request: the request object :param str app_id: the ID o...
Implement the Python class `AppEnvVariablesApiView` described below. Class description: Implement the AppEnvVariablesApiView class. Method signatures and docstrings: - def get(self, request, app_id): Get the environmental variables :param django.http.HttpRequest request: the request object :param str app_id: the ID o...
df2bbc2c0f7b593930a5c5bc038232f66394f8c5
<|skeleton|> class AppEnvVariablesApiView: def get(self, request, app_id): """Get the environmental variables :param django.http.HttpRequest request: the request object :param str app_id: the ID of the app :rtype: django.http.HttpResponse""" <|body_0|> def post(self, request, app_id): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AppEnvVariablesApiView: def get(self, request, app_id): """Get the environmental variables :param django.http.HttpRequest request: the request object :param str app_id: the ID of the app :rtype: django.http.HttpResponse""" backend = self.get_backend_for_app(app_id) auth_client = get_ba...
the_stack_v2_python_sparse
web/api_server/api/app_env_variables_api_view.py
TigerAppsOrg/TigerHost
train
0
bdd311797f7708a40ec246fa8eda22177c619d1a
[ "if not head or not head.next or k == 0:\n return head\ntail = head\ncount = 1\nwhile tail.next:\n count += 1\n tail = tail.next\nif count == k:\n return head\nnode = head\nfor _ in range(count - k % count - 1):\n node = node.next\ntail.next = head\nhead = node.next\nnode.next = None\nreturn head", ...
<|body_start_0|> if not head or not head.next or k == 0: return head tail = head count = 1 while tail.next: count += 1 tail = tail.next if count == k: return head node = head for _ in range(count - k % count - 1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotateRight(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_0|> def rotateRight_cycle(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> def rotateRight_v2(self, head, k): ...
stack_v2_sparse_classes_36k_train_004084
2,578
no_license
[ { "docstring": ":type head: ListNode :type k: int :rtype: ListNode", "name": "rotateRight", "signature": "def rotateRight(self, head, k)" }, { "docstring": ":type head: ListNode :type k: int :rtype: ListNode", "name": "rotateRight_cycle", "signature": "def rotateRight_cycle(self, head, k...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotateRight(self, head, k): :type head: ListNode :type k: int :rtype: ListNode - def rotateRight_cycle(self, head, k): :type head: ListNode :type k: int :rtype: ListNode - de...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotateRight(self, head, k): :type head: ListNode :type k: int :rtype: ListNode - def rotateRight_cycle(self, head, k): :type head: ListNode :type k: int :rtype: ListNode - de...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def rotateRight(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_0|> def rotateRight_cycle(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> def rotateRight_v2(self, head, k): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotateRight(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" if not head or not head.next or k == 0: return head tail = head count = 1 while tail.next: count += 1 tail = tail.next if count...
the_stack_v2_python_sparse
src/lt_61.py
oxhead/CodingYourWay
train
0
2ba9f5d4290faf4b5e6844c81ce59fc68627cdcc
[ "self.ip_address = ip_address\nself._sshtun_port = _sshtun_port\nself.ssh_user = ssh_user\nself.ssh_user_pass = ssh_user_pass", "client = paramiko.SSHClient()\nclient.set_missing_host_key_policy(paramiko.AutoAddPolicy())\nclient.connect(self.ip_address, self._sshtun_port, self.ssh_user, self.ssh_user_pass)\nshell...
<|body_start_0|> self.ip_address = ip_address self._sshtun_port = _sshtun_port self.ssh_user = ssh_user self.ssh_user_pass = ssh_user_pass <|end_body_0|> <|body_start_1|> client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c...
RemoteConnectSSH
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteConnectSSH: def __init__(self, ip_address, _sshtun_port, ssh_user, ssh_user_pass): """Initialization Args: ip_address: port: ssh_user: ssh_user_pass: Return:""" <|body_0|> def execute_ssh_command(self, command): """Executes command on switch. Args: command(str)...
stack_v2_sparse_classes_36k_train_004085
2,809
no_license
[ { "docstring": "Initialization Args: ip_address: port: ssh_user: ssh_user_pass: Return:", "name": "__init__", "signature": "def __init__(self, ip_address, _sshtun_port, ssh_user, ssh_user_pass)" }, { "docstring": "Executes command on switch. Args: command(str): ssh command to execute :return:", ...
4
null
Implement the Python class `RemoteConnectSSH` described below. Class description: Implement the RemoteConnectSSH class. Method signatures and docstrings: - def __init__(self, ip_address, _sshtun_port, ssh_user, ssh_user_pass): Initialization Args: ip_address: port: ssh_user: ssh_user_pass: Return: - def execute_ssh_c...
Implement the Python class `RemoteConnectSSH` described below. Class description: Implement the RemoteConnectSSH class. Method signatures and docstrings: - def __init__(self, ip_address, _sshtun_port, ssh_user, ssh_user_pass): Initialization Args: ip_address: port: ssh_user: ssh_user_pass: Return: - def execute_ssh_c...
0637a465088b468d6fdb6d1bb6f7b087547cec56
<|skeleton|> class RemoteConnectSSH: def __init__(self, ip_address, _sshtun_port, ssh_user, ssh_user_pass): """Initialization Args: ip_address: port: ssh_user: ssh_user_pass: Return:""" <|body_0|> def execute_ssh_command(self, command): """Executes command on switch. Args: command(str)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RemoteConnectSSH: def __init__(self, ip_address, _sshtun_port, ssh_user, ssh_user_pass): """Initialization Args: ip_address: port: ssh_user: ssh_user_pass: Return:""" self.ip_address = ip_address self._sshtun_port = _sshtun_port self.ssh_user = ssh_user self.ssh_user_pa...
the_stack_v2_python_sparse
remote_qa/remote_connect.py
Krishnaarunangsu/XpressoDataHandling
train
0
bfd659120433c047fed1377ba51dcf22745b0574
[ "self.model_id_attr = model_id_attr\nself.t_at_ccl = Cube(None)\nself.p_at_ccl = Cube(None)\nself.temperature = Cube(None)\nself.minimum_t_diff = 4", "cct = np.ma.masked_array(self.t_at_ccl.data.copy())\nq_at_ccl = saturated_humidity(self.t_at_ccl.data, self.p_at_ccl.data)\nccl_with_mask = np.ma.masked_array(self...
<|body_start_0|> self.model_id_attr = model_id_attr self.t_at_ccl = Cube(None) self.p_at_ccl = Cube(None) self.temperature = Cube(None) self.minimum_t_diff = 4 <|end_body_0|> <|body_start_1|> cct = np.ma.masked_array(self.t_at_ccl.data.copy()) q_at_ccl = saturate...
Plugin to calculate the convective cloud top temperature from the cloud condensation level temperature and pressure, and temperature on pressure levels data using saturated ascent. The temperature is that of the parcel after saturated ascent at the last pressure level where the parcel is buoyant. The interpolation requ...
CloudTopTemperature
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloudTopTemperature: """Plugin to calculate the convective cloud top temperature from the cloud condensation level temperature and pressure, and temperature on pressure levels data using saturated ascent. The temperature is that of the parcel after saturated ascent at the last pressure level wher...
stack_v2_sparse_classes_36k_train_004086
6,910
permissive
[ { "docstring": "Set up class Args: model_id_attr: Name of model ID attribute to be copied from source cubes to output cube", "name": "__init__", "signature": "def __init__(self, model_id_attr: str=None)" }, { "docstring": "Ascends through the pressure levels (decreasing pressure) calculating the...
4
null
Implement the Python class `CloudTopTemperature` described below. Class description: Plugin to calculate the convective cloud top temperature from the cloud condensation level temperature and pressure, and temperature on pressure levels data using saturated ascent. The temperature is that of the parcel after saturated...
Implement the Python class `CloudTopTemperature` described below. Class description: Plugin to calculate the convective cloud top temperature from the cloud condensation level temperature and pressure, and temperature on pressure levels data using saturated ascent. The temperature is that of the parcel after saturated...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class CloudTopTemperature: """Plugin to calculate the convective cloud top temperature from the cloud condensation level temperature and pressure, and temperature on pressure levels data using saturated ascent. The temperature is that of the parcel after saturated ascent at the last pressure level wher...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CloudTopTemperature: """Plugin to calculate the convective cloud top temperature from the cloud condensation level temperature and pressure, and temperature on pressure levels data using saturated ascent. The temperature is that of the parcel after saturated ascent at the last pressure level where the parcel ...
the_stack_v2_python_sparse
improver/psychrometric_calculations/cloud_top_temperature.py
metoppv/improver
train
101
ee5d565fff69ae732bc18fc77aff830b29e453ad
[ "dic = {}\nfor n in nums:\n if n not in dic:\n dic[n] = 1\n else:\n dic[n] += 1\nres = []\nfor k, v in dic.iteritems():\n if v == 1:\n res.append(k)\nreturn res", "nums.sort()\nres = []\ni = 0\nwhile i < len(nums) - 2:\n if nums[i] != nums[i + 1]:\n res.append(nums[i])\n ...
<|body_start_0|> dic = {} for n in nums: if n not in dic: dic[n] = 1 else: dic[n] += 1 res = [] for k, v in dic.iteritems(): if v == 1: res.append(k) return res <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def singleNumber2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> dic = {} for n in nums...
stack_v2_sparse_classes_36k_train_004087
1,346
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "singleNumber2", "signature": "def singleNumber2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_002477
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: List[int] - def singleNumber2(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: List[int] - def singleNumber2(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class Solution: ...
31b2b4dc1e5c3b1c53b333fe30b98ed04b0bdacc
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def singleNumber2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: List[int]""" dic = {} for n in nums: if n not in dic: dic[n] = 1 else: dic[n] += 1 res = [] for k, v in dic.iteritems(): if v == ...
the_stack_v2_python_sparse
prob260_single_number3.py
Hu-Wenchao/leetcode
train
0
d1eeeef9328629e21653fd9f3130ad41dd8fc7d6
[ "self._use_polld = use_polld\nself._server = None\nif use_polld:\n remote = 'http://%s:%s' % (host, tcp_port)\n self._server = net_utils.TimeoutXMLRPCServerProxy(remote, timeout=timeout, verbose=verbose)", "if edge not in self.GPIO_EDGE_LIST:\n raise GpioManagerError('Invalid edge %r. Valid values: %r' %...
<|body_start_0|> self._use_polld = use_polld self._server = None if use_polld: remote = 'http://%s:%s' % (host, tcp_port) self._server = net_utils.TimeoutXMLRPCServerProxy(remote, timeout=timeout, verbose=verbose) <|end_body_0|> <|body_start_1|> if edge not in se...
GPIO monitor and control manager.
GpioManager
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GpioManager: """GPIO monitor and control manager.""" def __init__(self, use_polld, host=None, tcp_port=None, timeout=10, verbose=False): """Constructor. Args: use_polld: True to use polld to manage GPIO on remote server, or False to manage local GPIO port directly. host: Name or IP a...
stack_v2_sparse_classes_36k_train_004088
11,503
permissive
[ { "docstring": "Constructor. Args: use_polld: True to use polld to manage GPIO on remote server, or False to manage local GPIO port directly. host: Name or IP address of servo server host. tcp_port: TCP port on which servod is listening on. timeout: Timeout for HTTP connection. verbose: Enables verbose messagin...
4
stack_v2_sparse_classes_30k_train_001915
Implement the Python class `GpioManager` described below. Class description: GPIO monitor and control manager. Method signatures and docstrings: - def __init__(self, use_polld, host=None, tcp_port=None, timeout=10, verbose=False): Constructor. Args: use_polld: True to use polld to manage GPIO on remote server, or Fal...
Implement the Python class `GpioManager` described below. Class description: GPIO monitor and control manager. Method signatures and docstrings: - def __init__(self, use_polld, host=None, tcp_port=None, timeout=10, verbose=False): Constructor. Args: use_polld: True to use polld to manage GPIO on remote server, or Fal...
a1b0fccd68987d8cd9c89710adc3c04b868347ec
<|skeleton|> class GpioManager: """GPIO monitor and control manager.""" def __init__(self, use_polld, host=None, tcp_port=None, timeout=10, verbose=False): """Constructor. Args: use_polld: True to use polld to manage GPIO on remote server, or False to manage local GPIO port directly. host: Name or IP a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GpioManager: """GPIO monitor and control manager.""" def __init__(self, use_polld, host=None, tcp_port=None, timeout=10, verbose=False): """Constructor. Args: use_polld: True to use polld to manage GPIO on remote server, or False to manage local GPIO port directly. host: Name or IP address of ser...
the_stack_v2_python_sparse
py/utils/gpio_utils.py
bridder/factory
train
0
bb70e4e0c2476bc4f6955e358c2f08be80a92daf
[ "notebook = get_object_or_404(Notebook, slug=notebook_slug)\ncontent = request.data.get('content')\ntitle = request.data.get('title', '')\ntags = request.data.get('tags')\ntype = request.data.get('type', '')\ndate = request.data.get('date', '')\nif content:\n kwargs = {'content': content, 'author': request.user,...
<|body_start_0|> notebook = get_object_or_404(Notebook, slug=notebook_slug) content = request.data.get('content') title = request.data.get('title', '') tags = request.data.get('tags') type = request.data.get('type', '') date = request.data.get('date', '') if conte...
# Entries - **GET** List the entries for the current notebook. - **POST** Create a new entry attached to the current notebook. - **PUT** Edit the current notebook's name, status, group, or sections. - **DELETE** Delete the current notebook (sets the status to deleted).
EntryListAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntryListAPIView: """# Entries - **GET** List the entries for the current notebook. - **POST** Create a new entry attached to the current notebook. - **PUT** Edit the current notebook's name, status, group, or sections. - **DELETE** Delete the current notebook (sets the status to deleted).""" ...
stack_v2_sparse_classes_36k_train_004089
19,450
no_license
[ { "docstring": "Create a new Entry.", "name": "post", "signature": "def post(self, request, notebook_slug)" }, { "docstring": "Update an existing Notebook.", "name": "put", "signature": "def put(self, request, notebook_slug)" }, { "docstring": "Delete a Notebook. Sets the status ...
3
stack_v2_sparse_classes_30k_train_004867
Implement the Python class `EntryListAPIView` described below. Class description: # Entries - **GET** List the entries for the current notebook. - **POST** Create a new entry attached to the current notebook. - **PUT** Edit the current notebook's name, status, group, or sections. - **DELETE** Delete the current notebo...
Implement the Python class `EntryListAPIView` described below. Class description: # Entries - **GET** List the entries for the current notebook. - **POST** Create a new entry attached to the current notebook. - **PUT** Edit the current notebook's name, status, group, or sections. - **DELETE** Delete the current notebo...
b8c4ceff83c92e83a2297b17ad29e29b3b8fdc3c
<|skeleton|> class EntryListAPIView: """# Entries - **GET** List the entries for the current notebook. - **POST** Create a new entry attached to the current notebook. - **PUT** Edit the current notebook's name, status, group, or sections. - **DELETE** Delete the current notebook (sets the status to deleted).""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntryListAPIView: """# Entries - **GET** List the entries for the current notebook. - **POST** Create a new entry attached to the current notebook. - **PUT** Edit the current notebook's name, status, group, or sections. - **DELETE** Delete the current notebook (sets the status to deleted).""" def post(se...
the_stack_v2_python_sparse
vinci/views/apis.py
mod2/vinci
train
1
65d476eadb6b2d358c08cbe9c88cf6a5797a4b2a
[ "print('**kwargs', kwargs)\nif cls not in cls._instance:\n cls._instance[cls] = super(MetaClass, cls).__call__(*args, **kwargs)\n return cls._instance[cls]", "if cls.__name__[0].isupper():\n ' Create class only if First Letter is Capital '\n for k, v in attr.items():\n if hasattr(v, '__call_...
<|body_start_0|> print('**kwargs', kwargs) if cls not in cls._instance: cls._instance[cls] = super(MetaClass, cls).__call__(*args, **kwargs) return cls._instance[cls] <|end_body_0|> <|body_start_1|> if cls.__name__[0].isupper(): ' Create class only if First L...
Meta class
MetaClass
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetaClass: """Meta class""" def __call__(cls, *args, **kwargs): """Implementing Singleton Design Pattern""" <|body_0|> def __init__(cls, name, base, attr): """Defining Your Own Rules""" <|body_1|> <|end_skeleton|> <|body_start_0|> print('**kwarg...
stack_v2_sparse_classes_36k_train_004090
1,990
no_license
[ { "docstring": "Implementing Singleton Design Pattern", "name": "__call__", "signature": "def __call__(cls, *args, **kwargs)" }, { "docstring": "Defining Your Own Rules", "name": "__init__", "signature": "def __init__(cls, name, base, attr)" } ]
2
stack_v2_sparse_classes_30k_train_005676
Implement the Python class `MetaClass` described below. Class description: Meta class Method signatures and docstrings: - def __call__(cls, *args, **kwargs): Implementing Singleton Design Pattern - def __init__(cls, name, base, attr): Defining Your Own Rules
Implement the Python class `MetaClass` described below. Class description: Meta class Method signatures and docstrings: - def __call__(cls, *args, **kwargs): Implementing Singleton Design Pattern - def __init__(cls, name, base, attr): Defining Your Own Rules <|skeleton|> class MetaClass: """Meta class""" de...
41c4346132d84c00ee2163f14d5a47b052716663
<|skeleton|> class MetaClass: """Meta class""" def __call__(cls, *args, **kwargs): """Implementing Singleton Design Pattern""" <|body_0|> def __init__(cls, name, base, attr): """Defining Your Own Rules""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MetaClass: """Meta class""" def __call__(cls, *args, **kwargs): """Implementing Singleton Design Pattern""" print('**kwargs', kwargs) if cls not in cls._instance: cls._instance[cls] = super(MetaClass, cls).__call__(*args, **kwargs) return cls._instance[cls]...
the_stack_v2_python_sparse
Metaclass/MetaClassMaster.py
soumilshah1995/Data-Structure-and-Algorithm-and-Meta-class
train
1
75a2af4fa6a4557a64082fdee5b9b2b2d49ee7ed
[ "wx.Panel.__init__(self, parent)\nself.number_of_grids = 0\nself.frame = parent\nself.mainSizer = wx.BoxSizer(wx.VERTICAL)\ncontrolSizer = wx.BoxSizer(wx.HORIZONTAL)\nself.widgetSizer = wx.BoxSizer(wx.VERTICAL)\nself.addButton = wx.Button(self, label='Add')\nself.addButton.Bind(wx.EVT_BUTTON, self.onAddWidget)\ncon...
<|body_start_0|> wx.Panel.__init__(self, parent) self.number_of_grids = 0 self.frame = parent self.mainSizer = wx.BoxSizer(wx.VERTICAL) controlSizer = wx.BoxSizer(wx.HORIZONTAL) self.widgetSizer = wx.BoxSizer(wx.VERTICAL) self.addButton = wx.Button(self, label='Ad...
MyPanel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyPanel: def __init__(self, parent): """Constructor""" <|body_0|> def onAddWidget(self, event): """Add widget.""" <|body_1|> def onRemoveWidget(self, event): """Remove widget.""" <|body_2|> <|end_skeleton|> <|body_start_0|> wx.P...
stack_v2_sparse_classes_36k_train_004091
6,784
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "Add widget.", "name": "onAddWidget", "signature": "def onAddWidget(self, event)" }, { "docstring": "Remove widget.", "name": "onRemoveWidget", "signature": "def ...
3
stack_v2_sparse_classes_30k_train_006660
Implement the Python class `MyPanel` described below. Class description: Implement the MyPanel class. Method signatures and docstrings: - def __init__(self, parent): Constructor - def onAddWidget(self, event): Add widget. - def onRemoveWidget(self, event): Remove widget.
Implement the Python class `MyPanel` described below. Class description: Implement the MyPanel class. Method signatures and docstrings: - def __init__(self, parent): Constructor - def onAddWidget(self, event): Add widget. - def onRemoveWidget(self, event): Remove widget. <|skeleton|> class MyPanel: def __init__...
5a07e02588b1b7c8ebf7458b10e81b8ecf84ad13
<|skeleton|> class MyPanel: def __init__(self, parent): """Constructor""" <|body_0|> def onAddWidget(self, event): """Add widget.""" <|body_1|> def onRemoveWidget(self, event): """Remove widget.""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyPanel: def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent) self.number_of_grids = 0 self.frame = parent self.mainSizer = wx.BoxSizer(wx.VERTICAL) controlSizer = wx.BoxSizer(wx.HORIZONTAL) self.widgetSizer = wx.BoxSizer(wx.VERT...
the_stack_v2_python_sparse
sandbox/dynamic_widgets2.py
baluneboy/pims
train
0
607d40807b6dac66d5e3a77b88ef132d598ba0e7
[ "res = []\nfor i in range(len(words)):\n for j in range(len(words)):\n if i == j:\n continue\n concat_words = words[i] + words[j]\n if concat_words == concat_words[::-1]:\n res.append((i, j))\nreturn res", "d = {w: i for i, w in enumerate(words)}\nres = []\nfor i, w i...
<|body_start_0|> res = [] for i in range(len(words)): for j in range(len(words)): if i == j: continue concat_words = words[i] + words[j] if concat_words == concat_words[::-1]: res.append((i, j)) r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def palindromePairs(self, words: List[str]) -> List[List[int]]: """Brute force method O(n^2)""" <|body_0|> def palindromePairs(self, words: List[str]) -> List[List[int]]: """optimized O(N*k^2), iterate over all words, iterate over all characters, check pali...
stack_v2_sparse_classes_36k_train_004092
2,241
no_license
[ { "docstring": "Brute force method O(n^2)", "name": "palindromePairs", "signature": "def palindromePairs(self, words: List[str]) -> List[List[int]]" }, { "docstring": "optimized O(N*k^2), iterate over all words, iterate over all characters, check palindrome 4 different cases: Case 1: If s2 is th...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def palindromePairs(self, words: List[str]) -> List[List[int]]: Brute force method O(n^2) - def palindromePairs(self, words: List[str]) -> List[List[int]]: optimized O(N*k^2), it...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def palindromePairs(self, words: List[str]) -> List[List[int]]: Brute force method O(n^2) - def palindromePairs(self, words: List[str]) -> List[List[int]]: optimized O(N*k^2), it...
e50dc0642f087f37ab3234390be3d8a0ed48fe62
<|skeleton|> class Solution: def palindromePairs(self, words: List[str]) -> List[List[int]]: """Brute force method O(n^2)""" <|body_0|> def palindromePairs(self, words: List[str]) -> List[List[int]]: """optimized O(N*k^2), iterate over all words, iterate over all characters, check pali...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def palindromePairs(self, words: List[str]) -> List[List[int]]: """Brute force method O(n^2)""" res = [] for i in range(len(words)): for j in range(len(words)): if i == j: continue concat_words = words[i] + words...
the_stack_v2_python_sparse
Leetcode/ByteDance/336. Palindrome Pairs.py
brlala/Educative-Grokking-Coding-Exercise
train
3
56f9f4c476195a198682891f1558760e85252574
[ "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...
Service defines a gRPC service for interacting with transactions.
ServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceServicer: """Service defines a gRPC service for interacting with transactions.""" def Simulate(self, request, context): """Simulate simulates executing a transaction for estimating gas usage.""" <|body_0|> def GetTx(self, request, context): """GetTx fetche...
stack_v2_sparse_classes_36k_train_004093
7,930
permissive
[ { "docstring": "Simulate simulates executing a transaction for estimating gas usage.", "name": "Simulate", "signature": "def Simulate(self, request, context)" }, { "docstring": "GetTx fetches a tx by hash.", "name": "GetTx", "signature": "def GetTx(self, request, context)" }, { "...
4
stack_v2_sparse_classes_30k_train_020947
Implement the Python class `ServiceServicer` described below. Class description: Service defines a gRPC service for interacting with transactions. Method signatures and docstrings: - def Simulate(self, request, context): Simulate simulates executing a transaction for estimating gas usage. - def GetTx(self, request, c...
Implement the Python class `ServiceServicer` described below. Class description: Service defines a gRPC service for interacting with transactions. Method signatures and docstrings: - def Simulate(self, request, context): Simulate simulates executing a transaction for estimating gas usage. - def GetTx(self, request, c...
c38a07458a36305457680196e8c47372008db5ab
<|skeleton|> class ServiceServicer: """Service defines a gRPC service for interacting with transactions.""" def Simulate(self, request, context): """Simulate simulates executing a transaction for estimating gas usage.""" <|body_0|> def GetTx(self, request, context): """GetTx fetche...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServiceServicer: """Service defines a gRPC service for interacting with transactions.""" def Simulate(self, request, context): """Simulate simulates executing a transaction for estimating gas usage.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not...
the_stack_v2_python_sparse
bluzelle/codec/cosmos/tx/v1beta1/service_pb2_grpc.py
hhio618/bluzelle-py
train
3
247291bd3923b474de92021a5db93c110c0d7e9a
[ "form = super(CommonGeoDatasetEditView, self).get_form()\nform.fields['categories'].queryset = form.fields['categories'].queryset.filter(organization=self.request.organization)\nreturn form", "if form.instance.pk:\n created = False\nelse:\n created = True\nresponse = super(CommonGeoDatasetEditView, self).fo...
<|body_start_0|> form = super(CommonGeoDatasetEditView, self).get_form() form.fields['categories'].queryset = form.fields['categories'].queryset.filter(organization=self.request.organization) return form <|end_body_0|> <|body_start_1|> if form.instance.pk: created = False ...
Create or edit a geodataset
CommonGeoDatasetEditView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonGeoDatasetEditView: """Create or edit a geodataset""" def get_form(self): """Get the form""" <|body_0|> def form_valid(self, form): """Handle a valid form""" <|body_1|> <|end_skeleton|> <|body_start_0|> form = super(CommonGeoDatasetEditVie...
stack_v2_sparse_classes_36k_train_004094
7,482
permissive
[ { "docstring": "Get the form", "name": "get_form", "signature": "def get_form(self)" }, { "docstring": "Handle a valid form", "name": "form_valid", "signature": "def form_valid(self, form)" } ]
2
null
Implement the Python class `CommonGeoDatasetEditView` described below. Class description: Create or edit a geodataset Method signatures and docstrings: - def get_form(self): Get the form - def form_valid(self, form): Handle a valid form
Implement the Python class `CommonGeoDatasetEditView` described below. Class description: Create or edit a geodataset Method signatures and docstrings: - def get_form(self): Get the form - def form_valid(self, form): Handle a valid form <|skeleton|> class CommonGeoDatasetEditView: """Create or edit a geodataset"...
3af6bc9f3ff4e5dfdbb118209e877379428bc06c
<|skeleton|> class CommonGeoDatasetEditView: """Create or edit a geodataset""" def get_form(self): """Get the form""" <|body_0|> def form_valid(self, form): """Handle a valid form""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommonGeoDatasetEditView: """Create or edit a geodataset""" def get_form(self): """Get the form""" form = super(CommonGeoDatasetEditView, self).get_form() form.fields['categories'].queryset = form.fields['categories'].queryset.filter(organization=self.request.organization) ...
the_stack_v2_python_sparse
geodataset/views.py
ofa/everyvoter
train
7
0623dfd86a435ef1695bfa540bec1d19ccbe511e
[ "name = 'masDASdk213aksd123Saad'\nself.assertRaises(ProposedCardInfo.DoesNotExist, ProposedCardInfo.objects.get, name=name)\neffect_without_modifiers = CardEffect.objects.filter(has_modifier=False).first()\neffect_with_modifiers = CardEffect.objects.filter(has_modifier=True).first()\nself.assertIsNotNone(effect_wit...
<|body_start_0|> name = 'masDASdk213aksd123Saad' self.assertRaises(ProposedCardInfo.DoesNotExist, ProposedCardInfo.objects.get, name=name) effect_without_modifiers = CardEffect.objects.filter(has_modifier=False).first() effect_with_modifiers = CardEffect.objects.filter(has_modifier=True)...
WholeProposedCardListTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WholeProposedCardListTestCase: def test_post1(self): """Scenario: POST request is made with correct data. Expected result: Proposed card is created correctly.""" <|body_0|> def test_post2(self): """Scenario: POST request is made with levels array provided, but empty....
stack_v2_sparse_classes_36k_train_004095
42,884
permissive
[ { "docstring": "Scenario: POST request is made with correct data. Expected result: Proposed card is created correctly.", "name": "test_post1", "signature": "def test_post1(self)" }, { "docstring": "Scenario: POST request is made with levels array provided, but empty. Expected result: Proposed ca...
2
stack_v2_sparse_classes_30k_train_001204
Implement the Python class `WholeProposedCardListTestCase` described below. Class description: Implement the WholeProposedCardListTestCase class. Method signatures and docstrings: - def test_post1(self): Scenario: POST request is made with correct data. Expected result: Proposed card is created correctly. - def test_...
Implement the Python class `WholeProposedCardListTestCase` described below. Class description: Implement the WholeProposedCardListTestCase class. Method signatures and docstrings: - def test_post1(self): Scenario: POST request is made with correct data. Expected result: Proposed card is created correctly. - def test_...
ea812b13de0cd6c47c541cbede2d016a7837b4b8
<|skeleton|> class WholeProposedCardListTestCase: def test_post1(self): """Scenario: POST request is made with correct data. Expected result: Proposed card is created correctly.""" <|body_0|> def test_post2(self): """Scenario: POST request is made with levels array provided, but empty....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WholeProposedCardListTestCase: def test_post1(self): """Scenario: POST request is made with correct data. Expected result: Proposed card is created correctly.""" name = 'masDASdk213aksd123Saad' self.assertRaises(ProposedCardInfo.DoesNotExist, ProposedCardInfo.objects.get, name=name) ...
the_stack_v2_python_sparse
WMIAdventure/backend/WMIAdventure_backend/proposed_content/tests.py
Michal-Czekanski/WMIAdventure-1
train
0
bc573e9fe7b5d7a29a24d324b6fa18f5d4ab5d93
[ "p = len(nums) - 1\nfor i in range(len(nums) - 1, -1, -1):\n if i + nums[i] >= p:\n p = i\nreturn p == 0", "reachable = [True] + [False] * (len(nums) - 1)\nfor i, n in enumerate(nums):\n if reachable[i]:\n for j in range(i, min(len(nums), i + n + 1)):\n reachable[j] = True\nreturn r...
<|body_start_0|> p = len(nums) - 1 for i in range(len(nums) - 1, -1, -1): if i + nums[i] >= p: p = i return p == 0 <|end_body_0|> <|body_start_1|> reachable = [True] + [False] * (len(nums) - 1) for i, n in enumerate(nums): if reachable[i]:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canJump(self, nums): """:type nums: List[int] :rtype: bool 這個做法的想法是從終點往回看每一個格子是不是有機會走到終點 如果有機會,就將p更新到那個位子 然後再繼續往回看每一個剩下的格子能不能走到更新後的p點 如果到最後 p 點被更新到 0, 也就是起點 就表示這個是可以從起點走到終點的, 所以最後是回傳 p == 0""" <|body_0|> def canJumpSlow(self, nums): """:type nums: List[...
stack_v2_sparse_classes_36k_train_004096
1,531
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool 這個做法的想法是從終點往回看每一個格子是不是有機會走到終點 如果有機會,就將p更新到那個位子 然後再繼續往回看每一個剩下的格子能不能走到更新後的p點 如果到最後 p 點被更新到 0, 也就是起點 就表示這個是可以從起點走到終點的, 所以最後是回傳 p == 0", "name": "canJump", "signature": "def canJump(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool"...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums): :type nums: List[int] :rtype: bool 這個做法的想法是從終點往回看每一個格子是不是有機會走到終點 如果有機會,就將p更新到那個位子 然後再繼續往回看每一個剩下的格子能不能走到更新後的p點 如果到最後 p 點被更新到 0, 也就是起點 就表示這個是可以從起點走到終點的, 所以...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums): :type nums: List[int] :rtype: bool 這個做法的想法是從終點往回看每一個格子是不是有機會走到終點 如果有機會,就將p更新到那個位子 然後再繼續往回看每一個剩下的格子能不能走到更新後的p點 如果到最後 p 點被更新到 0, 也就是起點 就表示這個是可以從起點走到終點的, 所以...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def canJump(self, nums): """:type nums: List[int] :rtype: bool 這個做法的想法是從終點往回看每一個格子是不是有機會走到終點 如果有機會,就將p更新到那個位子 然後再繼續往回看每一個剩下的格子能不能走到更新後的p點 如果到最後 p 點被更新到 0, 也就是起點 就表示這個是可以從起點走到終點的, 所以最後是回傳 p == 0""" <|body_0|> def canJumpSlow(self, nums): """:type nums: List[...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canJump(self, nums): """:type nums: List[int] :rtype: bool 這個做法的想法是從終點往回看每一個格子是不是有機會走到終點 如果有機會,就將p更新到那個位子 然後再繼續往回看每一個剩下的格子能不能走到更新後的p點 如果到最後 p 點被更新到 0, 也就是起點 就表示這個是可以從起點走到終點的, 所以最後是回傳 p == 0""" p = len(nums) - 1 for i in range(len(nums) - 1, -1, -1): if i + num...
the_stack_v2_python_sparse
cs_notes/arrays/jump_game.py
hwc1824/LeetCodeSolution
train
0
bea510e3466d9c17839bd176c8024a8cb589664a
[ "if asyncEstimate:\n task = self._coreEstimator.asyncEstimate(warp.warpedImage.coreImage)\n return AsyncTask(task, POST_PROCESSING.postProcessing)\nerror, estimation = self._coreEstimator.estimate(warp.warpedImage.coreImage)\nreturn POST_PROCESSING.postProcessing(error, estimation)", "coreImages = [warp.war...
<|body_start_0|> if asyncEstimate: task = self._coreEstimator.asyncEstimate(warp.warpedImage.coreImage) return AsyncTask(task, POST_PROCESSING.postProcessing) error, estimation = self._coreEstimator.estimate(warp.warpedImage.coreImage) return POST_PROCESSING.postProcessin...
Image color type estimator. Work on face detections. Allowed types see `ImageColorSchema`.
ImageColorTypeEstimator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageColorTypeEstimator: """Image color type estimator. Work on face detections. Allowed types see `ImageColorSchema`.""" def estimate(self, warp: Union[FaceWarp, FaceWarpedImage], asyncEstimate: bool=False) -> Union[ImageColorType, AsyncTask[ImageColorType]]: """Estimate image color...
stack_v2_sparse_classes_36k_train_004097
4,296
permissive
[ { "docstring": "Estimate image color type on warp. Args: warp: warped image asyncEstimate: estimate or run estimation in background Returns: estimated image color type if asyncEstimate is false otherwise async task Raises: LunaSDKException: if estimation failed", "name": "estimate", "signature": "def es...
2
stack_v2_sparse_classes_30k_train_011864
Implement the Python class `ImageColorTypeEstimator` described below. Class description: Image color type estimator. Work on face detections. Allowed types see `ImageColorSchema`. Method signatures and docstrings: - def estimate(self, warp: Union[FaceWarp, FaceWarpedImage], asyncEstimate: bool=False) -> Union[ImageCo...
Implement the Python class `ImageColorTypeEstimator` described below. Class description: Image color type estimator. Work on face detections. Allowed types see `ImageColorSchema`. Method signatures and docstrings: - def estimate(self, warp: Union[FaceWarp, FaceWarpedImage], asyncEstimate: bool=False) -> Union[ImageCo...
7a4bebc92ae7a96d8d9c18a024208308942f90cd
<|skeleton|> class ImageColorTypeEstimator: """Image color type estimator. Work on face detections. Allowed types see `ImageColorSchema`.""" def estimate(self, warp: Union[FaceWarp, FaceWarpedImage], asyncEstimate: bool=False) -> Union[ImageColorType, AsyncTask[ImageColorType]]: """Estimate image color...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageColorTypeEstimator: """Image color type estimator. Work on face detections. Allowed types see `ImageColorSchema`.""" def estimate(self, warp: Union[FaceWarp, FaceWarpedImage], asyncEstimate: bool=False) -> Union[ImageColorType, AsyncTask[ImageColorType]]: """Estimate image color type on warp...
the_stack_v2_python_sparse
lunavl/sdk/estimators/face_estimators/image_type.py
matemax/lunasdk
train
16
2cef6fb2b668c333be11e85155c5bdaf29d0dfcd
[ "super().__init__()\nself.criterion = criterion\nself.weight = weight\nself.independent_perm = independent_perm\nself.solver = PITSolver(criterion, weight, independent_perm)\nself.layer_weights = layer_weights", "losses = 0.0\nif not isinstance(infs[0], (tuple, list)) and len(infs) == len(ref):\n loss, stats, ...
<|body_start_0|> super().__init__() self.criterion = criterion self.weight = weight self.independent_perm = independent_perm self.solver = PITSolver(criterion, weight, independent_perm) self.layer_weights = layer_weights <|end_body_0|> <|body_start_1|> losses = 0...
MultiLayerPITSolver
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiLayerPITSolver: def __init__(self, criterion: AbsEnhLoss, weight=1.0, independent_perm=True, layer_weights=None): """Multi-Layer Permutation Invariant Training Solver. Compute the PIT loss given inferences of multiple layers and a single reference. It also support single inference a...
stack_v2_sparse_classes_36k_train_004098
3,042
permissive
[ { "docstring": "Multi-Layer Permutation Invariant Training Solver. Compute the PIT loss given inferences of multiple layers and a single reference. It also support single inference and single reference in evaluation stage. Args: criterion (AbsEnhLoss): an instance of AbsEnhLoss weight (float): weight (between 0...
2
null
Implement the Python class `MultiLayerPITSolver` described below. Class description: Implement the MultiLayerPITSolver class. Method signatures and docstrings: - def __init__(self, criterion: AbsEnhLoss, weight=1.0, independent_perm=True, layer_weights=None): Multi-Layer Permutation Invariant Training Solver. Compute...
Implement the Python class `MultiLayerPITSolver` described below. Class description: Implement the MultiLayerPITSolver class. Method signatures and docstrings: - def __init__(self, criterion: AbsEnhLoss, weight=1.0, independent_perm=True, layer_weights=None): Multi-Layer Permutation Invariant Training Solver. Compute...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class MultiLayerPITSolver: def __init__(self, criterion: AbsEnhLoss, weight=1.0, independent_perm=True, layer_weights=None): """Multi-Layer Permutation Invariant Training Solver. Compute the PIT loss given inferences of multiple layers and a single reference. It also support single inference a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiLayerPITSolver: def __init__(self, criterion: AbsEnhLoss, weight=1.0, independent_perm=True, layer_weights=None): """Multi-Layer Permutation Invariant Training Solver. Compute the PIT loss given inferences of multiple layers and a single reference. It also support single inference and single refe...
the_stack_v2_python_sparse
espnet2/enh/loss/wrappers/multilayer_pit_solver.py
espnet/espnet
train
7,242
6d3c29363a5e25edf0c0dfa091737648b4bcb7bd
[ "user = User.objects.create_user('user', 'user@test.com')\nactivity = Activity.objects.create(title='Test activity', slug='test-activity', description='Testing!', duration=10, point_value=10, pub_date=datetime.datetime.today(), expire_date=datetime.datetime.today() + datetime.timedelta(days=7), confirm_type='text',...
<|body_start_0|> user = User.objects.create_user('user', 'user@test.com') activity = Activity.objects.create(title='Test activity', slug='test-activity', description='Testing!', duration=10, point_value=10, pub_date=datetime.datetime.today(), expire_date=datetime.datetime.today() + datetime.timedelta(da...
MissionTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MissionTest: def testGroupMissionCompletion(self): """Test that a group mission is completed when its related activity is completed.""" <|body_0|> def testGroupMissionKarma(self): """Test that karma for a group activity is handled properly.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_004099
7,469
no_license
[ { "docstring": "Test that a group mission is completed when its related activity is completed.", "name": "testGroupMissionCompletion", "signature": "def testGroupMissionCompletion(self)" }, { "docstring": "Test that karma for a group activity is handled properly.", "name": "testGroupMissionK...
4
null
Implement the Python class `MissionTest` described below. Class description: Implement the MissionTest class. Method signatures and docstrings: - def testGroupMissionCompletion(self): Test that a group mission is completed when its related activity is completed. - def testGroupMissionKarma(self): Test that karma for ...
Implement the Python class `MissionTest` described below. Class description: Implement the MissionTest class. Method signatures and docstrings: - def testGroupMissionCompletion(self): Test that a group mission is completed when its related activity is completed. - def testGroupMissionKarma(self): Test that karma for ...
783db33ed0b38fb4dccc371c426265f7028a2d13
<|skeleton|> class MissionTest: def testGroupMissionCompletion(self): """Test that a group mission is completed when its related activity is completed.""" <|body_0|> def testGroupMissionKarma(self): """Test that karma for a group activity is handled properly.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MissionTest: def testGroupMissionCompletion(self): """Test that a group mission is completed when its related activity is completed.""" user = User.objects.create_user('user', 'user@test.com') activity = Activity.objects.create(title='Test activity', slug='test-activity', description='...
the_stack_v2_python_sparse
makahiki/apps/components/canopy/tests.py
keokilee/makahiki
train
2