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
47ae6aae0321307823f97613e97d8a51af22d6e4
[ "max_shape = self._find_max_shape(self.fovlist)\nfig = plt.figure(figsize=(20, 16))\ngs = gridspec.GridSpec(max_shape[0], 16, figure=fig)\nself._plot_traces_with_cell_img(self.fovlist, gs, max_shape)", "shapes = []\nnum_of_labeled = 0\nfor fov in fovlist:\n shapes.append(fov.all_data.shape)\n try:\n ...
<|body_start_0|> max_shape = self._find_max_shape(self.fovlist) fig = plt.figure(figsize=(20, 16)) gs = gridspec.GridSpec(max_shape[0], 16, figure=fig) self._plot_traces_with_cell_img(self.fovlist, gs, max_shape) <|end_body_0|> <|body_start_1|> shapes = [] num_of_labeled...
Plots a simple comparison of the dF/F traces that originated from the unlabeled cells and the labeled cells.
ShowLabeledAndUnlabeled
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShowLabeledAndUnlabeled: """Plots a simple comparison of the dF/F traces that originated from the unlabeled cells and the labeled cells.""" def run(self): """Main pipeline""" <|body_0|> def _find_max_shape(self, fovlist): """Iterate over the found files and decid...
stack_v2_sparse_classes_36k_train_025400
11,294
permissive
[ { "docstring": "Main pipeline", "name": "run", "signature": "def run(self)" }, { "docstring": "Iterate over the found files and decide upon the shape of the array that will hold the stacked data. This is useful when the number of measurements in each FOV was unequal.", "name": "_find_max_sha...
5
stack_v2_sparse_classes_30k_train_020242
Implement the Python class `ShowLabeledAndUnlabeled` described below. Class description: Plots a simple comparison of the dF/F traces that originated from the unlabeled cells and the labeled cells. Method signatures and docstrings: - def run(self): Main pipeline - def _find_max_shape(self, fovlist): Iterate over the ...
Implement the Python class `ShowLabeledAndUnlabeled` described below. Class description: Plots a simple comparison of the dF/F traces that originated from the unlabeled cells and the labeled cells. Method signatures and docstrings: - def run(self): Main pipeline - def _find_max_shape(self, fovlist): Iterate over the ...
87fcca6fd79f65122b4010d2225d10403450da7e
<|skeleton|> class ShowLabeledAndUnlabeled: """Plots a simple comparison of the dF/F traces that originated from the unlabeled cells and the labeled cells.""" def run(self): """Main pipeline""" <|body_0|> def _find_max_shape(self, fovlist): """Iterate over the found files and decid...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShowLabeledAndUnlabeled: """Plots a simple comparison of the dF/F traces that originated from the unlabeled cells and the labeled cells.""" def run(self): """Main pipeline""" max_shape = self._find_max_shape(self.fovlist) fig = plt.figure(figsize=(20, 16)) gs = gridspec.Gr...
the_stack_v2_python_sparse
calcium_bflow_analysis/colabeled_cells/compare_labeled_unlabeled.py
PBLab/ca-analysis-bloodflow
train
0
9981a9d733723cae2a904efb9b12018279e61c85
[ "url = '{0}/consumers'.format(container_ref)\nresp = self.client.post(url, request_model=model, extra_headers=extra_headers, user_name=user_name, use_auth=use_auth)\nif resp.status_code == 401 and (not use_auth):\n return (resp, None)\nif resp.status_code == 200:\n if admin is None:\n admin = user_name...
<|body_start_0|> url = '{0}/consumers'.format(container_ref) resp = self.client.post(url, request_model=model, extra_headers=extra_headers, user_name=user_name, use_auth=use_auth) if resp.status_code == 401 and (not use_auth): return (resp, None) if resp.status_code == 200: ...
ConsumerBehaviors
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConsumerBehaviors: def create_consumer(self, model, container_ref, extra_headers=None, user_name=None, admin=None, use_auth=True): """Register a consumer to a container. :param model: The metadata for the consumer :param container_ref: Full reference to a container :param extra_headers: ...
stack_v2_sparse_classes_36k_train_025401
4,859
permissive
[ { "docstring": "Register a consumer to a container. :param model: The metadata for the consumer :param container_ref: Full reference to a container :param extra_headers: Any additional headers to pass to the request :param user_name: The user name used to create the consumer :param admin: The user with permissi...
4
stack_v2_sparse_classes_30k_train_015173
Implement the Python class `ConsumerBehaviors` described below. Class description: Implement the ConsumerBehaviors class. Method signatures and docstrings: - def create_consumer(self, model, container_ref, extra_headers=None, user_name=None, admin=None, use_auth=True): Register a consumer to a container. :param model...
Implement the Python class `ConsumerBehaviors` described below. Class description: Implement the ConsumerBehaviors class. Method signatures and docstrings: - def create_consumer(self, model, container_ref, extra_headers=None, user_name=None, admin=None, use_auth=True): Register a consumer to a container. :param model...
c8e3dc14e6225f1d400131434e8afec0aa410ae7
<|skeleton|> class ConsumerBehaviors: def create_consumer(self, model, container_ref, extra_headers=None, user_name=None, admin=None, use_auth=True): """Register a consumer to a container. :param model: The metadata for the consumer :param container_ref: Full reference to a container :param extra_headers: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConsumerBehaviors: def create_consumer(self, model, container_ref, extra_headers=None, user_name=None, admin=None, use_auth=True): """Register a consumer to a container. :param model: The metadata for the consumer :param container_ref: Full reference to a container :param extra_headers: Any additional...
the_stack_v2_python_sparse
functionaltests/api/v1/behaviors/consumer_behaviors.py
openstack/barbican
train
189
6bc385410d626ca67296a556af1bd89ff2cf596d
[ "font = ImageFont.truetype(str(self.font_file), 45, encoding='utf-8')\nfor letter in self.hebrew.letter_li:\n (self.training_folder / letter).mkdir(parents=True, exist_ok=True)\nfor i in range(len(self.hebrew.font_li)):\n letter_path = self.training_folder / Path(self.hebrew.letter_li[i])\n text = self.heb...
<|body_start_0|> font = ImageFont.truetype(str(self.font_file), 45, encoding='utf-8') for letter in self.hebrew.letter_li: (self.training_folder / letter).mkdir(parents=True, exist_ok=True) for i in range(len(self.hebrew.font_li)): letter_path = self.training_folder / Pat...
Creates a folder with example images for each hebrew letter using habbakuk font.
FontImages
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FontImages: """Creates a folder with example images for each hebrew letter using habbakuk font.""" def create_images(self): """Write a .jpeg image for each character in the font character set.""" <|body_0|> def assert_data_correct(self) -> bool: """Assert that th...
stack_v2_sparse_classes_36k_train_025402
3,430
no_license
[ { "docstring": "Write a .jpeg image for each character in the font character set.", "name": "create_images", "signature": "def create_images(self)" }, { "docstring": "Assert that the font data exists and is in the correct format.", "name": "assert_data_correct", "signature": "def assert_...
3
stack_v2_sparse_classes_30k_train_001160
Implement the Python class `FontImages` described below. Class description: Creates a folder with example images for each hebrew letter using habbakuk font. Method signatures and docstrings: - def create_images(self): Write a .jpeg image for each character in the font character set. - def assert_data_correct(self) ->...
Implement the Python class `FontImages` described below. Class description: Creates a folder with example images for each hebrew letter using habbakuk font. Method signatures and docstrings: - def create_images(self): Write a .jpeg image for each character in the font character set. - def assert_data_correct(self) ->...
5283f8f5d00e99777ff28fe4b5f97c34c7bbeb7f
<|skeleton|> class FontImages: """Creates a folder with example images for each hebrew letter using habbakuk font.""" def create_images(self): """Write a .jpeg image for each character in the font character set.""" <|body_0|> def assert_data_correct(self) -> bool: """Assert that th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FontImages: """Creates a folder with example images for each hebrew letter using habbakuk font.""" def create_images(self): """Write a .jpeg image for each character in the font character set.""" font = ImageFont.truetype(str(self.font_file), 45, encoding='utf-8') for letter in se...
the_stack_v2_python_sparse
src/data_handler/font_images.py
Wehzie/hwr-2021
train
0
549a30caebdb2311958ec94ee705e7089e120f6f
[ "self.name = name\nself.help = help\nself.args = args\nself.execute = None", "@wraps(wrapped_function)\ndef wrapper(*args, **kwds):\n return wrapped_function(*args, **kwds)\nif self.name is None:\n self.name = wrapped_function.__name__\nself.execute = wrapped_function\nwrapper.decorator = self\nreturn wrapp...
<|body_start_0|> self.name = name self.help = help self.args = args self.execute = None <|end_body_0|> <|body_start_1|> @wraps(wrapped_function) def wrapper(*args, **kwds): return wrapped_function(*args, **kwds) if self.name is None: self....
The @cmd() function decorator marks a function as the implementation of a command-line command of an executable.
cmd
[ "MIT", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class cmd: """The @cmd() function decorator marks a function as the implementation of a command-line command of an executable.""" def __init__(self, name=None, help=None, args=()): """Create a function decorator and wrapper for a function implementing a command-line command. For example, t...
stack_v2_sparse_classes_36k_train_025403
7,308
permissive
[ { "docstring": "Create a function decorator and wrapper for a function implementing a command-line command. For example, the command-line executable 'foo' may wish to implement a command-line command 'bar' with the option '--baz' invoked at the command line as 'foo bar --baz'. The arguments of this constructor ...
2
stack_v2_sparse_classes_30k_train_016892
Implement the Python class `cmd` described below. Class description: The @cmd() function decorator marks a function as the implementation of a command-line command of an executable. Method signatures and docstrings: - def __init__(self, name=None, help=None, args=()): Create a function decorator and wrapper for a fun...
Implement the Python class `cmd` described below. Class description: The @cmd() function decorator marks a function as the implementation of a command-line command of an executable. Method signatures and docstrings: - def __init__(self, name=None, help=None, args=()): Create a function decorator and wrapper for a fun...
b531d5d374ee9b3b66732001eaa6923b3f97ec1b
<|skeleton|> class cmd: """The @cmd() function decorator marks a function as the implementation of a command-line command of an executable.""" def __init__(self, name=None, help=None, args=()): """Create a function decorator and wrapper for a function implementing a command-line command. For example, t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class cmd: """The @cmd() function decorator marks a function as the implementation of a command-line command of an executable.""" def __init__(self, name=None, help=None, args=()): """Create a function decorator and wrapper for a function implementing a command-line command. For example, the command-li...
the_stack_v2_python_sparse
pylib/cmdline.py
engineeringentropy/echronos
train
0
b74b97d30356952ba8928fe9043a9db14137730d
[ "self.mor_item = mor_item\nself.mor_type = mor_type\nself.uuid = uuid", "if dictionary is None:\n return None\nmor_item = dictionary.get('morItem')\nmor_type = dictionary.get('morType')\nuuid = dictionary.get('uuid')\nreturn cls(mor_item, mor_type, uuid)" ]
<|body_start_0|> self.mor_item = mor_item self.mor_type = mor_type self.uuid = uuid <|end_body_0|> <|body_start_1|> if dictionary is None: return None mor_item = dictionary.get('morItem') mor_type = dictionary.get('morType') uuid = dictionary.get('uui...
Implementation of the 'VmwareObjectId' model. Specifies a unique Protection Source id across Cohesity Clusters. It is derived from the id of the VMware Protection Source. Attributes: mor_item (string): Specifies the Managed Object Reference Item. mor_type (string): Specifies the Managed Object Reference Type. uuid (str...
VmwareObjectId
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VmwareObjectId: """Implementation of the 'VmwareObjectId' model. Specifies a unique Protection Source id across Cohesity Clusters. It is derived from the id of the VMware Protection Source. Attributes: mor_item (string): Specifies the Managed Object Reference Item. mor_type (string): Specifies th...
stack_v2_sparse_classes_36k_train_025404
1,877
permissive
[ { "docstring": "Constructor for the VmwareObjectId class", "name": "__init__", "signature": "def __init__(self, mor_item=None, mor_type=None, uuid=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the objec...
2
stack_v2_sparse_classes_30k_train_021068
Implement the Python class `VmwareObjectId` described below. Class description: Implementation of the 'VmwareObjectId' model. Specifies a unique Protection Source id across Cohesity Clusters. It is derived from the id of the VMware Protection Source. Attributes: mor_item (string): Specifies the Managed Object Referenc...
Implement the Python class `VmwareObjectId` described below. Class description: Implementation of the 'VmwareObjectId' model. Specifies a unique Protection Source id across Cohesity Clusters. It is derived from the id of the VMware Protection Source. Attributes: mor_item (string): Specifies the Managed Object Referenc...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class VmwareObjectId: """Implementation of the 'VmwareObjectId' model. Specifies a unique Protection Source id across Cohesity Clusters. It is derived from the id of the VMware Protection Source. Attributes: mor_item (string): Specifies the Managed Object Reference Item. mor_type (string): Specifies th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VmwareObjectId: """Implementation of the 'VmwareObjectId' model. Specifies a unique Protection Source id across Cohesity Clusters. It is derived from the id of the VMware Protection Source. Attributes: mor_item (string): Specifies the Managed Object Reference Item. mor_type (string): Specifies the Managed Obj...
the_stack_v2_python_sparse
cohesity_management_sdk/models/vmware_object_id.py
cohesity/management-sdk-python
train
24
6f0a46f62d4864cc8aa07dee0b2a58c2c34a4dd5
[ "groups = [set(), set()]\ng = defaultdict(set)\nfor i, nodes in enumerate(graph):\n for j in nodes:\n g[i].add(j)\n g[j].add(i)\n\ndef dfs(u, i):\n result = True\n for v in g[u]:\n if v in groups[i]:\n return False\n elif v not in groups[(i + 1) % 2]:\n gro...
<|body_start_0|> groups = [set(), set()] g = defaultdict(set) for i, nodes in enumerate(graph): for j in nodes: g[i].add(j) g[j].add(i) def dfs(u, i): result = True for v in g[u]: if v in groups[i]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isBipartite(self, graph: List[List[int]]) -> bool: """09/11/2020 23:15""" <|body_0|> def isBipartite(self, graph: List[List[int]]) -> bool: """09/11/2020 23:17""" <|body_1|> def isBipartite(self, graph: List[List[int]]) -> bool: """...
stack_v2_sparse_classes_36k_train_025405
3,868
no_license
[ { "docstring": "09/11/2020 23:15", "name": "isBipartite", "signature": "def isBipartite(self, graph: List[List[int]]) -> bool" }, { "docstring": "09/11/2020 23:17", "name": "isBipartite", "signature": "def isBipartite(self, graph: List[List[int]]) -> bool" }, { "docstring": "05/1...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBipartite(self, graph: List[List[int]]) -> bool: 09/11/2020 23:15 - def isBipartite(self, graph: List[List[int]]) -> bool: 09/11/2020 23:17 - def isBipartite(self, graph: L...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBipartite(self, graph: List[List[int]]) -> bool: 09/11/2020 23:15 - def isBipartite(self, graph: List[List[int]]) -> bool: 09/11/2020 23:17 - def isBipartite(self, graph: L...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def isBipartite(self, graph: List[List[int]]) -> bool: """09/11/2020 23:15""" <|body_0|> def isBipartite(self, graph: List[List[int]]) -> bool: """09/11/2020 23:17""" <|body_1|> def isBipartite(self, graph: List[List[int]]) -> bool: """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isBipartite(self, graph: List[List[int]]) -> bool: """09/11/2020 23:15""" groups = [set(), set()] g = defaultdict(set) for i, nodes in enumerate(graph): for j in nodes: g[i].add(j) g[j].add(i) def dfs(u, i): ...
the_stack_v2_python_sparse
leetcode/solved/801_Is_Graph_Bipartite?/solution.py
sungminoh/algorithms
train
0
f5ec7046d0dde0e18a462ca7b2e23907432c02b9
[ "self.config = config_\nself.logger = logging.getLogger('gym_logger')\ndata_provider = DataProvider(self.config)\nself.city_states = data_provider.read_city_states()\nself.hex_attr_df = data_provider.read_hex_bin_attributes()\nself.hex_bins = self.hex_attr_df['hex_id']\nself.T = len(self.city_states)\nself.S = len(...
<|body_start_0|> self.config = config_ self.logger = logging.getLogger('gym_logger') data_provider = DataProvider(self.config) self.city_states = data_provider.read_city_states() self.hex_attr_df = data_provider.read_hex_bin_attributes() self.hex_bins = self.hex_attr_df['...
BasicEnv
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicEnv: def __init__(self, config_): """Constructor :param config_: :return:""" <|body_0|> def step(self, action): """Advances the environment by 1 time step :param action: :return:""" <|body_1|> def lookahead(self, action, t, city_state, driver_distri...
stack_v2_sparse_classes_36k_train_025406
4,505
no_license
[ { "docstring": "Constructor :param config_: :return:", "name": "__init__", "signature": "def __init__(self, config_)" }, { "docstring": "Advances the environment by 1 time step :param action: :return:", "name": "step", "signature": "def step(self, action)" }, { "docstring": "Look...
5
stack_v2_sparse_classes_30k_train_007125
Implement the Python class `BasicEnv` described below. Class description: Implement the BasicEnv class. Method signatures and docstrings: - def __init__(self, config_): Constructor :param config_: :return: - def step(self, action): Advances the environment by 1 time step :param action: :return: - def lookahead(self, ...
Implement the Python class `BasicEnv` described below. Class description: Implement the BasicEnv class. Method signatures and docstrings: - def __init__(self, config_): Constructor :param config_: :return: - def step(self, action): Advances the environment by 1 time step :param action: :return: - def lookahead(self, ...
f7fcd2cc1d6ba18b199d176d4d39193f025ee281
<|skeleton|> class BasicEnv: def __init__(self, config_): """Constructor :param config_: :return:""" <|body_0|> def step(self, action): """Advances the environment by 1 time step :param action: :return:""" <|body_1|> def lookahead(self, action, t, city_state, driver_distri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicEnv: def __init__(self, config_): """Constructor :param config_: :return:""" self.config = config_ self.logger = logging.getLogger('gym_logger') data_provider = DataProvider(self.config) self.city_states = data_provider.read_city_states() self.hex_attr_df =...
the_stack_v2_python_sparse
gym_nyc_yellow_taxi/envs/basic_env.py
transparent-framework/optimize-ride-sharing-earnings
train
7
696671acf1ae3b613457e05ab4124171105fde6f
[ "print('\\n//////////////////////////////////////////////////')\nprint('♪♪ CountGraphController Initialized ♪♪')\nprint('//////////////////////////////////////////////////\\n')\nself.controller: ElevatorController = ElevatorController(dir, start_at, end_at)", "value_list: list[int] = []\ncreated_list: list[dateti...
<|body_start_0|> print('\n//////////////////////////////////////////////////') print('♪♪ CountGraphController Initialized ♪♪') print('//////////////////////////////////////////////////\n') self.controller: ElevatorController = ElevatorController(dir, start_at, end_at) <|end_body_0|> <|b...
CountGraphController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CountGraphController: def __init__(self, dir: str, start_at: datetime=None, end_at: datetime=None): """カウントのグラフを表示するためのコントローラー @params str dir エレベーター向き(left or right)""" <|body_0|> def show_graph(self): """グラフを生成・表示""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_025407
2,180
no_license
[ { "docstring": "カウントのグラフを表示するためのコントローラー @params str dir エレベーター向き(left or right)", "name": "__init__", "signature": "def __init__(self, dir: str, start_at: datetime=None, end_at: datetime=None)" }, { "docstring": "グラフを生成・表示", "name": "show_graph", "signature": "def show_graph(self)" } ]
2
stack_v2_sparse_classes_30k_train_012898
Implement the Python class `CountGraphController` described below. Class description: Implement the CountGraphController class. Method signatures and docstrings: - def __init__(self, dir: str, start_at: datetime=None, end_at: datetime=None): カウントのグラフを表示するためのコントローラー @params str dir エレベーター向き(left or right) - def show_g...
Implement the Python class `CountGraphController` described below. Class description: Implement the CountGraphController class. Method signatures and docstrings: - def __init__(self, dir: str, start_at: datetime=None, end_at: datetime=None): カウントのグラフを表示するためのコントローラー @params str dir エレベーター向き(left or right) - def show_g...
0de2ee9c5af2e39f15952adf3df55c227d9a3bd0
<|skeleton|> class CountGraphController: def __init__(self, dir: str, start_at: datetime=None, end_at: datetime=None): """カウントのグラフを表示するためのコントローラー @params str dir エレベーター向き(left or right)""" <|body_0|> def show_graph(self): """グラフを生成・表示""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CountGraphController: def __init__(self, dir: str, start_at: datetime=None, end_at: datetime=None): """カウントのグラフを表示するためのコントローラー @params str dir エレベーター向き(left or right)""" print('\n//////////////////////////////////////////////////') print('♪♪ CountGraphController Initialized ♪♪') ...
the_stack_v2_python_sparse
src/controllers/graph/count.py
Alesion30/elecon-py
train
0
cf1c816017173afb2dd1b21d8ad75706c12af189
[ "print(\"Checkers in Surround's linter\")\nprint('=============================')\ntry:\n Run(['--list-msgs-enabled'])\nexcept SystemExit:\n pass", "ignore_dirs = ['scripts', 'spikes', 'notebooks']\nargs = [str(p) for p in Path(project_root).glob('**/*.py')]\nargs = [p for p in args if os.path.basename(os.p...
<|body_start_0|> print("Checkers in Surround's linter") print('=============================') try: Run(['--list-msgs-enabled']) except SystemExit: pass <|end_body_0|> <|body_start_1|> ignore_dirs = ['scripts', 'spikes', 'notebooks'] args = [str(p...
Represents the Surround linter which performs multiple checks on the surround project and displays warnings/errors found during the linting process. This class is used by the Surround CLI to perform the linting of a project via the `lint` sub-command.
Linter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Linter: """Represents the Surround linter which performs multiple checks on the surround project and displays warnings/errors found during the linting process. This class is used by the Surround CLI to perform the linting of a project via the `lint` sub-command.""" def dump_checks(self): ...
stack_v2_sparse_classes_36k_train_025408
1,910
permissive
[ { "docstring": "Dumps a list of the checks in this linter to the terminal. :return: formatted list of the checkers in the linter :rtype: str", "name": "dump_checks", "signature": "def dump_checks(self)" }, { "docstring": "Runs the linter against the project specified, returning zero on success :...
2
stack_v2_sparse_classes_30k_train_018639
Implement the Python class `Linter` described below. Class description: Represents the Surround linter which performs multiple checks on the surround project and displays warnings/errors found during the linting process. This class is used by the Surround CLI to perform the linting of a project via the `lint` sub-comm...
Implement the Python class `Linter` described below. Class description: Represents the Surround linter which performs multiple checks on the surround project and displays warnings/errors found during the linting process. This class is used by the Surround CLI to perform the linting of a project via the `lint` sub-comm...
effbb5353ae81d95a30306f94065ac2c8124ec44
<|skeleton|> class Linter: """Represents the Surround linter which performs multiple checks on the surround project and displays warnings/errors found during the linting process. This class is used by the Surround CLI to perform the linting of a project via the `lint` sub-command.""" def dump_checks(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Linter: """Represents the Surround linter which performs multiple checks on the surround project and displays warnings/errors found during the linting process. This class is used by the Surround CLI to perform the linting of a project via the `lint` sub-command.""" def dump_checks(self): """Dumps...
the_stack_v2_python_sparse
surround_cli/surround_cli/linter.py
a2i2/surround
train
14
89ceb35496e9fec21fc66b408ed180cbb0e081b3
[ "Agent.__init__(self, parent)\nself.server_config = CONFIG\nself.snmp_config = CONFIG_SNMP", "delay = self.server_config.polling_interval()\nts_start = int(time.time())\nwhile True:\n log_message = 'Starting device polling sequence.'\n log.log2info(1056, log_message)\n temp_topology_directory = self.serv...
<|body_start_0|> Agent.__init__(self, parent) self.server_config = CONFIG self.snmp_config = CONFIG_SNMP <|end_body_0|> <|body_start_1|> delay = self.server_config.polling_interval() ts_start = int(time.time()) while True: log_message = 'Starting device polli...
Switchmap-NG agent that gathers data. Args: None Returns: None Functions: __init__: populate: post:
PollingAgent
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PollingAgent: """Switchmap-NG agent that gathers data. Args: None Returns: None Functions: __init__: populate: post:""" def __init__(self, parent): """Method initializing the class. Args: config_dir: Configuration directory Returns: None""" <|body_0|> def query(self): ...
stack_v2_sparse_classes_36k_train_025409
16,748
permissive
[ { "docstring": "Method initializing the class. Args: config_dir: Configuration directory Returns: None", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "Query all remote hosts for data. Args: None Returns: None", "name": "query", "signature": "def query(s...
2
null
Implement the Python class `PollingAgent` described below. Class description: Switchmap-NG agent that gathers data. Args: None Returns: None Functions: __init__: populate: post: Method signatures and docstrings: - def __init__(self, parent): Method initializing the class. Args: config_dir: Configuration directory Ret...
Implement the Python class `PollingAgent` described below. Class description: Switchmap-NG agent that gathers data. Args: None Returns: None Functions: __init__: populate: post: Method signatures and docstrings: - def __init__(self, parent): Method initializing the class. Args: config_dir: Configuration directory Ret...
ae82589fbbab77fef6d6be09c1fcca5846f595a8
<|skeleton|> class PollingAgent: """Switchmap-NG agent that gathers data. Args: None Returns: None Functions: __init__: populate: post:""" def __init__(self, parent): """Method initializing the class. Args: config_dir: Configuration directory Returns: None""" <|body_0|> def query(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PollingAgent: """Switchmap-NG agent that gathers data. Args: None Returns: None Functions: __init__: populate: post:""" def __init__(self, parent): """Method initializing the class. Args: config_dir: Configuration directory Returns: None""" Agent.__init__(self, parent) self.server...
the_stack_v2_python_sparse
_deprecated/switchmap-ng-poller.old
PalisadoesFoundation/switchmap-ng
train
8
33202def949b6f0c4f47c192c311bcf208bb4293
[ "super().__init__(coordinator)\nself.entity_description = description\nself.coordinator = coordinator\nself._entry_id = entry_id\nself._attrs: dict[str, Any] = {}\n_id = coordinator.data.iata\nself._attr_name = f'{_id} {description.name}'\nself._attr_unique_id = f'{_id}_{description.key}'", "sensor_type = self.en...
<|body_start_0|> super().__init__(coordinator) self.entity_description = description self.coordinator = coordinator self._entry_id = entry_id self._attrs: dict[str, Any] = {} _id = coordinator.data.iata self._attr_name = f'{_id} {description.name}' self._a...
Define a binary sensor for FAA Delays.
FAABinarySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FAABinarySensor: """Define a binary sensor for FAA Delays.""" def __init__(self, coordinator, entry_id, description: BinarySensorEntityDescription) -> None: """Initialize the sensor.""" <|body_0|> def is_on(self): """Return the status of the sensor.""" <|...
stack_v2_sparse_classes_36k_train_025410
3,718
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, coordinator, entry_id, description: BinarySensorEntityDescription) -> None" }, { "docstring": "Return the status of the sensor.", "name": "is_on", "signature": "def is_on(self)" }, { "do...
3
null
Implement the Python class `FAABinarySensor` described below. Class description: Define a binary sensor for FAA Delays. Method signatures and docstrings: - def __init__(self, coordinator, entry_id, description: BinarySensorEntityDescription) -> None: Initialize the sensor. - def is_on(self): Return the status of the ...
Implement the Python class `FAABinarySensor` described below. Class description: Define a binary sensor for FAA Delays. Method signatures and docstrings: - def __init__(self, coordinator, entry_id, description: BinarySensorEntityDescription) -> None: Initialize the sensor. - def is_on(self): Return the status of the ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class FAABinarySensor: """Define a binary sensor for FAA Delays.""" def __init__(self, coordinator, entry_id, description: BinarySensorEntityDescription) -> None: """Initialize the sensor.""" <|body_0|> def is_on(self): """Return the status of the sensor.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FAABinarySensor: """Define a binary sensor for FAA Delays.""" def __init__(self, coordinator, entry_id, description: BinarySensorEntityDescription) -> None: """Initialize the sensor.""" super().__init__(coordinator) self.entity_description = description self.coordinator = ...
the_stack_v2_python_sparse
homeassistant/components/faa_delays/binary_sensor.py
home-assistant/core
train
35,501
315911396961d52916c19292d41ac6fd4a565761
[ "head1 = self.build_list(nums1)\nhead2 = self.build_list(nums2)\np1 = head1\np2 = head2\nres = []\nwhile p1 and p2:\n if p1.val < p2.val:\n p2 = p2.next\n elif p1.val > p2.val:\n p1 = p1.next\n else:\n res.append(p1.val)\n p1 = p1.next\n p2 = p2.next\nreturn res", "dumm...
<|body_start_0|> head1 = self.build_list(nums1) head2 = self.build_list(nums2) p1 = head1 p2 = head2 res = [] while p1 and p2: if p1.val < p2.val: p2 = p2.next elif p1.val > p2.val: p1 = p1.next else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def func(self, nums1, nums2): """Args: nums1: list[int] nums2: list[int] Return: list[int]""" <|body_0|> def build_list(self, nums): """Args: nums: list[int] Return: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> head1 = self.bui...
stack_v2_sparse_classes_36k_train_025411
1,263
no_license
[ { "docstring": "Args: nums1: list[int] nums2: list[int] Return: list[int]", "name": "func", "signature": "def func(self, nums1, nums2)" }, { "docstring": "Args: nums: list[int] Return: ListNode", "name": "build_list", "signature": "def build_list(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_000073
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def func(self, nums1, nums2): Args: nums1: list[int] nums2: list[int] Return: list[int] - def build_list(self, nums): Args: nums: list[int] Return: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def func(self, nums1, nums2): Args: nums1: list[int] nums2: list[int] Return: list[int] - def build_list(self, nums): Args: nums: list[int] Return: ListNode <|skeleton|> class S...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def func(self, nums1, nums2): """Args: nums1: list[int] nums2: list[int] Return: list[int]""" <|body_0|> def build_list(self, nums): """Args: nums: list[int] Return: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def func(self, nums1, nums2): """Args: nums1: list[int] nums2: list[int] Return: list[int]""" head1 = self.build_list(nums1) head2 = self.build_list(nums2) p1 = head1 p2 = head2 res = [] while p1 and p2: if p1.val < p2.val: ...
the_stack_v2_python_sparse
秋招/腾讯/1.1.py
AiZhanghan/Leetcode
train
0
3fd0f8a80e2687472efde5a91ec8037e95c57006
[ "data = self.data\nid_ = data['entity']['id']\nreturn f'{PLATFORM_URL}orders/{id_}'", "available = super().available\ndata = self.data\nto_role = data['to_role']\nreturn to_role == 'customer_user' and available" ]
<|body_start_0|> data = self.data id_ = data['entity']['id'] return f'{PLATFORM_URL}orders/{id_}' <|end_body_0|> <|body_start_1|> available = super().available data = self.data to_role = data['to_role'] return to_role == 'customer_user' and available <|end_body_1...
Email to customer on comment created.
CommentCreatedToCustomer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentCreatedToCustomer: """Email to customer on comment created.""" def action_url(self) -> str: """Action URL.""" <|body_0|> def available(self) -> bool: """Check if this action is available.""" <|body_1|> <|end_skeleton|> <|body_start_0|> da...
stack_v2_sparse_classes_36k_train_025412
5,020
no_license
[ { "docstring": "Action URL.", "name": "action_url", "signature": "def action_url(self) -> str" }, { "docstring": "Check if this action is available.", "name": "available", "signature": "def available(self) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_006981
Implement the Python class `CommentCreatedToCustomer` described below. Class description: Email to customer on comment created. Method signatures and docstrings: - def action_url(self) -> str: Action URL. - def available(self) -> bool: Check if this action is available.
Implement the Python class `CommentCreatedToCustomer` described below. Class description: Email to customer on comment created. Method signatures and docstrings: - def action_url(self) -> str: Action URL. - def available(self) -> bool: Check if this action is available. <|skeleton|> class CommentCreatedToCustomer: ...
cca179f55ebc3c420426eff59b23d7c8963ca9a3
<|skeleton|> class CommentCreatedToCustomer: """Email to customer on comment created.""" def action_url(self) -> str: """Action URL.""" <|body_0|> def available(self) -> bool: """Check if this action is available.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommentCreatedToCustomer: """Email to customer on comment created.""" def action_url(self) -> str: """Action URL.""" data = self.data id_ = data['entity']['id'] return f'{PLATFORM_URL}orders/{id_}' def available(self) -> bool: """Check if this action is availa...
the_stack_v2_python_sparse
src/briefy/choreographer/actions/mail/leica/comment.py
BriefyHQ/briefy.choreographer
train
0
5f0bc3d0f189c1a422c5dada12222f2a13e1c8f6
[ "super().__init__(func, M, b, w, None, useNumericalDerivatives)\nself.m_Dt = Dt\nself.m_c = np.zeros(len(c) + 1)\nself.m_c[1:len(c) + 1] = c\nself.m_c[0] = -np.sum(c)", "qn_hat = qn\npn_hat = pn\nfor c in self.m_c:\n qn_hat, pn_hat = self.m_step(c * self.m_Dt, qn_hat, pn_hat)\nfor c in self.m_c:\n qn_hat, p...
<|body_start_0|> super().__init__(func, M, b, w, None, useNumericalDerivatives) self.m_Dt = Dt self.m_c = np.zeros(len(c) + 1) self.m_c[1:len(c) + 1] = c self.m_c[0] = -np.sum(c) <|end_body_0|> <|body_start_1|> qn_hat = qn pn_hat = pn for c in self.m_c: ...
A derived class to create a post-processed composition method as described in L + R section 6.2.3, pp. 148. The idea here is that a composition method is applied to z after it has undergone a transformation. When the output is required the composition method is then applied to the results. This allows a higher order me...
Processing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Processing: """A derived class to create a post-processed composition method as described in L + R section 6.2.3, pp. 148. The idea here is that a composition method is applied to z after it has undergone a transformation. When the output is required the composition method is then applied to the ...
stack_v2_sparse_classes_36k_train_025413
16,278
no_license
[ { "docstring": "Parameters: func - Either the potential function or its first spatial derivative, depending on whether useNumericalDerivatices is False or True. Must take a one-dimensional three element vector represent the spatial coordinates at which at which the function will evaluate. M - The mass of the pa...
4
stack_v2_sparse_classes_30k_train_008675
Implement the Python class `Processing` described below. Class description: A derived class to create a post-processed composition method as described in L + R section 6.2.3, pp. 148. The idea here is that a composition method is applied to z after it has undergone a transformation. When the output is required the com...
Implement the Python class `Processing` described below. Class description: A derived class to create a post-processed composition method as described in L + R section 6.2.3, pp. 148. The idea here is that a composition method is applied to z after it has undergone a transformation. When the output is required the com...
17bd483cbb80381edb5dbf3306035c5cd423191b
<|skeleton|> class Processing: """A derived class to create a post-processed composition method as described in L + R section 6.2.3, pp. 148. The idea here is that a composition method is applied to z after it has undergone a transformation. When the output is required the composition method is then applied to the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Processing: """A derived class to create a post-processed composition method as described in L + R section 6.2.3, pp. 148. The idea here is that a composition method is applied to z after it has undergone a transformation. When the output is required the composition method is then applied to the results. This...
the_stack_v2_python_sparse
Steppers/scovel.py
Rhys314/Simulating_Hamiltonian_Dynamics
train
0
8c11a5fda007282b39b69846cd6acaaec9141609
[ "self.nmap_services_file = 'nemo/common/utils/nmap-services'\nself.port_service = {}\nself.custom_service_file = 'nemo/common/utils/custom-services.txt'\nself.custom_port_service = {}\nself.__load_services()", "try:\n with open(self.nmap_services_file) as f:\n for line in f:\n if line.startsw...
<|body_start_0|> self.nmap_services_file = 'nemo/common/utils/nmap-services' self.port_service = {} self.custom_service_file = 'nemo/common/utils/custom-services.txt' self.custom_port_service = {} self.__load_services() <|end_body_0|> <|body_start_1|> try: wi...
解析端口的Service名称 包括通用定义和自定义
ParsePortService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParsePortService: """解析端口的Service名称 包括通用定义和自定义""" def __init__(self): """默认参数""" <|body_0|> def __load_services(self): """读取映射关系:nmap-services""" <|body_1|> def get_service(self, port, port_type='tcp'): """根据端口号查找Service名称""" <|body_2...
stack_v2_sparse_classes_36k_train_025414
2,419
no_license
[ { "docstring": "默认参数", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "读取映射关系:nmap-services", "name": "__load_services", "signature": "def __load_services(self)" }, { "docstring": "根据端口号查找Service名称", "name": "get_service", "signature": "def get_se...
3
stack_v2_sparse_classes_30k_train_009618
Implement the Python class `ParsePortService` described below. Class description: 解析端口的Service名称 包括通用定义和自定义 Method signatures and docstrings: - def __init__(self): 默认参数 - def __load_services(self): 读取映射关系:nmap-services - def get_service(self, port, port_type='tcp'): 根据端口号查找Service名称
Implement the Python class `ParsePortService` described below. Class description: 解析端口的Service名称 包括通用定义和自定义 Method signatures and docstrings: - def __init__(self): 默认参数 - def __load_services(self): 读取映射关系:nmap-services - def get_service(self, port, port_type='tcp'): 根据端口号查找Service名称 <|skeleton|> class ParsePortServi...
ac9b63c60a64677d4d070afe069af04be591dfcc
<|skeleton|> class ParsePortService: """解析端口的Service名称 包括通用定义和自定义""" def __init__(self): """默认参数""" <|body_0|> def __load_services(self): """读取映射关系:nmap-services""" <|body_1|> def get_service(self, port, port_type='tcp'): """根据端口号查找Service名称""" <|body_2...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParsePortService: """解析端口的Service名称 包括通用定义和自定义""" def __init__(self): """默认参数""" self.nmap_services_file = 'nemo/common/utils/nmap-services' self.port_service = {} self.custom_service_file = 'nemo/common/utils/custom-services.txt' self.custom_port_service = {} ...
the_stack_v2_python_sparse
nemo/common/utils/parseservice.py
xiaolushuo/nemo
train
0
d3190b2172dbb8b8071bf720cd25e81b48e2ef57
[ "self.loggit = logging.getLogger('curator.validators.SchemaCheck')\nself.loggit.debug('Schema: %s', schema)\nself.loggit.debug('\"%s\" config: %s', test_what, config)\nself.config = config\nself.schema = schema\nself.test_what = test_what\nself.location = location\nself.badvalue = None\nself.error = None", "def g...
<|body_start_0|> self.loggit = logging.getLogger('curator.validators.SchemaCheck') self.loggit.debug('Schema: %s', schema) self.loggit.debug('"%s" config: %s', test_what, config) self.config = config self.schema = schema self.test_what = test_what self.location = ...
SchemaCheck
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchemaCheck: def __init__(self, config, schema, test_what, location): """Validate ``config`` with the provided :py:class:`~.voluptuous.schema_builder.Schema` from ``schema``. ``test_what`` and ``location`` are for reporting the results, in case of failure. If validation is successful, :p...
stack_v2_sparse_classes_36k_train_025415
3,571
permissive
[ { "docstring": "Validate ``config`` with the provided :py:class:`~.voluptuous.schema_builder.Schema` from ``schema``. ``test_what`` and ``location`` are for reporting the results, in case of failure. If validation is successful, :py:meth:`result` returns ``config`` a valid :py:class:`~.voluptuous.schema_builder...
3
stack_v2_sparse_classes_30k_train_015831
Implement the Python class `SchemaCheck` described below. Class description: Implement the SchemaCheck class. Method signatures and docstrings: - def __init__(self, config, schema, test_what, location): Validate ``config`` with the provided :py:class:`~.voluptuous.schema_builder.Schema` from ``schema``. ``test_what``...
Implement the Python class `SchemaCheck` described below. Class description: Implement the SchemaCheck class. Method signatures and docstrings: - def __init__(self, config, schema, test_what, location): Validate ``config`` with the provided :py:class:`~.voluptuous.schema_builder.Schema` from ``schema``. ``test_what``...
b41743a061ad790820affe7acee5f71abe819357
<|skeleton|> class SchemaCheck: def __init__(self, config, schema, test_what, location): """Validate ``config`` with the provided :py:class:`~.voluptuous.schema_builder.Schema` from ``schema``. ``test_what`` and ``location`` are for reporting the results, in case of failure. If validation is successful, :p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SchemaCheck: def __init__(self, config, schema, test_what, location): """Validate ``config`` with the provided :py:class:`~.voluptuous.schema_builder.Schema` from ``schema``. ``test_what`` and ``location`` are for reporting the results, in case of failure. If validation is successful, :py:meth:`result...
the_stack_v2_python_sparse
curator/validators/schemacheck.py
volatilemolotov/curator
train
0
c9c6a74bf47b9be9792fe8b207a94906f08e48a5
[ "self._attr_unique_id = hashlib.sha256(user.name.encode('utf-8')).hexdigest()\nself._attr_name = user.name\nself._user = user", "self._attr_entity_picture = self._user.get_image()\nif (now_playing := self._user.get_now_playing()):\n self._attr_native_value = format_track(now_playing)\nelse:\n self._attr_nat...
<|body_start_0|> self._attr_unique_id = hashlib.sha256(user.name.encode('utf-8')).hexdigest() self._attr_name = user.name self._user = user <|end_body_0|> <|body_start_1|> self._attr_entity_picture = self._user.get_image() if (now_playing := self._user.get_now_playing()): ...
A class for the Last.fm account.
LastFmSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LastFmSensor: """A class for the Last.fm account.""" def __init__(self, user: User, lastfm_api: LastFMNetwork) -> None: """Initialize the sensor.""" <|body_0|> def update(self) -> None: """Update device state.""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_025416
2,863
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, user: User, lastfm_api: LastFMNetwork) -> None" }, { "docstring": "Update device state.", "name": "update", "signature": "def update(self) -> None" } ]
2
stack_v2_sparse_classes_30k_train_009803
Implement the Python class `LastFmSensor` described below. Class description: A class for the Last.fm account. Method signatures and docstrings: - def __init__(self, user: User, lastfm_api: LastFMNetwork) -> None: Initialize the sensor. - def update(self) -> None: Update device state.
Implement the Python class `LastFmSensor` described below. Class description: A class for the Last.fm account. Method signatures and docstrings: - def __init__(self, user: User, lastfm_api: LastFMNetwork) -> None: Initialize the sensor. - def update(self) -> None: Update device state. <|skeleton|> class LastFmSensor...
2e65b77b2b5c17919939481f327963abdfdc53f0
<|skeleton|> class LastFmSensor: """A class for the Last.fm account.""" def __init__(self, user: User, lastfm_api: LastFMNetwork) -> None: """Initialize the sensor.""" <|body_0|> def update(self) -> None: """Update device state.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LastFmSensor: """A class for the Last.fm account.""" def __init__(self, user: User, lastfm_api: LastFMNetwork) -> None: """Initialize the sensor.""" self._attr_unique_id = hashlib.sha256(user.name.encode('utf-8')).hexdigest() self._attr_name = user.name self._user = user ...
the_stack_v2_python_sparse
homeassistant/components/lastfm/sensor.py
konnected-io/home-assistant
train
24
11b1b53046b8dcd84dd96e7f40e99557de9100d5
[ "for mapping in CmsError.__dict__.items():\n if mapping[1] == code:\n return mapping[0]\nreturn None", "for mapping in CmsError.__dict__.items():\n if mapping[0] == name:\n return mapping[1]\nreturn None" ]
<|body_start_0|> for mapping in CmsError.__dict__.items(): if mapping[1] == code: return mapping[0] return None <|end_body_0|> <|body_start_1|> for mapping in CmsError.__dict__.items(): if mapping[0] == name: return mapping[1] retu...
CMS errors
CmsError
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CmsError: """CMS errors""" def getName(code): """Gets the CMS error name from its code :param code: The code to map :return None: Failed to map code :return String: The name of the code""" <|body_0|> def getCode(name): """Gets the CMS error code from its name :pa...
stack_v2_sparse_classes_36k_train_025417
6,596
no_license
[ { "docstring": "Gets the CMS error name from its code :param code: The code to map :return None: Failed to map code :return String: The name of the code", "name": "getName", "signature": "def getName(code)" }, { "docstring": "Gets the CMS error code from its name :param name; The name to map :re...
2
stack_v2_sparse_classes_30k_train_009504
Implement the Python class `CmsError` described below. Class description: CMS errors Method signatures and docstrings: - def getName(code): Gets the CMS error name from its code :param code: The code to map :return None: Failed to map code :return String: The name of the code - def getCode(name): Gets the CMS error c...
Implement the Python class `CmsError` described below. Class description: CMS errors Method signatures and docstrings: - def getName(code): Gets the CMS error name from its code :param code: The code to map :return None: Failed to map code :return String: The name of the code - def getCode(name): Gets the CMS error c...
1c87d086f15a7810b839368fdb82c0de264a7272
<|skeleton|> class CmsError: """CMS errors""" def getName(code): """Gets the CMS error name from its code :param code: The code to map :return None: Failed to map code :return String: The name of the code""" <|body_0|> def getCode(name): """Gets the CMS error code from its name :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CmsError: """CMS errors""" def getName(code): """Gets the CMS error name from its code :param code: The code to map :return None: Failed to map code :return String: The name of the code""" for mapping in CmsError.__dict__.items(): if mapping[1] == code: return ...
the_stack_v2_python_sparse
nimbelink/cell/at/cmsError.py
NimbeLink/pynl-cell
train
0
27bdc6035c31eb562e1a96c5877f647de99af71a
[ "if root == None:\n return False\nreturn bool(self.helper(root, sum, 0))", "pathSum += root.val\nif root.left:\n left = self.helper(root.left, target, pathSum)\n if left:\n return True\nif root.right:\n right = self.helper(root.right, target, pathSum)\n if right:\n return True\nif not...
<|body_start_0|> if root == None: return False return bool(self.helper(root, sum, 0)) <|end_body_0|> <|body_start_1|> pathSum += root.val if root.left: left = self.helper(root.left, target, pathSum) if left: return True if root...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :rtype: int""" <|body_0|> def helper(self, root, target, pathSum): """:type root: TreeNode :type depth: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root == Non...
stack_v2_sparse_classes_36k_train_025418
1,704
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "hasPathSum", "signature": "def hasPathSum(self, root, sum)" }, { "docstring": ":type root: TreeNode :type depth: int :rtype: int", "name": "helper", "signature": "def helper(self, root, target, pathSum)" } ]
2
stack_v2_sparse_classes_30k_train_003862
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root, sum): :type root: TreeNode :rtype: int - def helper(self, root, target, pathSum): :type root: TreeNode :type depth: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root, sum): :type root: TreeNode :rtype: int - def helper(self, root, target, pathSum): :type root: TreeNode :type depth: int :rtype: int <|skeleton|> class...
61933e7c0b8d8ffef9bd9a4af4fddfdb77568b62
<|skeleton|> class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :rtype: int""" <|body_0|> def helper(self, root, target, pathSum): """:type root: TreeNode :type depth: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :rtype: int""" if root == None: return False return bool(self.helper(root, sum, 0)) def helper(self, root, target, pathSum): """:type root: TreeNode :type depth: int :rtype: int""" pathS...
the_stack_v2_python_sparse
112-Path-Sum.py
OhMesch/Algorithm-Problems
train
0
f4b8afd0437e6be91dc002bde22a9c0dc98fdf69
[ "mask1 = 1 << 7\nmask2 = 1 << 6\nn_byte = 0\nfor num in data:\n mask = 1 << 7\n if n_byte == 0:\n while mask & num:\n n_byte += 1\n mask >>= 1\n if n_byte == 0:\n continue\n if n_byte > 4 or n_byte == 1:\n return False\n n_byte -= 1\n ...
<|body_start_0|> mask1 = 1 << 7 mask2 = 1 << 6 n_byte = 0 for num in data: mask = 1 << 7 if n_byte == 0: while mask & num: n_byte += 1 mask >>= 1 if n_byte == 0: continue ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def validUtf8(self, data): """:type data: List[int] :rtype: bool""" <|body_0|> def validUtf8_1(self, data): """:type data: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> mask1 = 1 << 7 mask2 = 1 << 6 ...
stack_v2_sparse_classes_36k_train_025419
1,579
no_license
[ { "docstring": ":type data: List[int] :rtype: bool", "name": "validUtf8", "signature": "def validUtf8(self, data)" }, { "docstring": ":type data: List[int] :rtype: bool", "name": "validUtf8_1", "signature": "def validUtf8_1(self, data)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validUtf8(self, data): :type data: List[int] :rtype: bool - def validUtf8_1(self, data): :type data: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validUtf8(self, data): :type data: List[int] :rtype: bool - def validUtf8_1(self, data): :type data: List[int] :rtype: bool <|skeleton|> class Solution: def validUtf8(s...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def validUtf8(self, data): """:type data: List[int] :rtype: bool""" <|body_0|> def validUtf8_1(self, data): """:type data: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def validUtf8(self, data): """:type data: List[int] :rtype: bool""" mask1 = 1 << 7 mask2 = 1 << 6 n_byte = 0 for num in data: mask = 1 << 7 if n_byte == 0: while mask & num: n_byte += 1 ...
the_stack_v2_python_sparse
python/leetcode/393_UTF-8_Validation.py
bobcaoge/my-code
train
0
d78a13d3944c2813a8128d2e495ddaedff049ecd
[ "self.x_obst = copy.deepcopy(x)\nself.gamma = copy.deepcopy(gamma)\nself.beta = copy.deepcopy(beta)\nself.n_dim = np.size(self.x_obst)", "c = np.cos(theta)\ns = np.sin(theta)\nif self.n_dim == 2:\n R = np.array([[c, -s], [s, c]])\nelif self.n_dim == 3:\n if np.shape(u)[0] != self.n_dim:\n raise Value...
<|body_start_0|> self.x_obst = copy.deepcopy(x) self.gamma = copy.deepcopy(gamma) self.beta = copy.deepcopy(beta) self.n_dim = np.size(self.x_obst) <|end_body_0|> <|body_start_1|> c = np.cos(theta) s = np.sin(theta) if self.n_dim == 2: R = np.array([[...
Implementation of an obstacle for Dynamic Movement Primitives as described in [1] Hoffmann, H., Pastor, P., Park, D. H., & Schaal, S. (2009, May). Biologically-inspired dynamical systems for movement generation: automatic real-time goal adaptation and obstacle avoidance. In Robotics and Automation, 2009. ICRA'09. IEEE ...
Obstacle_Steering
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Obstacle_Steering: """Implementation of an obstacle for Dynamic Movement Primitives as described in [1] Hoffmann, H., Pastor, P., Park, D. H., & Schaal, S. (2009, May). Biologically-inspired dynamical systems for movement generation: automatic real-time goal adaptation and obstacle avoidance. In ...
stack_v2_sparse_classes_36k_train_025420
6,106
no_license
[ { "docstring": "Initialize the obstacle object", "name": "__init__", "signature": "def __init__(self, x=np.zeros(3), gamma=20.0, beta=10.0 / np.pi, **kwargs)" }, { "docstring": "Compute the rotation matrix of a rotation of theta around the direction given by u (if self.n_dim = 3)", "name": "...
3
stack_v2_sparse_classes_30k_train_017665
Implement the Python class `Obstacle_Steering` described below. Class description: Implementation of an obstacle for Dynamic Movement Primitives as described in [1] Hoffmann, H., Pastor, P., Park, D. H., & Schaal, S. (2009, May). Biologically-inspired dynamical systems for movement generation: automatic real-time goal...
Implement the Python class `Obstacle_Steering` described below. Class description: Implementation of an obstacle for Dynamic Movement Primitives as described in [1] Hoffmann, H., Pastor, P., Park, D. H., & Schaal, S. (2009, May). Biologically-inspired dynamical systems for movement generation: automatic real-time goal...
41e353f91f78613cf7bea2ef2369f7589a091a01
<|skeleton|> class Obstacle_Steering: """Implementation of an obstacle for Dynamic Movement Primitives as described in [1] Hoffmann, H., Pastor, P., Park, D. H., & Schaal, S. (2009, May). Biologically-inspired dynamical systems for movement generation: automatic real-time goal adaptation and obstacle avoidance. In ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Obstacle_Steering: """Implementation of an obstacle for Dynamic Movement Primitives as described in [1] Hoffmann, H., Pastor, P., Park, D. H., & Schaal, S. (2009, May). Biologically-inspired dynamical systems for movement generation: automatic real-time goal adaptation and obstacle avoidance. In Robotics and ...
the_stack_v2_python_sparse
dmp/point_obstacle.py
mginesi/dmp_vol_obst
train
23
3b14377946dd19af220f60f69e8419571f787ecd
[ "def tuplify(root):\n return root and (root.val, [tuplify(c) for c in root.children])\nreturn json.dumps(tuplify(root))", "def detuplify(t):\n if t:\n root = Node(t[0], [])\n for c in t[1]:\n root.children.append(detuplify(c))\n return root\n return None\nreturn detuplify(...
<|body_start_0|> def tuplify(root): return root and (root.val, [tuplify(c) for c in root.children]) return json.dumps(tuplify(root)) <|end_body_0|> <|body_start_1|> def detuplify(t): if t: root = Node(t[0], []) for c in t[1]: ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_025421
748
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root: 'Node') -> str" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def des...
2
stack_v2_sparse_classes_30k_train_008184
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre...
4b1c76729576684331a8f1cdd7ced8b757c20fea
<|skeleton|> class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" def tuplify(root): return root and (root.val, [tuplify(c) for c in root.children]) return json.dumps(tuplify(root)) def deserialize(self, data: str) -...
the_stack_v2_python_sparse
0428_SerializeandDeserializeN-aryTree.py
ysonggit/leetcode_python
train
1
5ab9b49605001bc229f7829d858a52fe43fb2d7a
[ "if isinstance(transition, list):\n dbg = [cls(function=function, transition=t, target=target) for t in transition]\n return meta.CrestList.fromlist(dbg)\nelse:\n return super().__new__(cls)", "super().__init__(name, parent)\nself.function = function\nself.transition = transition\nself.target = target" ]
<|body_start_0|> if isinstance(transition, list): dbg = [cls(function=function, transition=t, target=target) for t in transition] return meta.CrestList.fromlist(dbg) else: return super().__new__(cls) <|end_body_0|> <|body_start_1|> super().__init__(name, pare...
An Action whose function is executed when a certain automaton transition is triggered. .. note:: Pro-tip: To avoid repetition, you can initialise it with a list of transitions (or str-names). This will automatically create an action for each transition. Be careful, because the action's name will be autoamtically number...
Action
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Action: """An Action whose function is executed when a certain automaton transition is triggered. .. note:: Pro-tip: To avoid repetition, you can initialise it with a list of transitions (or str-names). This will automatically create an action for each transition. Be careful, because the action's...
stack_v2_sparse_classes_36k_train_025422
8,941
permissive
[ { "docstring": "this is so we can define the same update for multiple states", "name": "__new__", "signature": "def __new__(cls, transition, target, function, name='', parent=None)" }, { "docstring": "Parameters ---------- source: Transition or str The transition at which the update should be tr...
2
stack_v2_sparse_classes_30k_val_000562
Implement the Python class `Action` described below. Class description: An Action whose function is executed when a certain automaton transition is triggered. .. note:: Pro-tip: To avoid repetition, you can initialise it with a list of transitions (or str-names). This will automatically create an action for each trans...
Implement the Python class `Action` described below. Class description: An Action whose function is executed when a certain automaton transition is triggered. .. note:: Pro-tip: To avoid repetition, you can initialise it with a list of transitions (or str-names). This will automatically create an action for each trans...
7fd97c50b0c6c923e1c477105bed4f0ea032bb99
<|skeleton|> class Action: """An Action whose function is executed when a certain automaton transition is triggered. .. note:: Pro-tip: To avoid repetition, you can initialise it with a list of transitions (or str-names). This will automatically create an action for each transition. Be careful, because the action's...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Action: """An Action whose function is executed when a certain automaton transition is triggered. .. note:: Pro-tip: To avoid repetition, you can initialise it with a list of transitions (or str-names). This will automatically create an action for each transition. Be careful, because the action's name will be...
the_stack_v2_python_sparse
crestdsl/model/model.py
crestdsl/CREST
train
16
3c6b9405778e5c3d928822ad42ab3a0378c73b2d
[ "if self.context.get('request').user.full_name != '':\n raise serializers.ValidationError('身份已被认证过!')\nidentify_instance_face = ocr.apply_async(args=(attrs.get('face'), 'face'))\nidentify_instance_back = ocr.apply_async(args=(attrs.get('back'), 'face'))\nis_success = identify_instance_face.get() and identify_ins...
<|body_start_0|> if self.context.get('request').user.full_name != '': raise serializers.ValidationError('身份已被认证过!') identify_instance_face = ocr.apply_async(args=(attrs.get('face'), 'face')) identify_instance_back = ocr.apply_async(args=(attrs.get('back'), 'face')) is_success...
身份认证序列化器
VerifyIdCardSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VerifyIdCardSerializer: """身份认证序列化器""" def validate(self, attrs): """OCR识别身份正反 验证阶段验证身份信息是否正确或是否已被验证""" <|body_0|> def update(self, instance, validated_data): """更新身份信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> if self.context.get('request...
stack_v2_sparse_classes_36k_train_025423
5,759
permissive
[ { "docstring": "OCR识别身份正反 验证阶段验证身份信息是否正确或是否已被验证", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "更新身份信息", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
null
Implement the Python class `VerifyIdCardSerializer` described below. Class description: 身份认证序列化器 Method signatures and docstrings: - def validate(self, attrs): OCR识别身份正反 验证阶段验证身份信息是否正确或是否已被验证 - def update(self, instance, validated_data): 更新身份信息
Implement the Python class `VerifyIdCardSerializer` described below. Class description: 身份认证序列化器 Method signatures and docstrings: - def validate(self, attrs): OCR识别身份正反 验证阶段验证身份信息是否正确或是否已被验证 - def update(self, instance, validated_data): 更新身份信息 <|skeleton|> class VerifyIdCardSerializer: """身份认证序列化器""" def v...
13cb59130d15e782f78bc5148409bef0f1c516e0
<|skeleton|> class VerifyIdCardSerializer: """身份认证序列化器""" def validate(self, attrs): """OCR识别身份正反 验证阶段验证身份信息是否正确或是否已被验证""" <|body_0|> def update(self, instance, validated_data): """更新身份信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VerifyIdCardSerializer: """身份认证序列化器""" def validate(self, attrs): """OCR识别身份正反 验证阶段验证身份信息是否正确或是否已被验证""" if self.context.get('request').user.full_name != '': raise serializers.ValidationError('身份已被认证过!') identify_instance_face = ocr.apply_async(args=(attrs.get('face'), ...
the_stack_v2_python_sparse
user_app/serializers/individual_info_serializers.py
lmyfzx/Django-Mall
train
0
bd55fc42feba492079bc822c9fd158e63c24c03d
[ "if db_field.name == 'groups':\n kwargs['queryset'] = Group.objects.exclude(Q(name__startswith='preprint_') | Q(name__startswith='node_') | Q(name__startswith='osfgroup_') | Q(name__startswith='collections_'))\nreturn super(OSFUserAdmin, self).formfield_for_manytomany(db_field, request, **kwargs)", "groups_to_...
<|body_start_0|> if db_field.name == 'groups': kwargs['queryset'] = Group.objects.exclude(Q(name__startswith='preprint_') | Q(name__startswith='node_') | Q(name__startswith='osfgroup_') | Q(name__startswith='collections_')) return super(OSFUserAdmin, self).formfield_for_manytomany(db_field, ...
OSFUserAdmin
[ "Apache-2.0", "LGPL-2.0-or-later", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "MIT", "AGPL-3.0-only", "LicenseRef-scancode-unknown-license-reference", "MPL-1.1", "CPAL-1.0", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OSFUserAdmin: def formfield_for_manytomany(self, db_field, request, **kwargs): """Restricts preprint/node/osfgroup django groups from showing up in the user's groups list in the admin app""" <|body_0|> def save_related(self, request, form, formsets, change): """Since...
stack_v2_sparse_classes_36k_train_025424
2,154
permissive
[ { "docstring": "Restricts preprint/node/osfgroup django groups from showing up in the user's groups list in the admin app", "name": "formfield_for_manytomany", "signature": "def formfield_for_manytomany(self, db_field, request, **kwargs)" }, { "docstring": "Since m2m fields overridden with new f...
2
stack_v2_sparse_classes_30k_train_003710
Implement the Python class `OSFUserAdmin` described below. Class description: Implement the OSFUserAdmin class. Method signatures and docstrings: - def formfield_for_manytomany(self, db_field, request, **kwargs): Restricts preprint/node/osfgroup django groups from showing up in the user's groups list in the admin app...
Implement the Python class `OSFUserAdmin` described below. Class description: Implement the OSFUserAdmin class. Method signatures and docstrings: - def formfield_for_manytomany(self, db_field, request, **kwargs): Restricts preprint/node/osfgroup django groups from showing up in the user's groups list in the admin app...
5d632eb6d4566d7d31cd8d6b40d1bc93c60ddf5e
<|skeleton|> class OSFUserAdmin: def formfield_for_manytomany(self, db_field, request, **kwargs): """Restricts preprint/node/osfgroup django groups from showing up in the user's groups list in the admin app""" <|body_0|> def save_related(self, request, form, formsets, change): """Since...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OSFUserAdmin: def formfield_for_manytomany(self, db_field, request, **kwargs): """Restricts preprint/node/osfgroup django groups from showing up in the user's groups list in the admin app""" if db_field.name == 'groups': kwargs['queryset'] = Group.objects.exclude(Q(name__startswith...
the_stack_v2_python_sparse
osf/admin.py
RCOSDP/RDM-osf.io
train
12
eebdc26acca3c256d2e89eda60bb90bbf6538125
[ "super(AllCurImageFC, self).__init__()\nargs.wrap_model = False\nself.args = args\nself.dropout = nn.Dropout(p=args.dropout)\nself.r_y_fc = nn.Linear(args.hidden_dim * 4, 2)\nself.l_y_fc = nn.Linear(args.hidden_dim * 4, 2)\nself.y_fc = nn.Linear(args.hidden_dim * 4, 2)", "x = self.dropout(x)\nB, N, H = x.size()\n...
<|body_start_0|> super(AllCurImageFC, self).__init__() args.wrap_model = False self.args = args self.dropout = nn.Dropout(p=args.dropout) self.r_y_fc = nn.Linear(args.hidden_dim * 4, 2) self.l_y_fc = nn.Linear(args.hidden_dim * 4, 2) self.y_fc = nn.Linear(args.hid...
AllCurImageFC
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllCurImageFC: def __init__(self, args): """Given some a patch model, add add some FC layers and a shortcut to make whole image prediction""" <|body_0|> def forward(self, x): """param x: a batch of image tensors, in the order of: [Cu L CC, Cu L MLO, Cu R CC, Cu R MLO...
stack_v2_sparse_classes_36k_train_025425
5,214
permissive
[ { "docstring": "Given some a patch model, add add some FC layers and a shortcut to make whole image prediction", "name": "__init__", "signature": "def __init__(self, args)" }, { "docstring": "param x: a batch of image tensors, in the order of: [Cu L CC, Cu L MLO, Cu R CC, Cu R MLO Pr L CC, Pr L ...
2
stack_v2_sparse_classes_30k_train_012231
Implement the Python class `AllCurImageFC` described below. Class description: Implement the AllCurImageFC class. Method signatures and docstrings: - def __init__(self, args): Given some a patch model, add add some FC layers and a shortcut to make whole image prediction - def forward(self, x): param x: a batch of ima...
Implement the Python class `AllCurImageFC` described below. Class description: Implement the AllCurImageFC class. Method signatures and docstrings: - def __init__(self, args): Given some a patch model, add add some FC layers and a shortcut to make whole image prediction - def forward(self, x): param x: a batch of ima...
12bace8fd6ce9c5bb129fd0d30a46a00a2f7b054
<|skeleton|> class AllCurImageFC: def __init__(self, args): """Given some a patch model, add add some FC layers and a shortcut to make whole image prediction""" <|body_0|> def forward(self, x): """param x: a batch of image tensors, in the order of: [Cu L CC, Cu L MLO, Cu R CC, Cu R MLO...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AllCurImageFC: def __init__(self, args): """Given some a patch model, add add some FC layers and a shortcut to make whole image prediction""" super(AllCurImageFC, self).__init__() args.wrap_model = False self.args = args self.dropout = nn.Dropout(p=args.dropout) ...
the_stack_v2_python_sparse
onconet/models/aggregate_hiddens.py
yala/Mirai
train
66
ca54b3f61cd29e0ebf226207120f4a6b4384d6c6
[ "self.temperature = temperature\nself.scale = scale\nself.normalize = normalize\nsuper(PositionalEncodingSine, self).__init__(input_channels, **kwargs)", "if self.normalize:\n bin_scale = position_mat.max() - position_mat.min()\n if self.input_channels > 2:\n cords = position_mat[..., :2] / bin_scale...
<|body_start_0|> self.temperature = temperature self.scale = scale self.normalize = normalize super(PositionalEncodingSine, self).__init__(input_channels, **kwargs) <|end_body_0|> <|body_start_1|> if self.normalize: bin_scale = position_mat.max() - position_mat.min()...
PositionalEncodingSine
[ "Apache-2.0", "BSD-2-Clause-Views", "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionalEncodingSine: def __init__(self, input_channels: int, temperature: float=1000, scale: float=1.0, normalize=False, **kwargs): """Generate sine positional embedding. See `BasePositionalEncoding` for details. Args: input_channels (int): the dimension of input. temperature (float, ...
stack_v2_sparse_classes_36k_train_025426
12,251
permissive
[ { "docstring": "Generate sine positional embedding. See `BasePositionalEncoding` for details. Args: input_channels (int): the dimension of input. temperature (float, optional): Defaults to 1000. scale (float, optional): Defaults to 1.0. normalize (bool, optional): Defaults to False.", "name": "__init__", ...
2
null
Implement the Python class `PositionalEncodingSine` described below. Class description: Implement the PositionalEncodingSine class. Method signatures and docstrings: - def __init__(self, input_channels: int, temperature: float=1000, scale: float=1.0, normalize=False, **kwargs): Generate sine positional embedding. See...
Implement the Python class `PositionalEncodingSine` described below. Class description: Implement the PositionalEncodingSine class. Method signatures and docstrings: - def __init__(self, input_channels: int, temperature: float=1000, scale: float=1.0, normalize=False, **kwargs): Generate sine positional embedding. See...
3652b18c7ce68122dae7a32670624727d50e0914
<|skeleton|> class PositionalEncodingSine: def __init__(self, input_channels: int, temperature: float=1000, scale: float=1.0, normalize=False, **kwargs): """Generate sine positional embedding. See `BasePositionalEncoding` for details. Args: input_channels (int): the dimension of input. temperature (float, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PositionalEncodingSine: def __init__(self, input_channels: int, temperature: float=1000, scale: float=1.0, normalize=False, **kwargs): """Generate sine positional embedding. See `BasePositionalEncoding` for details. Args: input_channels (int): the dimension of input. temperature (float, optional): Def...
the_stack_v2_python_sparse
mmdet/models/utils/bvr_transformer/positional_encoding.py
shinya7y/UniverseNet
train
407
e210760c63c85cafe55b8ac84dad80440a0a6780
[ "super(VAEReconstructionLoss, self).__init__()\nself.reconstruction_function = torch.nn.MSELoss()\nself.model = model", "recon_x = x_hat\ngeneration_loss = self.reconstruction_function(recon_x, x)\nif self.model.embedding_module is None:\n mu, logvar = self.model.get_posteriors(x)\n KLD = -0.5 * torch.sum(1...
<|body_start_0|> super(VAEReconstructionLoss, self).__init__() self.reconstruction_function = torch.nn.MSELoss() self.model = model <|end_body_0|> <|body_start_1|> recon_x = x_hat generation_loss = self.reconstruction_function(recon_x, x) if self.model.embedding_module i...
VAEReconstructionLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VAEReconstructionLoss: def __init__(self, model): """Calculate the sum of the Kullback–Leibler divergence loss and the loss of any given function Parameters ---------- model : dies.autoencoder model of the autoencoder for which the loss is to be calculated""" <|body_0|> def ...
stack_v2_sparse_classes_36k_train_025427
4,402
no_license
[ { "docstring": "Calculate the sum of the Kullback–Leibler divergence loss and the loss of any given function Parameters ---------- model : dies.autoencoder model of the autoencoder for which the loss is to be calculated", "name": "__init__", "signature": "def __init__(self, model)" }, { "docstri...
2
stack_v2_sparse_classes_30k_train_012422
Implement the Python class `VAEReconstructionLoss` described below. Class description: Implement the VAEReconstructionLoss class. Method signatures and docstrings: - def __init__(self, model): Calculate the sum of the Kullback–Leibler divergence loss and the loss of any given function Parameters ---------- model : di...
Implement the Python class `VAEReconstructionLoss` described below. Class description: Implement the VAEReconstructionLoss class. Method signatures and docstrings: - def __init__(self, model): Calculate the sum of the Kullback–Leibler divergence loss and the loss of any given function Parameters ---------- model : di...
b686e6b28a263722a642ddca21eeb71f7c810ad3
<|skeleton|> class VAEReconstructionLoss: def __init__(self, model): """Calculate the sum of the Kullback–Leibler divergence loss and the loss of any given function Parameters ---------- model : dies.autoencoder model of the autoencoder for which the loss is to be calculated""" <|body_0|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VAEReconstructionLoss: def __init__(self, model): """Calculate the sum of the Kullback–Leibler divergence loss and the loss of any given function Parameters ---------- model : dies.autoencoder model of the autoencoder for which the loss is to be calculated""" super(VAEReconstructionLoss, self)...
the_stack_v2_python_sparse
dies/dies/losses.py
scribbler00/task-TCN
train
3
e9bb0b2d574bc55c41115a01ecd67313b1cd8fc0
[ "with open(self.filename) if not self.gzip else gzip.open(self.filename) as lease_file:\n lease_data = lease_file.read()\n if self.gzip:\n lease_data = lease_data.decode('utf-8')\n for match in self.regex_leaseblock.finditer(lease_data):\n block = match.groupdict()\n properties, option...
<|body_start_0|> with open(self.filename) if not self.gzip else gzip.open(self.filename) as lease_file: lease_data = lease_file.read() if self.gzip: lease_data = lease_data.decode('utf-8') for match in self.regex_leaseblock.finditer(lease_data): ...
IscDhcpLeasesGen
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IscDhcpLeasesGen: def get_iter(self, include_backups=False): """Parse the lease file and return a generator of Lease instances.""" <|body_0|> def _get_current_iter(self): """Parse the lease file and return a dict of active and valid Lease instances. The key for this ...
stack_v2_sparse_classes_36k_train_025428
5,648
no_license
[ { "docstring": "Parse the lease file and return a generator of Lease instances.", "name": "get_iter", "signature": "def get_iter(self, include_backups=False)" }, { "docstring": "Parse the lease file and return a dict of active and valid Lease instances. The key for this dict is the ethernet addr...
2
null
Implement the Python class `IscDhcpLeasesGen` described below. Class description: Implement the IscDhcpLeasesGen class. Method signatures and docstrings: - def get_iter(self, include_backups=False): Parse the lease file and return a generator of Lease instances. - def _get_current_iter(self): Parse the lease file and...
Implement the Python class `IscDhcpLeasesGen` described below. Class description: Implement the IscDhcpLeasesGen class. Method signatures and docstrings: - def get_iter(self, include_backups=False): Parse the lease file and return a generator of Lease instances. - def _get_current_iter(self): Parse the lease file and...
10379e974d969be94a40317e8121436f03f19ca2
<|skeleton|> class IscDhcpLeasesGen: def get_iter(self, include_backups=False): """Parse the lease file and return a generator of Lease instances.""" <|body_0|> def _get_current_iter(self): """Parse the lease file and return a dict of active and valid Lease instances. The key for this ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IscDhcpLeasesGen: def get_iter(self, include_backups=False): """Parse the lease file and return a generator of Lease instances.""" with open(self.filename) if not self.gzip else gzip.open(self.filename) as lease_file: lease_data = lease_file.read() if self.gzip: ...
the_stack_v2_python_sparse
networks/management/commands/load_from_isc_dhcp.py
playmepe/djing2
train
0
218a54e8059e1d513866433510c2d86d07dddc41
[ "self.parameters = parameters\nself.storage = storage\nself._instance = None\nreturn", "if self._instance is None:\n self._instance = Reporter(header=self.parameters.header, filename=self.parameters.filename, storage=self.storage, delimiter=self.parameters.delimiter, missing=self.parameters.missing)\nreturn se...
<|body_start_0|> self.parameters = parameters self.storage = storage self._instance = None return <|end_body_0|> <|body_start_1|> if self._instance is None: self._instance = Reporter(header=self.parameters.header, filename=self.parameters.filename, storage=self.stora...
A Report builder builds an instance of a Reporter
ReportBuilder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReportBuilder: """A Report builder builds an instance of a Reporter""" def __init__(self, parameters, storage): """:param: - `parameters`: parameters needed to build a reporter - `storage`: a file opener""" <|body_0|> def instance(self): """:return: instance of R...
stack_v2_sparse_classes_36k_train_025429
990
permissive
[ { "docstring": ":param: - `parameters`: parameters needed to build a reporter - `storage`: a file opener", "name": "__init__", "signature": "def __init__(self, parameters, storage)" }, { "docstring": ":return: instance of Reporter", "name": "instance", "signature": "def instance(self)" ...
2
stack_v2_sparse_classes_30k_train_013851
Implement the Python class `ReportBuilder` described below. Class description: A Report builder builds an instance of a Reporter Method signatures and docstrings: - def __init__(self, parameters, storage): :param: - `parameters`: parameters needed to build a reporter - `storage`: a file opener - def instance(self): :...
Implement the Python class `ReportBuilder` described below. Class description: A Report builder builds an instance of a Reporter Method signatures and docstrings: - def __init__(self, parameters, storage): :param: - `parameters`: parameters needed to build a reporter - `storage`: a file opener - def instance(self): :...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class ReportBuilder: """A Report builder builds an instance of a Reporter""" def __init__(self, parameters, storage): """:param: - `parameters`: parameters needed to build a reporter - `storage`: a file opener""" <|body_0|> def instance(self): """:return: instance of R...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReportBuilder: """A Report builder builds an instance of a Reporter""" def __init__(self, parameters, storage): """:param: - `parameters`: parameters needed to build a reporter - `storage`: a file opener""" self.parameters = parameters self.storage = storage self._instance...
the_stack_v2_python_sparse
apetools/builders/subbuilders/reportbuilder.py
russell-n/oldape
train
0
6eeb2d6be78771a9465d6d2e7b9be50ccaa4674f
[ "self.num_vulnerabilities = num_vulnerabilities\nself.num_intensity_bins = num_intensity_bins\nself.num_damage_bins = num_damage_bins\nself.vulnerability_sparseness = vulnerability_sparseness\nself.dtypes = OrderedDict([('vulnerability_id', 'i'), ('intensity_bin_index', 'i'), ('damage_bin_index', 'i'), ('prob', 'f'...
<|body_start_0|> self.num_vulnerabilities = num_vulnerabilities self.num_intensity_bins = num_intensity_bins self.num_damage_bins = num_damage_bins self.vulnerability_sparseness = vulnerability_sparseness self.dtypes = OrderedDict([('vulnerability_id', 'i'), ('intensity_bin_index...
Generate random data for Vulnerability dummy model file. This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID. Attributes: generate_data: Generate Vulnerability dummy model file data.
VulnerabilityFile
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VulnerabilityFile: """Generate random data for Vulnerability dummy model file. This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID. Attributes: generate_data: Generate Vulnerability dummy model file data.""" def __init__(self, num_vuln...
stack_v2_sparse_classes_36k_train_025430
39,722
permissive
[ { "docstring": "Initialise VulnerabilityFile class. Args: num_vulnerabilities (int): number of vulnerabilities. num_intensity_bins (int): number of intensity bins. num_damage_bins(int): number of damage bins. vulnerability_sparseness (float): percentage of bins normalised to range [0,1] impacted for a vulnerabi...
2
null
Implement the Python class `VulnerabilityFile` described below. Class description: Generate random data for Vulnerability dummy model file. This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID. Attributes: generate_data: Generate Vulnerability dummy model file da...
Implement the Python class `VulnerabilityFile` described below. Class description: Generate random data for Vulnerability dummy model file. This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID. Attributes: generate_data: Generate Vulnerability dummy model file da...
23e704c335629ccd010969b1090446cfa3f384d5
<|skeleton|> class VulnerabilityFile: """Generate random data for Vulnerability dummy model file. This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID. Attributes: generate_data: Generate Vulnerability dummy model file data.""" def __init__(self, num_vuln...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VulnerabilityFile: """Generate random data for Vulnerability dummy model file. This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID. Attributes: generate_data: Generate Vulnerability dummy model file data.""" def __init__(self, num_vulnerabilities, ...
the_stack_v2_python_sparse
oasislmf/computation/data/dummy_model/generate.py
OasisLMF/OasisLMF
train
122
6c2ca81f10b03dab9a20586a6bca92323d023fb3
[ "self._count = slave_count + 1\nself._coordinator: DataUpdateCoordinator[list[int] | None] | None = None\nself._result: list[int] = []\nsuper().__init__(hub, entry)", "name = self._attr_name if self._attr_name else 'modbus_sensor'\nself._coordinator = DataUpdateCoordinator(hass, _LOGGER, name=name)\nslaves: list[...
<|body_start_0|> self._count = slave_count + 1 self._coordinator: DataUpdateCoordinator[list[int] | None] | None = None self._result: list[int] = [] super().__init__(hub, entry) <|end_body_0|> <|body_start_1|> name = self._attr_name if self._attr_name else 'modbus_sensor' ...
Modbus binary sensor.
ModbusBinarySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModbusBinarySensor: """Modbus binary sensor.""" def __init__(self, hub: ModbusHub, entry: dict[str, Any], slave_count: int) -> None: """Initialize the Modbus binary sensor.""" <|body_0|> async def async_setup_slaves(self, hass: HomeAssistant, slave_count: int, entry: dic...
stack_v2_sparse_classes_36k_train_025431
5,764
permissive
[ { "docstring": "Initialize the Modbus binary sensor.", "name": "__init__", "signature": "def __init__(self, hub: ModbusHub, entry: dict[str, Any], slave_count: int) -> None" }, { "docstring": "Add slaves as needed (1 read for multiple sensors).", "name": "async_setup_slaves", "signature"...
4
stack_v2_sparse_classes_30k_train_011576
Implement the Python class `ModbusBinarySensor` described below. Class description: Modbus binary sensor. Method signatures and docstrings: - def __init__(self, hub: ModbusHub, entry: dict[str, Any], slave_count: int) -> None: Initialize the Modbus binary sensor. - async def async_setup_slaves(self, hass: HomeAssista...
Implement the Python class `ModbusBinarySensor` described below. Class description: Modbus binary sensor. Method signatures and docstrings: - def __init__(self, hub: ModbusHub, entry: dict[str, Any], slave_count: int) -> None: Initialize the Modbus binary sensor. - async def async_setup_slaves(self, hass: HomeAssista...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ModbusBinarySensor: """Modbus binary sensor.""" def __init__(self, hub: ModbusHub, entry: dict[str, Any], slave_count: int) -> None: """Initialize the Modbus binary sensor.""" <|body_0|> async def async_setup_slaves(self, hass: HomeAssistant, slave_count: int, entry: dic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModbusBinarySensor: """Modbus binary sensor.""" def __init__(self, hub: ModbusHub, entry: dict[str, Any], slave_count: int) -> None: """Initialize the Modbus binary sensor.""" self._count = slave_count + 1 self._coordinator: DataUpdateCoordinator[list[int] | None] | None = None ...
the_stack_v2_python_sparse
homeassistant/components/modbus/binary_sensor.py
home-assistant/core
train
35,501
d72d07557f329c79b4d38f1ddf419c1c2e139b74
[ "args = parser.parse_args()\ntry:\n if not all([args['platform_id'], args['vm_uuid']]):\n raise Exception('Parameter error')\n data = control.network_devices.get_network_by_vm_uuid(platform_id=args['platform_id'], vm_uuid=args['vm_uuid'])\nexcept Exception as e:\n return (set_return_val(False, [], s...
<|body_start_0|> args = parser.parse_args() try: if not all([args['platform_id'], args['vm_uuid']]): raise Exception('Parameter error') data = control.network_devices.get_network_by_vm_uuid(platform_id=args['platform_id'], vm_uuid=args['vm_uuid']) except E...
NetWorkManage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetWorkManage: def get(self): """获取vCenter vm_network_device 信息 --- tags: - vCenter network device parameters: - in: query name: platform_id type: integer required: true - in: query name: vm_uuid type: string required: true responses: 200: description: vCenter network device 信息 schema: p...
stack_v2_sparse_classes_36k_train_025432
7,551
no_license
[ { "docstring": "获取vCenter vm_network_device 信息 --- tags: - vCenter network device parameters: - in: query name: platform_id type: integer required: true - in: query name: vm_uuid type: string required: true responses: 200: description: vCenter network device 信息 schema: properties: ok: type: boolean description:...
3
stack_v2_sparse_classes_30k_train_016832
Implement the Python class `NetWorkManage` described below. Class description: Implement the NetWorkManage class. Method signatures and docstrings: - def get(self): 获取vCenter vm_network_device 信息 --- tags: - vCenter network device parameters: - in: query name: platform_id type: integer required: true - in: query name...
Implement the Python class `NetWorkManage` described below. Class description: Implement the NetWorkManage class. Method signatures and docstrings: - def get(self): 获取vCenter vm_network_device 信息 --- tags: - vCenter network device parameters: - in: query name: platform_id type: integer required: true - in: query name...
d25871dc66dfbd9f04e3d4d95843e39de286cfc8
<|skeleton|> class NetWorkManage: def get(self): """获取vCenter vm_network_device 信息 --- tags: - vCenter network device parameters: - in: query name: platform_id type: integer required: true - in: query name: vm_uuid type: string required: true responses: 200: description: vCenter network device 信息 schema: p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NetWorkManage: def get(self): """获取vCenter vm_network_device 信息 --- tags: - vCenter network device parameters: - in: query name: platform_id type: integer required: true - in: query name: vm_uuid type: string required: true responses: 200: description: vCenter network device 信息 schema: properties: ok:...
the_stack_v2_python_sparse
app/main/vcenter/apis/network_devices.py
zcl-organization/naguan
train
0
a5eef6f68ed1112a9350ac19109fec232028a099
[ "pos = 0\nfor i in range(len(nums)):\n if nums[i] != 0:\n nums[i], nums[pos] = (nums[pos], nums[i])\n pos += 1", "def sorting(n):\n return (0,) if n != 0 else (1, 0)\nnums.sort(key=sorting)", "count = 0\nfor i in range(len(nums) - 1):\n i = i - count\n if nums[i] == 0:\n count +...
<|body_start_0|> pos = 0 for i in range(len(nums)): if nums[i] != 0: nums[i], nums[pos] = (nums[pos], nums[i]) pos += 1 <|end_body_0|> <|body_start_1|> def sorting(n): return (0,) if n != 0 else (1, 0) nums.sort(key=sorting) <|end_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def moveZeroes3(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes2(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead. time complexity : O(NlogN) space ...
stack_v2_sparse_classes_36k_train_025433
1,082
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead.", "name": "moveZeroes3", "signature": "def moveZeroes3(self, nums: List[int]) -> None" }, { "docstring": "Do not return anything, modify nums in-place instead. time complexity : O(NlogN) space complexity : O(1)", "name": "...
3
stack_v2_sparse_classes_30k_train_004368
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes3(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. - def moveZeroes2(self, nums: List[int]) -> None: Do not return anything, mo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes3(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. - def moveZeroes2(self, nums: List[int]) -> None: Do not return anything, mo...
29cb49a166a1dfd19c39613a0e9895c545a6bfe9
<|skeleton|> class Solution: def moveZeroes3(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes2(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead. time complexity : O(NlogN) space ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def moveZeroes3(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" pos = 0 for i in range(len(nums)): if nums[i] != 0: nums[i], nums[pos] = (nums[pos], nums[i]) pos += 1 def moveZeroes2(...
the_stack_v2_python_sparse
01.Array&String/2-09.moveZeroes.py
mjmingd/study_algorithm
train
0
ba4829a196275b6f3d94f407eb058c7f2138ae8e
[ "serializer = GroupSerializer2(data=request.data)\nif serializer.is_valid():\n serializer.save()\n return Response(serializer.data)\nelse:\n return Response(serializer.errors)", "serializer = GroupSerializer2(data=request.data)\ntemp = Group.objects.get(id=pk)\nif serializer.is_valid():\n temp.delete(...
<|body_start_0|> serializer = GroupSerializer2(data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data) else: return Response(serializer.errors) <|end_body_0|> <|body_start_1|> serializer = GroupSerializer2(data=...
GroupViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupViewSet: def create(self, request): """Створення групи""" <|body_0|> def delete(self, request, pk): """Видалення групи за айді""" <|body_1|> def list(self, request): """Вивід списку груп""" <|body_2|> def add_student(self, reque...
stack_v2_sparse_classes_36k_train_025434
3,505
no_license
[ { "docstring": "Створення групи", "name": "create", "signature": "def create(self, request)" }, { "docstring": "Видалення групи за айді", "name": "delete", "signature": "def delete(self, request, pk)" }, { "docstring": "Вивід списку груп", "name": "list", "signature": "de...
5
stack_v2_sparse_classes_30k_train_012027
Implement the Python class `GroupViewSet` described below. Class description: Implement the GroupViewSet class. Method signatures and docstrings: - def create(self, request): Створення групи - def delete(self, request, pk): Видалення групи за айді - def list(self, request): Вивід списку груп - def add_student(self, r...
Implement the Python class `GroupViewSet` described below. Class description: Implement the GroupViewSet class. Method signatures and docstrings: - def create(self, request): Створення групи - def delete(self, request, pk): Видалення групи за айді - def list(self, request): Вивід списку груп - def add_student(self, r...
c21c0df4974ff625f78cb967edb86ec18e2d062d
<|skeleton|> class GroupViewSet: def create(self, request): """Створення групи""" <|body_0|> def delete(self, request, pk): """Видалення групи за айді""" <|body_1|> def list(self, request): """Вивід списку груп""" <|body_2|> def add_student(self, reque...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupViewSet: def create(self, request): """Створення групи""" serializer = GroupSerializer2(data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data) else: return Response(serializer.errors) def del...
the_stack_v2_python_sparse
OpenEduApi/Users/views.py
AkiroToshira/OpenEdu
train
0
7ada38ce3f9e547a2bbc91c707b9c16f68211b33
[ "exception_handler.return_value = \"it's handled\"\nresult = custom_exception_handler(None, None)\nself.assertTrue(exception_handler.called)\nself.assertEqual(result, \"it's handled\")", "exception_handler.return_value = None\nresult = custom_exception_handler(elasticsearch.exceptions.ConnectionError('oops'), Non...
<|body_start_0|> exception_handler.return_value = "it's handled" result = custom_exception_handler(None, None) self.assertTrue(exception_handler.called) self.assertEqual(result, "it's handled") <|end_body_0|> <|body_start_1|> exception_handler.return_value = None result ...
Tests for DRF custom exception handling.
CustomExceptionHandlerTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomExceptionHandlerTests: """Tests for DRF custom exception handling.""" def test_drf_handled_exception(self, exception_handler): """Test that we pass DRF recognized exceptions through unmodified""" <|body_0|> def test_502_error_exceptions(self, exception_handler): ...
stack_v2_sparse_classes_36k_train_025435
12,045
permissive
[ { "docstring": "Test that we pass DRF recognized exceptions through unmodified", "name": "test_drf_handled_exception", "signature": "def test_drf_handled_exception(self, exception_handler)" }, { "docstring": "Test ES connection exception is handled", "name": "test_502_error_exceptions", ...
4
stack_v2_sparse_classes_30k_train_002461
Implement the Python class `CustomExceptionHandlerTests` described below. Class description: Tests for DRF custom exception handling. Method signatures and docstrings: - def test_drf_handled_exception(self, exception_handler): Test that we pass DRF recognized exceptions through unmodified - def test_502_error_excepti...
Implement the Python class `CustomExceptionHandlerTests` described below. Class description: Tests for DRF custom exception handling. Method signatures and docstrings: - def test_drf_handled_exception(self, exception_handler): Test that we pass DRF recognized exceptions through unmodified - def test_502_error_excepti...
73d334a9f0df7c044c06989977a9a22dd2ff9b7a
<|skeleton|> class CustomExceptionHandlerTests: """Tests for DRF custom exception handling.""" def test_drf_handled_exception(self, exception_handler): """Test that we pass DRF recognized exceptions through unmodified""" <|body_0|> def test_502_error_exceptions(self, exception_handler): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomExceptionHandlerTests: """Tests for DRF custom exception handling.""" def test_drf_handled_exception(self, exception_handler): """Test that we pass DRF recognized exceptions through unmodified""" exception_handler.return_value = "it's handled" result = custom_exception_handl...
the_stack_v2_python_sparse
goldstone/drfes/tests.py
bhuvan-rk/goldstone-server
train
0
7a958ef7288168c82419957d30710eb71434c811
[ "excitation = self.GetExcitation()\nresponse = self._system_response\nvariance = sumpf.modules.SignalMean(excitation * excitation).GetMean()[0]\nkernels = []\nfor branch in self._select_branches:\n input = nlsp.nonlinear_function.Power(excitation, branch)\n cross_corr = sumpf.modules.CorrelateSignals(signal1=...
<|body_start_0|> excitation = self.GetExcitation() response = self._system_response variance = sumpf.modules.SignalMean(excitation * excitation).GetMean()[0] kernels = [] for branch in self._select_branches: input = nlsp.nonlinear_function.Power(excitation, branch) ...
WienerGapproach
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WienerGapproach: def _GetFilterImpuleResponses(self): """Get the identified filter impulse responses. :return: the filter impulse responses""" <|body_0|> def _GetNonlinerFunctions(self): """Get the nonlinear functions. :return: the nonlinear functions""" <|bo...
stack_v2_sparse_classes_36k_train_025436
1,917
no_license
[ { "docstring": "Get the identified filter impulse responses. :return: the filter impulse responses", "name": "_GetFilterImpuleResponses", "signature": "def _GetFilterImpuleResponses(self)" }, { "docstring": "Get the nonlinear functions. :return: the nonlinear functions", "name": "_GetNonline...
2
stack_v2_sparse_classes_30k_train_005728
Implement the Python class `WienerGapproach` described below. Class description: Implement the WienerGapproach class. Method signatures and docstrings: - def _GetFilterImpuleResponses(self): Get the identified filter impulse responses. :return: the filter impulse responses - def _GetNonlinerFunctions(self): Get the n...
Implement the Python class `WienerGapproach` described below. Class description: Implement the WienerGapproach class. Method signatures and docstrings: - def _GetFilterImpuleResponses(self): Get the identified filter impulse responses. :return: the filter impulse responses - def _GetNonlinerFunctions(self): Get the n...
41ba79cddeb8f76ffed1d3435d629e014f7d04c5
<|skeleton|> class WienerGapproach: def _GetFilterImpuleResponses(self): """Get the identified filter impulse responses. :return: the filter impulse responses""" <|body_0|> def _GetNonlinerFunctions(self): """Get the nonlinear functions. :return: the nonlinear functions""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WienerGapproach: def _GetFilterImpuleResponses(self): """Get the identified filter impulse responses. :return: the filter impulse responses""" excitation = self.GetExcitation() response = self._system_response variance = sumpf.modules.SignalMean(excitation * excitation).GetMean...
the_stack_v2_python_sparse
model_generator/system_identification/wgn_identification/wiener_g_approach.py
zuowanbushiwo/systemidentifier
train
0
b53e4603b387644eeccbed8a999ac75b4d1f426b
[ "f = self.dtype_f(self.init)\nself.A.mult(u, f)\nfa2 = self.init.getVecArray(f)\nxa = self.init.getVecArray(u)\nfor i in range(self.xs, self.xe):\n fa2[i] += self.lambda0 ** 2 * xa[i] * (1 - xa[i] ** self.nu)\nfa2[0] = 0\nfa2[-1] = 0\nreturn f", "me = self.dtype_u(u0)\ntarget = Fisher_full(self.init, self, fac...
<|body_start_0|> f = self.dtype_f(self.init) self.A.mult(u, f) fa2 = self.init.getVecArray(f) xa = self.init.getVecArray(u) for i in range(self.xs, self.xe): fa2[i] += self.lambda0 ** 2 * xa[i] * (1 - xa[i] ** self.nu) fa2[0] = 0 fa2[-1] = 0 re...
Problem class implementing the fully-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc
petsc_fisher_fullyimplicit
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class petsc_fisher_fullyimplicit: """Problem class implementing the fully-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc""" def eval_f(self, u, t): """Routine to evaluate the RHS Args: u (dtype_u): current values t (float): current time Returns: dtype_f: the ...
stack_v2_sparse_classes_36k_train_025437
16,584
permissive
[ { "docstring": "Routine to evaluate the RHS Args: u (dtype_u): current values t (float): current time Returns: dtype_f: the RHS", "name": "eval_f", "signature": "def eval_f(self, u, t)" }, { "docstring": "Nonlinear solver for (I-factor*F)(u) = rhs Args: rhs (dtype_f): right-hand side for the lin...
2
null
Implement the Python class `petsc_fisher_fullyimplicit` described below. Class description: Problem class implementing the fully-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc Method signatures and docstrings: - def eval_f(self, u, t): Routine to evaluate the RHS Args: u (dtype_u): curr...
Implement the Python class `petsc_fisher_fullyimplicit` described below. Class description: Problem class implementing the fully-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc Method signatures and docstrings: - def eval_f(self, u, t): Routine to evaluate the RHS Args: u (dtype_u): curr...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class petsc_fisher_fullyimplicit: """Problem class implementing the fully-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc""" def eval_f(self, u, t): """Routine to evaluate the RHS Args: u (dtype_u): current values t (float): current time Returns: dtype_f: the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class petsc_fisher_fullyimplicit: """Problem class implementing the fully-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc""" def eval_f(self, u, t): """Routine to evaluate the RHS Args: u (dtype_u): current values t (float): current time Returns: dtype_f: the RHS""" ...
the_stack_v2_python_sparse
pySDC/implementations/problem_classes/GeneralizedFisher_1D_PETSc.py
Parallel-in-Time/pySDC
train
30
122dc14c3630ef281f91bcdf46677b4d920a59d1
[ "authors = ','.join([x['name'] for x in doc.artists])\nauthor = re.sub('[\\\\\\\\/:*?\"<>|]', '', authors.strip())\nmp3_name = re.sub('[\\\\\\\\/:*?\"<>|]', '', doc['name'])\nname = os.path.join(author, '%s - %s.mp4' % (author, mp3_name))\nreturn name", "try:\n target_r = get_target_r(doc, Config().get_mv_reso...
<|body_start_0|> authors = ','.join([x['name'] for x in doc.artists]) author = re.sub('[\\\\/:*?"<>|]', '', authors.strip()) mp3_name = re.sub('[\\\\/:*?"<>|]', '', doc['name']) name = os.path.join(author, '%s - %s.mp4' % (author, mp3_name)) return name <|end_body_0|> <|body_sta...
Video
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Video: def download_filename_full(self, doc): """implement pls get a path to save file, by relative path need be complete by child :param doc: :return: :rtype: str""" <|body_0|> def url_load(self, doc): """implement pls :param doc: :return: :rtype: str""" <|b...
stack_v2_sparse_classes_36k_train_025438
1,545
permissive
[ { "docstring": "implement pls get a path to save file, by relative path need be complete by child :param doc: :return: :rtype: str", "name": "download_filename_full", "signature": "def download_filename_full(self, doc)" }, { "docstring": "implement pls :param doc: :return: :rtype: str", "nam...
2
stack_v2_sparse_classes_30k_train_017154
Implement the Python class `Video` described below. Class description: Implement the Video class. Method signatures and docstrings: - def download_filename_full(self, doc): implement pls get a path to save file, by relative path need be complete by child :param doc: :return: :rtype: str - def url_load(self, doc): imp...
Implement the Python class `Video` described below. Class description: Implement the Video class. Method signatures and docstrings: - def download_filename_full(self, doc): implement pls get a path to save file, by relative path need be complete by child :param doc: :return: :rtype: str - def url_load(self, doc): imp...
68e588c0612d0ab2af3a820ff88ca24d698ceeb7
<|skeleton|> class Video: def download_filename_full(self, doc): """implement pls get a path to save file, by relative path need be complete by child :param doc: :return: :rtype: str""" <|body_0|> def url_load(self, doc): """implement pls :param doc: :return: :rtype: str""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Video: def download_filename_full(self, doc): """implement pls get a path to save file, by relative path need be complete by child :param doc: :return: :rtype: str""" authors = ','.join([x['name'] for x in doc.artists]) author = re.sub('[\\\\/:*?"<>|]', '', authors.strip()) mp3...
the_stack_v2_python_sparse
NXSpider/spider/video.py
Z-Shuming/NXSpider
train
0
f5ec543e4fa6c611bc868851ef090ff4ccf747b2
[ "super(ErrorCalculator, self).__init__()\nself.char_list = char_list\nself.space = sym_space\nself.pad = sym_pad\nself.report_bleu = report_bleu\nself.idx_blank = self.char_list.index(self.pad)\nif self.space in self.char_list:\n self.idx_space = self.char_list.index(self.space)\nelse:\n self.idx_space = None...
<|body_start_0|> super(ErrorCalculator, self).__init__() self.char_list = char_list self.space = sym_space self.pad = sym_pad self.report_bleu = report_bleu self.idx_blank = self.char_list.index(self.pad) if self.space in self.char_list: self.idx_space...
Calculate BLEU for ST and MT models during training. :param y_hats: numpy array with predicted text :param y_pads: numpy array with true (target) text :param char_list: vocabulary list :param sym_space: space symbol :param sym_pad: pad symbol :param report_bleu: report BLUE score if True
ErrorCalculator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ErrorCalculator: """Calculate BLEU for ST and MT models during training. :param y_hats: numpy array with predicted text :param y_pads: numpy array with true (target) text :param char_list: vocabulary list :param sym_space: space symbol :param sym_pad: pad symbol :param report_bleu: report BLUE sc...
stack_v2_sparse_classes_36k_train_025439
4,216
permissive
[ { "docstring": "Construct an ErrorCalculator object.", "name": "__init__", "signature": "def __init__(self, char_list, sym_space, sym_pad, report_bleu=False)" }, { "docstring": "Calculate corpus-level BLEU score. :param torch.Tensor ys_hat: prediction (batch, seqlen) :param torch.Tensor ys_pad: ...
4
null
Implement the Python class `ErrorCalculator` described below. Class description: Calculate BLEU for ST and MT models during training. :param y_hats: numpy array with predicted text :param y_pads: numpy array with true (target) text :param char_list: vocabulary list :param sym_space: space symbol :param sym_pad: pad sy...
Implement the Python class `ErrorCalculator` described below. Class description: Calculate BLEU for ST and MT models during training. :param y_hats: numpy array with predicted text :param y_pads: numpy array with true (target) text :param char_list: vocabulary list :param sym_space: space symbol :param sym_pad: pad sy...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class ErrorCalculator: """Calculate BLEU for ST and MT models during training. :param y_hats: numpy array with predicted text :param y_pads: numpy array with true (target) text :param char_list: vocabulary list :param sym_space: space symbol :param sym_pad: pad symbol :param report_bleu: report BLUE sc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ErrorCalculator: """Calculate BLEU for ST and MT models during training. :param y_hats: numpy array with predicted text :param y_pads: numpy array with true (target) text :param char_list: vocabulary list :param sym_space: space symbol :param sym_pad: pad symbol :param report_bleu: report BLUE score if True""...
the_stack_v2_python_sparse
espnet/nets/e2e_mt_common.py
espnet/espnet
train
7,242
253a2a357091b0ac92a0980ab37e31c8af5e4a23
[ "self.epochs = epochs\nself.batch_size = batch_size\nself.hidden_neurons = hidden_neurons\nself.output_neurons = output_neurons", "input_dims = 1\nmodel = Sequential()\nmodel.add(Dense(self.hidden_neurons, activation='relu', input_shape=(input_dims,)))\nmodel.add(Dense(self.output_neurons, activation='linear'))\n...
<|body_start_0|> self.epochs = epochs self.batch_size = batch_size self.hidden_neurons = hidden_neurons self.output_neurons = output_neurons <|end_body_0|> <|body_start_1|> input_dims = 1 model = Sequential() model.add(Dense(self.hidden_neurons, activation='relu'...
ANN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ANN: def __init__(self, epochs, batch_size, hidden_neurons, output_neurons): """Initialize NN settings""" <|body_0|> def solve(self, train_X, train_Y, test_X, test_Y): """Initialize NN, train and test""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025440
1,636
no_license
[ { "docstring": "Initialize NN settings", "name": "__init__", "signature": "def __init__(self, epochs, batch_size, hidden_neurons, output_neurons)" }, { "docstring": "Initialize NN, train and test", "name": "solve", "signature": "def solve(self, train_X, train_Y, test_X, test_Y)" } ]
2
stack_v2_sparse_classes_30k_val_000413
Implement the Python class `ANN` described below. Class description: Implement the ANN class. Method signatures and docstrings: - def __init__(self, epochs, batch_size, hidden_neurons, output_neurons): Initialize NN settings - def solve(self, train_X, train_Y, test_X, test_Y): Initialize NN, train and test
Implement the Python class `ANN` described below. Class description: Implement the ANN class. Method signatures and docstrings: - def __init__(self, epochs, batch_size, hidden_neurons, output_neurons): Initialize NN settings - def solve(self, train_X, train_Y, test_X, test_Y): Initialize NN, train and test <|skeleto...
4a9e1166faa8af8b499cb90adbbaddcc93ad88e2
<|skeleton|> class ANN: def __init__(self, epochs, batch_size, hidden_neurons, output_neurons): """Initialize NN settings""" <|body_0|> def solve(self, train_X, train_Y, test_X, test_Y): """Initialize NN, train and test""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ANN: def __init__(self, epochs, batch_size, hidden_neurons, output_neurons): """Initialize NN settings""" self.epochs = epochs self.batch_size = batch_size self.hidden_neurons = hidden_neurons self.output_neurons = output_neurons def solve(self, train_X, train_Y, t...
the_stack_v2_python_sparse
Tutorial 2/ann.py
clara2911/ANNProject
train
1
01d38d164a9b8314bf8d1090e64174179ddac863
[ "if not strs:\n return None\nif strs == ['']:\n return ''\nx = chr(258).join(strs)\nreturn x", "if s is None:\n return None\nif s == '':\n return ['']\nres = s.split(chr(258))\nreturn res" ]
<|body_start_0|> if not strs: return None if strs == ['']: return '' x = chr(258).join(strs) return x <|end_body_0|> <|body_start_1|> if s is None: return None if s == '': return [''] res = s.split(chr(258)) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not st...
stack_v2_sparse_classes_36k_train_025441
515
no_license
[ { "docstring": "Encodes a list of strings to a single string.", "name": "encode", "signature": "def encode(self, strs: [str]) -> str" }, { "docstring": "Decodes a single string to a list of strings.", "name": "decode", "signature": "def decode(self, s: str) -> [str]" } ]
2
stack_v2_sparse_classes_30k_train_005522
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings. <|skeleton|> cla...
fb5a930b5ad27e7ed405e5787346327d9b3bf957
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" if not strs: return None if strs == ['']: return '' x = chr(258).join(strs) return x def decode(self, s: str) -> [str]: """Decodes a sin...
the_stack_v2_python_sparse
Jiuzhang_practice/encode_decode_str.py
armstrong019/coding_n_project
train
0
70895d393258b47f3d8da573e86c45916b21fa4c
[ "self.age_adjustment_functions = {}\naffected_age_indices = [i for i in AGE_INDICES if f'age_{i}' in mixing_age_adjust]\nfor age_idx in affected_age_indices:\n key = f'age_{age_idx}'\n mixing_age_adjust[key]['times'] = [(time_date - BASE_DATE).days for time_date in mixing_age_adjust[key]['times']]\n age_ti...
<|body_start_0|> self.age_adjustment_functions = {} affected_age_indices = [i for i in AGE_INDICES if f'age_{i}' in mixing_age_adjust] for age_idx in affected_age_indices: key = f'age_{age_idx}' mixing_age_adjust[key]['times'] = [(time_date - BASE_DATE).days for time_date...
AgeMixingAdjustment
[ "BSD-2-Clause-Views" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AgeMixingAdjustment: def __init__(self, mixing_age_adjust: dict): """Build the time variant age adjustment functions""" <|body_0|> def get_adjustment(self, time: float, mixing_matrix: np.ndarray) -> np.ndarray: """Apply time-varying age adjustments. Returns a new mix...
stack_v2_sparse_classes_36k_train_025442
1,827
permissive
[ { "docstring": "Build the time variant age adjustment functions", "name": "__init__", "signature": "def __init__(self, mixing_age_adjust: dict)" }, { "docstring": "Apply time-varying age adjustments. Returns a new mixing matrix, modified to adjust for dynamic mixing changes for a given point in ...
2
null
Implement the Python class `AgeMixingAdjustment` described below. Class description: Implement the AgeMixingAdjustment class. Method signatures and docstrings: - def __init__(self, mixing_age_adjust: dict): Build the time variant age adjustment functions - def get_adjustment(self, time: float, mixing_matrix: np.ndarr...
Implement the Python class `AgeMixingAdjustment` described below. Class description: Implement the AgeMixingAdjustment class. Method signatures and docstrings: - def __init__(self, mixing_age_adjust: dict): Build the time variant age adjustment functions - def get_adjustment(self, time: float, mixing_matrix: np.ndarr...
0cbd006d1f15da414d02eed44e48bb5c06f0802e
<|skeleton|> class AgeMixingAdjustment: def __init__(self, mixing_age_adjust: dict): """Build the time variant age adjustment functions""" <|body_0|> def get_adjustment(self, time: float, mixing_matrix: np.ndarray) -> np.ndarray: """Apply time-varying age adjustments. Returns a new mix...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AgeMixingAdjustment: def __init__(self, mixing_age_adjust: dict): """Build the time variant age adjustment functions""" self.age_adjustment_functions = {} affected_age_indices = [i for i in AGE_INDICES if f'age_{i}' in mixing_age_adjust] for age_idx in affected_age_indices: ...
the_stack_v2_python_sparse
apps/covid_19/preprocess/mixing_matrix/adjust_age.py
malanchak/AuTuMN
train
0
7404a7b58c06514cc5aa293cb0e627371d43bff4
[ "self._image = tfx_image\nself._k8s_core_api = kube_utils.make_core_v1_api()\nself._namespace = name_space\nself._container_name = container_name\nself._job_name = kube_utils.sanitize_pod_name(job_prefix + _generate_component_name_suffix())\nself.ttl_seconds = 5\nself._pod_name = None\nself._stream_pod_logs = strea...
<|body_start_0|> self._image = tfx_image self._k8s_core_api = kube_utils.make_core_v1_api() self._namespace = name_space self._container_name = container_name self._job_name = kube_utils.sanitize_pod_name(job_prefix + _generate_component_name_suffix()) self.ttl_seconds = ...
A Kubernetes job runner that launches and executes pipeline components in kubernetes cluster.
KubernetesJobRunner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KubernetesJobRunner: """A Kubernetes job runner that launches and executes pipeline components in kubernetes cluster.""" def __init__(self, tfx_image, job_prefix, container_name, name_space='default', stream_logs=False): """Create a kubernetes model server runner. Args: tfx_image: co...
stack_v2_sparse_classes_36k_train_025443
7,976
permissive
[ { "docstring": "Create a kubernetes model server runner. Args: tfx_image: container image for tfx. job_prefix: prefix for the job. Unique hash will follow as suffix. container_name: name of the container. name_space: namespace of the run. stream_logs: whether to stream logs from the pod.", "name": "__init__...
6
stack_v2_sparse_classes_30k_train_019902
Implement the Python class `KubernetesJobRunner` described below. Class description: A Kubernetes job runner that launches and executes pipeline components in kubernetes cluster. Method signatures and docstrings: - def __init__(self, tfx_image, job_prefix, container_name, name_space='default', stream_logs=False): Cre...
Implement the Python class `KubernetesJobRunner` described below. Class description: A Kubernetes job runner that launches and executes pipeline components in kubernetes cluster. Method signatures and docstrings: - def __init__(self, tfx_image, job_prefix, container_name, name_space='default', stream_logs=False): Cre...
1b328504fa08a70388691e4072df76f143631325
<|skeleton|> class KubernetesJobRunner: """A Kubernetes job runner that launches and executes pipeline components in kubernetes cluster.""" def __init__(self, tfx_image, job_prefix, container_name, name_space='default', stream_logs=False): """Create a kubernetes model server runner. Args: tfx_image: co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KubernetesJobRunner: """A Kubernetes job runner that launches and executes pipeline components in kubernetes cluster.""" def __init__(self, tfx_image, job_prefix, container_name, name_space='default', stream_logs=False): """Create a kubernetes model server runner. Args: tfx_image: container image...
the_stack_v2_python_sparse
tfx/orchestration/experimental/centralized_kubernetes_orchestrator/kubernetes_job_runner.py
tensorflow/tfx
train
2,116
09ceeff88db61da4ecf6a84878bedc5302bdf39a
[ "if self.request.version == 'v6':\n return IngestStatusSerializerV6\nelif self.request.version == 'v7':\n return IngestStatusSerializerV6", "if request.version == 'v6' or request.version == 'v7':\n return self.list_impl(request)\nraise Http404()", "started = rest_util.parse_timestamp(request, 'started'...
<|body_start_0|> if self.request.version == 'v6': return IngestStatusSerializerV6 elif self.request.version == 'v7': return IngestStatusSerializerV6 <|end_body_0|> <|body_start_1|> if request.version == 'v6' or request.version == 'v7': return self.list_impl(r...
This view is the endpoint for retrieving summarized ingest status.
IngestsStatusView
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IngestsStatusView: """This view is the endpoint for retrieving summarized ingest status.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" <|body_0|> def list(self, request): """Determine ap...
stack_v2_sparse_classes_36k_train_025444
30,689
permissive
[ { "docstring": "Returns the appropriate serializer based off the requests version of the REST API", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Determine api version and call specific method :param request: the HTTP POST request :type request:...
3
stack_v2_sparse_classes_30k_train_001387
Implement the Python class `IngestsStatusView` described below. Class description: This view is the endpoint for retrieving summarized ingest status. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API - def list(self, r...
Implement the Python class `IngestsStatusView` described below. Class description: This view is the endpoint for retrieving summarized ingest status. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API - def list(self, r...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class IngestsStatusView: """This view is the endpoint for retrieving summarized ingest status.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" <|body_0|> def list(self, request): """Determine ap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IngestsStatusView: """This view is the endpoint for retrieving summarized ingest status.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" if self.request.version == 'v6': return IngestStatusSerializerV6 ...
the_stack_v2_python_sparse
scale/ingest/views.py
kfconsultant/scale
train
0
c3fad39e744ec77c591ae0667e9f9e319af025dd
[ "category_links = response.xpath('//a[@class=\"level-top \"]/@href').extract()\nfor link in category_links:\n yield scrapy.Request(link, self.parse_main)", "for i in response.xpath('//li[@class=\"item product product-item\"]'):\n cost = i.xpath('.//span[@class=\"price\"]/text()').get().replace('$', '')\n ...
<|body_start_0|> category_links = response.xpath('//a[@class="level-top "]/@href').extract() for link in category_links: yield scrapy.Request(link, self.parse_main) <|end_body_0|> <|body_start_1|> for i in response.xpath('//li[@class="item product product-item"]'): cost ...
JmlSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JmlSpider: def parse(self, response, **kwargs): """Grab category pages. @url https://www.jmlhomefashion.com/ @returns items 0 @returns requests 6 @request https://www.jmlhomefashion.com/bedroom.html""" <|body_0|> def parse_main(self, response): """extract some item's...
stack_v2_sparse_classes_36k_train_025445
7,251
no_license
[ { "docstring": "Grab category pages. @url https://www.jmlhomefashion.com/ @returns items 0 @returns requests 6 @request https://www.jmlhomefashion.com/bedroom.html", "name": "parse", "signature": "def parse(self, response, **kwargs)" }, { "docstring": "extract some item's data and loop item urls...
3
null
Implement the Python class `JmlSpider` described below. Class description: Implement the JmlSpider class. Method signatures and docstrings: - def parse(self, response, **kwargs): Grab category pages. @url https://www.jmlhomefashion.com/ @returns items 0 @returns requests 6 @request https://www.jmlhomefashion.com/bedr...
Implement the Python class `JmlSpider` described below. Class description: Implement the JmlSpider class. Method signatures and docstrings: - def parse(self, response, **kwargs): Grab category pages. @url https://www.jmlhomefashion.com/ @returns items 0 @returns requests 6 @request https://www.jmlhomefashion.com/bedr...
025babe4a03553d720806828f89929c6e773d683
<|skeleton|> class JmlSpider: def parse(self, response, **kwargs): """Grab category pages. @url https://www.jmlhomefashion.com/ @returns items 0 @returns requests 6 @request https://www.jmlhomefashion.com/bedroom.html""" <|body_0|> def parse_main(self, response): """extract some item's...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JmlSpider: def parse(self, response, **kwargs): """Grab category pages. @url https://www.jmlhomefashion.com/ @returns items 0 @returns requests 6 @request https://www.jmlhomefashion.com/bedroom.html""" category_links = response.xpath('//a[@class="level-top "]/@href').extract() for link...
the_stack_v2_python_sparse
data_scraping/gmd/spiders/jml.py
panky2202/scrapy-dev
train
1
cec325bb82d1f6ded6943c8ad925184f6e410239
[ "cursor = self.view.sel()\nself.original_position = cursor[0]\ncursor.clear()\ncursor.add(region)\nself.view.show(region)", "last_edits = self.view.settings().get(LAST_EDITS_SETTING, {})\nlast_edit = last_edits.get(str(self.view.id()), None)\ncurrent_position = self.view.sel()[0]\nif last_edit is None:\n retur...
<|body_start_0|> cursor = self.view.sel() self.original_position = cursor[0] cursor.clear() cursor.add(region) self.view.show(region) <|end_body_0|> <|body_start_1|> last_edits = self.view.settings().get(LAST_EDITS_SETTING, {}) last_edit = last_edits.get(str(self...
GotoLastEdit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GotoLastEdit: def move_cursor_to_region(self, region): """Clear the cursor's position and move it to `region`.""" <|body_0|> def run(self, edit): """If there was a last edit recorded for the view, store the current position as self.original_position and move the curs...
stack_v2_sparse_classes_36k_train_025446
1,978
no_license
[ { "docstring": "Clear the cursor's position and move it to `region`.", "name": "move_cursor_to_region", "signature": "def move_cursor_to_region(self, region)" }, { "docstring": "If there was a last edit recorded for the view, store the current position as self.original_position and move the curs...
2
null
Implement the Python class `GotoLastEdit` described below. Class description: Implement the GotoLastEdit class. Method signatures and docstrings: - def move_cursor_to_region(self, region): Clear the cursor's position and move it to `region`. - def run(self, edit): If there was a last edit recorded for the view, store...
Implement the Python class `GotoLastEdit` described below. Class description: Implement the GotoLastEdit class. Method signatures and docstrings: - def move_cursor_to_region(self, region): Clear the cursor's position and move it to `region`. - def run(self, edit): If there was a last edit recorded for the view, store...
8390a0139137574ab237b3ff5fe8ea61e8a0b76b
<|skeleton|> class GotoLastEdit: def move_cursor_to_region(self, region): """Clear the cursor's position and move it to `region`.""" <|body_0|> def run(self, edit): """If there was a last edit recorded for the view, store the current position as self.original_position and move the curs...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GotoLastEdit: def move_cursor_to_region(self, region): """Clear the cursor's position and move it to `region`.""" cursor = self.view.sel() self.original_position = cursor[0] cursor.clear() cursor.add(region) self.view.show(region) def run(self, edit): ...
the_stack_v2_python_sparse
data/input/abrookins/GotoLastEdit/goto_last_edit.py
bopopescu/pythonanalyzer
train
0
22967d5ae9a84b89ccf0c31c0200765a1c308a72
[ "if null_default_value is None:\n null_default_value = math.log2(min_included)\nelse:\n null_default_value = math.log2(null_default_value)\nself.min_included: float = min_included\nself.max_included: float = max_included\nself.log2_min_included = math.log2(min_included)\nself.log2_max_included = math.log2(max...
<|body_start_0|> if null_default_value is None: null_default_value = math.log2(min_included) else: null_default_value = math.log2(null_default_value) self.min_included: float = min_included self.max_included: float = max_included self.log2_min_included = m...
Get a LogUniform distribution. Refer to: :class:`scipy.stats.loguniform`. .. seealso:: :func:`~neuraxle.base.BaseStep.set_hyperparams_space`, :class:`ScipyDistributionWrapper`,
ScipyLogUniform
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScipyLogUniform: """Get a LogUniform distribution. Refer to: :class:`scipy.stats.loguniform`. .. seealso:: :func:`~neuraxle.base.BaseStep.set_hyperparams_space`, :class:`ScipyDistributionWrapper`,""" def __init__(self, min_included: float, max_included: float, null_default_value=None): ...
stack_v2_sparse_classes_36k_train_025447
19,816
permissive
[ { "docstring": "Create a quantized random log uniform distribution. A random float between the two values inclusively will be returned. :param min_included: minimum integer, should be somehow included. :param max_included: maximum integer, should be somehow included. :param null_default_value: null default valu...
2
stack_v2_sparse_classes_30k_train_017305
Implement the Python class `ScipyLogUniform` described below. Class description: Get a LogUniform distribution. Refer to: :class:`scipy.stats.loguniform`. .. seealso:: :func:`~neuraxle.base.BaseStep.set_hyperparams_space`, :class:`ScipyDistributionWrapper`, Method signatures and docstrings: - def __init__(self, min_i...
Implement the Python class `ScipyLogUniform` described below. Class description: Get a LogUniform distribution. Refer to: :class:`scipy.stats.loguniform`. .. seealso:: :func:`~neuraxle.base.BaseStep.set_hyperparams_space`, :class:`ScipyDistributionWrapper`, Method signatures and docstrings: - def __init__(self, min_i...
af917c984241178436a759be3b830e6d8b03245f
<|skeleton|> class ScipyLogUniform: """Get a LogUniform distribution. Refer to: :class:`scipy.stats.loguniform`. .. seealso:: :func:`~neuraxle.base.BaseStep.set_hyperparams_space`, :class:`ScipyDistributionWrapper`,""" def __init__(self, min_included: float, max_included: float, null_default_value=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScipyLogUniform: """Get a LogUniform distribution. Refer to: :class:`scipy.stats.loguniform`. .. seealso:: :func:`~neuraxle.base.BaseStep.set_hyperparams_space`, :class:`ScipyDistributionWrapper`,""" def __init__(self, min_included: float, max_included: float, null_default_value=None): """Create ...
the_stack_v2_python_sparse
neuraxle/hyperparams/scipy_distributions.py
Neuraxio/Neuraxle
train
597
dfb2574187cf7489c0bfddfce99d425708130eef
[ "if preprocessor_id == 'mangoml_WordCountTransformer':\n return WordCountTransformer(**preprocessor_params)\nelif preprocessor_id == 'mangoml_StopwordCountTransformer':\n return StopwordCountTransformer(**preprocessor_params)\nelif preprocessor_id == 'mangoml_MeanWordLengthTransformer':\n return MeanWordLe...
<|body_start_0|> if preprocessor_id == 'mangoml_WordCountTransformer': return WordCountTransformer(**preprocessor_params) elif preprocessor_id == 'mangoml_StopwordCountTransformer': return StopwordCountTransformer(**preprocessor_params) elif preprocessor_id == 'mangoml_Me...
Class used to build preprocessors
PreprocessorFactory
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreprocessorFactory: """Class used to build preprocessors""" def build_mangoml(self, preprocessor_id, preprocessor_params): """Method that builds preprocessors/wrappers implemented by mango""" <|body_0|> def build_sklearn(self, preprocessor_id, preprocessor_params): ...
stack_v2_sparse_classes_36k_train_025448
3,247
permissive
[ { "docstring": "Method that builds preprocessors/wrappers implemented by mango", "name": "build_mangoml", "signature": "def build_mangoml(self, preprocessor_id, preprocessor_params)" }, { "docstring": "Method that builds preprocessors implemented in sklearn", "name": "build_sklearn", "si...
3
stack_v2_sparse_classes_30k_train_021665
Implement the Python class `PreprocessorFactory` described below. Class description: Class used to build preprocessors Method signatures and docstrings: - def build_mangoml(self, preprocessor_id, preprocessor_params): Method that builds preprocessors/wrappers implemented by mango - def build_sklearn(self, preprocesso...
Implement the Python class `PreprocessorFactory` described below. Class description: Class used to build preprocessors Method signatures and docstrings: - def build_mangoml(self, preprocessor_id, preprocessor_params): Method that builds preprocessors/wrappers implemented by mango - def build_sklearn(self, preprocesso...
36764761418f13253359ead379c7af467a578ba7
<|skeleton|> class PreprocessorFactory: """Class used to build preprocessors""" def build_mangoml(self, preprocessor_id, preprocessor_params): """Method that builds preprocessors/wrappers implemented by mango""" <|body_0|> def build_sklearn(self, preprocessor_id, preprocessor_params): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PreprocessorFactory: """Class used to build preprocessors""" def build_mangoml(self, preprocessor_id, preprocessor_params): """Method that builds preprocessors/wrappers implemented by mango""" if preprocessor_id == 'mangoml_WordCountTransformer': return WordCountTransformer(**...
the_stack_v2_python_sparse
mangoml/mangoml/model/preprocessors/preprocessor_factory.py
gustavosantos/mango
train
0
c3530a98dd01e194c42c74c839482aad8ef88ca0
[ "true_data = ('Q4JUZ8', 'O27018', 'B7GCS7', 'B5FMN5', 'A9PQS5', 'C8A7E2', 'C5R887', 'C6QM83', 'A8XHC3', 'D1IMX6', 'D2I171', 'B3ZUA2', 'A8FYR2', 'A8NFC2', 'Q6CHT1', 'D2QE09', 'B0HSZ7', 'B2A7G7', 'Q4JUZ8', 'O27018', 'B7GCS7', 'B5FMN5', 'A9PQS5', 'C8A7E2', 'C9QA98')\nfor data in true_data:\n self.assertTrue(is_unip...
<|body_start_0|> true_data = ('Q4JUZ8', 'O27018', 'B7GCS7', 'B5FMN5', 'A9PQS5', 'C8A7E2', 'C5R887', 'C6QM83', 'A8XHC3', 'D1IMX6', 'D2I171', 'B3ZUA2', 'A8FYR2', 'A8NFC2', 'Q6CHT1', 'D2QE09', 'B0HSZ7', 'B2A7G7', 'Q4JUZ8', 'O27018', 'B7GCS7', 'B5FMN5', 'A9PQS5', 'C8A7E2', 'C9QA98') for data in true_data: ...
Legacy tests for PhyloFacts (Limahuli) System
IdentifiersAndAccessionsTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdentifiersAndAccessionsTest: """Legacy tests for PhyloFacts (Limahuli) System""" def test_uniprot_accessions(self): """Verify a sample of UniProt identifiers validate""" <|body_0|> def test_bogus_uniprot_accessions(self): """Verify that a sample of bad UniProt a...
stack_v2_sparse_classes_36k_train_025449
11,037
no_license
[ { "docstring": "Verify a sample of UniProt identifiers validate", "name": "test_uniprot_accessions", "signature": "def test_uniprot_accessions(self)" }, { "docstring": "Verify that a sample of bad UniProt accessions fail", "name": "test_bogus_uniprot_accessions", "signature": "def test_b...
4
null
Implement the Python class `IdentifiersAndAccessionsTest` described below. Class description: Legacy tests for PhyloFacts (Limahuli) System Method signatures and docstrings: - def test_uniprot_accessions(self): Verify a sample of UniProt identifiers validate - def test_bogus_uniprot_accessions(self): Verify that a sa...
Implement the Python class `IdentifiersAndAccessionsTest` described below. Class description: Legacy tests for PhyloFacts (Limahuli) System Method signatures and docstrings: - def test_uniprot_accessions(self): Verify a sample of UniProt identifiers validate - def test_bogus_uniprot_accessions(self): Verify that a sa...
bbf5df137a0a459598c3f9073d80f0086e5f7550
<|skeleton|> class IdentifiersAndAccessionsTest: """Legacy tests for PhyloFacts (Limahuli) System""" def test_uniprot_accessions(self): """Verify a sample of UniProt identifiers validate""" <|body_0|> def test_bogus_uniprot_accessions(self): """Verify that a sample of bad UniProt a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IdentifiersAndAccessionsTest: """Legacy tests for PhyloFacts (Limahuli) System""" def test_uniprot_accessions(self): """Verify a sample of UniProt identifiers validate""" true_data = ('Q4JUZ8', 'O27018', 'B7GCS7', 'B5FMN5', 'A9PQS5', 'C8A7E2', 'C5R887', 'C6QM83', 'A8XHC3', 'D1IMX6', 'D2I1...
the_stack_v2_python_sparse
pfacts003/utils/tests.py
berkeleyphylogenomics/BPG_utilities
train
1
2ac57ac4d6068159dbd7f33372238af32a5b7842
[ "super().__init__(api, coordinator, description)\nself._previous_uptime: str | None = None\nself._last_boot: datetime | None = None", "attr = getattr(self._api.information, self.entity_description.key)\nif attr is None:\n return None\nif self.entity_description.key == 'uptime':\n if self._previous_uptime is...
<|body_start_0|> super().__init__(api, coordinator, description) self._previous_uptime: str | None = None self._last_boot: datetime | None = None <|end_body_0|> <|body_start_1|> attr = getattr(self._api.information, self.entity_description.key) if attr is None: retur...
Representation a Synology information sensor.
SynoDSMInfoSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SynoDSMInfoSensor: """Representation a Synology information sensor.""" def __init__(self, api: SynoApi, coordinator: SynologyDSMCentralUpdateCoordinator, description: SynologyDSMSensorEntityDescription) -> None: """Initialize the Synology SynoDSMInfoSensor entity.""" <|body_0...
stack_v2_sparse_classes_36k_train_025450
15,893
permissive
[ { "docstring": "Initialize the Synology SynoDSMInfoSensor entity.", "name": "__init__", "signature": "def __init__(self, api: SynoApi, coordinator: SynologyDSMCentralUpdateCoordinator, description: SynologyDSMSensorEntityDescription) -> None" }, { "docstring": "Return the state.", "name": "n...
2
null
Implement the Python class `SynoDSMInfoSensor` described below. Class description: Representation a Synology information sensor. Method signatures and docstrings: - def __init__(self, api: SynoApi, coordinator: SynologyDSMCentralUpdateCoordinator, description: SynologyDSMSensorEntityDescription) -> None: Initialize t...
Implement the Python class `SynoDSMInfoSensor` described below. Class description: Representation a Synology information sensor. Method signatures and docstrings: - def __init__(self, api: SynoApi, coordinator: SynologyDSMCentralUpdateCoordinator, description: SynologyDSMSensorEntityDescription) -> None: Initialize t...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SynoDSMInfoSensor: """Representation a Synology information sensor.""" def __init__(self, api: SynoApi, coordinator: SynologyDSMCentralUpdateCoordinator, description: SynologyDSMSensorEntityDescription) -> None: """Initialize the Synology SynoDSMInfoSensor entity.""" <|body_0...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SynoDSMInfoSensor: """Representation a Synology information sensor.""" def __init__(self, api: SynoApi, coordinator: SynologyDSMCentralUpdateCoordinator, description: SynologyDSMSensorEntityDescription) -> None: """Initialize the Synology SynoDSMInfoSensor entity.""" super().__init__(api,...
the_stack_v2_python_sparse
homeassistant/components/synology_dsm/sensor.py
home-assistant/core
train
35,501
bb976bf58a7164c41d78134633e883e8b8bc9bf1
[ "value = {'fw_version': fw_version, 'on_schedule': on_time}\nid = self.client.api.create_changeset(JOB_FOTA_NAME, value, devices)\nreturn id", "status = self.client.api.get_current_device_status(device_id)\nmstatus = [self.prepare_model(s) for s in status]\nfor s in mstatus:\n if s.name == JOB_FOTA_NAME:\n ...
<|body_start_0|> value = {'fw_version': fw_version, 'on_schedule': on_time} id = self.client.api.create_changeset(JOB_FOTA_NAME, value, devices) return id <|end_body_0|> <|body_start_1|> status = self.client.api.get_current_device_status(device_id) mstatus = [self.prepare_model(...
FotaCollection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FotaCollection: def schedule(self, fw_version, devices, on_time=''): """Schedule a FOTA. Args: fw_version (str): Firmware version. devices (list of str): Targets devices. on_time (datetime): When to schedule the fota. Returns: A :py:class:`FotaModel` object. Raises: :py:class:`adm.errors...
stack_v2_sparse_classes_36k_train_025451
2,177
no_license
[ { "docstring": "Schedule a FOTA. Args: fw_version (str): Firmware version. devices (list of str): Targets devices. on_time (datetime): When to schedule the fota. Returns: A :py:class:`FotaModel` object. Raises: :py:class:`adm.errors.APIError` If the server returns an error.", "name": "schedule", "signat...
3
null
Implement the Python class `FotaCollection` described below. Class description: Implement the FotaCollection class. Method signatures and docstrings: - def schedule(self, fw_version, devices, on_time=''): Schedule a FOTA. Args: fw_version (str): Firmware version. devices (list of str): Targets devices. on_time (datet...
Implement the Python class `FotaCollection` described below. Class description: Implement the FotaCollection class. Method signatures and docstrings: - def schedule(self, fw_version, devices, on_time=''): Schedule a FOTA. Args: fw_version (str): Firmware version. devices (list of str): Targets devices. on_time (datet...
d27b0d6ee47b9c4f320f518705074f1032fedf8a
<|skeleton|> class FotaCollection: def schedule(self, fw_version, devices, on_time=''): """Schedule a FOTA. Args: fw_version (str): Firmware version. devices (list of str): Targets devices. on_time (datetime): When to schedule the fota. Returns: A :py:class:`FotaModel` object. Raises: :py:class:`adm.errors...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FotaCollection: def schedule(self, fw_version, devices, on_time=''): """Schedule a FOTA. Args: fw_version (str): Firmware version. devices (list of str): Targets devices. on_time (datetime): When to schedule the fota. Returns: A :py:class:`FotaModel` object. Raises: :py:class:`adm.errors.APIError` If ...
the_stack_v2_python_sparse
zdevicemanager/client/models/fota.py
zerynth/core-zerynth-toolchain
train
0
d5ddb217ce6ebb68f9b9a1047b0341748688c478
[ "self.logic = None\nself.environ = None\nself.actions = 0\nself.hasArrow = True", "self.environ = environment\nself.logic = logicEngine\nself.actions = 0\nself.hasArrow = True\nsuccess = False\ndead = False\ngoldFound = False\nx, y = (0, 0)\nwhile not goldFound and (not dead):\n breeze, stench, gilter = self.e...
<|body_start_0|> self.logic = None self.environ = None self.actions = 0 self.hasArrow = True <|end_body_0|> <|body_start_1|> self.environ = environment self.logic = logicEngine self.actions = 0 self.hasArrow = True success = False dead = F...
A hybrid agent that uses logic and a planner to work its way through the wumpus world
RandomAgent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomAgent: """A hybrid agent that uses logic and a planner to work its way through the wumpus world""" def __init__(self): """Initializes the agent""" <|body_0|> def search(self, environment, logicEngine): """Executes a random search for the gold""" <|b...
stack_v2_sparse_classes_36k_train_025452
1,170
no_license
[ { "docstring": "Initializes the agent", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Executes a random search for the gold", "name": "search", "signature": "def search(self, environment, logicEngine)" } ]
2
null
Implement the Python class `RandomAgent` described below. Class description: A hybrid agent that uses logic and a planner to work its way through the wumpus world Method signatures and docstrings: - def __init__(self): Initializes the agent - def search(self, environment, logicEngine): Executes a random search for th...
Implement the Python class `RandomAgent` described below. Class description: A hybrid agent that uses logic and a planner to work its way through the wumpus world Method signatures and docstrings: - def __init__(self): Initializes the agent - def search(self, environment, logicEngine): Executes a random search for th...
b20bb8af5d3ef0809811d01a73cb173d075c4c3e
<|skeleton|> class RandomAgent: """A hybrid agent that uses logic and a planner to work its way through the wumpus world""" def __init__(self): """Initializes the agent""" <|body_0|> def search(self, environment, logicEngine): """Executes a random search for the gold""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomAgent: """A hybrid agent that uses logic and a planner to work its way through the wumpus world""" def __init__(self): """Initializes the agent""" self.logic = None self.environ = None self.actions = 0 self.hasArrow = True def search(self, environment, l...
the_stack_v2_python_sparse
project4/randomAgent.py
mqtlam/osu-cs531
train
0
5b27f794883ed18b0c95360e6ea778cb50d750a2
[ "preorder = []\n\ndef traverse(root):\n if root is None:\n preorder.append('#')\n return\n preorder.append(root.val)\n traverse(root.left)\n traverse(root.right)\ntraverse(root)\nreturn ','.join([str(val) for val in preorder])", "if data == '':\n return None\npreorder = data.split(','...
<|body_start_0|> preorder = [] def traverse(root): if root is None: preorder.append('#') return preorder.append(root.val) traverse(root.left) traverse(root.right) traverse(root) return ','.join([str(val) for...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_025453
6,926
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_017508
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
0821af55eca60084b503b5f751301048c55e4381
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" preorder = [] def traverse(root): if root is None: preorder.append('#') return preorder.append(root.val) trav...
the_stack_v2_python_sparse
Hard/LC297.py
shuowenwei/LeetCodePython
train
2
511ba6bc33c3b211bf5bdf5d182e93513f0820ca
[ "if isinstance(configuration, dict):\n if strict:\n configuration = analysis_version.update_input_with_defaults(configuration)\n key_set = set(configuration.keys())\n if ignore_non_config:\n configuration_keys = analysis_version.input_specification.configuration_keys\n key_set = key_se...
<|body_start_0|> if isinstance(configuration, dict): if strict: configuration = analysis_version.update_input_with_defaults(configuration) key_set = set(configuration.keys()) if ignore_non_config: configuration_keys = analysis_version.input_spe...
Manager for the :class:`~django_analyses.models.run.Run` model. Handles the creation and retrieval of runs when :class:`~django_analyses.models.pipeline.node.Node` are executed.
RunManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunManager: """Manager for the :class:`~django_analyses.models.run.Run` model. Handles the creation and retrieval of runs when :class:`~django_analyses.models.pipeline.node.Node` are executed.""" def filter_by_configuration(self, analysis_version: AnalysisVersion, configuration: Union[Dict[s...
stack_v2_sparse_classes_36k_train_025454
10,200
permissive
[ { "docstring": "Returns a queryset of *analysis_version* runs matching the provided *configuration*. Parameters ---------- analysis_version : AnalysisVersion Analysis version runs to query configuration : Union[Dict[str, Any], Iterable[Dict[str, Any]]] Configuration options to filter by strict : bool, optional ...
4
null
Implement the Python class `RunManager` described below. Class description: Manager for the :class:`~django_analyses.models.run.Run` model. Handles the creation and retrieval of runs when :class:`~django_analyses.models.pipeline.node.Node` are executed. Method signatures and docstrings: - def filter_by_configuration(...
Implement the Python class `RunManager` described below. Class description: Manager for the :class:`~django_analyses.models.run.Run` model. Handles the creation and retrieval of runs when :class:`~django_analyses.models.pipeline.node.Node` are executed. Method signatures and docstrings: - def filter_by_configuration(...
5642579660fd09dde4a23bf02ec98a7ec264bceb
<|skeleton|> class RunManager: """Manager for the :class:`~django_analyses.models.run.Run` model. Handles the creation and retrieval of runs when :class:`~django_analyses.models.pipeline.node.Node` are executed.""" def filter_by_configuration(self, analysis_version: AnalysisVersion, configuration: Union[Dict[s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunManager: """Manager for the :class:`~django_analyses.models.run.Run` model. Handles the creation and retrieval of runs when :class:`~django_analyses.models.pipeline.node.Node` are executed.""" def filter_by_configuration(self, analysis_version: AnalysisVersion, configuration: Union[Dict[str, Any], Ite...
the_stack_v2_python_sparse
django_analyses/models/managers/run.py
TheLabbingProject/django_analyses
train
1
7d712f2a91abb98b510b193c3769ea0264d18af7
[ "db_obj = None\nif data.get('id') is not None:\n db_obj = cls.get(db=db, id=data['id'])\n identifier = data.get('id')\nelif data.get('key') is not None:\n db_obj = cls.get_by(db=db, field='key', value=data['key'])\n identifier = data.get('key')\nif db_obj:\n if db_obj.rule_id != data['rule_id']:\n ...
<|body_start_0|> db_obj = None if data.get('id') is not None: db_obj = cls.get(db=db, id=data['id']) identifier = data.get('id') elif data.get('key') is not None: db_obj = cls.get_by(db=db, field='key', value=data['key']) identifier = data.get('key...
Which data categories to apply the referenced Rule to
RuleTarget
[ "CC-BY-4.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RuleTarget: """Which data categories to apply the referenced Rule to""" def create_or_update(cls, db: Session, *, data: Dict[str, Any]) -> FidesopsBase: """An override of `FidesopsBase.create_or_update` that handles the specific edge case where a `RuleTarget` getting updated may be h...
stack_v2_sparse_classes_36k_train_025455
15,366
permissive
[ { "docstring": "An override of `FidesopsBase.create_or_update` that handles the specific edge case where a `RuleTarget` getting updated may be having its `rule_id` changed, potentially causing `RuleTarget`s to unexpectedly bounce between `Rule`s.", "name": "create_or_update", "signature": "def create_or...
4
stack_v2_sparse_classes_30k_train_013925
Implement the Python class `RuleTarget` described below. Class description: Which data categories to apply the referenced Rule to Method signatures and docstrings: - def create_or_update(cls, db: Session, *, data: Dict[str, Any]) -> FidesopsBase: An override of `FidesopsBase.create_or_update` that handles the specifi...
Implement the Python class `RuleTarget` described below. Class description: Which data categories to apply the referenced Rule to Method signatures and docstrings: - def create_or_update(cls, db: Session, *, data: Dict[str, Any]) -> FidesopsBase: An override of `FidesopsBase.create_or_update` that handles the specifi...
1ab840206a78e60673aebd5838ba567095512a58
<|skeleton|> class RuleTarget: """Which data categories to apply the referenced Rule to""" def create_or_update(cls, db: Session, *, data: Dict[str, Any]) -> FidesopsBase: """An override of `FidesopsBase.create_or_update` that handles the specific edge case where a `RuleTarget` getting updated may be h...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RuleTarget: """Which data categories to apply the referenced Rule to""" def create_or_update(cls, db: Session, *, data: Dict[str, Any]) -> FidesopsBase: """An override of `FidesopsBase.create_or_update` that handles the specific edge case where a `RuleTarget` getting updated may be having its `ru...
the_stack_v2_python_sparse
src/fidesops/models/policy.py
nathanawmk/fidesops
train
0
4cb80bf0b76dd6b8405d2b9fa83484b6bfe94cd0
[ "if count is None:\n qs = ''\nelse:\n qs = '?limit=%s' % count\nuri = '/%s%s' % (self.uri_base, qs)\nbody = {'ttl': ttl, 'grace': grace}\nresp, resp_body = self.api.method_post(uri, body=body)\nif resp.status_code == 204:\n return None\nhref = resp_body[0]['href']\nclaim_id = href.split('claim_id=')[-1]\nr...
<|body_start_0|> if count is None: qs = '' else: qs = '?limit=%s' % count uri = '/%s%s' % (self.uri_base, qs) body = {'ttl': ttl, 'grace': grace} resp, resp_body = self.api.method_post(uri, body=body) if resp.status_code == 204: return ...
Manager class for a Queue Claims.
QueueClaimManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueueClaimManager: """Manager class for a Queue Claims.""" def claim(self, ttl, grace, count=None): """Claims up to `count` unclaimed messages from this queue. If count is not specified, the default is to claim 10 messages. The `ttl` parameter specifies how long the server should wai...
stack_v2_sparse_classes_36k_train_025456
26,279
permissive
[ { "docstring": "Claims up to `count` unclaimed messages from this queue. If count is not specified, the default is to claim 10 messages. The `ttl` parameter specifies how long the server should wait before releasing the claim. The ttl value MUST be between 60 and 43200 seconds. The `grace` parameter is the mess...
2
stack_v2_sparse_classes_30k_test_000507
Implement the Python class `QueueClaimManager` described below. Class description: Manager class for a Queue Claims. Method signatures and docstrings: - def claim(self, ttl, grace, count=None): Claims up to `count` unclaimed messages from this queue. If count is not specified, the default is to claim 10 messages. The...
Implement the Python class `QueueClaimManager` described below. Class description: Manager class for a Queue Claims. Method signatures and docstrings: - def claim(self, ttl, grace, count=None): Claims up to `count` unclaimed messages from this queue. If count is not specified, the default is to claim 10 messages. The...
2397136b75e6fcc906ee406e9c1bc7aaef94387a
<|skeleton|> class QueueClaimManager: """Manager class for a Queue Claims.""" def claim(self, ttl, grace, count=None): """Claims up to `count` unclaimed messages from this queue. If count is not specified, the default is to claim 10 messages. The `ttl` parameter specifies how long the server should wai...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueueClaimManager: """Manager class for a Queue Claims.""" def claim(self, ttl, grace, count=None): """Claims up to `count` unclaimed messages from this queue. If count is not specified, the default is to claim 10 messages. The `ttl` parameter specifies how long the server should wait before rele...
the_stack_v2_python_sparse
pyrax/queueing.py
pycontribs/pyrax
train
10
b948b46f351388179dc76e1f7db4d562d85c0f3a
[ "super().__init__()\nself.type_ = type_\nself.op = op\nself.query = query\nself.description = description", "from norm.engine import ImplType\nlam = None\nif self.op == ImplType.ASS:\n lam = self.type_.execute(session, context)\n if lam is None:\n lam = Lambda(namespace=context.context_namespace, nam...
<|body_start_0|> super().__init__() self.type_ = type_ self.op = op self.query = query self.description = description <|end_body_0|> <|body_start_1|> from norm.engine import ImplType lam = None if self.op == ImplType.ASS: lam = self.type_.exec...
TypeImplementation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TypeImplementation: def __init__(self, type_, op, query, description): """The implementation of a type. Depending on the operation, it can be initial implementation or incremental implementation. :param type_: the type to implement :type type_: TypeName :param op: the operation of the im...
stack_v2_sparse_classes_36k_train_025457
1,927
permissive
[ { "docstring": "The implementation of a type. Depending on the operation, it can be initial implementation or incremental implementation. :param type_: the type to implement :type type_: TypeName :param op: the operation of the implementation, i.e., ['=', '|=', '&='] :type op: ImplType :param query: the query e...
2
stack_v2_sparse_classes_30k_train_000238
Implement the Python class `TypeImplementation` described below. Class description: Implement the TypeImplementation class. Method signatures and docstrings: - def __init__(self, type_, op, query, description): The implementation of a type. Depending on the operation, it can be initial implementation or incremental i...
Implement the Python class `TypeImplementation` described below. Class description: Implement the TypeImplementation class. Method signatures and docstrings: - def __init__(self, type_, op, query, description): The implementation of a type. Depending on the operation, it can be initial implementation or incremental i...
ff76e030d7cebdca51c72d5d7e789d90f0e1e565
<|skeleton|> class TypeImplementation: def __init__(self, type_, op, query, description): """The implementation of a type. Depending on the operation, it can be initial implementation or incremental implementation. :param type_: the type to implement :type type_: TypeName :param op: the operation of the im...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TypeImplementation: def __init__(self, type_, op, query, description): """The implementation of a type. Depending on the operation, it can be initial implementation or incremental implementation. :param type_: the type to implement :type type_: TypeName :param op: the operation of the implementation, ...
the_stack_v2_python_sparse
norm/executable/implementation.py
xumiao/supernorm
train
0
5fb80fbed65d0b1f9c8e4959dca6f16c5463f036
[ "self.capabilities = capabilities\nself.risk = (1 - R / 3) / (1 + R / 3)\nself.p_win = 0\nself.k_ab = 0\nself.total_utility = 0\nsuper().__init__(*args, **kwargs)", "adj_mat = nx.to_numpy_matrix(world.network)\npos_to_name = {}\nname_to_pos = {}\nfor i, node in enumerate(world.network.nodes()):\n pos_to_name[i...
<|body_start_0|> self.capabilities = capabilities self.risk = (1 - R / 3) / (1 + R / 3) self.p_win = 0 self.k_ab = 0 self.total_utility = 0 super().__init__(*args, **kwargs) <|end_body_0|> <|body_start_1|> adj_mat = nx.to_numpy_matrix(world.network) pos_t...
Base class.
WarAgent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WarAgent: """Base class.""" def __init__(self, capabilities, R, *args, **kwargs): """New WarAgent""" <|body_0|> def start_conflict(self, world, rival): """Called at the beginning of a sub-model run to compute the utility and percieved probability of winning for t...
stack_v2_sparse_classes_36k_train_025458
12,998
no_license
[ { "docstring": "New WarAgent", "name": "__init__", "signature": "def __init__(self, capabilities, R, *args, **kwargs)" }, { "docstring": "Called at the beginning of a sub-model run to compute the utility and percieved probability of winning for the agent.", "name": "start_conflict", "sig...
2
null
Implement the Python class `WarAgent` described below. Class description: Base class. Method signatures and docstrings: - def __init__(self, capabilities, R, *args, **kwargs): New WarAgent - def start_conflict(self, world, rival): Called at the beginning of a sub-model run to compute the utility and percieved probabi...
Implement the Python class `WarAgent` described below. Class description: Base class. Method signatures and docstrings: - def __init__(self, capabilities, R, *args, **kwargs): New WarAgent - def start_conflict(self, world, rival): Called at the beginning of a sub-model run to compute the utility and percieved probabi...
5e9a0e03aa7ddf5e5ddf89943ccc68d94b539e95
<|skeleton|> class WarAgent: """Base class.""" def __init__(self, capabilities, R, *args, **kwargs): """New WarAgent""" <|body_0|> def start_conflict(self, world, rival): """Called at the beginning of a sub-model run to compute the utility and percieved probability of winning for t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WarAgent: """Base class.""" def __init__(self, capabilities, R, *args, **kwargs): """New WarAgent""" self.capabilities = capabilities self.risk = (1 - R / 3) / (1 + R / 3) self.p_win = 0 self.k_ab = 0 self.total_utility = 0 super().__init__(*args, *...
the_stack_v2_python_sparse
Predicting_Politics_Mesquita/Agents-In-Conflict-master/Code/WarReason/models/war_reason_model/war_reason.py
burakbayramli/books
train
223
7e235e3e8e74ecb32ce189a3f8af9ae7ec2bceaf
[ "string = string.strip()\nsort_name, birth, death = cls._get_lifespan(string)\nextra = dict()\nif birth is not None:\n extra[Contributor.BIRTH_DATE] = birth\nif death is not None:\n extra[Contributor.DEATH_DATE] = death\nreturn ContributorData(sort_name=sort_name, extra=extra)", "birth = None\ndeath = None\...
<|body_start_0|> string = string.strip() sort_name, birth, death = cls._get_lifespan(string) extra = dict() if birth is not None: extra[Contributor.BIRTH_DATE] = birth if death is not None: extra[Contributor.DEATH_DATE] = death return ContributorDa...
Parse VIAF-style personal names. These are used by VIAF but also (in slightly modified form) by OCLC Classify. TODO: VIAFParser has its own "name parsing" code which focuses on extractingdata from the XML generated by the VIAF API. These code bases need to be merged.
NameParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NameParser: """Parse VIAF-style personal names. These are used by VIAF but also (in slightly modified form) by OCLC Classify. TODO: VIAFParser has its own "name parsing" code which focuses on extractingdata from the XML generated by the VIAF API. These code bases need to be merged.""" def pa...
stack_v2_sparse_classes_36k_train_025459
40,883
permissive
[ { "docstring": "Parse a string into a ContributorData object. This may include sort_name, birth_date, and death_date.", "name": "parse", "signature": "def parse(cls, string)" }, { "docstring": "Extract a possible lifespan from an author string. :return: A 3-tuple (name_without_lifespan, birth, d...
2
null
Implement the Python class `NameParser` described below. Class description: Parse VIAF-style personal names. These are used by VIAF but also (in slightly modified form) by OCLC Classify. TODO: VIAFParser has its own "name parsing" code which focuses on extractingdata from the XML generated by the VIAF API. These code ...
Implement the Python class `NameParser` described below. Class description: Parse VIAF-style personal names. These are used by VIAF but also (in slightly modified form) by OCLC Classify. TODO: VIAFParser has its own "name parsing" code which focuses on extractingdata from the XML generated by the VIAF API. These code ...
0ab8add4890280334779ba0862eb9290ab792bb5
<|skeleton|> class NameParser: """Parse VIAF-style personal names. These are used by VIAF but also (in slightly modified form) by OCLC Classify. TODO: VIAFParser has its own "name parsing" code which focuses on extractingdata from the XML generated by the VIAF API. These code bases need to be merged.""" def pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NameParser: """Parse VIAF-style personal names. These are used by VIAF but also (in slightly modified form) by OCLC Classify. TODO: VIAFParser has its own "name parsing" code which focuses on extractingdata from the XML generated by the VIAF API. These code bases need to be merged.""" def parse(cls, stri...
the_stack_v2_python_sparse
viaf.py
NYPL-Simplified/metadata_wrangler
train
6
2b5ff03bc155daaece7585ef8a03299574061b3a
[ "super().__init__(dev=dev, qubits=qubits, **kw)\nself.index_iteration = 1\nself.index_spectroscopy = 1\nself.previous_freqs = {qb.name: qb.ge_freq() for qb in qubits}\nself.results = {}\nself.final_init(**kw)", "super().create_routine_template()\nfor i in range(self.get_param_value('n_spectroscopies', default=2))...
<|body_start_0|> super().__init__(dev=dev, qubits=qubits, **kw) self.index_iteration = 1 self.index_spectroscopy = 1 self.previous_freqs = {qb.name: qb.ge_freq() for qb in qubits} self.results = {} self.final_init(**kw) <|end_body_0|> <|body_start_1|> super().cre...
Routine to find the ge transition frequency via qubit spectroscopy. A series of qubit spectroscopies is performed. A Decision step decides whether a fit failed for some qubits and whether to rerun the spectroscopy for them. The user can specify the number of spectroscopies via the keyword "n_spectroscopies" in the conf...
AdaptiveQubitSpectroscopy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdaptiveQubitSpectroscopy: """Routine to find the ge transition frequency via qubit spectroscopy. A series of qubit spectroscopies is performed. A Decision step decides whether a fit failed for some qubits and whether to rerun the spectroscopy for them. The user can specify the number of spectros...
stack_v2_sparse_classes_36k_train_025460
24,662
permissive
[ { "docstring": "Initialize the AdaptiveQubitSpectroscopy routine. Args: dev (Device): Device to be used for the routine qubits (list): The qubits which should be calibrated. By default, all qubits of the device are selected. Configuration parameters (coming from the configuration parameter dictionary): n_spectr...
3
stack_v2_sparse_classes_30k_train_020194
Implement the Python class `AdaptiveQubitSpectroscopy` described below. Class description: Routine to find the ge transition frequency via qubit spectroscopy. A series of qubit spectroscopies is performed. A Decision step decides whether a fit failed for some qubits and whether to rerun the spectroscopy for them. The ...
Implement the Python class `AdaptiveQubitSpectroscopy` described below. Class description: Routine to find the ge transition frequency via qubit spectroscopy. A series of qubit spectroscopies is performed. A Decision step decides whether a fit failed for some qubits and whether to rerun the spectroscopy for them. The ...
bc6733d774fe31a23f4c7e73e5eb0beed8d30e7d
<|skeleton|> class AdaptiveQubitSpectroscopy: """Routine to find the ge transition frequency via qubit spectroscopy. A series of qubit spectroscopies is performed. A Decision step decides whether a fit failed for some qubits and whether to rerun the spectroscopy for them. The user can specify the number of spectros...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdaptiveQubitSpectroscopy: """Routine to find the ge transition frequency via qubit spectroscopy. A series of qubit spectroscopies is performed. A Decision step decides whether a fit failed for some qubits and whether to rerun the spectroscopy for them. The user can specify the number of spectroscopies via th...
the_stack_v2_python_sparse
pycqed/measurement/calibration/automatic_calibration_routines/adaptive_qubit_spectroscopy.py
QudevETH/PycQED_py3
train
8
484d0c0e3ae779ca662c3578876853f4a116d9cf
[ "logging.debug('Loading features from %s', endpath(featmap.dirname()))\nself.rdonly = rdonly\nself.featmap = FeatureMapping(featmap)\nself.featuredb = FeatureVectors(featdb)\nself.fstream = FeatureStream(fstream, rdonly)\nself.featurespace = featurespace", "base = rc.articles_home / featurespace\nif not base.exis...
<|body_start_0|> logging.debug('Loading features from %s', endpath(featmap.dirname())) self.rdonly = rdonly self.featmap = FeatureMapping(featmap) self.featuredb = FeatureVectors(featdb) self.fstream = FeatureStream(fstream, rdonly) self.featurespace = featurespace <|end_...
Wraps the L{FeatureMapping}, L{FeatureVectors} and L{FeatureStream} objects. There may be multiple L{FeatureData} indexes for the same database of articles, depending on the choice of feature extraction method. @ivar featmap: L{FeatureMapping} between feature names and feature IDs. @ivar featuredb: L{FeatureVectors} to...
FeatureData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureData: """Wraps the L{FeatureMapping}, L{FeatureVectors} and L{FeatureStream} objects. There may be multiple L{FeatureData} indexes for the same database of articles, depending on the choice of feature extraction method. @ivar featmap: L{FeatureMapping} between feature names and feature IDs...
stack_v2_sparse_classes_36k_train_025461
8,507
no_license
[ { "docstring": "Constructor. @param featmap: Path to FeatureMapping. @param featdb: Path to FeatureVectors. @param fstream: Path to FeatureStream.", "name": "__init__", "signature": "def __init__(self, featmap, featdb, fstream, featurespace, rdonly=True)" }, { "docstring": "Initialise L{FeatureD...
6
stack_v2_sparse_classes_30k_train_000455
Implement the Python class `FeatureData` described below. Class description: Wraps the L{FeatureMapping}, L{FeatureVectors} and L{FeatureStream} objects. There may be multiple L{FeatureData} indexes for the same database of articles, depending on the choice of feature extraction method. @ivar featmap: L{FeatureMapping...
Implement the Python class `FeatureData` described below. Class description: Wraps the L{FeatureMapping}, L{FeatureVectors} and L{FeatureStream} objects. There may be multiple L{FeatureData} indexes for the same database of articles, depending on the choice of feature extraction method. @ivar featmap: L{FeatureMapping...
a91b94917404f92c97eaa814ebaa3180af17be61
<|skeleton|> class FeatureData: """Wraps the L{FeatureMapping}, L{FeatureVectors} and L{FeatureStream} objects. There may be multiple L{FeatureData} indexes for the same database of articles, depending on the choice of feature extraction method. @ivar featmap: L{FeatureMapping} between feature names and feature IDs...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureData: """Wraps the L{FeatureMapping}, L{FeatureVectors} and L{FeatureStream} objects. There may be multiple L{FeatureData} indexes for the same database of articles, depending on the choice of feature extraction method. @ivar featmap: L{FeatureMapping} between feature names and feature IDs. @ivar featu...
the_stack_v2_python_sparse
medline/FeatureData.py
gpoulter/mscanner
train
1
67f363ce27fd222fe32ca451394d9054c509e3a5
[ "if not issparse(data):\n return False\nif data.dtype.char in UNSUPPORTED_NUMERIC_TYPE_CODES:\n return False\nreturn np.issubdtype(data.dtype, np.number)", "self.sparse = 'yes'\ndata = self.data.tocoo()\nif np.issubdtype(self.data.dtype, np.complexfloating):\n self.complex = 'yes'\n self.array_size = ...
<|body_start_0|> if not issparse(data): return False if data.dtype.char in UNSUPPORTED_NUMERIC_TYPE_CODES: return False return np.issubdtype(data.dtype, np.number) <|end_body_0|> <|body_start_1|> self.sparse = 'yes' data = self.data.tocoo() if np....
Inserter for sparse, numeric arrays.
SparseInserter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparseInserter: """Inserter for sparse, numeric arrays.""" def can_insert(data): """Can insert numeric scalars.""" <|body_0|> def prepare_data(self): """Records RecordSize metadata.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not issparse...
stack_v2_sparse_classes_36k_train_025462
3,589
permissive
[ { "docstring": "Can insert numeric scalars.", "name": "can_insert", "signature": "def can_insert(data)" }, { "docstring": "Records RecordSize metadata.", "name": "prepare_data", "signature": "def prepare_data(self)" } ]
2
stack_v2_sparse_classes_30k_train_013286
Implement the Python class `SparseInserter` described below. Class description: Inserter for sparse, numeric arrays. Method signatures and docstrings: - def can_insert(data): Can insert numeric scalars. - def prepare_data(self): Records RecordSize metadata.
Implement the Python class `SparseInserter` described below. Class description: Inserter for sparse, numeric arrays. Method signatures and docstrings: - def can_insert(data): Can insert numeric scalars. - def prepare_data(self): Records RecordSize metadata. <|skeleton|> class SparseInserter: """Inserter for spar...
5923798f61c80771d69ff7500446b711921159a7
<|skeleton|> class SparseInserter: """Inserter for sparse, numeric arrays.""" def can_insert(data): """Can insert numeric scalars.""" <|body_0|> def prepare_data(self): """Records RecordSize metadata.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SparseInserter: """Inserter for sparse, numeric arrays.""" def can_insert(data): """Can insert numeric scalars.""" if not issparse(data): return False if data.dtype.char in UNSUPPORTED_NUMERIC_TYPE_CODES: return False return np.issubdtype(data.dtype...
the_stack_v2_python_sparse
sdafile/numeric_inserter.py
enthought/sandia-data-archive
train
0
84efa6791d6b095b31ea29e21f30daa52318552d
[ "self.num = 0\n\ndef inner_order(root):\n if root is None:\n return\n inner_order(root.right)\n self.num += root.val\n root.val = self.num\n inner_order(root.left)\ninner_order(root)", "order_list = []\n\ndef inner_order(root, order_list):\n if root is None:\n return None\n inne...
<|body_start_0|> self.num = 0 def inner_order(root): if root is None: return inner_order(root.right) self.num += root.val root.val = self.num inner_order(root.left) inner_order(root) <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def convertBST(self, root: TreeNode) -> TreeNode: """方案:中序遍历""" <|body_0|> def convertBST_v2(self, root: TreeNode) -> TreeNode: """方案:中序遍历,逆序叠加""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.num = 0 def inner_order(root): ...
stack_v2_sparse_classes_36k_train_025463
1,910
no_license
[ { "docstring": "方案:中序遍历", "name": "convertBST", "signature": "def convertBST(self, root: TreeNode) -> TreeNode" }, { "docstring": "方案:中序遍历,逆序叠加", "name": "convertBST_v2", "signature": "def convertBST_v2(self, root: TreeNode) -> TreeNode" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def convertBST(self, root: TreeNode) -> TreeNode: 方案:中序遍历 - def convertBST_v2(self, root: TreeNode) -> TreeNode: 方案:中序遍历,逆序叠加
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def convertBST(self, root: TreeNode) -> TreeNode: 方案:中序遍历 - def convertBST_v2(self, root: TreeNode) -> TreeNode: 方案:中序遍历,逆序叠加 <|skeleton|> class Solution: def convertBST(se...
2e81b871bf1db7ea7432d1ebf889c72066e64753
<|skeleton|> class Solution: def convertBST(self, root: TreeNode) -> TreeNode: """方案:中序遍历""" <|body_0|> def convertBST_v2(self, root: TreeNode) -> TreeNode: """方案:中序遍历,逆序叠加""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def convertBST(self, root: TreeNode) -> TreeNode: """方案:中序遍历""" self.num = 0 def inner_order(root): if root is None: return inner_order(root.right) self.num += root.val root.val = self.num inner_orde...
the_stack_v2_python_sparse
Tree/convertBST.py
NextNight/LeetCodeAndStructAndAlgorithm
train
0
4b11bbaaaa2c3d8554f629fa6da538eead1ae024
[ "chr_location = models.ChromosomeLocation(species_id='taxonomy:9606', chr=location['chr'], interval=models.CytobandInterval(start=location['start'], end=location['end']))\nchr_location._id = ga4gh_identify(chr_location)\nreturn chr_location.as_dict()", "if 'chr' in location and 'start' in location and ('end' in l...
<|body_start_0|> chr_location = models.ChromosomeLocation(species_id='taxonomy:9606', chr=location['chr'], interval=models.CytobandInterval(start=location['start'], end=location['end'])) chr_location._id = ga4gh_identify(chr_location) return chr_location.as_dict() <|end_body_0|> <|body_start_1|...
The class for GA4GH Chromosome Location.
ChromosomeLocation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChromosomeLocation: """The class for GA4GH Chromosome Location.""" def add_location(self, location): """Get a gene's Chromosome Location. :param dict location: A gene's location. :return: A dictionary of a GA4GH VRS ChromosomeLocation.""" <|body_0|> def get_location(self...
stack_v2_sparse_classes_36k_train_025464
3,279
permissive
[ { "docstring": "Get a gene's Chromosome Location. :param dict location: A gene's location. :return: A dictionary of a GA4GH VRS ChromosomeLocation.", "name": "add_location", "signature": "def add_location(self, location)" }, { "docstring": "Transform a gene's location into a Chromosome Location....
3
stack_v2_sparse_classes_30k_val_001179
Implement the Python class `ChromosomeLocation` described below. Class description: The class for GA4GH Chromosome Location. Method signatures and docstrings: - def add_location(self, location): Get a gene's Chromosome Location. :param dict location: A gene's location. :return: A dictionary of a GA4GH VRS ChromosomeL...
Implement the Python class `ChromosomeLocation` described below. Class description: The class for GA4GH Chromosome Location. Method signatures and docstrings: - def add_location(self, location): Get a gene's Chromosome Location. :param dict location: A gene's location. :return: A dictionary of a GA4GH VRS ChromosomeL...
6dd633c2590aa6a40247b1b48c2e3381225d89ab
<|skeleton|> class ChromosomeLocation: """The class for GA4GH Chromosome Location.""" def add_location(self, location): """Get a gene's Chromosome Location. :param dict location: A gene's location. :return: A dictionary of a GA4GH VRS ChromosomeLocation.""" <|body_0|> def get_location(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChromosomeLocation: """The class for GA4GH Chromosome Location.""" def add_location(self, location): """Get a gene's Chromosome Location. :param dict location: A gene's location. :return: A dictionary of a GA4GH VRS ChromosomeLocation.""" chr_location = models.ChromosomeLocation(species_i...
the_stack_v2_python_sparse
gene/vrs_locations/chromosome_location.py
richardhj/gene-normalization
train
0
9775c895efff4add3dfa347a907b5f3cc7bf0bc2
[ "url = response.url\nself.logger.info('Response url is %s' % url)\nnext_btn = response.xpath('//a[contains(.//text(),\"下一页\")]/@href').extract_first()\nif next_btn:\n next_page = parse.urljoin(url, next_btn)\n yield Request(next_page, callback=self.parse)\ncoding_list = response.xpath('//div[@class=\"shizhan-...
<|body_start_0|> url = response.url self.logger.info('Response url is %s' % url) next_btn = response.xpath('//a[contains(.//text(),"下一页")]/@href').extract_first() if next_btn: next_page = parse.urljoin(url, next_btn) yield Request(next_page, callback=self.parse) ...
CodingSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CodingSpider: def parse(self, response): """抓取课程列表页面""" <|body_0|> def parse_detail(self, response): """抓取课程详情页面""" <|body_1|> <|end_skeleton|> <|body_start_0|> url = response.url self.logger.info('Response url is %s' % url) next_btn...
stack_v2_sparse_classes_36k_train_025465
3,795
no_license
[ { "docstring": "抓取课程列表页面", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "抓取课程详情页面", "name": "parse_detail", "signature": "def parse_detail(self, response)" } ]
2
stack_v2_sparse_classes_30k_train_017445
Implement the Python class `CodingSpider` described below. Class description: Implement the CodingSpider class. Method signatures and docstrings: - def parse(self, response): 抓取课程列表页面 - def parse_detail(self, response): 抓取课程详情页面
Implement the Python class `CodingSpider` described below. Class description: Implement the CodingSpider class. Method signatures and docstrings: - def parse(self, response): 抓取课程列表页面 - def parse_detail(self, response): 抓取课程详情页面 <|skeleton|> class CodingSpider: def parse(self, response): """抓取课程列表页面""" ...
f4d6a6b9bb9fd68ad3f336aa3350a22844b9ddb2
<|skeleton|> class CodingSpider: def parse(self, response): """抓取课程列表页面""" <|body_0|> def parse_detail(self, response): """抓取课程详情页面""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CodingSpider: def parse(self, response): """抓取课程列表页面""" url = response.url self.logger.info('Response url is %s' % url) next_btn = response.xpath('//a[contains(.//text(),"下一页")]/@href').extract_first() if next_btn: next_page = parse.urljoin(url, next_btn) ...
the_stack_v2_python_sparse
scrapys/imooc/imooc/spiders/coding.py
jinjin123/CodeRecordAsPython
train
1
a45759a94a84e722f6b1cc73ed9c5055a652bf9a
[ "if not isinstance(items, list):\n items = [items]\nresponses = []\ntry:\n table = DYNAMO_DB.Table(table_name)\nexcept Exception as e:\n Logger.e('DynamoDB#put_item', f'Failed at DYNAMO_DB.Table(table_name) : {e}')\n raise e\nif use_batch_writer:\n with table.batch_writer() as batch:\n for ite...
<|body_start_0|> if not isinstance(items, list): items = [items] responses = [] try: table = DYNAMO_DB.Table(table_name) except Exception as e: Logger.e('DynamoDB#put_item', f'Failed at DYNAMO_DB.Table(table_name) : {e}') raise e if...
DynamoDB
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynamoDB: def put_items(table_name: str, items: List[Dict], use_batch_writer: bool=False) -> List: """[summary] Args: table_name (str): [description] items (List[Dict]): [description] Raises: e: [description] Returns: List: [description]""" <|body_0|> def partitionkey_query(...
stack_v2_sparse_classes_36k_train_025466
2,734
no_license
[ { "docstring": "[summary] Args: table_name (str): [description] items (List[Dict]): [description] Raises: e: [description] Returns: List: [description]", "name": "put_items", "signature": "def put_items(table_name: str, items: List[Dict], use_batch_writer: bool=False) -> List" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_val_000487
Implement the Python class `DynamoDB` described below. Class description: Implement the DynamoDB class. Method signatures and docstrings: - def put_items(table_name: str, items: List[Dict], use_batch_writer: bool=False) -> List: [summary] Args: table_name (str): [description] items (List[Dict]): [description] Raises:...
Implement the Python class `DynamoDB` described below. Class description: Implement the DynamoDB class. Method signatures and docstrings: - def put_items(table_name: str, items: List[Dict], use_batch_writer: bool=False) -> List: [summary] Args: table_name (str): [description] items (List[Dict]): [description] Raises:...
f8b3f30920825e35fbaca9c28d9ef9ae134b8d66
<|skeleton|> class DynamoDB: def put_items(table_name: str, items: List[Dict], use_batch_writer: bool=False) -> List: """[summary] Args: table_name (str): [description] items (List[Dict]): [description] Raises: e: [description] Returns: List: [description]""" <|body_0|> def partitionkey_query(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DynamoDB: def put_items(table_name: str, items: List[Dict], use_batch_writer: bool=False) -> List: """[summary] Args: table_name (str): [description] items (List[Dict]): [description] Raises: e: [description] Returns: List: [description]""" if not isinstance(items, list): items = [...
the_stack_v2_python_sparse
fin_app/database/nosql/dynamodb.py
pondelion/FinAppBackend
train
0
d1824c9697eef4fc236e87df0b11aa251c719efa
[ "self.position_hash = {}\nself.hashwa = {}\nself.min = float('inf')\nself.max = -1", "for w in dict:\n self.min = min(self.min, len(w))\n self.max = max(self.max, len(w))\n for pos, char in enumerate(w):\n if pos not in self.position_hash:\n self.position_hash[pos] = set()\n self...
<|body_start_0|> self.position_hash = {} self.hashwa = {} self.min = float('inf') self.max = -1 <|end_body_0|> <|body_start_1|> for w in dict: self.min = min(self.min, len(w)) self.max = max(self.max, len(w)) for pos, char in enumerate(w): ...
MagicDictionary
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MagicDictionary: def __init__(self): """Initialize your data structure here.""" <|body_0|> def buildDict(self, dict): """Build a dictionary through a list of words :type dict: List[str] :rtype: void""" <|body_1|> def search(self, word): """Return...
stack_v2_sparse_classes_36k_train_025467
2,297
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Build a dictionary through a list of words :type dict: List[str] :rtype: void", "name": "buildDict", "signature": "def buildDict(self, dict)" }, { "docs...
3
stack_v2_sparse_classes_30k_val_000761
Implement the Python class `MagicDictionary` described below. Class description: Implement the MagicDictionary class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def buildDict(self, dict): Build a dictionary through a list of words :type dict: List[str] :rtype: void ...
Implement the Python class `MagicDictionary` described below. Class description: Implement the MagicDictionary class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def buildDict(self, dict): Build a dictionary through a list of words :type dict: List[str] :rtype: void ...
5feb84672630a97e6af3a0327cea5c58a6fa7563
<|skeleton|> class MagicDictionary: def __init__(self): """Initialize your data structure here.""" <|body_0|> def buildDict(self, dict): """Build a dictionary through a list of words :type dict: List[str] :rtype: void""" <|body_1|> def search(self, word): """Return...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MagicDictionary: def __init__(self): """Initialize your data structure here.""" self.position_hash = {} self.hashwa = {} self.min = float('inf') self.max = -1 def buildDict(self, dict): """Build a dictionary through a list of words :type dict: List[str] :rt...
the_stack_v2_python_sparse
Adhoc/Implement-Magic-Dictionary/location_hash_solution.py
Aditya0025/CoderChef-Kitchen
train
1
4465bedab331f4fc1378cddb2d4933ed199d76f4
[ "super(DNET_BAW, self).__init__()\nself.nc = 1\nself.ef_dim = nef\nself.df_dim = ndf\nself.define_module()", "ndf = self.df_dim\nself.netD_1 = nn.Sequential(conv4x4(self.nc, ndf), nn.LeakyReLU(negative_slope=0.2, inplace=True), conv4x4(ndf, ndf), nn.LeakyReLU(negative_slope=0.2, inplace=True), conv4x4(ndf, ndf * ...
<|body_start_0|> super(DNET_BAW, self).__init__() self.nc = 1 self.ef_dim = nef self.df_dim = ndf self.define_module() <|end_body_0|> <|body_start_1|> ndf = self.df_dim self.netD_1 = nn.Sequential(conv4x4(self.nc, ndf), nn.LeakyReLU(negative_slope=0.2, inplace=Tr...
Discriminator class for the Black and White stage. Args: - ndf (int, optional): dimension of Black and White discriminator's filters. (Default: 64) - nef (int, optional): Projected embeddings dimensions. (Default: 128)
DNET_BAW
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DNET_BAW: """Discriminator class for the Black and White stage. Args: - ndf (int, optional): dimension of Black and White discriminator's filters. (Default: 64) - nef (int, optional): Projected embeddings dimensions. (Default: 128)""" def __init__(self, ndf=64, nef=128): """Initializ...
stack_v2_sparse_classes_36k_train_025468
22,492
no_license
[ { "docstring": "Initialize the Black and White stage discriminator. Other attributes: - nc (int): Number of channels.", "name": "__init__", "signature": "def __init__(self, ndf=64, nef=128)" }, { "docstring": "Define the ENCOLOR discriminator module.", "name": "define_module", "signature...
3
stack_v2_sparse_classes_30k_train_016875
Implement the Python class `DNET_BAW` described below. Class description: Discriminator class for the Black and White stage. Args: - ndf (int, optional): dimension of Black and White discriminator's filters. (Default: 64) - nef (int, optional): Projected embeddings dimensions. (Default: 128) Method signatures and doc...
Implement the Python class `DNET_BAW` described below. Class description: Discriminator class for the Black and White stage. Args: - ndf (int, optional): dimension of Black and White discriminator's filters. (Default: 64) - nef (int, optional): Projected embeddings dimensions. (Default: 128) Method signatures and doc...
70d344d80425e7bbcc7984737dbe50a6638293c9
<|skeleton|> class DNET_BAW: """Discriminator class for the Black and White stage. Args: - ndf (int, optional): dimension of Black and White discriminator's filters. (Default: 64) - nef (int, optional): Projected embeddings dimensions. (Default: 128)""" def __init__(self, ndf=64, nef=128): """Initializ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DNET_BAW: """Discriminator class for the Black and White stage. Args: - ndf (int, optional): dimension of Black and White discriminator's filters. (Default: 64) - nef (int, optional): Projected embeddings dimensions. (Default: 128)""" def __init__(self, ndf=64, nef=128): """Initialize the Black a...
the_stack_v2_python_sparse
TeleGAN/model.py
ails-lab/teleGAN
train
1
58125ed5a79e1560775737532faec1359f4480de
[ "dat = pd.read_csv(src, delimiter=',')\nnp_list = np.array(dat.as_matrix())\nreturn np_list", "with open(src, 'r') as input:\n reader = csv.reader(input, delimiter=',')\n data_holder = []\n for index, row in enumerate(reader):\n print('Reading index#' + str(index))\n data = []\n for ...
<|body_start_0|> dat = pd.read_csv(src, delimiter=',') np_list = np.array(dat.as_matrix()) return np_list <|end_body_0|> <|body_start_1|> with open(src, 'r') as input: reader = csv.reader(input, delimiter=',') data_holder = [] for index, row in enumer...
CSVReader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSVReader: def csv_to_numpy_list(self, src): """Grabs csv file and return numpy list Args: stc(str): Csv file location Returns: np_list(np(list)): numpy containing csv data""" <|body_0|> def csv_to_list(self, src): """Grabs csv file and return 2 dimension list Args: ...
stack_v2_sparse_classes_36k_train_025469
2,803
no_license
[ { "docstring": "Grabs csv file and return numpy list Args: stc(str): Csv file location Returns: np_list(np(list)): numpy containing csv data", "name": "csv_to_numpy_list", "signature": "def csv_to_numpy_list(self, src)" }, { "docstring": "Grabs csv file and return 2 dimension list Args: src(str)...
5
stack_v2_sparse_classes_30k_train_016312
Implement the Python class `CSVReader` described below. Class description: Implement the CSVReader class. Method signatures and docstrings: - def csv_to_numpy_list(self, src): Grabs csv file and return numpy list Args: stc(str): Csv file location Returns: np_list(np(list)): numpy containing csv data - def csv_to_list...
Implement the Python class `CSVReader` described below. Class description: Implement the CSVReader class. Method signatures and docstrings: - def csv_to_numpy_list(self, src): Grabs csv file and return numpy list Args: stc(str): Csv file location Returns: np_list(np(list)): numpy containing csv data - def csv_to_list...
1cd33aa6c5dd08b29c14b55e24c2f4ee66203a08
<|skeleton|> class CSVReader: def csv_to_numpy_list(self, src): """Grabs csv file and return numpy list Args: stc(str): Csv file location Returns: np_list(np(list)): numpy containing csv data""" <|body_0|> def csv_to_list(self, src): """Grabs csv file and return 2 dimension list Args: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CSVReader: def csv_to_numpy_list(self, src): """Grabs csv file and return numpy list Args: stc(str): Csv file location Returns: np_list(np(list)): numpy containing csv data""" dat = pd.read_csv(src, delimiter=',') np_list = np.array(dat.as_matrix()) return np_list def csv_...
the_stack_v2_python_sparse
dataset_generator/lib/CSVReader.py
amumu/noox_project_ai
train
0
d98f5c7d16d712221c0ea840e8d828f773728611
[ "self.moles_base = moles_base\nself.moles_mapping_url = f'{moles_base}/api/v0/obs/all'\nif MOLES_MAPPING_FILE:\n with open(MOLES_MAPPING_FILE) as reader:\n self.moles_mapping = json.load(reader)\nelse:\n try:\n self.moles_mapping = requests.get(self.moles_mapping_url).json()\n except JSONDeco...
<|body_start_0|> self.moles_base = moles_base self.moles_mapping_url = f'{moles_base}/api/v0/obs/all' if MOLES_MAPPING_FILE: with open(MOLES_MAPPING_FILE) as reader: self.moles_mapping = json.load(reader) else: try: self.moles_mappi...
Class to map a filepath to the relate MOLES record :param moles_base: Base URL to the MOLES api server (default: http://api.catalogue.ceda.ac.uk). :type moles_base: str
CatalogueDatasets
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CatalogueDatasets: """Class to map a filepath to the relate MOLES record :param moles_base: Base URL to the MOLES api server (default: http://api.catalogue.ceda.ac.uk). :type moles_base: str""" def __init__(self, moles_base='http://api.catalogue.ceda.ac.uk'): """:param moles_base: Th...
stack_v2_sparse_classes_36k_train_025470
3,204
permissive
[ { "docstring": ":param moles_base: The base URL for the MOLES API server :type moles_base: str", "name": "__init__", "signature": "def __init__(self, moles_base='http://api.catalogue.ceda.ac.uk')" }, { "docstring": "Try and find metadata for a MOLES record associated with the path. Example API r...
2
stack_v2_sparse_classes_30k_train_015717
Implement the Python class `CatalogueDatasets` described below. Class description: Class to map a filepath to the relate MOLES record :param moles_base: Base URL to the MOLES api server (default: http://api.catalogue.ceda.ac.uk). :type moles_base: str Method signatures and docstrings: - def __init__(self, moles_base=...
Implement the Python class `CatalogueDatasets` described below. Class description: Class to map a filepath to the relate MOLES record :param moles_base: Base URL to the MOLES api server (default: http://api.catalogue.ceda.ac.uk). :type moles_base: str Method signatures and docstrings: - def __init__(self, moles_base=...
b0dcf7fba0f66e8f7d2c61d8ab031d2257a3742e
<|skeleton|> class CatalogueDatasets: """Class to map a filepath to the relate MOLES record :param moles_base: Base URL to the MOLES api server (default: http://api.catalogue.ceda.ac.uk). :type moles_base: str""" def __init__(self, moles_base='http://api.catalogue.ceda.ac.uk'): """:param moles_base: Th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CatalogueDatasets: """Class to map a filepath to the relate MOLES record :param moles_base: Base URL to the MOLES api server (default: http://api.catalogue.ceda.ac.uk). :type moles_base: str""" def __init__(self, moles_base='http://api.catalogue.ceda.ac.uk'): """:param moles_base: The base URL fo...
the_stack_v2_python_sparse
facet_scanner/collection_handlers/utils/moles_datasets.py
cedadev/facet-scanner
train
0
5568c53b8e8f44243969ce8850a1e295688c95c5
[ "queue = [root]\nres = []\nwhile queue:\n node = queue.pop(0)\n if node:\n res.append(str(node.val))\n queue.append(node.left)\n queue.append(node.right)\n else:\n res.append('#')\nreturn ','.join(res)", "vals = data.split(',')\nroot_val = vals.pop(0)\nif root_val == '#':\n ...
<|body_start_0|> queue = [root] res = [] while queue: node = queue.pop(0) if node: res.append(str(node.val)) queue.append(node.left) queue.append(node.right) else: res.append('#') return '...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_025471
1,507
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
dca40686c6a280bd394feb8e6e78d40eecf854b9
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" queue = [root] res = [] while queue: node = queue.pop(0) if node: res.append(str(node.val)) queue.append(node.left...
the_stack_v2_python_sparse
src/amazon/297. Serialize and Deserialize Binary Tree.py
1325052669/leetcode
train
0
ba0c5a7f9c03c173a66e5523f0d872fc48d75226
[ "if not root:\n return [None]\nres = [root.val]\nleft = self.serialize(root.left)\nright = self.serialize(root.right)\nreturn res + left + right", "if not data:\n return None\nval = data.pop(0)\nif val == None:\n return None\nroot = TreeNode(val)\nroot.left = self.deserialize(data)\nroot.right = self.des...
<|body_start_0|> if not root: return [None] res = [root.val] left = self.serialize(root.left) right = self.serialize(root.right) return res + left + right <|end_body_0|> <|body_start_1|> if not data: return None val = data.pop(0) i...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_025472
2,324
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
9535d038bee690b7c7aeca352a4ab32d188684bb
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return [None] res = [root.val] left = self.serialize(root.left) right = self.serialize(root.right) return res + left + right ...
the_stack_v2_python_sparse
0297.py
Agchai52/Leetcode1
train
1
d870bc14e27f410951e7876aeb88f69f19ec363f
[ "self.require_collection()\nrequest = http.Request('POST', self.get_url(), self.wrap_object(text))\nreturn (request, parsers.parse_json)", "self.require_item()\nrequest = http.Request('PUT', self.get_url(), self.wrap_object(text))\nreturn (request, parsers.parse_json)" ]
<|body_start_0|> self.require_collection() request = http.Request('POST', self.get_url(), self.wrap_object(text)) return (request, parsers.parse_json) <|end_body_0|> <|body_start_1|> self.require_item() request = http.Request('PUT', self.get_url(), self.wrap_object(text)) ...
UserVoiceTextResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserVoiceTextResource: def create(self, text): """Create a new resource. :var text: the text of the resource to be created. :vartype text: str""" <|body_0|> def update(self, text): """Update this resource. :var text: the new text of the resource. :vartype text: str""...
stack_v2_sparse_classes_36k_train_025473
2,920
permissive
[ { "docstring": "Create a new resource. :var text: the text of the resource to be created. :vartype text: str", "name": "create", "signature": "def create(self, text)" }, { "docstring": "Update this resource. :var text: the new text of the resource. :vartype text: str", "name": "update", ...
2
stack_v2_sparse_classes_30k_train_016668
Implement the Python class `UserVoiceTextResource` described below. Class description: Implement the UserVoiceTextResource class. Method signatures and docstrings: - def create(self, text): Create a new resource. :var text: the text of the resource to be created. :vartype text: str - def update(self, text): Update th...
Implement the Python class `UserVoiceTextResource` described below. Class description: Implement the UserVoiceTextResource class. Method signatures and docstrings: - def create(self, text): Create a new resource. :var text: the text of the resource to be created. :vartype text: str - def update(self, text): Update th...
25caa745a104c8dc209584fa359294c65dbf88bb
<|skeleton|> class UserVoiceTextResource: def create(self, text): """Create a new resource. :var text: the text of the resource to be created. :vartype text: str""" <|body_0|> def update(self, text): """Update this resource. :var text: the new text of the resource. :vartype text: str""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserVoiceTextResource: def create(self, text): """Create a new resource. :var text: the text of the resource to be created. :vartype text: str""" self.require_collection() request = http.Request('POST', self.get_url(), self.wrap_object(text)) return (request, parsers.parse_json...
the_stack_v2_python_sparse
libsaas/services/uservoice/resource.py
piplcom/libsaas
train
1
eebce5055491523aac6d617b41b23e8efa31c585
[ "line_separated_items = [s + '\\\\\\\\' for s in items]\nTexText.__init__(self, *line_separated_items, **kwargs)\nfor part in self:\n dot = Tex('\\\\cdot').scale(self.dot_scale_factor)\n dot.next_to(part[0], LEFT, SMALL_BUFF)\n part.add_to_back(dot)\nself.arrange(DOWN, aligned_edge=LEFT, buff=self.buff)", ...
<|body_start_0|> line_separated_items = [s + '\\\\' for s in items] TexText.__init__(self, *line_separated_items, **kwargs) for part in self: dot = Tex('\\cdot').scale(self.dot_scale_factor) dot.next_to(part[0], LEFT, SMALL_BUFF) part.add_to_back(dot) ...
项目列表
BulletedList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BulletedList: """项目列表""" def __init__(self, *items: str, **kwargs): """支持多个字符串,每个一行;也支持一个字符串,使用 LaTeX 的换行(\\\\)""" <|body_0|> def fade_all_but(self, index_or_string: int | str, opacity: float=0.5) -> None: """把除了 ``index_or_string`` 之外的不透明度均设为 ``opacity`` ``index...
stack_v2_sparse_classes_36k_train_025474
14,403
permissive
[ { "docstring": "支持多个字符串,每个一行;也支持一个字符串,使用 LaTeX 的换行(\\\\\\\\)", "name": "__init__", "signature": "def __init__(self, *items: str, **kwargs)" }, { "docstring": "把除了 ``index_or_string`` 之外的不透明度均设为 ``opacity`` ``index_or_string`` 可以传入子物体的下标,也可以传入一个字符串", "name": "fade_all_but", "signature": "...
2
stack_v2_sparse_classes_30k_val_000496
Implement the Python class `BulletedList` described below. Class description: 项目列表 Method signatures and docstrings: - def __init__(self, *items: str, **kwargs): 支持多个字符串,每个一行;也支持一个字符串,使用 LaTeX 的换行(\\\\) - def fade_all_but(self, index_or_string: int | str, opacity: float=0.5) -> None: 把除了 ``index_or_string`` 之外的不透明度均设...
Implement the Python class `BulletedList` described below. Class description: 项目列表 Method signatures and docstrings: - def __init__(self, *items: str, **kwargs): 支持多个字符串,每个一行;也支持一个字符串,使用 LaTeX 的换行(\\\\) - def fade_all_but(self, index_or_string: int | str, opacity: float=0.5) -> None: 把除了 ``index_or_string`` 之外的不透明度均设...
99fe80a55cdc5c2fcc249b3645d7f1cd19852bcd
<|skeleton|> class BulletedList: """项目列表""" def __init__(self, *items: str, **kwargs): """支持多个字符串,每个一行;也支持一个字符串,使用 LaTeX 的换行(\\\\)""" <|body_0|> def fade_all_but(self, index_or_string: int | str, opacity: float=0.5) -> None: """把除了 ``index_or_string`` 之外的不透明度均设为 ``opacity`` ``index...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BulletedList: """项目列表""" def __init__(self, *items: str, **kwargs): """支持多个字符串,每个一行;也支持一个字符串,使用 LaTeX 的换行(\\\\)""" line_separated_items = [s + '\\\\' for s in items] TexText.__init__(self, *line_separated_items, **kwargs) for part in self: dot = Tex('\\cdot').s...
the_stack_v2_python_sparse
manimlib/mobject/svg/tex_mobject.py
manim-kindergarten/manim
train
130
f7f0f40e4c7e3be96d5a121901d49344f01edff7
[ "cleaned_data = self.cleaned_data\ntry:\n precio_costo = int(cleaned_data.get('precio_costo'))\n precio_venta = int(cleaned_data.get('precio_venta'))\nexcept (TypeError, ValueError):\n return cleaned_data\nif precio_costo >= precio_venta:\n msg = u'El Precio de costo debe ser menor que el precio de vent...
<|body_start_0|> cleaned_data = self.cleaned_data try: precio_costo = int(cleaned_data.get('precio_costo')) precio_venta = int(cleaned_data.get('precio_venta')) except (TypeError, ValueError): return cleaned_data if precio_costo >= precio_venta: ...
PromocionForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PromocionForm: def clean(self): """Método de validación personalizado que válida si el precio de costo no sea mayor que el precio de venta""" <|body_0|> def clean_codigo(self): """Verifica que campo único, quitando espacio en blanco""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_025475
14,795
permissive
[ { "docstring": "Método de validación personalizado que válida si el precio de costo no sea mayor que el precio de venta", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Verifica que campo único, quitando espacio en blanco", "name": "clean_codigo", "signature": "def cl...
2
stack_v2_sparse_classes_30k_train_013893
Implement the Python class `PromocionForm` described below. Class description: Implement the PromocionForm class. Method signatures and docstrings: - def clean(self): Método de validación personalizado que válida si el precio de costo no sea mayor que el precio de venta - def clean_codigo(self): Verifica que campo ún...
Implement the Python class `PromocionForm` described below. Class description: Implement the PromocionForm class. Method signatures and docstrings: - def clean(self): Método de validación personalizado que válida si el precio de costo no sea mayor que el precio de venta - def clean_codigo(self): Verifica que campo ún...
1420e305f41301b8548dfbbabfc64330b74403be
<|skeleton|> class PromocionForm: def clean(self): """Método de validación personalizado que válida si el precio de costo no sea mayor que el precio de venta""" <|body_0|> def clean_codigo(self): """Verifica que campo único, quitando espacio en blanco""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PromocionForm: def clean(self): """Método de validación personalizado que válida si el precio de costo no sea mayor que el precio de venta""" cleaned_data = self.cleaned_data try: precio_costo = int(cleaned_data.get('precio_costo')) precio_venta = int(cleaned_da...
the_stack_v2_python_sparse
AlyMoly/mantenedor/forms.py
CreceLibre/alymoly
train
0
3d2e01c99ec4c3a8cd5f88d4ced9016fa5dd17d9
[ "m = hashlib.md5()\nm.update(str(value).strip().encode('utf-8'))\nreturn m.hexdigest()", "for f in cols:\n df['{}_md5'.format(f)] = df[f].apply(lambda value: cls.func_md5(str(value)))\nreturn df", "hsobj = hashlib.sha256()\nhsobj.update(value.encode('utf-8'))\nreturn hsobj.hexdigest().upper()", "for f in c...
<|body_start_0|> m = hashlib.md5() m.update(str(value).strip().encode('utf-8')) return m.hexdigest() <|end_body_0|> <|body_start_1|> for f in cols: df['{}_md5'.format(f)] = df[f].apply(lambda value: cls.func_md5(str(value))) return df <|end_body_1|> <|body_start_2|>...
ENCRYPT
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ENCRYPT: def func_md5(cls, value): """Get md5 code :param value: value :return: md5 code Examples: func_md5(value='杨海天')""" <|body_0|> def get_md5(cls, df, cols=['name', 'id_number', 'mobile_number']): """Do md5 encoding for specific columns :param df: dataframe :par...
stack_v2_sparse_classes_36k_train_025476
32,015
no_license
[ { "docstring": "Get md5 code :param value: value :return: md5 code Examples: func_md5(value='杨海天')", "name": "func_md5", "signature": "def func_md5(cls, value)" }, { "docstring": "Do md5 encoding for specific columns :param df: dataframe :param cols: columns to encode md5 :return: Examples: df =...
6
stack_v2_sparse_classes_30k_train_000350
Implement the Python class `ENCRYPT` described below. Class description: Implement the ENCRYPT class. Method signatures and docstrings: - def func_md5(cls, value): Get md5 code :param value: value :return: md5 code Examples: func_md5(value='杨海天') - def get_md5(cls, df, cols=['name', 'id_number', 'mobile_number']): Do...
Implement the Python class `ENCRYPT` described below. Class description: Implement the ENCRYPT class. Method signatures and docstrings: - def func_md5(cls, value): Get md5 code :param value: value :return: md5 code Examples: func_md5(value='杨海天') - def get_md5(cls, df, cols=['name', 'id_number', 'mobile_number']): Do...
2b6812fcd8a7414e606cc3f5964b171503683144
<|skeleton|> class ENCRYPT: def func_md5(cls, value): """Get md5 code :param value: value :return: md5 code Examples: func_md5(value='杨海天')""" <|body_0|> def get_md5(cls, df, cols=['name', 'id_number', 'mobile_number']): """Do md5 encoding for specific columns :param df: dataframe :par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ENCRYPT: def func_md5(cls, value): """Get md5 code :param value: value :return: md5 code Examples: func_md5(value='杨海天')""" m = hashlib.md5() m.update(str(value).strip().encode('utf-8')) return m.hexdigest() def get_md5(cls, df, cols=['name', 'id_number', 'mobile_number'])...
the_stack_v2_python_sparse
model_tools/model_tools/gentools/advtools.py
yanghaitian1/risk_control
train
3
22d5fdecf6a39aa894c165eeccf682b085e569b3
[ "self.parentTagId.append(parentTagId)\nself.path.append(path)\nsuper(HierarchicalTag, self).__init__()", "self.validate_object()\nself.only_available_attrs(['parentTagId', 'path'])\nreturn self.validated_dict" ]
<|body_start_0|> self.parentTagId.append(parentTagId) self.path.append(path) super(HierarchicalTag, self).__init__() <|end_body_0|> <|body_start_1|> self.validate_object() self.only_available_attrs(['parentTagId', 'path']) return self.validated_dict <|end_body_1|>
HierarchicalTag
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HierarchicalTag: def __init__(self, parentTagId: str=Empty, path: list=Empty): """:param parentTagId: :param path:""" <|body_0|> def __todict__(self): """:return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.parentTagId.append(parentTagId) ...
stack_v2_sparse_classes_36k_train_025477
776
no_license
[ { "docstring": ":param parentTagId: :param path:", "name": "__init__", "signature": "def __init__(self, parentTagId: str=Empty, path: list=Empty)" }, { "docstring": ":return:", "name": "__todict__", "signature": "def __todict__(self)" } ]
2
null
Implement the Python class `HierarchicalTag` described below. Class description: Implement the HierarchicalTag class. Method signatures and docstrings: - def __init__(self, parentTagId: str=Empty, path: list=Empty): :param parentTagId: :param path: - def __todict__(self): :return:
Implement the Python class `HierarchicalTag` described below. Class description: Implement the HierarchicalTag class. Method signatures and docstrings: - def __init__(self, parentTagId: str=Empty, path: list=Empty): :param parentTagId: :param path: - def __todict__(self): :return: <|skeleton|> class HierarchicalTag:...
623d23917ecf6761e7254d7d6a4881b6a05e11f8
<|skeleton|> class HierarchicalTag: def __init__(self, parentTagId: str=Empty, path: list=Empty): """:param parentTagId: :param path:""" <|body_0|> def __todict__(self): """:return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HierarchicalTag: def __init__(self, parentTagId: str=Empty, path: list=Empty): """:param parentTagId: :param path:""" self.parentTagId.append(parentTagId) self.path.append(path) super(HierarchicalTag, self).__init__() def __todict__(self): """:return:""" se...
the_stack_v2_python_sparse
space_sdk/space_types/tags.py
AnthraxisBR/jetbrains-space-python-sdk
train
0
f6b1e71ade3babfa4e6a0ca4f0478177dddbdc0a
[ "self.posical = float(posical)\nself.negical = float(negical)\nsuper(flux, self).__init__(var, bad_val)", "if abs(self.variable) >= 6999:\n self.result = self.bad_value\n return\nif self.variable >= 0:\n self.result = self.posical * self.variable\nelse:\n self.result = self.negical * self.variable" ]
<|body_start_0|> self.posical = float(posical) self.negical = float(negical) super(flux, self).__init__(var, bad_val) <|end_body_0|> <|body_start_1|> if abs(self.variable) >= 6999: self.result = self.bad_value return if self.variable >= 0: sel...
The function this class reprsents calculats a flux value
flux
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class flux: """The function this class reprsents calculats a flux value""" def __init__(self, var, posical, negical, bad_val=6999): """Class initializer Arguments: var: (convertible to float) the domain value posical: (convertible to float) the multiplier for positive values negical: (conv...
stack_v2_sparse_classes_36k_train_025478
17,830
no_license
[ { "docstring": "Class initializer Arguments: var: (convertible to float) the domain value posical: (convertible to float) the multiplier for positive values negical: (convertible to float) the multiplier for negative values bad_val: (convertible to int) the value to indicate a bad data item", "name": "__ini...
2
stack_v2_sparse_classes_30k_train_018158
Implement the Python class `flux` described below. Class description: The function this class reprsents calculats a flux value Method signatures and docstrings: - def __init__(self, var, posical, negical, bad_val=6999): Class initializer Arguments: var: (convertible to float) the domain value posical: (convertible to...
Implement the Python class `flux` described below. Class description: The function this class reprsents calculats a flux value Method signatures and docstrings: - def __init__(self, var, posical, negical, bad_val=6999): Class initializer Arguments: var: (convertible to float) the domain value posical: (convertible to...
95d0c102d649c5b028d262f5254106f997a7c77a
<|skeleton|> class flux: """The function this class reprsents calculats a flux value""" def __init__(self, var, posical, negical, bad_val=6999): """Class initializer Arguments: var: (convertible to float) the domain value posical: (convertible to float) the multiplier for positive values negical: (conv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class flux: """The function this class reprsents calculats a flux value""" def __init__(self, var, posical, negical, bad_val=6999): """Class initializer Arguments: var: (convertible to float) the domain value posical: (convertible to float) the multiplier for positive values negical: (convertible to fl...
the_stack_v2_python_sparse
csv_lib/equations.py
rwspicer/csv_utilities
train
1
24da3e2f5f2a4d1053868c84264d30811ad91d2b
[ "url = 'projects/%s/tags/%s' % (project_id, tag)\nresp, body = self.put(url, '{}')\nself.expected_success(201, resp.status)\nreturn rest_client.ResponseBody(resp, body)", "url = 'projects/%s/tags' % project_id\nresp, body = self.get(url)\nself.expected_success(200, resp.status)\nbody = json.loads(body)\nreturn re...
<|body_start_0|> url = 'projects/%s/tags/%s' % (project_id, tag) resp, body = self.put(url, '{}') self.expected_success(201, resp.status) return rest_client.ResponseBody(resp, body) <|end_body_0|> <|body_start_1|> url = 'projects/%s/tags' % project_id resp, body = self.g...
ProjectTagsClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectTagsClient: def update_project_tag(self, project_id, tag): """Updates the specified tag and adds it to the project's list of tags.""" <|body_0|> def list_project_tags(self, project_id): """List tags for a project.""" <|body_1|> def update_all_proj...
stack_v2_sparse_classes_36k_train_025479
3,220
permissive
[ { "docstring": "Updates the specified tag and adds it to the project's list of tags.", "name": "update_project_tag", "signature": "def update_project_tag(self, project_id, tag)" }, { "docstring": "List tags for a project.", "name": "list_project_tags", "signature": "def list_project_tags...
6
stack_v2_sparse_classes_30k_train_009366
Implement the Python class `ProjectTagsClient` described below. Class description: Implement the ProjectTagsClient class. Method signatures and docstrings: - def update_project_tag(self, project_id, tag): Updates the specified tag and adds it to the project's list of tags. - def list_project_tags(self, project_id): L...
Implement the Python class `ProjectTagsClient` described below. Class description: Implement the ProjectTagsClient class. Method signatures and docstrings: - def update_project_tag(self, project_id, tag): Updates the specified tag and adds it to the project's list of tags. - def list_project_tags(self, project_id): L...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class ProjectTagsClient: def update_project_tag(self, project_id, tag): """Updates the specified tag and adds it to the project's list of tags.""" <|body_0|> def list_project_tags(self, project_id): """List tags for a project.""" <|body_1|> def update_all_proj...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectTagsClient: def update_project_tag(self, project_id, tag): """Updates the specified tag and adds it to the project's list of tags.""" url = 'projects/%s/tags/%s' % (project_id, tag) resp, body = self.put(url, '{}') self.expected_success(201, resp.status) return r...
the_stack_v2_python_sparse
tempest/lib/services/identity/v3/project_tags_client.py
openstack/tempest
train
270
f1614b9d5702c7f7b8845016dbff547c4e6649cf
[ "url = self.action\nif url is None:\n return {}\nhalves = url.split('?')\nif len(halves) == 1:\n return {}\nkey_value_pairs = halves[1].split('&')\nreturn dict([pair.split('=') for pair in key_value_pairs])", "url = self.action\nif url is None:\n return None\nprotocol_and_host = url.split('?')[0]\nhost =...
<|body_start_0|> url = self.action if url is None: return {} halves = url.split('?') if len(halves) == 1: return {} key_value_pairs = halves[1].split('&') return dict([pair.split('=') for pair in key_value_pairs]) <|end_body_0|> <|body_start_1|> ...
Custom element class for <a:hlinkClick> elements.
CT_Hyperlink
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CT_Hyperlink: """Custom element class for <a:hlinkClick> elements.""" def action_fields(self): """A dictionary containing any key-value pairs present in the query portion of the `ppaction://` URL in the action attribute. For example `{'id':'0', 'return':'true'}` in 'ppaction://custom...
stack_v2_sparse_classes_36k_train_025480
1,603
permissive
[ { "docstring": "A dictionary containing any key-value pairs present in the query portion of the `ppaction://` URL in the action attribute. For example `{'id':'0', 'return':'true'}` in 'ppaction://customshow?id=0&return=true'. Returns an empty dictionary if the URL contains no query string or if no action attrib...
2
null
Implement the Python class `CT_Hyperlink` described below. Class description: Custom element class for <a:hlinkClick> elements. Method signatures and docstrings: - def action_fields(self): A dictionary containing any key-value pairs present in the query portion of the `ppaction://` URL in the action attribute. For ex...
Implement the Python class `CT_Hyperlink` described below. Class description: Custom element class for <a:hlinkClick> elements. Method signatures and docstrings: - def action_fields(self): A dictionary containing any key-value pairs present in the query portion of the `ppaction://` URL in the action attribute. For ex...
cabf6e4f1970dc14302f87414f170de19944bac2
<|skeleton|> class CT_Hyperlink: """Custom element class for <a:hlinkClick> elements.""" def action_fields(self): """A dictionary containing any key-value pairs present in the query portion of the `ppaction://` URL in the action attribute. For example `{'id':'0', 'return':'true'}` in 'ppaction://custom...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CT_Hyperlink: """Custom element class for <a:hlinkClick> elements.""" def action_fields(self): """A dictionary containing any key-value pairs present in the query portion of the `ppaction://` URL in the action attribute. For example `{'id':'0', 'return':'true'}` in 'ppaction://customshow?id=0&ret...
the_stack_v2_python_sparse
Pdf_docx_pptx_xlsx_epub_png/source/pptx/oxml/action.py
ryfeus/lambda-packs
train
1,283
01748e70cb0ed5a7a8237b9c3b3175dc3827d778
[ "kernel_width = float(kernel_width)\nif kernel is None:\n\n def kernel(d, kernel_width):\n return np.sqrt(np.exp(-d ** 2 / kernel_width ** 2))\nkernel_fn = partial(kernel, kernel_width=kernel_width)\nself.random_state = check_random_state(random_state)\nself.feature_selection = feature_selection\nself.bas...
<|body_start_0|> kernel_width = float(kernel_width) if kernel is None: def kernel(d, kernel_width): return np.sqrt(np.exp(-d ** 2 / kernel_width ** 2)) kernel_fn = partial(kernel, kernel_width=kernel_width) self.random_state = check_random_state(random_state)...
Explains predictions on Image (i.e. matrix) data. For numerical features, perturb them by sampling from a Normal(0,1) and doing the inverse operation of mean-centering and scaling, according to the means and stds in the training data. For categorical features, perturb by sampling according to the training distribution,...
LimeImageExplainer
[ "MIT", "BSD-2-Clause", "LGPL-2.1-or-later", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LimeImageExplainer: """Explains predictions on Image (i.e. matrix) data. For numerical features, perturb them by sampling from a Normal(0,1) and doing the inverse operation of mean-centering and scaling, according to the means and stds in the training data. For categorical features, perturb by sa...
stack_v2_sparse_classes_36k_train_025481
10,934
permissive
[ { "docstring": "Init function. Args: kernel_width: kernel width for the exponential kernel. If None, defaults to sqrt(number of columns) * 0.75. kernel: similarity kernel that takes euclidean distances and kernel width as input and outputs weights in (0,1). If None, defaults to an exponential kernel. verbose: i...
3
stack_v2_sparse_classes_30k_train_002771
Implement the Python class `LimeImageExplainer` described below. Class description: Explains predictions on Image (i.e. matrix) data. For numerical features, perturb them by sampling from a Normal(0,1) and doing the inverse operation of mean-centering and scaling, according to the means and stds in the training data. ...
Implement the Python class `LimeImageExplainer` described below. Class description: Explains predictions on Image (i.e. matrix) data. For numerical features, perturb them by sampling from a Normal(0,1) and doing the inverse operation of mean-centering and scaling, according to the means and stds in the training data. ...
f59730dc7a8735232ef417685800652372c3b5dd
<|skeleton|> class LimeImageExplainer: """Explains predictions on Image (i.e. matrix) data. For numerical features, perturb them by sampling from a Normal(0,1) and doing the inverse operation of mean-centering and scaling, according to the means and stds in the training data. For categorical features, perturb by sa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LimeImageExplainer: """Explains predictions on Image (i.e. matrix) data. For numerical features, perturb them by sampling from a Normal(0,1) and doing the inverse operation of mean-centering and scaling, according to the means and stds in the training data. For categorical features, perturb by sampling accord...
the_stack_v2_python_sparse
tensorwatch/saliency/lime/lime_image.py
microsoft/tensorwatch
train
3,626
061a058fffce77b9c6c92eaa0c6bce66261fcb2e
[ "self.sent_id_map = {str_i.lower(): i + 1 for i, str_i in enumerate(sentence_ids)}\nself.EOD_index = len(self.sent_id_map)\nself.max_doc_length = max_doc_length + 1\nself.max_sent_length = None\nself.PAD_index = 0", "numeric_context_docs = []\nfor doc in documents:\n doc = doc.split(' ')\n doc = [self.sent_...
<|body_start_0|> self.sent_id_map = {str_i.lower(): i + 1 for i, str_i in enumerate(sentence_ids)} self.EOD_index = len(self.sent_id_map) self.max_doc_length = max_doc_length + 1 self.max_sent_length = None self.PAD_index = 0 <|end_body_0|> <|body_start_1|> numeric_conte...
Creates numerical representations as input for the CIM model
Processor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Processor: """Creates numerical representations as input for the CIM model""" def __init__(self, sentence_ids, max_doc_length): """Stores indexes of sentences, End-of-Sentence index, maximum document and sentence length, and pad index.""" <|body_0|> def to_numeric_docume...
stack_v2_sparse_classes_36k_train_025482
21,540
no_license
[ { "docstring": "Stores indexes of sentences, End-of-Sentence index, maximum document and sentence length, and pad index.", "name": "__init__", "signature": "def __init__(self, sentence_ids, max_doc_length)" }, { "docstring": "Creates numerical representations (sentence ids) for documents (= arti...
3
stack_v2_sparse_classes_30k_train_001881
Implement the Python class `Processor` described below. Class description: Creates numerical representations as input for the CIM model Method signatures and docstrings: - def __init__(self, sentence_ids, max_doc_length): Stores indexes of sentences, End-of-Sentence index, maximum document and sentence length, and pa...
Implement the Python class `Processor` described below. Class description: Creates numerical representations as input for the CIM model Method signatures and docstrings: - def __init__(self, sentence_ids, max_doc_length): Stores indexes of sentences, End-of-Sentence index, maximum document and sentence length, and pa...
400bfa885ddbbc5f1d7c40d3a9e9df37ecc81dc9
<|skeleton|> class Processor: """Creates numerical representations as input for the CIM model""" def __init__(self, sentence_ids, max_doc_length): """Stores indexes of sentences, End-of-Sentence index, maximum document and sentence length, and pad index.""" <|body_0|> def to_numeric_docume...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Processor: """Creates numerical representations as input for the CIM model""" def __init__(self, sentence_ids, max_doc_length): """Stores indexes of sentences, End-of-Sentence index, maximum document and sentence length, and pad index.""" self.sent_id_map = {str_i.lower(): i + 1 for i, st...
the_stack_v2_python_sparse
experiments/context_inclusive_model.py
vdenberg/context-in-informational-bias-detection
train
3
3b4a8427ba328e0c119320a99e6e9fe68b3fbe35
[ "if not x:\n return None\nreturn sum(x) / len(x)", "if not x:\n return None\nx.sort()\nn = len(x)\nif n % 2 == 0:\n return (x[n // 2 - 1] + x[n // 2]) / 2\nelse:\n return x[n // 2]", "if not x:\n return None\nx.sort()\nn = len(x)\nQ1 = x[n // 4]\nQ3 = x[3 * n // 4]\nreturn [Q1, Q3]", "if not x:...
<|body_start_0|> if not x: return None return sum(x) / len(x) <|end_body_0|> <|body_start_1|> if not x: return None x.sort() n = len(x) if n % 2 == 0: return (x[n // 2 - 1] + x[n // 2]) / 2 else: return x[n // 2] <|...
TinyStatistician
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TinyStatistician: def mean(self, x): """Calcule la moyenne de la liste""" <|body_0|> def median(self, x): """Calcule la mediane""" <|body_1|> def quartile(self, x): """Calcule le premier et troisieme quartile""" <|body_2|> def var(se...
stack_v2_sparse_classes_36k_train_025483
1,649
no_license
[ { "docstring": "Calcule la moyenne de la liste", "name": "mean", "signature": "def mean(self, x)" }, { "docstring": "Calcule la mediane", "name": "median", "signature": "def median(self, x)" }, { "docstring": "Calcule le premier et troisieme quartile", "name": "quartile", ...
5
stack_v2_sparse_classes_30k_train_018851
Implement the Python class `TinyStatistician` described below. Class description: Implement the TinyStatistician class. Method signatures and docstrings: - def mean(self, x): Calcule la moyenne de la liste - def median(self, x): Calcule la mediane - def quartile(self, x): Calcule le premier et troisieme quartile - de...
Implement the Python class `TinyStatistician` described below. Class description: Implement the TinyStatistician class. Method signatures and docstrings: - def mean(self, x): Calcule la moyenne de la liste - def median(self, x): Calcule la mediane - def quartile(self, x): Calcule le premier et troisieme quartile - de...
24358cc6807d86fe5da766bb4505eef29f1e371f
<|skeleton|> class TinyStatistician: def mean(self, x): """Calcule la moyenne de la liste""" <|body_0|> def median(self, x): """Calcule la mediane""" <|body_1|> def quartile(self, x): """Calcule le premier et troisieme quartile""" <|body_2|> def var(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TinyStatistician: def mean(self, x): """Calcule la moyenne de la liste""" if not x: return None return sum(x) / len(x) def median(self, x): """Calcule la mediane""" if not x: return None x.sort() n = len(x) if n % 2 =...
the_stack_v2_python_sparse
day02/ex05/TinyStatistician.py
Ghilphar/bootcamp_python
train
0
62f4fc070bb300b5137066cd86588c2bc7aed9f0
[ "self.component = component\nself.priority = priority\nself.mtype = mtype\nself.view_box_id = view_box_id\nself.view_id = view_id", "if dictionary is None:\n return None\ncomponent = dictionary.get('component')\npriority = dictionary.get('priority')\nmtype = dictionary.get('type')\nview_box_id = dictionary.get...
<|body_start_0|> self.component = component self.priority = priority self.mtype = mtype self.view_box_id = view_box_id self.view_id = view_id <|end_body_0|> <|body_start_1|> if dictionary is None: return None component = dictionary.get('component') ...
Implementation of the 'ClusterConfigProto_QoSMapping_QoSContext' model. QoSContext captures the properties that are relevant for QoS in a request. If a new field is added to QoSContext, cluster_config.h should be changed to enhance the hasher (QoSContextHash) and comparator (QoSContextEqual) for QoSContext. Attributes:...
ClusterConfigProto_QoSMapping_QoSContext
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterConfigProto_QoSMapping_QoSContext: """Implementation of the 'ClusterConfigProto_QoSMapping_QoSContext' model. QoSContext captures the properties that are relevant for QoS in a request. If a new field is added to QoSContext, cluster_config.h should be changed to enhance the hasher (QoSConte...
stack_v2_sparse_classes_36k_train_025484
2,453
permissive
[ { "docstring": "Constructor for the ClusterConfigProto_QoSMapping_QoSContext class", "name": "__init__", "signature": "def __init__(self, component=None, priority=None, mtype=None, view_box_id=None, view_id=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dicti...
2
stack_v2_sparse_classes_30k_train_005410
Implement the Python class `ClusterConfigProto_QoSMapping_QoSContext` described below. Class description: Implementation of the 'ClusterConfigProto_QoSMapping_QoSContext' model. QoSContext captures the properties that are relevant for QoS in a request. If a new field is added to QoSContext, cluster_config.h should be ...
Implement the Python class `ClusterConfigProto_QoSMapping_QoSContext` described below. Class description: Implementation of the 'ClusterConfigProto_QoSMapping_QoSContext' model. QoSContext captures the properties that are relevant for QoS in a request. If a new field is added to QoSContext, cluster_config.h should be ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ClusterConfigProto_QoSMapping_QoSContext: """Implementation of the 'ClusterConfigProto_QoSMapping_QoSContext' model. QoSContext captures the properties that are relevant for QoS in a request. If a new field is added to QoSContext, cluster_config.h should be changed to enhance the hasher (QoSConte...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClusterConfigProto_QoSMapping_QoSContext: """Implementation of the 'ClusterConfigProto_QoSMapping_QoSContext' model. QoSContext captures the properties that are relevant for QoS in a request. If a new field is added to QoSContext, cluster_config.h should be changed to enhance the hasher (QoSContextHash) and c...
the_stack_v2_python_sparse
cohesity_management_sdk/models/cluster_config_proto_qo_s_mapping_qo_s_context.py
cohesity/management-sdk-python
train
24
eec7ade4a3829cc27460793150918a5081265d99
[ "def dfs(node, path, path_list):\n if not node:\n return\n current_path = path + [node.val]\n if not node.left and (not node.right):\n path_list.append(current_path)\n if node.left:\n dfs(node.left, current_path, path_list)\n if node.right:\n dfs(node.right, current_path, ...
<|body_start_0|> def dfs(node, path, path_list): if not node: return current_path = path + [node.val] if not node.left and (not node.right): path_list.append(current_path) if node.left: dfs(node.left, current_path, p...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def binaryTreePaths(self, root): """:type root: TreeNode :rtype: List[str]""" <|body_0|> def binaryTreePaths_v2(self, root): """:type root: TreeNode :rtype: List[str]""" <|body_1|> def binaryTreePaths2(self, root): """:type root: TreeNo...
stack_v2_sparse_classes_36k_train_025485
3,053
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[str]", "name": "binaryTreePaths", "signature": "def binaryTreePaths(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[str]", "name": "binaryTreePaths_v2", "signature": "def binaryTreePaths_v2(self, root)" }, { "doc...
3
stack_v2_sparse_classes_30k_train_003068
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binaryTreePaths(self, root): :type root: TreeNode :rtype: List[str] - def binaryTreePaths_v2(self, root): :type root: TreeNode :rtype: List[str] - def binaryTreePaths2(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binaryTreePaths(self, root): :type root: TreeNode :rtype: List[str] - def binaryTreePaths_v2(self, root): :type root: TreeNode :rtype: List[str] - def binaryTreePaths2(self, ...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def binaryTreePaths(self, root): """:type root: TreeNode :rtype: List[str]""" <|body_0|> def binaryTreePaths_v2(self, root): """:type root: TreeNode :rtype: List[str]""" <|body_1|> def binaryTreePaths2(self, root): """:type root: TreeNo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def binaryTreePaths(self, root): """:type root: TreeNode :rtype: List[str]""" def dfs(node, path, path_list): if not node: return current_path = path + [node.val] if not node.left and (not node.right): path_list.appe...
the_stack_v2_python_sparse
src/lt_257.py
oxhead/CodingYourWay
train
0
8a51f3dc2d318d2df430b3033bc3b90db581a878
[ "progbar = training_utils.get_progbar(model, 'samples' if use_samples else 'steps')\nprogbar.params = callbacks.params\nprogbar.params['verbose'] = verbose\ncallbacks.model.stop_training = False\ncallbacks._call_begin_hook(mode)\nprogbar.on_train_begin()\nself.callbacks = callbacks\nself.progbar = progbar\ntry:\n ...
<|body_start_0|> progbar = training_utils.get_progbar(model, 'samples' if use_samples else 'steps') progbar.params = callbacks.params progbar.params['verbose'] = verbose callbacks.model.stop_training = False callbacks._call_begin_hook(mode) progbar.on_train_begin() ...
Utility object that wrap around callbacks and progress bars.
TrainingContext
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrainingContext: """Utility object that wrap around callbacks and progress bars.""" def on_start(self, model, callbacks=None, use_samples=False, verbose=0, mode=ModeKeys.TRAIN): """Provide a scope for the whole training process.""" <|body_0|> def on_epoch(self, epoch=0, ...
stack_v2_sparse_classes_36k_train_025486
28,479
permissive
[ { "docstring": "Provide a scope for the whole training process.", "name": "on_start", "signature": "def on_start(self, model, callbacks=None, use_samples=False, verbose=0, mode=ModeKeys.TRAIN)" }, { "docstring": "Provide a scope for running one epoch.", "name": "on_epoch", "signature": "...
3
stack_v2_sparse_classes_30k_train_007865
Implement the Python class `TrainingContext` described below. Class description: Utility object that wrap around callbacks and progress bars. Method signatures and docstrings: - def on_start(self, model, callbacks=None, use_samples=False, verbose=0, mode=ModeKeys.TRAIN): Provide a scope for the whole training process...
Implement the Python class `TrainingContext` described below. Class description: Utility object that wrap around callbacks and progress bars. Method signatures and docstrings: - def on_start(self, model, callbacks=None, use_samples=False, verbose=0, mode=ModeKeys.TRAIN): Provide a scope for the whole training process...
7cbba04a2ee16d21309eefad5be6585183a2d5a9
<|skeleton|> class TrainingContext: """Utility object that wrap around callbacks and progress bars.""" def on_start(self, model, callbacks=None, use_samples=False, verbose=0, mode=ModeKeys.TRAIN): """Provide a scope for the whole training process.""" <|body_0|> def on_epoch(self, epoch=0, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrainingContext: """Utility object that wrap around callbacks and progress bars.""" def on_start(self, model, callbacks=None, use_samples=False, verbose=0, mode=ModeKeys.TRAIN): """Provide a scope for the whole training process.""" progbar = training_utils.get_progbar(model, 'samples' if ...
the_stack_v2_python_sparse
tensorflow/python/keras/engine/training_v2.py
NVIDIA/tensorflow
train
763
1b7672437aa119e032ee7d055fc61aab601484ee
[ "layer_name = None\nif layer_index > 0:\n dom = xml.dom.minidom.parse('utils/model_info.xml')\n root = dom.documentElement\n model = root.getElementsByTagName(model_name)[0]\n layer_name_str = model.getElementsByTagName('model_layer_name')[0].firstChild.data\n layer_name_list = eval(layer_name_str.re...
<|body_start_0|> layer_name = None if layer_index > 0: dom = xml.dom.minidom.parse('utils/model_info.xml') root = dom.documentElement model = root.getElementsByTagName(model_name)[0] layer_name_str = model.getElementsByTagName('model_layer_name')[0].firstC...
ModelInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelInfo: def get_layer_name_by_index(self, model_name, layer_index): """:param model_name: :param layer_index: [0,layer_num] layer_index==0 means the input layer. :return:""" <|body_0|> def get_layer_shape_by_index(self, model_name, layer_index): """:param model_na...
stack_v2_sparse_classes_36k_train_025487
1,685
no_license
[ { "docstring": ":param model_name: :param layer_index: [0,layer_num] layer_index==0 means the input layer. :return:", "name": "get_layer_name_by_index", "signature": "def get_layer_name_by_index(self, model_name, layer_index)" }, { "docstring": ":param model_name: :param layer_index: [0,layer_nu...
2
stack_v2_sparse_classes_30k_test_001025
Implement the Python class `ModelInfo` described below. Class description: Implement the ModelInfo class. Method signatures and docstrings: - def get_layer_name_by_index(self, model_name, layer_index): :param model_name: :param layer_index: [0,layer_num] layer_index==0 means the input layer. :return: - def get_layer_...
Implement the Python class `ModelInfo` described below. Class description: Implement the ModelInfo class. Method signatures and docstrings: - def get_layer_name_by_index(self, model_name, layer_index): :param model_name: :param layer_index: [0,layer_num] layer_index==0 means the input layer. :return: - def get_layer_...
9076a813c803bc9c47054fff7bae2824304da282
<|skeleton|> class ModelInfo: def get_layer_name_by_index(self, model_name, layer_index): """:param model_name: :param layer_index: [0,layer_num] layer_index==0 means the input layer. :return:""" <|body_0|> def get_layer_shape_by_index(self, model_name, layer_index): """:param model_na...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelInfo: def get_layer_name_by_index(self, model_name, layer_index): """:param model_name: :param layer_index: [0,layer_num] layer_index==0 means the input layer. :return:""" layer_name = None if layer_index > 0: dom = xml.dom.minidom.parse('utils/model_info.xml') ...
the_stack_v2_python_sparse
old_code/model_info_bk.py
JaneWuNEU/hitdl_server
train
0
a3f321dea5c763417b3855ba6200a16ed9363cef
[ "super(DQN, self).__init__()\nself.hidden_size = lstm_hidden_size\nself.lstm_layers = lstm_layers\nself.lstm = LSTM(input_size=input_size, hidden_size=self.hidden_size, num_layers=self.lstm_layers, batch_first=True)\nself.network = Sequential(Linear(self.hidden_size, 128), LeakyReLU(inplace=True), BatchNorm1d(num_f...
<|body_start_0|> super(DQN, self).__init__() self.hidden_size = lstm_hidden_size self.lstm_layers = lstm_layers self.lstm = LSTM(input_size=input_size, hidden_size=self.hidden_size, num_layers=self.lstm_layers, batch_first=True) self.network = Sequential(Linear(self.hidden_size, ...
DQN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DQN: def __init__(self, input_size, num_actions, lstm_hidden_size=64, lstm_layers=1, get_action_by_boltzmann=True): """Double Q-Network. Used for training the Robot behaviour. :param input_size: Int. Size of the Input. :param num_actions: Int. Number of possible actions that can be taken...
stack_v2_sparse_classes_36k_train_025488
4,428
no_license
[ { "docstring": "Double Q-Network. Used for training the Robot behaviour. :param input_size: Int. Size of the Input. :param num_actions: Int. Number of possible actions that can be taken. :param lstm_hidden_size: Int. Hidden size of the LSTM layers. :param lstm_layers: Int. Number of LSTM layers. :param get_acti...
5
stack_v2_sparse_classes_30k_train_002513
Implement the Python class `DQN` described below. Class description: Implement the DQN class. Method signatures and docstrings: - def __init__(self, input_size, num_actions, lstm_hidden_size=64, lstm_layers=1, get_action_by_boltzmann=True): Double Q-Network. Used for training the Robot behaviour. :param input_size: I...
Implement the Python class `DQN` described below. Class description: Implement the DQN class. Method signatures and docstrings: - def __init__(self, input_size, num_actions, lstm_hidden_size=64, lstm_layers=1, get_action_by_boltzmann=True): Double Q-Network. Used for training the Robot behaviour. :param input_size: I...
5103b2bd78ffbbb42afb892bdca67859324726e9
<|skeleton|> class DQN: def __init__(self, input_size, num_actions, lstm_hidden_size=64, lstm_layers=1, get_action_by_boltzmann=True): """Double Q-Network. Used for training the Robot behaviour. :param input_size: Int. Size of the Input. :param num_actions: Int. Number of possible actions that can be taken...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DQN: def __init__(self, input_size, num_actions, lstm_hidden_size=64, lstm_layers=1, get_action_by_boltzmann=True): """Double Q-Network. Used for training the Robot behaviour. :param input_size: Int. Size of the Input. :param num_actions: Int. Number of possible actions that can be taken. :param lstm_...
the_stack_v2_python_sparse
RobotController/MovementControl/ReinforcementLearningController/DQN.py
Eric-Canas/BabyRobot
train
1
1222def6f047d91f358fe9173f7af36c86d64538
[ "self.nums = nums\nself.size_bucket = int(math.ceil(math.sqrt(len(nums))))\nself.bucket = [0 for _ in range(self.size_bucket)]\nfor idx, num in enumerate(nums):\n self.bucket[idx // self.size_bucket] += num", "self.bucket[i // self.size_bucket] -= self.nums[i]\nself.bucket[i // self.size_bucket] += val\nself.n...
<|body_start_0|> self.nums = nums self.size_bucket = int(math.ceil(math.sqrt(len(nums)))) self.bucket = [0 for _ in range(self.size_bucket)] for idx, num in enumerate(nums): self.bucket[idx // self.size_bucket] += num <|end_body_0|> <|body_start_1|> self.bucket[i // ...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_36k_train_025489
1,666
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type val: int :rtype: void", "name": "update", "signature": "def update(self, i, val)" }, { "docstring": ":type i: int :type j: int :rtype: int", ...
3
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
11d6bf2ba7b50c07e048df37c4e05c8f46b92241
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" self.nums = nums self.size_bucket = int(math.ceil(math.sqrt(len(nums)))) self.bucket = [0 for _ in range(self.size_bucket)] for idx, num in enumerate(nums): self.bucket[idx // self.size_bucket] ...
the_stack_v2_python_sparse
LeetCodes/Google/RangeSumQueryMutable.py
chutianwen/LeetCodes
train
0
1eb062ef04791542a0364bf1df407388783c742a
[ "disc_fake_X_hat = disc_X(fake_X.detach())\ndisc_fake_X_loss = adv_criterion(disc_fake_X_hat, torch.zeros_like(disc_fake_X_hat))\ndisc_real_X_hat = disc_X(real_X)\ndisc_real_X_loss = adv_criterion(disc_real_X_hat, torch.ones_like(disc_real_X_hat))\ndisc_loss = (disc_fake_X_loss + disc_real_X_loss) / 2\nreturn disc_...
<|body_start_0|> disc_fake_X_hat = disc_X(fake_X.detach()) disc_fake_X_loss = adv_criterion(disc_fake_X_hat, torch.zeros_like(disc_fake_X_hat)) disc_real_X_hat = disc_X(real_X) disc_real_X_loss = adv_criterion(disc_real_X_hat, torch.ones_like(disc_real_X_hat)) disc_loss = (disc_f...
GANLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GANLoss: def get_disc_loss(self, real_X, fake_X, disc_X, adv_criterion): """Return the loss of the discriminator given inputs. Parameters: real_X: the real images from pile X fake_X: the generated images of class X disc_X: the discriminator for class X; takes images and returns real/fake...
stack_v2_sparse_classes_36k_train_025490
8,946
no_license
[ { "docstring": "Return the loss of the discriminator given inputs. Parameters: real_X: the real images from pile X fake_X: the generated images of class X disc_X: the discriminator for class X; takes images and returns real/fake class X prediction matrices adv_criterion: the adversarial loss function; takes the...
5
stack_v2_sparse_classes_30k_train_020797
Implement the Python class `GANLoss` described below. Class description: Implement the GANLoss class. Method signatures and docstrings: - def get_disc_loss(self, real_X, fake_X, disc_X, adv_criterion): Return the loss of the discriminator given inputs. Parameters: real_X: the real images from pile X fake_X: the gener...
Implement the Python class `GANLoss` described below. Class description: Implement the GANLoss class. Method signatures and docstrings: - def get_disc_loss(self, real_X, fake_X, disc_X, adv_criterion): Return the loss of the discriminator given inputs. Parameters: real_X: the real images from pile X fake_X: the gener...
d65bd1b2a6c6310e3107b7bc21639925ee9438e8
<|skeleton|> class GANLoss: def get_disc_loss(self, real_X, fake_X, disc_X, adv_criterion): """Return the loss of the discriminator given inputs. Parameters: real_X: the real images from pile X fake_X: the generated images of class X disc_X: the discriminator for class X; takes images and returns real/fake...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GANLoss: def get_disc_loss(self, real_X, fake_X, disc_X, adv_criterion): """Return the loss of the discriminator given inputs. Parameters: real_X: the real images from pile X fake_X: the generated images of class X disc_X: the discriminator for class X; takes images and returns real/fake class X predi...
the_stack_v2_python_sparse
Losses.py
kartikprabhu20/3dReconstruction
train
0
b4dbb0dbac0b1998c26dba5f2ff9a5a9f95ed488
[ "ignore = {}\nfor character in ' \\t\\r\\n' + ignorable:\n ignore[character] = None\ncounter = 0\nfor character in text[:position]:\n if ignore.has_key(character):\n counter = counter + 1\nself.position = position - counter", "ignore = {}\nfor character in ' \\t\\r\\n' + ignorable:\n ignore[charac...
<|body_start_0|> ignore = {} for character in ' \t\r\n' + ignorable: ignore[character] = None counter = 0 for character in text[:position]: if ignore.has_key(character): counter = counter + 1 self.position = position - counter <|end_body_0|...
Marker
[ "ICU" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Marker: def save_position(self, text, position, ignorable): """Given a TEXT and a POSITION in that text, save the adjusted position by faking that all IGNORABLE characters before POSITION were removed.""" <|body_0|> def get_position(self, text, ignorable, latest=0): ...
stack_v2_sparse_classes_36k_train_025491
45,021
permissive
[ { "docstring": "Given a TEXT and a POSITION in that text, save the adjusted position by faking that all IGNORABLE characters before POSITION were removed.", "name": "save_position", "signature": "def save_position(self, text, position, ignorable)" }, { "docstring": "Given a TEXT, return the valu...
2
stack_v2_sparse_classes_30k_train_002953
Implement the Python class `Marker` described below. Class description: Implement the Marker class. Method signatures and docstrings: - def save_position(self, text, position, ignorable): Given a TEXT and a POSITION in that text, save the adjusted position by faking that all IGNORABLE characters before POSITION were ...
Implement the Python class `Marker` described below. Class description: Implement the Marker class. Method signatures and docstrings: - def save_position(self, text, position, ignorable): Given a TEXT and a POSITION in that text, save the adjusted position by faking that all IGNORABLE characters before POSITION were ...
dd054e802d6d8ad80baeccee0396da68144f2a26
<|skeleton|> class Marker: def save_position(self, text, position, ignorable): """Given a TEXT and a POSITION in that text, save the adjusted position by faking that all IGNORABLE characters before POSITION were removed.""" <|body_0|> def get_position(self, text, ignorable, latest=0): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Marker: def save_position(self, text, position, ignorable): """Given a TEXT and a POSITION in that text, save the adjusted position by faking that all IGNORABLE characters before POSITION were removed.""" ignore = {} for character in ' \t\r\n' + ignorable: ignore[character]...
the_stack_v2_python_sparse
ide-integration/Pymacs-0.20/Pymacs/rebox.py
debiancn/bicyclerepair
train
3
1ff5cf19221fcaf3017c0cc3f48325da8afe2ce5
[ "try:\n db.show_by_id(show_id, session=session)\nexcept NoResultFound:\n raise NotFoundError('show with ID %s not found' % show_id)\ntry:\n season = db.season_by_id(season_id, session)\nexcept NoResultFound:\n raise NotFoundError('season with ID %s not found' % season_id)\nif not db.season_in_show(show_...
<|body_start_0|> try: db.show_by_id(show_id, session=session) except NoResultFound: raise NotFoundError('show with ID %s not found' % show_id) try: season = db.season_by_id(season_id, session) except NoResultFound: raise NotFoundError('seas...
SeriesSeasonAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SeriesSeasonAPI: def get(self, show_id, season_id, session): """Get season by show ID and season ID""" <|body_0|> def delete(self, show_id, season_id, session): """Forgets season by show ID and season ID""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025492
47,001
permissive
[ { "docstring": "Get season by show ID and season ID", "name": "get", "signature": "def get(self, show_id, season_id, session)" }, { "docstring": "Forgets season by show ID and season ID", "name": "delete", "signature": "def delete(self, show_id, season_id, session)" } ]
2
stack_v2_sparse_classes_30k_train_010247
Implement the Python class `SeriesSeasonAPI` described below. Class description: Implement the SeriesSeasonAPI class. Method signatures and docstrings: - def get(self, show_id, season_id, session): Get season by show ID and season ID - def delete(self, show_id, season_id, session): Forgets season by show ID and seaso...
Implement the Python class `SeriesSeasonAPI` described below. Class description: Implement the SeriesSeasonAPI class. Method signatures and docstrings: - def get(self, show_id, season_id, session): Get season by show ID and season ID - def delete(self, show_id, season_id, session): Forgets season by show ID and seaso...
ea95ff60041beaea9aacbc2d93549e3a6b981dc5
<|skeleton|> class SeriesSeasonAPI: def get(self, show_id, season_id, session): """Get season by show ID and season ID""" <|body_0|> def delete(self, show_id, season_id, session): """Forgets season by show ID and season ID""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SeriesSeasonAPI: def get(self, show_id, season_id, session): """Get season by show ID and season ID""" try: db.show_by_id(show_id, session=session) except NoResultFound: raise NotFoundError('show with ID %s not found' % show_id) try: season =...
the_stack_v2_python_sparse
flexget/components/series/api.py
BrutuZ/Flexget
train
1
d9631b04a48de845c1965c996a9ec019e42d513b
[ "pre_head = ListNode(-1)\nprev = pre_head\nwhile l1 and l2:\n if l1.val <= l2.val:\n prev.next = l1\n l1 = l1.next\n else:\n prev.next = l2\n l2 = l2.next\n prev = prev.next\nprev.next = l1 if l1 else l2\nreturn pre_head.next", "if not l1:\n return l2\nelif not l2:\n ret...
<|body_start_0|> pre_head = ListNode(-1) prev = pre_head while l1 and l2: if l1.val <= l2.val: prev.next = l1 l1 = l1.next else: prev.next = l2 l2 = l2.next prev = prev.next prev.next = l1...
LinkedList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkedList: def merge_(self, l1: 'ListNode', l2: 'ListNode'): """Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param l1: :param l2: :return:""" <|body_0|> def merge(self, l1: 'ListNode', l2: 'ListNode'): """Approach: Recursion Time Complexity: O(M...
stack_v2_sparse_classes_36k_train_025493
1,190
no_license
[ { "docstring": "Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param l1: :param l2: :return:", "name": "merge_", "signature": "def merge_(self, l1: 'ListNode', l2: 'ListNode')" }, { "docstring": "Approach: Recursion Time Complexity: O(M + N) Space Complexity: O(N) :param l1: :...
2
null
Implement the Python class `LinkedList` described below. Class description: Implement the LinkedList class. Method signatures and docstrings: - def merge_(self, l1: 'ListNode', l2: 'ListNode'): Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param l1: :param l2: :return: - def merge(self, l1: 'ListN...
Implement the Python class `LinkedList` described below. Class description: Implement the LinkedList class. Method signatures and docstrings: - def merge_(self, l1: 'ListNode', l2: 'ListNode'): Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param l1: :param l2: :return: - def merge(self, l1: 'ListN...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class LinkedList: def merge_(self, l1: 'ListNode', l2: 'ListNode'): """Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param l1: :param l2: :return:""" <|body_0|> def merge(self, l1: 'ListNode', l2: 'ListNode'): """Approach: Recursion Time Complexity: O(M...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkedList: def merge_(self, l1: 'ListNode', l2: 'ListNode'): """Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param l1: :param l2: :return:""" pre_head = ListNode(-1) prev = pre_head while l1 and l2: if l1.val <= l2.val: prev.nex...
the_stack_v2_python_sparse
amazon/linked_list/merge_two_sorted_list.py
Shiv2157k/leet_code
train
1
98d8c72e2d00bfcdfb19067cc89e2f95753ec4f9
[ "FeatureExtractor.__init__(self)\nself.width = 224\nself.height = 224\nself.channels = 3\nself.final_pools = 7 * 7 * 2048\nself.model = ResNet50(weights='imagenet', include_top=False)\nprint('[INFO] loaded model ok: ResNet50 + imagenet')", "imgs_p = []\nfor img in imgs:\n if img.shape[0] != self.height or img....
<|body_start_0|> FeatureExtractor.__init__(self) self.width = 224 self.height = 224 self.channels = 3 self.final_pools = 7 * 7 * 2048 self.model = ResNet50(weights='imagenet', include_top=False) print('[INFO] loaded model ok: ResNet50 + imagenet') <|end_body_0|> ...
ResNet50特征提取器 es 2018-11-06
ResNet50FeatureExtractor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResNet50FeatureExtractor: """ResNet50特征提取器 es 2018-11-06""" def __init__(self): """初始化""" <|body_0|> def preprocess(self, imgs): """图像预处理""" <|body_1|> def extract_features(self, imgs, batch_size=128, normalizing=False): """批量图像特征提取""" ...
stack_v2_sparse_classes_36k_train_025494
2,176
no_license
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "图像预处理", "name": "preprocess", "signature": "def preprocess(self, imgs)" }, { "docstring": "批量图像特征提取", "name": "extract_features", "signature": "def extract_features(self, imgs, ...
3
stack_v2_sparse_classes_30k_train_013320
Implement the Python class `ResNet50FeatureExtractor` described below. Class description: ResNet50特征提取器 es 2018-11-06 Method signatures and docstrings: - def __init__(self): 初始化 - def preprocess(self, imgs): 图像预处理 - def extract_features(self, imgs, batch_size=128, normalizing=False): 批量图像特征提取
Implement the Python class `ResNet50FeatureExtractor` described below. Class description: ResNet50特征提取器 es 2018-11-06 Method signatures and docstrings: - def __init__(self): 初始化 - def preprocess(self, imgs): 图像预处理 - def extract_features(self, imgs, batch_size=128, normalizing=False): 批量图像特征提取 <|skeleton|> class ResN...
3c756d00c83cd0a8dd745fd32a074c9121977ab8
<|skeleton|> class ResNet50FeatureExtractor: """ResNet50特征提取器 es 2018-11-06""" def __init__(self): """初始化""" <|body_0|> def preprocess(self, imgs): """图像预处理""" <|body_1|> def extract_features(self, imgs, batch_size=128, normalizing=False): """批量图像特征提取""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResNet50FeatureExtractor: """ResNet50特征提取器 es 2018-11-06""" def __init__(self): """初始化""" FeatureExtractor.__init__(self) self.width = 224 self.height = 224 self.channels = 3 self.final_pools = 7 * 7 * 2048 self.model = ResNet50(weights='imagenet', ...
the_stack_v2_python_sparse
feature/resnet50_feature_extractor.py
esfamely/es_face_server
train
0
24aa4eacf1619d0b6886f15e59ec7ddf35b2e85f
[ "self.name = name\nself.units = units\nself.short_desc = short_desc\nself.long_desc = long_desc\nself.query = query\nself._data = dict()\nself._metadata = dict()", "date = (year, month)\nif date not in self._metadata:\n self._metadata[date] = dict()\nself._metadata[date]['last_request_time'] = datetime.now()\n...
<|body_start_0|> self.name = name self.units = units self.short_desc = short_desc self.long_desc = long_desc self.query = query self._data = dict() self._metadata = dict() <|end_body_0|> <|body_start_1|> date = (year, month) if date not in self._m...
A single metric, including its definition and all associated data. Note that this class also deals with the filesystem and makes certain assumptions about how data (and definitions) are represented. Also, data is loaded on demand instead of up front. This is intended to mitigate RAM usage at the expense of load time, b...
Metric
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Metric: """A single metric, including its definition and all associated data. Note that this class also deals with the filesystem and makes certain assumptions about how data (and definitions) are represented. Also, data is loaded on demand instead of up front. This is intended to mitigate RAM us...
stack_v2_sparse_classes_36k_train_025495
11,452
permissive
[ { "docstring": "Constructor. Args: name (string): This metric's name. units (string): Units the metric is measured in. short_desc (string): Short description. long_desc (string): Long description. query (string): BigQuery query string to compute this metric.", "name": "__init__", "signature": "def __ini...
3
stack_v2_sparse_classes_30k_train_010015
Implement the Python class `Metric` described below. Class description: A single metric, including its definition and all associated data. Note that this class also deals with the filesystem and makes certain assumptions about how data (and definitions) are represented. Also, data is loaded on demand instead of up fro...
Implement the Python class `Metric` described below. Class description: A single metric, including its definition and all associated data. Note that this class also deals with the filesystem and makes certain assumptions about how data (and definitions) are represented. Also, data is loaded on demand instead of up fro...
32027575bdea49c0b645754c7a60666af0c86ba6
<|skeleton|> class Metric: """A single metric, including its definition and all associated data. Note that this class also deals with the filesystem and makes certain assumptions about how data (and definitions) are represented. Also, data is loaded on demand instead of up front. This is intended to mitigate RAM us...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Metric: """A single metric, including its definition and all associated data. Note that this class also deals with the filesystem and makes certain assumptions about how data (and definitions) are represented. Also, data is loaded on demand instead of up front. This is intended to mitigate RAM usage at the ex...
the_stack_v2_python_sparse
common/metrics.py
m-lab/mlab-metrics-api
train
0
f398e5b6d3a97e2f039feea93f2450ed05c87e59
[ "self.rad = radius\nself.xc = x_center\nself.yc = y_center", "while True:\n x = self.xc + random.uniform(-1, 1) * self.rad\n y = self.yc + random.uniform(-1, 1) * self.rad\n if (x - self.xc) ** 2 + (y - self.yc) ** 2 <= self.rad ** 2:\n return [x, y]" ]
<|body_start_0|> self.rad = radius self.xc = x_center self.yc = y_center <|end_body_0|> <|body_start_1|> while True: x = self.xc + random.uniform(-1, 1) * self.rad y = self.yc + random.uniform(-1, 1) * self.rad if (x - self.xc) ** 2 + (y - self.yc) **...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.rad = radius ...
stack_v2_sparse_classes_36k_train_025496
1,035
no_license
[ { "docstring": ":type radius: float :type x_center: float :type y_center: float", "name": "__init__", "signature": "def __init__(self, radius, x_center, y_center)" }, { "docstring": ":rtype: List[float]", "name": "randPoint", "signature": "def randPoint(self)" } ]
2
stack_v2_sparse_classes_30k_train_002848
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float] <|skeleton|> class Sol...
6fec95b9b4d735727160905e754a698513bfb7d8
<|skeleton|> class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" self.rad = radius self.xc = x_center self.yc = y_center def randPoint(self): """:rtype: List[float]""" while True: x ...
the_stack_v2_python_sparse
leetcode/math/generate-random-point-in-a-circle.py
jwyx3/practices
train
2
9fb9f1d57e27dbdff5cd70e19cb4e6db17f944bb
[ "feature = csmlDataset.dataset.getFeature(csmlFeatureId)\ntry:\n long_name = feature.description.CONTENT\nexcept AttributeError:\n long_name = id\nsuper(CsmlLayer, self).__init__(long_name)\nself.dimensions = dict(time=CsmlTimeDimension(feature.getDomain()['time']))\nself.minValue = minValue\nself.maxValue = ...
<|body_start_0|> feature = csmlDataset.dataset.getFeature(csmlFeatureId) try: long_name = feature.description.CONTENT except AttributeError: long_name = id super(CsmlLayer, self).__init__(long_name) self.dimensions = dict(time=CsmlTimeDimension(feature.get...
This layer extracts selected grids to a temporary NetCDF file and then uses CDMS to serve the data.
CsmlLayer
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CsmlLayer: """This layer extracts selected grids to a temporary NetCDF file and then uses CDMS to serve the data.""" def __init__(self, csmlFeatureId, csmlDataset, minValue, maxValue): """@param csmlFeatureId: The id of the feature instance. @param csmlDataset: A CsmlDataset instance...
stack_v2_sparse_classes_36k_train_025497
5,018
permissive
[ { "docstring": "@param csmlFeatureId: The id of the feature instance. @param csmlDataset: A CsmlDataset instance. @todo: Get units @todo: tidy up where features are referenced.", "name": "__init__", "signature": "def __init__(self, csmlFeatureId, csmlDataset, minValue, maxValue)" }, { "docstring...
2
stack_v2_sparse_classes_30k_train_020828
Implement the Python class `CsmlLayer` described below. Class description: This layer extracts selected grids to a temporary NetCDF file and then uses CDMS to serve the data. Method signatures and docstrings: - def __init__(self, csmlFeatureId, csmlDataset, minValue, maxValue): @param csmlFeatureId: The id of the fea...
Implement the Python class `CsmlLayer` described below. Class description: This layer extracts selected grids to a temporary NetCDF file and then uses CDMS to serve the data. Method signatures and docstrings: - def __init__(self, csmlFeatureId, csmlDataset, minValue, maxValue): @param csmlFeatureId: The id of the fea...
db9ed729c886b271ce85355b97e39243081e8246
<|skeleton|> class CsmlLayer: """This layer extracts selected grids to a temporary NetCDF file and then uses CDMS to serve the data.""" def __init__(self, csmlFeatureId, csmlDataset, minValue, maxValue): """@param csmlFeatureId: The id of the feature instance. @param csmlDataset: A CsmlDataset instance...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CsmlLayer: """This layer extracts selected grids to a temporary NetCDF file and then uses CDMS to serve the data.""" def __init__(self, csmlFeatureId, csmlDataset, minValue, maxValue): """@param csmlFeatureId: The id of the feature instance. @param csmlDataset: A CsmlDataset instance. @todo: Get ...
the_stack_v2_python_sparse
cows/service/imps/pywms/wms_csml.py
cedadev/cows
train
2
fedef0e420a8c8a0895dae29fc3ac74b1676fb4f
[ "self.entity_description = description\nserial_number = coordinator.envoy.serial_number\nassert serial_number is not None\nself.envoy_serial_num = serial_number\nsuper().__init__(coordinator)", "data = self.coordinator.envoy.data\nassert data is not None\nreturn data" ]
<|body_start_0|> self.entity_description = description serial_number = coordinator.envoy.serial_number assert serial_number is not None self.envoy_serial_num = serial_number super().__init__(coordinator) <|end_body_0|> <|body_start_1|> data = self.coordinator.envoy.data ...
Defines a base envoy entity.
EnvoyBaseEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnvoyBaseEntity: """Defines a base envoy entity.""" def __init__(self, coordinator: EnphaseUpdateCoordinator, description: EntityDescription) -> None: """Init the Enphase base entity.""" <|body_0|> def data(self) -> EnvoyData: """Return envoy data.""" <|b...
stack_v2_sparse_classes_36k_train_025498
1,029
permissive
[ { "docstring": "Init the Enphase base entity.", "name": "__init__", "signature": "def __init__(self, coordinator: EnphaseUpdateCoordinator, description: EntityDescription) -> None" }, { "docstring": "Return envoy data.", "name": "data", "signature": "def data(self) -> EnvoyData" } ]
2
stack_v2_sparse_classes_30k_train_010000
Implement the Python class `EnvoyBaseEntity` described below. Class description: Defines a base envoy entity. Method signatures and docstrings: - def __init__(self, coordinator: EnphaseUpdateCoordinator, description: EntityDescription) -> None: Init the Enphase base entity. - def data(self) -> EnvoyData: Return envoy...
Implement the Python class `EnvoyBaseEntity` described below. Class description: Defines a base envoy entity. Method signatures and docstrings: - def __init__(self, coordinator: EnphaseUpdateCoordinator, description: EntityDescription) -> None: Init the Enphase base entity. - def data(self) -> EnvoyData: Return envoy...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class EnvoyBaseEntity: """Defines a base envoy entity.""" def __init__(self, coordinator: EnphaseUpdateCoordinator, description: EntityDescription) -> None: """Init the Enphase base entity.""" <|body_0|> def data(self) -> EnvoyData: """Return envoy data.""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnvoyBaseEntity: """Defines a base envoy entity.""" def __init__(self, coordinator: EnphaseUpdateCoordinator, description: EntityDescription) -> None: """Init the Enphase base entity.""" self.entity_description = description serial_number = coordinator.envoy.serial_number ...
the_stack_v2_python_sparse
homeassistant/components/enphase_envoy/entity.py
home-assistant/core
train
35,501
3b1e4071344cc3940cd0e2d77bc1a5a821aaae3c
[ "self.setModel(params)\nchi2 = ((self.model_vals - self.data.d) ** 2 / self.data.sig2).sum()\nreturn -chi2 / 2", "norm = (self.data.n - 1) * log(2 * pi)\nnorm2 = self.data.lnDetN + dNid\nreturn -0.5 * (norm + norm2)" ]
<|body_start_0|> self.setModel(params) chi2 = ((self.model_vals - self.data.d) ** 2 / self.data.sig2).sum() return -chi2 / 2 <|end_body_0|> <|body_start_1|> norm = (self.data.n - 1) * log(2 * pi) norm2 = self.data.lnDetN + dNid return -0.5 * (norm + norm2) <|end_body_1|>...
Represents the likelihood for CMB C_l data.
GaussianLikelihood
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianLikelihood: """Represents the likelihood for CMB C_l data.""" def lnLike(self, params): """return ln p(data|params) up to a param-independent term""" <|body_0|> def lnNorm(self): """return the parameter-independent part of the ln-likelihood.""" <|...
stack_v2_sparse_classes_36k_train_025499
784
no_license
[ { "docstring": "return ln p(data|params) up to a param-independent term", "name": "lnLike", "signature": "def lnLike(self, params)" }, { "docstring": "return the parameter-independent part of the ln-likelihood.", "name": "lnNorm", "signature": "def lnNorm(self)" } ]
2
null
Implement the Python class `GaussianLikelihood` described below. Class description: Represents the likelihood for CMB C_l data. Method signatures and docstrings: - def lnLike(self, params): return ln p(data|params) up to a param-independent term - def lnNorm(self): return the parameter-independent part of the ln-like...
Implement the Python class `GaussianLikelihood` described below. Class description: Represents the likelihood for CMB C_l data. Method signatures and docstrings: - def lnLike(self, params): return ln p(data|params) up to a param-independent term - def lnNorm(self): return the parameter-independent part of the ln-like...
e6f49c4a986a70ce040d8b7c09879665d5f81f78
<|skeleton|> class GaussianLikelihood: """Represents the likelihood for CMB C_l data.""" def lnLike(self, params): """return ln p(data|params) up to a param-independent term""" <|body_0|> def lnNorm(self): """return the parameter-independent part of the ln-likelihood.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianLikelihood: """Represents the likelihood for CMB C_l data.""" def lnLike(self, params): """return ln p(data|params) up to a param-independent term""" self.setModel(params) chi2 = ((self.model_vals - self.data.d) ** 2 / self.data.sig2).sum() return -chi2 / 2 de...
the_stack_v2_python_sparse
unused/ClLikelihood.py
defjaf/MCMC
train
1